From 9f6480dc09acfefe02dbb438ace34573fa056af9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 6 May 2021 07:07:35 +0200 Subject: update vlc code for testing --- src/plugins/vlc_extractor.c | 61 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/src/plugins/vlc_extractor.c b/src/plugins/vlc_extractor.c index e90b3ea..ab9dfb2 100644 --- a/src/plugins/vlc_extractor.c +++ b/src/plugins/vlc_extractor.c @@ -266,6 +266,20 @@ media_ready (const struct libvlc_event_t *p_event, } +static void +my_logger (void *data, + int level, + const libvlc_log_t *ctx, + const char *fmt, + va_list args) +{ + vfprintf (stderr, + fmt, + args); + fprintf (stderr, "\n"); +} + + /** * Extract information using libvlc * @@ -287,15 +301,48 @@ EXTRACTOR_vlc_extract_method (struct EXTRACTOR_ExtractContext *ec) pthread_sigmask (SIG_BLOCK, &set, NULL); } - vlc = libvlc_new (0, NULL); + { + const char *argv[] = { + "-v", + "3", + NULL + }; + vlc = libvlc_new (2, argv); + } if (NULL == vlc) return; - media = libvlc_media_new_callbacks (vlc, - &open_cb, - &read_cb, - &seek_cb, - &close_cb, - ec); + libvlc_log_set (vlc, + &my_logger, + NULL); + if (0) + { + fprintf (stderr, + "Opening file `%s'\n", + "testdata/matroska_flame.mkv"); + int fd = open ("testdata/matroska_flame.mkv", + O_RDONLY); + if (-1 == fd) + { + fprintf (stderr, + "Open failed: %s\n", + strerror (errno)); + libvlc_release (vlc); + return; + } + media = libvlc_media_new_fd (vlc, + fd); + } + else + { + fprintf (stderr, + "Reading via IPC\n"); + media = libvlc_media_new_callbacks (vlc, + &open_cb, + &read_cb, + &seek_cb, + &close_cb, + ec); + } if (NULL == media) { libvlc_release (vlc); -- cgit v1.2.3