Mercurial > hg > forks > bilotrip-mj12
annotate liboggplayer-src/src/imp.hpp @ 60:9c63b355c82b
Remove the audio code completely.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 06 Aug 2013 23:45:05 +0300 |
parents | 3eacedd172ab |
children |
rev | line source |
---|---|
2 | 1 #include <oggplayer.h> |
2 #include <fstream> | |
3 #include <vector> | |
4 #include <theora/theora.h> | |
5 #include <boost/thread.hpp> | |
6 #include <boost/bind.hpp> | |
7 #include <boost/thread/mutex.hpp> | |
8 #include <boost/thread/locks.hpp> | |
9 #include <boost/thread/condition.hpp> | |
10 #include <boost/circular_buffer.hpp> | |
11 #include <boost/timer.hpp> | |
12 | |
13 struct OggPlayer::Imp { | |
14 | |
15 Imp() : | |
60
9c63b355c82b
Remove the audio code completely.
Matti Hamalainen <ccr@tnsp.org>
parents:
59
diff
changeset
|
16 video_lock(video_mut, boost::defer_lock){ |
2 | 17 failbit = false; |
18 playing = false; | |
19 need_close = false; | |
20 time_factor = 1; | |
21 refs = 1; | |
22 } | |
23 | |
24 ~Imp() { | |
25 // open() tears down the partial setup on fail | |
26 if (!failbit) | |
27 close(); | |
28 } | |
29 int queue_page(ogg_page * page); | |
30 bool buffer_data(); | |
31 double get_time(); | |
32 void close(); | |
33 bool init_decoders(); | |
34 bool parse_headers(); | |
35 void open(std::string path, AudioFormat audio_format, int channels, | |
36 int rate, VideoFormat video_format); | |
37 bool decode_video(); | |
38 bool ready(); | |
39 void play(); | |
40 void play_loop(); | |
41 | |
42 bool failbit; | |
43 std::ifstream file_in; | |
44 | |
45 int theora_p; | |
46 int vorbis_p; | |
47 | |
48 ogg_sync_state o_sync; | |
49 | |
50 theora_info t_info; | |
51 theora_comment t_comment; | |
52 | |
53 ogg_page o_page; | |
54 ogg_packet o_packet; | |
55 | |
56 ogg_stream_state o_tsstate; | |
57 ogg_stream_state o_vsstate; | |
58 | |
59 theora_state t_state; | |
26
74b28a572438
Fence some more vorbis-related things.
Matti Hamalainen <ccr@tnsp.org>
parents:
14
diff
changeset
|
60 |
2 | 61 int pp_level_max; |
62 int pp_level; | |
63 int pp_inc; | |
64 | |
65 bool playing; | |
66 | |
67 boost::thread play_thread; | |
59
3eacedd172ab
Fence some lingering audio code, based on fixes from visy.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
68 boost::mutex video_mut; |
3eacedd172ab
Fence some lingering audio code, based on fixes from visy.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
69 boost::condition_variable video_ready_cond; |
2 | 70 |
71 bool videobuf_ready; | |
72 double videobuf_time; | |
73 | |
74 // This lock should only be used from the main thread | |
75 boost::unique_lock<boost::mutex> video_lock; | |
76 // These variables are used to identify the frames (not just count them, not a debug variable) | |
77 // see video_buffer_try_lock and video_read | |
78 int frame; | |
79 int last_frame_read; | |
80 | |
81 double time_factor; | |
82 | |
83 struct PixelFormat{ | |
84 void set(int r,int g,int b,int bpp){ | |
85 r_offset = r; | |
86 g_offset = g; | |
87 b_offset = b; | |
88 this->bpp =bpp; | |
89 } | |
90 int r_offset; | |
91 int g_offset; | |
92 int b_offset; | |
93 // if bpp=4 we have an alpha channel at offset 4 | |
94 int bpp; | |
95 | |
96 } pixel_format; | |
97 bool need_close; | |
98 boost::timer timer; | |
99 int refs; | |
100 }; |