Mercurial > hg > forks > bilotrip-mj12
comparison 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 |
comparison
equal
deleted
inserted
replaced
59:3eacedd172ab | 60:9c63b355c82b |
---|---|
1 #include <oggplayer.h> | 1 #include <oggplayer.h> |
2 #ifdef VORBIS_SUPPORT | |
3 #include "SDL_audiocvt.hpp" | |
4 #endif | |
5 #include <fstream> | 2 #include <fstream> |
6 #include <vector> | 3 #include <vector> |
7 #include <theora/theora.h> | 4 #include <theora/theora.h> |
8 #ifdef VORBIS_SUPPORT | |
9 #include <vorbis/codec.h> | |
10 #endif | |
11 #include <boost/thread.hpp> | 5 #include <boost/thread.hpp> |
12 #include <boost/bind.hpp> | 6 #include <boost/bind.hpp> |
13 #include <boost/thread/mutex.hpp> | 7 #include <boost/thread/mutex.hpp> |
14 #include <boost/thread/locks.hpp> | 8 #include <boost/thread/locks.hpp> |
15 #include <boost/thread/condition.hpp> | 9 #include <boost/thread/condition.hpp> |
17 #include <boost/timer.hpp> | 11 #include <boost/timer.hpp> |
18 | 12 |
19 struct OggPlayer::Imp { | 13 struct OggPlayer::Imp { |
20 | 14 |
21 Imp() : | 15 Imp() : |
22 cirbuf(0),video_lock(video_mut, boost::defer_lock){ | 16 video_lock(video_mut, boost::defer_lock){ |
23 failbit = false; | 17 failbit = false; |
24 playing = false; | 18 playing = false; |
25 need_close = false; | 19 need_close = false; |
26 time_factor = 1; | 20 time_factor = 1; |
27 refs = 1; | 21 refs = 1; |
38 void close(); | 32 void close(); |
39 bool init_decoders(); | 33 bool init_decoders(); |
40 bool parse_headers(); | 34 bool parse_headers(); |
41 void open(std::string path, AudioFormat audio_format, int channels, | 35 void open(std::string path, AudioFormat audio_format, int channels, |
42 int rate, VideoFormat video_format); | 36 int rate, VideoFormat video_format); |
43 #ifdef VORBIS_SUPPORT | |
44 bool decode_audio(); | |
45 #endif | |
46 bool decode_video(); | 37 bool decode_video(); |
47 bool ready(); | 38 bool ready(); |
48 void play(); | 39 void play(); |
49 void play_loop(); | 40 void play_loop(); |
50 | 41 |
54 int theora_p; | 45 int theora_p; |
55 int vorbis_p; | 46 int vorbis_p; |
56 | 47 |
57 ogg_sync_state o_sync; | 48 ogg_sync_state o_sync; |
58 | 49 |
59 #ifdef VORBIS_SUPPORT | |
60 vorbis_comment v_comment; | |
61 vorbis_info v_info; | |
62 #endif | |
63 | |
64 theora_info t_info; | 50 theora_info t_info; |
65 theora_comment t_comment; | 51 theora_comment t_comment; |
66 | 52 |
67 ogg_page o_page; | 53 ogg_page o_page; |
68 ogg_packet o_packet; | 54 ogg_packet o_packet; |
70 ogg_stream_state o_tsstate; | 56 ogg_stream_state o_tsstate; |
71 ogg_stream_state o_vsstate; | 57 ogg_stream_state o_vsstate; |
72 | 58 |
73 theora_state t_state; | 59 theora_state t_state; |
74 | 60 |
75 #ifdef VORBIS_SUPPORT | |
76 vorbis_dsp_state v_state; | |
77 vorbis_block v_block; | |
78 #endif | |
79 | |
80 int pp_level_max; | 61 int pp_level_max; |
81 int pp_level; | 62 int pp_level; |
82 int pp_inc; | 63 int pp_inc; |
83 | |
84 char* audio_buffer; | |
85 boost::circular_buffer<char> cirbuf; | |
86 unsigned int audio_buffer_size; | |
87 #ifdef VORBIS_SUPPORT | |
88 SDL_AudioCVT cvt; | |
89 #endif | |
90 | 64 |
91 bool playing; | 65 bool playing; |
92 | 66 |
93 boost::thread play_thread; | 67 boost::thread play_thread; |
94 boost::mutex video_mut; | 68 boost::mutex video_mut; |
95 boost::condition_variable video_ready_cond; | 69 boost::condition_variable video_ready_cond; |
96 #ifdef VORBIS_SUPPORT | |
97 boost::mutex audio_mut; | |
98 boost::condition_variable audio_ready_cond; | |
99 #endif | |
100 | 70 |
101 bool videobuf_ready; | 71 bool videobuf_ready; |
102 double videobuf_time; | 72 double videobuf_time; |
103 | |
104 bool audio_cache_ready; | |
105 | 73 |
106 // This lock should only be used from the main thread | 74 // This lock should only be used from the main thread |
107 boost::unique_lock<boost::mutex> video_lock; | 75 boost::unique_lock<boost::mutex> video_lock; |
108 // These variables are used to identify the frames (not just count them, not a debug variable) | 76 // These variables are used to identify the frames (not just count them, not a debug variable) |
109 // see video_buffer_try_lock and video_read | 77 // see video_buffer_try_lock and video_read |
110 int frame; | 78 int frame; |
111 int last_frame_read; | 79 int last_frame_read; |
112 | 80 |
113 int audio_bytes_played; | |
114 struct AudioGranulePos { | |
115 int pos; | |
116 double set_time; | |
117 }; | |
118 std::deque<AudioGranulePos> audio_granule_poses; | |
119 double time_factor; | 81 double time_factor; |
120 | 82 |
121 struct PixelFormat{ | 83 struct PixelFormat{ |
122 void set(int r,int g,int b,int bpp){ | 84 void set(int r,int g,int b,int bpp){ |
123 r_offset = r; | 85 r_offset = r; |