diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-03-29 16:28:50 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-03-29 16:28:50 +0200 |
commit | a854328342bf1f40bf1261199aca80b25de8b1b0 (patch) | |
tree | 48caa24ace0342706fdb95d95512c2e6753d9311 /src/VLCInput.cpp | |
parent | 77a15b38809df6084718afdc6116d036715a8b7e (diff) | |
download | ODR-AudioEnc-a854328342bf1f40bf1261199aca80b25de8b1b0.tar.gz ODR-AudioEnc-a854328342bf1f40bf1261199aca80b25de8b1b0.tar.bz2 ODR-AudioEnc-a854328342bf1f40bf1261199aca80b25de8b1b0.zip |
Fix libvlc error handling
Diffstat (limited to 'src/VLCInput.cpp')
-rw-r--r-- | src/VLCInput.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 4141535..e2dd5a8 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -111,10 +111,7 @@ int VLCInput::prepare() libvlc_media_release(m); // Start playing - libvlc_media_player_play(m_mp); - - fprintf(stderr, "VLC launched.\n"); - return 0; + return libvlc_media_player_play(m_mp); } void VLCInput::preRender_cb(uint8_t** pp_pcm_buffer, size_t size) @@ -196,6 +193,12 @@ ssize_t VLCInput::m_read(uint8_t* buf, size_t length) lock.unlock(); boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + + libvlc_media_t *media = libvlc_media_player_get_media(m_mp); + if (libvlc_media_get_state(media) == libvlc_Error) { + err = -1; + break; + } } return err; } |