aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--toolame.c3
-rw-r--r--vlc_input.c21
2 files changed, 23 insertions, 1 deletions
diff --git a/toolame.c b/toolame.c
index 51cf1e1..8d18b44 100644
--- a/toolame.c
+++ b/toolame.c
@@ -26,6 +26,7 @@
#include "xpad.h"
#include "utils.h"
#include "vlc_input.h"
+#include "zmqoutput.h"
#include <assert.h>
@@ -541,6 +542,8 @@ int main (int argc, char **argv)
peak_right = 0;
}
+ fprintf(stdout, "Main loop has quit with samps_read = %zu\n", samps_read);
+
close_bit_stream_w (&bs);
if ((glopts.verbosity > 1) && (glopts.vbr == TRUE)) {
diff --git a/vlc_input.c b/vlc_input.c
index 6786bab..1a73cb9 100644
--- a/vlc_input.c
+++ b/vlc_input.c
@@ -141,7 +141,26 @@ int vlc_in_prepare(unsigned verbosity, unsigned int rate, const char* uri)
head_buffer = vlc_buffer_new();
// Start playing
- return libvlc_media_player_play(m_mp);
+ int ret = libvlc_media_player_play(m_mp);
+
+ if (ret == 0) {
+ libvlc_media_t *media = libvlc_media_player_get_media(m_mp);
+ libvlc_state_t st;
+
+ ret = -1;
+
+ int timeout;
+ for (timeout = 0; timeout < 100; timeout++) {
+ st = libvlc_media_get_state(media);
+ usleep(10*1000);
+ if (st != libvlc_NothingSpecial) {
+ ret = 0;
+ break;
+ }
+ }
+ }
+
+ return ret;
}
ssize_t vlc_in_read(void *buf, size_t len)