comparison liboggplayer-src/src/oggplayer.cpp @ 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
57 } 57 }
58 58
59 bool OggPlayer::playing() { 59 bool OggPlayer::playing() {
60 return imp->playing; 60 return imp->playing;
61 } 61 }
62
63
64 #ifdef VORBIS_SUPPORT
65 int OggPlayer::audio_read(char* buf, unsigned int size) {
66 if(NULL==buf || !imp->vorbis_p || !playing() || !imp->ready()) return 0;
67 boost::unique_lock<boost::mutex> lock(imp->audio_mut);
68
69 while ((imp->cirbuf.size() < size) && playing()) {
70 if(imp->cirbuf.capacity()< size)
71 {
72 imp->cirbuf.set_capacity(2*size);
73 }
74 imp->audio_ready_cond.wait(lock);
75 }
76
77 unsigned int k = 0;
78 while (k < size && !imp->cirbuf.empty()) {
79 buf[k++] = imp->cirbuf.front();
80 imp->cirbuf.pop_front();
81 }
82 imp->audio_bytes_played+=k;
83
84 return k;
85 }
86 #endif
87 62
88 bool OggPlayer::yuv_buffer_try_lock(YUVBuffer *buffer) { 63 bool OggPlayer::yuv_buffer_try_lock(YUVBuffer *buffer) {
89 if (!playing() || !imp->theora_p || !imp->ready()) 64 if (!playing() || !imp->theora_p || !imp->ready())
90 return false; 65 return false;
91 // no new data, no reason to lock 66 // no new data, no reason to lock