Mercurial > hg > forks > bilotrip-mj12
diff liboggplayer-src/src/play.cpp @ 59:3eacedd172ab
Fence some lingering audio code, based on fixes from visy.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 06 Aug 2013 23:27:37 +0300 |
parents | 083c73ceb716 |
children | 9c63b355c82b |
line wrap: on
line diff
--- a/liboggplayer-src/src/play.cpp Tue Aug 06 23:15:34 2013 +0300 +++ b/liboggplayer-src/src/play.cpp Tue Aug 06 23:27:37 2013 +0300 @@ -1,14 +1,20 @@ #include "imp.hpp" bool OggPlayer::Imp::ready() { +#ifdef VORBIS_SUPPORT return audio_cache_ready; +#else + return true; +#endif } + + +#ifdef VORBIS_SUPPORT // return true if need more data // the return value is strange but the function is // for internal use only and should only be called // in play() bool OggPlayer::Imp::decode_audio() { -#ifdef VORBIS_SUPPORT int ret; float **pcm; // if there's pending, decoded audio, grab it @@ -80,9 +86,10 @@ return false; } } else { return true; } -#endif return true; } +#endif + // similar to decode_audio bool OggPlayer::Imp::decode_video() { bool was_ready=videobuf_ready; @@ -131,9 +138,13 @@ void OggPlayer::Imp::play_loop() { if(!file_in.is_open()) return; +#ifdef VORBIS_SUPPORT audio_cache_ready = false; audio_bytes_played = 0; bool audio_need_data = vorbis_p; +#else + bool audio_need_data = false; +#endif bool video_need_data = theora_p; timer.restart(); // buffer_data() will close the file on eof @@ -150,9 +161,11 @@ video_need_data = decode_video(); } +#ifdef VORBIS_SUPPORT if (vorbis_p) { audio_need_data = decode_audio(); } +#endif // are we at or past time for this video frame? if (videobuf_ready && videobuf_time <= get_time()) { @@ -172,7 +185,9 @@ playing = false; // do not risk a lock +#ifdef VORBIS_SUPPORT audio_ready_cond.notify_one(); +#endif video_ready_cond.notify_one(); // cleanup