diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-03-30 18:37:43 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-03-30 18:37:43 +0200 |
commit | 35977fc2e90a7bf7aedd1c0be13f14289dd061df (patch) | |
tree | b6b078129bd9d4b2e6ba84ed1e81942fde5c3ed1 /src | |
parent | a20cd53acbeb316c5cbcd7fce79cb2c6032c868a (diff) | |
download | fdk-aac-dabplus-35977fc2e90a7bf7aedd1c0be13f14289dd061df.tar.gz fdk-aac-dabplus-35977fc2e90a7bf7aedd1c0be13f14289dd061df.tar.bz2 fdk-aac-dabplus-35977fc2e90a7bf7aedd1c0be13f14289dd061df.zip |
VLC: change callback usage
Diffstat (limited to 'src')
-rw-r--r-- | src/VLCInput.cpp | 24 | ||||
-rw-r--r-- | src/VLCInput.h | 7 |
2 files changed, 12 insertions, 19 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index c4c0413..7c782b0 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -60,7 +60,10 @@ void handleStream( assert(rate == in->getRate()); assert(bits_per_sample == 8*BYTES_PER_SAMPLE); - in->postRender_cb(p_pcm_buffer, size); + // This assumes VLC always gives back the full + // buffer it asked for. According to VLC code + // smem.c for v2.2.0 this holds. + in->postRender_cb(); } // VLC Exit callback @@ -159,22 +162,14 @@ void VLCInput::cleanup() } } -void VLCInput::postRender_cb(uint8_t* p_pcm_buffer, size_t size) +void VLCInput::postRender_cb() { boost::mutex::scoped_lock lock(m_queue_mutex); - if (m_current_buf.size() == size) { - size_t queue_size = m_queue.size(); - m_queue.resize(m_queue.size() + size); - std::copy(m_current_buf.begin(), m_current_buf.end(), - m_queue.begin() + queue_size); - } - else { - fprintf(stderr, - "Received buffer size is not equal allocated " - "buffer size: %zu vs %zu\n", - m_current_buf.size(), size); - } + size_t queue_size = m_queue.size(); + m_queue.resize(m_queue.size() + m_current_buf.size()); + std::copy(m_current_buf.begin(), m_current_buf.end(), + m_queue.begin() + queue_size); } ssize_t VLCInput::m_read(uint8_t* buf, size_t length) @@ -199,6 +194,7 @@ ssize_t VLCInput::m_read(uint8_t* buf, size_t length) if (!(st == libvlc_Opening || st == libvlc_Buffering || st == libvlc_Playing) ) { + fprintf(stderr, "VLC state is %d\n", st); err = -1; break; } diff --git a/src/VLCInput.h b/src/VLCInput.h index e4a0557..f97b9d9 100644 --- a/src/VLCInput.h +++ b/src/VLCInput.h @@ -74,12 +74,9 @@ class VLCInput uint8_t** pp_pcm_buffer, size_t size); - /* Receive a buffer with audio samples - * from VLC + /* Notification from VLC that the buffer is now filled */ - void postRender_cb( - uint8_t* p_pcm_buffer, - size_t size); + void postRender_cb(); int getRate() { return m_rate; } |