aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-05-06 07:07:35 +0200
committerChristian Grothoff <christian@grothoff.org>2021-05-06 07:07:35 +0200
commit9f6480dc09acfefe02dbb438ace34573fa056af9 (patch)
tree1785b024b321e535dd9d7e34c86686c02ac610cd
parentd40016f1e8b4578b294cfa09a59f43000c427643 (diff)
downloadlibextractor-9f6480dc09acfefe02dbb438ace34573fa056af9.tar.gz
libextractor-9f6480dc09acfefe02dbb438ace34573fa056af9.zip
update vlc code for testing
-rw-r--r--src/plugins/vlc_extractor.c61
1 files 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,
266} 266}
267 267
268 268
269static void
270my_logger (void *data,
271 int level,
272 const libvlc_log_t *ctx,
273 const char *fmt,
274 va_list args)
275{
276 vfprintf (stderr,
277 fmt,
278 args);
279 fprintf (stderr, "\n");
280}
281
282
269/** 283/**
270 * Extract information using libvlc 284 * Extract information using libvlc
271 * 285 *
@@ -287,15 +301,48 @@ EXTRACTOR_vlc_extract_method (struct EXTRACTOR_ExtractContext *ec)
287 pthread_sigmask (SIG_BLOCK, &set, NULL); 301 pthread_sigmask (SIG_BLOCK, &set, NULL);
288 } 302 }
289 303
290 vlc = libvlc_new (0, NULL); 304 {
305 const char *argv[] = {
306 "-v",
307 "3",
308 NULL
309 };
310 vlc = libvlc_new (2, argv);
311 }
291 if (NULL == vlc) 312 if (NULL == vlc)
292 return; 313 return;
293 media = libvlc_media_new_callbacks (vlc, 314 libvlc_log_set (vlc,
294 &open_cb, 315 &my_logger,
295 &read_cb, 316 NULL);
296 &seek_cb, 317 if (0)
297 &close_cb, 318 {
298 ec); 319 fprintf (stderr,
320 "Opening file `%s'\n",
321 "testdata/matroska_flame.mkv");
322 int fd = open ("testdata/matroska_flame.mkv",
323 O_RDONLY);
324 if (-1 == fd)
325 {
326 fprintf (stderr,
327 "Open failed: %s\n",
328 strerror (errno));
329 libvlc_release (vlc);
330 return;
331 }
332 media = libvlc_media_new_fd (vlc,
333 fd);
334 }
335 else
336 {
337 fprintf (stderr,
338 "Reading via IPC\n");
339 media = libvlc_media_new_callbacks (vlc,
340 &open_cb,
341 &read_cb,
342 &seek_cb,
343 &close_cb,
344 ec);
345 }
299 if (NULL == media) 346 if (NULL == media)
300 { 347 {
301 libvlc_release (vlc); 348 libvlc_release (vlc);