aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-29 16:28:50 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-29 16:28:50 +0200
commita854328342bf1f40bf1261199aca80b25de8b1b0 (patch)
tree48caa24ace0342706fdb95d95512c2e6753d9311
parent77a15b38809df6084718afdc6116d036715a8b7e (diff)
downloadfdk-aac-dabplus-a854328342bf1f40bf1261199aca80b25de8b1b0.tar.gz
fdk-aac-dabplus-a854328342bf1f40bf1261199aca80b25de8b1b0.tar.bz2
fdk-aac-dabplus-a854328342bf1f40bf1261199aca80b25de8b1b0.zip
Fix libvlc error handling
-rw-r--r--src/VLCInput.cpp11
-rw-r--r--src/dabplus-enc.cpp1
2 files changed, 8 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;
}
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index 9e8bd00..806f68b 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -723,6 +723,7 @@ int main(int argc, char *argv[])
#if HAVE_VLC
else if (vlc_uri != "") {
read = vlc_in.read(input_buf, input_size);
+ fprintf(stderr, "Detected fault in VLC input!\n");
if (read < 0) {
break;
}