diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/extractor.c | 17 | ||||
-rw-r--r-- | src/main/extractor_ipc_gnu.c | 2 | ||||
-rw-r--r-- | src/main/extractor_ipc_w32.c | 16 | ||||
-rw-r--r-- | src/main/extractor_logging.h | 2 | ||||
-rw-r--r-- | src/main/extractor_plugin_main.c | 30 | ||||
-rw-r--r-- | src/main/extractor_plugins.c | 43 | ||||
-rw-r--r-- | src/plugins/gstreamer_extractor.c | 20 | ||||
-rw-r--r-- | src/plugins/previewopus_extractor.c | 30 | ||||
-rw-r--r-- | src/plugins/thumbnailffmpeg_extractor.c | 50 |
9 files changed, 177 insertions, 33 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c index 830eac8..09a99e9 100644 --- a/src/main/extractor.c +++ b/src/main/extractor.c | |||
@@ -35,7 +35,7 @@ | |||
35 | /** | 35 | /** |
36 | * Size used for the shared memory segment. | 36 | * Size used for the shared memory segment. |
37 | */ | 37 | */ |
38 | #define DEFAULT_SHM_SIZE (16 * 1024) | 38 | #define DEFAULT_SHM_SIZE (160 * 1024) |
39 | 39 | ||
40 | 40 | ||
41 | /** | 41 | /** |
@@ -382,6 +382,8 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
382 | ssize_t ready; | 382 | ssize_t ready; |
383 | int done; | 383 | int done; |
384 | int have_in_memory; | 384 | int have_in_memory; |
385 | |||
386 | LOG ("Stating !\n"); | ||
385 | 387 | ||
386 | plugin_count = 0; | 388 | plugin_count = 0; |
387 | for (pos = plugins; NULL != pos; pos = pos->next) | 389 | for (pos = plugins; NULL != pos; pos = pos->next) |
@@ -401,6 +403,7 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
401 | start.reserved2 = 0; | 403 | start.reserved2 = 0; |
402 | start.shm_ready_bytes = (uint32_t) ready; | 404 | start.shm_ready_bytes = (uint32_t) ready; |
403 | start.file_size = EXTRACTOR_datasource_get_size_ (ds, 0); | 405 | start.file_size = EXTRACTOR_datasource_get_size_ (ds, 0); |
406 | LOG ("Have %d\ !\n",plugin_count); | ||
404 | for (pos = plugins; NULL != pos; pos = pos->next) | 407 | for (pos = plugins; NULL != pos; pos = pos->next) |
405 | { | 408 | { |
406 | if (EXTRACTOR_OPTION_IN_PROCESS == pos->flags) | 409 | if (EXTRACTOR_OPTION_IN_PROCESS == pos->flags) |
@@ -424,6 +427,7 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
424 | done = 0; | 427 | done = 0; |
425 | while (! done) | 428 | while (! done) |
426 | { | 429 | { |
430 | //LOG ("In !done while\n"); | ||
427 | struct EXTRACTOR_Channel *channels[plugin_count]; | 431 | struct EXTRACTOR_Channel *channels[plugin_count]; |
428 | 432 | ||
429 | /* calculate current 'channels' array */ | 433 | /* calculate current 'channels' array */ |
@@ -433,15 +437,18 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
433 | if (-1 == pos->seek_request) | 437 | if (-1 == pos->seek_request) |
434 | { | 438 | { |
435 | /* channel is not seeking, must be running or done */ | 439 | /* channel is not seeking, must be running or done */ |
440 | //LOG ("No seeking, done\n"); | ||
436 | channels[plugin_off] = pos->channel; | 441 | channels[plugin_off] = pos->channel; |
437 | } | 442 | } |
438 | else | 443 | else |
439 | { | 444 | { |
440 | /* not running this round, seeking! */ | 445 | /* not running this round, seeking! */ |
446 | //LOG ("Nor running, seeking\n"); | ||
441 | channels[plugin_off] = NULL; | 447 | channels[plugin_off] = NULL; |
442 | } | 448 | } |
443 | plugin_off++; | 449 | plugin_off++; |
444 | } | 450 | } |
451 | //LOG ("Will call EXTRACTOR_IPC_channel_recv_\n"); | ||
445 | /* give plugins chance to send us meta data, seek or finished messages */ | 452 | /* give plugins chance to send us meta data, seek or finished messages */ |
446 | if (-1 == | 453 | if (-1 == |
447 | EXTRACTOR_IPC_channel_recv_ (channels, | 454 | EXTRACTOR_IPC_channel_recv_ (channels, |
@@ -450,7 +457,7 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
450 | &prp)) | 457 | &prp)) |
451 | { | 458 | { |
452 | /* serious problem in IPC; reset *all* channels */ | 459 | /* serious problem in IPC; reset *all* channels */ |
453 | LOG ("Failed to receive message from channels; full reset\n"); | 460 | //LOG ("Failed to receive message from channels; full reset\n"); |
454 | abort_all_channels (plugins); | 461 | abort_all_channels (plugins); |
455 | break; | 462 | break; |
456 | } | 463 | } |
@@ -463,10 +470,14 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
463 | { | 470 | { |
464 | plugin_off++; | 471 | plugin_off++; |
465 | if ( (1 == pos->round_finished) || | 472 | if ( (1 == pos->round_finished) || |
466 | (NULL == pos->channel) ) | 473 | (NULL == pos->channel) ){ |
474 | //LOG ("Inative plugin\n"); | ||
467 | continue; /* inactive plugin */ | 475 | continue; /* inactive plugin */ |
476 | |||
477 | } | ||
468 | if (-1 == pos->seek_request) | 478 | if (-1 == pos->seek_request) |
469 | { | 479 | { |
480 | //LOG ("pos->seek_request\n"); | ||
470 | /* possibly more meta data at current position, at least | 481 | /* possibly more meta data at current position, at least |
471 | this plugin is still working on it... */ | 482 | this plugin is still working on it... */ |
472 | done = 0; | 483 | done = 0; |
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c index 313120f..c39e08b 100644 --- a/src/main/extractor_ipc_gnu.c +++ b/src/main/extractor_ipc_gnu.c | |||
@@ -464,7 +464,7 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, | |||
464 | return 1; /* nothing left to do! */ | 464 | return 1; /* nothing left to do! */ |
465 | } | 465 | } |
466 | tv.tv_sec = 0; | 466 | tv.tv_sec = 0; |
467 | tv.tv_usec = 500000; /* 500 ms */ | 467 | tv.tv_usec = 5000000; /* 500 ms */ |
468 | if (0 >= select (max + 1, &to_check, NULL, NULL, &tv)) | 468 | if (0 >= select (max + 1, &to_check, NULL, NULL, &tv)) |
469 | { | 469 | { |
470 | /* an error or timeout -> something's wrong or all plugins hung up */ | 470 | /* an error or timeout -> something's wrong or all plugins hung up */ |
diff --git a/src/main/extractor_ipc_w32.c b/src/main/extractor_ipc_w32.c index c4b8284..600dbdd 100644 --- a/src/main/extractor_ipc_w32.c +++ b/src/main/extractor_ipc_w32.c | |||
@@ -725,12 +725,17 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, | |||
725 | if (c == 0) | 725 | if (c == 0) |
726 | return 1; /* nothing left to do! */ | 726 | return 1; /* nothing left to do! */ |
727 | 727 | ||
728 | ms = 10000; | 728 | ms = 1000000; |
729 | first_ready = WaitForMultipleObjects (c, events, FALSE, ms); | 729 | first_ready = WaitForMultipleObjects (c, events, FALSE, ms); |
730 | if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED) | 730 | if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED) |
731 | { | 731 | { |
732 | /* an error or timeout -> something's wrong or all plugins hung up */ | 732 | /* an error or timeout -> something's wrong or all plugins hung up */ |
733 | LOG_STRERROR ("WaitForMultipleObjects"); | 733 | LOG_STRERROR ("WaitForMultipleObjects"); |
734 | FILE *f; | ||
735 | f = fopen("debug.txt", "a+"); | ||
736 | fprintf(f, "WaitForMultipleObjects \n"); | ||
737 | fclose(f); | ||
738 | |||
734 | return -1; | 739 | return -1; |
735 | } | 740 | } |
736 | 741 | ||
@@ -749,6 +754,10 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, | |||
749 | if (MAX_META_DATA == channels[i]->mdata_size) | 754 | if (MAX_META_DATA == channels[i]->mdata_size) |
750 | { | 755 | { |
751 | LOG ("Inbound message from channel too large, aborting\n"); | 756 | LOG ("Inbound message from channel too large, aborting\n"); |
757 | FILE *f; | ||
758 | f = fopen("debug.txt", "a+"); | ||
759 | fprintf(f, "Inbound message from channel too large, aborting \n"); | ||
760 | fclose(f); | ||
752 | EXTRACTOR_IPC_channel_destroy_ (channels[i]); | 761 | EXTRACTOR_IPC_channel_destroy_ (channels[i]); |
753 | channels[i] = NULL; | 762 | channels[i] = NULL; |
754 | } | 763 | } |
@@ -761,6 +770,11 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, | |||
761 | LOG_STRERROR ("realloc"); | 770 | LOG_STRERROR ("realloc"); |
762 | EXTRACTOR_IPC_channel_destroy_ (channels[i]); | 771 | EXTRACTOR_IPC_channel_destroy_ (channels[i]); |
763 | channels[i] = NULL; | 772 | channels[i] = NULL; |
773 | |||
774 | FILE *f; | ||
775 | f = fopen("debug.txt", "a+"); | ||
776 | fprintf(f, "Realloc \n"); | ||
777 | fclose(f); | ||
764 | } | 778 | } |
765 | channels[i]->mdata = ndata; | 779 | channels[i]->mdata = ndata; |
766 | } | 780 | } |
diff --git a/src/main/extractor_logging.h b/src/main/extractor_logging.h index bf7a964..54a6564 100644 --- a/src/main/extractor_logging.h +++ b/src/main/extractor_logging.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #ifndef EXTRACTOR_LOGGING_H | 25 | #ifndef EXTRACTOR_LOGGING_H |
26 | #define EXTRACTOR_LOGGING_H | 26 | #define EXTRACTOR_LOGGING_H |
27 | 27 | ||
28 | #define DEBUG 0 | 28 | #define DEBUG 1 |
29 | 29 | ||
30 | #if DEBUG | 30 | #if DEBUG |
31 | 31 | ||
diff --git a/src/main/extractor_plugin_main.c b/src/main/extractor_plugin_main.c index c56dfab..4f6c77c 100644 --- a/src/main/extractor_plugin_main.c +++ b/src/main/extractor_plugin_main.c | |||
@@ -460,6 +460,7 @@ handle_start_message (struct ProcessingContext *pc) | |||
460 | LOG ("Failed to read 'start' message\n"); | 460 | LOG ("Failed to read 'start' message\n"); |
461 | return -1; | 461 | return -1; |
462 | } | 462 | } |
463 | fprintf (stderr, "Got start msg\n"); | ||
463 | pc->shm_ready_bytes = start.shm_ready_bytes; | 464 | pc->shm_ready_bytes = start.shm_ready_bytes; |
464 | pc->file_size = start.file_size; | 465 | pc->file_size = start.file_size; |
465 | pc->read_position = 0; | 466 | pc->read_position = 0; |
@@ -475,6 +476,10 @@ handle_start_message (struct ProcessingContext *pc) | |||
475 | if (-1 == EXTRACTOR_write_all_ (pc->out, &done, sizeof (done))) | 476 | if (-1 == EXTRACTOR_write_all_ (pc->out, &done, sizeof (done))) |
476 | { | 477 | { |
477 | LOG ("Failed to write 'done' message\n"); | 478 | LOG ("Failed to write 'done' message\n"); |
479 | FILE *f; | ||
480 | f = fopen("debug.txt", "a+"); | ||
481 | fprintf(f, "Failed to write 'done' message' \n"); | ||
482 | fclose(f); | ||
478 | return -1; | 483 | return -1; |
479 | } | 484 | } |
480 | if ( (NULL != pc->plugin->specials) && | 485 | if ( (NULL != pc->plugin->specials) && |
@@ -524,18 +529,33 @@ process_requests (struct ProcessingContext *pc) | |||
524 | if (0 != handle_start_message (pc)) | 529 | if (0 != handle_start_message (pc)) |
525 | { | 530 | { |
526 | LOG ("Failure to handle START\n"); | 531 | LOG ("Failure to handle START\n"); |
532 | FILE *f; | ||
533 | f = fopen("debug.txt", "a+"); | ||
534 | fprintf(f, "Failure to handle START' \n"); | ||
535 | fclose(f); | ||
527 | return; | 536 | return; |
528 | } | 537 | } |
529 | break; | 538 | break; |
530 | case MESSAGE_UPDATED_SHM: | 539 | case MESSAGE_UPDATED_SHM:{ |
531 | LOG ("Illegal message\n"); | 540 | LOG ("Illegal message\n"); |
532 | /* not allowed here, we're not waiting for SHM to move! */ | 541 | /* not allowed here, we're not waiting for SHM to move! */ |
542 | FILE *f; | ||
543 | f = fopen("debug.txt", "a+"); | ||
544 | fprintf(f, "Illegal message' \n"); | ||
545 | fclose(f); | ||
546 | |||
533 | return; | 547 | return; |
548 | } | ||
534 | case MESSAGE_DISCARD_STATE: | 549 | case MESSAGE_DISCARD_STATE: |
535 | /* odd, we're already in the start state... */ | 550 | /* odd, we're already in the start state... */ |
536 | continue; | 551 | continue; |
537 | default: | 552 | default: |
538 | LOG ("Received invalid messag %d\n", (int) code); | 553 | LOG ("Received invalid messag %d\n", (int) code); |
554 | FILE *f; | ||
555 | f = fopen("debug.txt", "a+"); | ||
556 | fprintf(f, "Received invalid messag' \n"); | ||
557 | fclose(f); | ||
558 | |||
539 | /* error, unexpected message */ | 559 | /* error, unexpected message */ |
540 | return; | 560 | return; |
541 | } | 561 | } |
@@ -625,6 +645,14 @@ EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin, | |||
625 | process_requests (&pc); | 645 | process_requests (&pc); |
626 | LOG ("IPC error; plugin `%s' terminates!\n", | 646 | LOG ("IPC error; plugin `%s' terminates!\n", |
627 | plugin->short_libname); | 647 | plugin->short_libname); |
648 | |||
649 | |||
650 | FILE *f; | ||
651 | f = fopen("debug.txt", "a+"); | ||
652 | fprintf(f, "IPC error; plugin `%s' terminates!\n", | ||
653 | plugin->short_libname); | ||
654 | fclose(f); | ||
655 | |||
628 | #if WINDOWS | 656 | #if WINDOWS |
629 | if (NULL != pc.shm) | 657 | if (NULL != pc.shm) |
630 | UnmapViewOfFile (pc.shm); | 658 | UnmapViewOfFile (pc.shm); |
diff --git a/src/main/extractor_plugins.c b/src/main/extractor_plugins.c index 290d511..444c051 100644 --- a/src/main/extractor_plugins.c +++ b/src/main/extractor_plugins.c | |||
@@ -120,6 +120,14 @@ get_symbol_with_prefix (void *lib_handle, | |||
120 | int | 120 | int |
121 | EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) | 121 | EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) |
122 | { | 122 | { |
123 | |||
124 | LOG ("In EXTRACTOR_plugin_load_"); | ||
125 | |||
126 | FILE *f; | ||
127 | f = fopen("debug.txt", "a+"); | ||
128 | fprintf(f, "EXTRACTOR_plugin_load_\n"); | ||
129 | fclose(f); | ||
130 | |||
123 | #if WINDOWS | 131 | #if WINDOWS |
124 | wchar_t wlibname[4097]; | 132 | wchar_t wlibname[4097]; |
125 | char llibname[4097]; | 133 | char llibname[4097]; |
@@ -137,6 +145,11 @@ EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) | |||
137 | plugin->flags = EXTRACTOR_OPTION_DISABLED; | 145 | plugin->flags = EXTRACTOR_OPTION_DISABLED; |
138 | return -1; | 146 | return -1; |
139 | } | 147 | } |
148 | |||
149 | LOG ("Loading plugin `%s' \n", plugin->short_libname); | ||
150 | lt_dlclose (plugin->libraryHandle); | ||
151 | |||
152 | |||
140 | lt_dladvise_init (&advise); | 153 | lt_dladvise_init (&advise); |
141 | lt_dladvise_ext (&advise); | 154 | lt_dladvise_ext (&advise); |
142 | lt_dladvise_local (&advise); | 155 | lt_dladvise_local (&advise); |
@@ -151,6 +164,11 @@ EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) | |||
151 | LOG ("Loading `%s' plugin failed: %s\n", | 164 | LOG ("Loading `%s' plugin failed: %s\n", |
152 | plugin->short_libname, | 165 | plugin->short_libname, |
153 | "can't convert plugin name to local encoding"); | 166 | "can't convert plugin name to local encoding"); |
167 | FILE *f; | ||
168 | f = fopen("debug.txt", "a+"); | ||
169 | fprintf(f, "Loading `%s' plugin failed!\n", | ||
170 | plugin->short_libname); | ||
171 | fclose(f); | ||
154 | free (plugin->libname); | 172 | free (plugin->libname); |
155 | plugin->libname = NULL; | 173 | plugin->libname = NULL; |
156 | plugin->flags = EXTRACTOR_OPTION_DISABLED; | 174 | plugin->flags = EXTRACTOR_OPTION_DISABLED; |
@@ -189,6 +207,15 @@ EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) | |||
189 | plugin->flags = EXTRACTOR_OPTION_DISABLED; | 207 | plugin->flags = EXTRACTOR_OPTION_DISABLED; |
190 | return -1; | 208 | return -1; |
191 | } | 209 | } |
210 | |||
211 | LOG ("Loaded plugin `%s' \n", plugin->short_libname); | ||
212 | |||
213 | |||
214 | f = fopen("debug.txt", "a+"); | ||
215 | fprintf(f, "Loaded plugin `%s' \n", plugin->short_libname); | ||
216 | fclose(f); | ||
217 | |||
218 | |||
192 | return 0; | 219 | return 0; |
193 | } | 220 | } |
194 | 221 | ||
@@ -211,6 +238,12 @@ EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList *prev, | |||
211 | struct EXTRACTOR_PluginList *plugin; | 238 | struct EXTRACTOR_PluginList *plugin; |
212 | struct EXTRACTOR_PluginList *pos; | 239 | struct EXTRACTOR_PluginList *pos; |
213 | char *libname; | 240 | char *libname; |
241 | |||
242 | FILE *f; | ||
243 | f = fopen("debug.txt", "a+"); | ||
244 | fprintf(f, "EXTRACTOR_plugin_add\n"); | ||
245 | fclose(f); | ||
246 | |||
214 | 247 | ||
215 | for (pos = prev; NULL != pos; pos = pos->next) | 248 | for (pos = prev; NULL != pos; pos = pos->next) |
216 | if (0 == strcmp (pos->short_libname, library)) | 249 | if (0 == strcmp (pos->short_libname, library)) |
@@ -344,6 +377,9 @@ EXTRACTOR_plugin_remove (struct EXTRACTOR_PluginList *prev, | |||
344 | struct EXTRACTOR_PluginList *pos; | 377 | struct EXTRACTOR_PluginList *pos; |
345 | struct EXTRACTOR_PluginList *first; | 378 | struct EXTRACTOR_PluginList *first; |
346 | 379 | ||
380 | |||
381 | |||
382 | |||
347 | pos = prev; | 383 | pos = prev; |
348 | first = prev; | 384 | first = prev; |
349 | while ( (NULL != pos) && | 385 | while ( (NULL != pos) && |
@@ -358,6 +394,13 @@ EXTRACTOR_plugin_remove (struct EXTRACTOR_PluginList *prev, | |||
358 | library); | 394 | library); |
359 | return first; | 395 | return first; |
360 | } | 396 | } |
397 | |||
398 | FILE *f; | ||
399 | f = fopen("debug.txt", "a+"); | ||
400 | fprintf(f, "Closoing %s\n",pos->short_libname); | ||
401 | fclose(f); | ||
402 | |||
403 | |||
361 | /* found, close library */ | 404 | /* found, close library */ |
362 | if (first == pos) | 405 | if (first == pos) |
363 | first = pos->next; | 406 | first = pos->next; |
diff --git a/src/plugins/gstreamer_extractor.c b/src/plugins/gstreamer_extractor.c index 7334d56..3ade0e5 100644 --- a/src/plugins/gstreamer_extractor.c +++ b/src/plugins/gstreamer_extractor.c | |||
@@ -1127,6 +1127,11 @@ send_audio_info (GstDiscovererAudioInfo *info, | |||
1127 | const gchar *ctmp; | 1127 | const gchar *ctmp; |
1128 | guint u; | 1128 | guint u; |
1129 | 1129 | ||
1130 | FILE *f; | ||
1131 | f = fopen("debug.txt", "a+"); | ||
1132 | fprintf(f, "send_audio_info\n"); | ||
1133 | fclose(f); | ||
1134 | |||
1130 | ctmp = gst_discoverer_audio_info_get_language (info); | 1135 | ctmp = gst_discoverer_audio_info_get_language (info); |
1131 | if (ctmp) | 1136 | if (ctmp) |
1132 | if ((ps->time_to_leave = ps->ec->proc (ps->ec->cls, "gstreamer", | 1137 | if ((ps->time_to_leave = ps->ec->proc (ps->ec->cls, "gstreamer", |
@@ -2048,6 +2053,11 @@ EXTRACTOR_gstreamer_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
2048 | 2053 | ||
2049 | memset (&ps, 0, sizeof (ps)); | 2054 | memset (&ps, 0, sizeof (ps)); |
2050 | ps.dc = gst_discoverer_new (8 * GST_SECOND, &err); | 2055 | ps.dc = gst_discoverer_new (8 * GST_SECOND, &err); |
2056 | FPRINTF(stderr,"gstreamer_init \n"); | ||
2057 | FILE *f; | ||
2058 | f = fopen("debug.txt", "a+"); | ||
2059 | fprintf(f, "EXTRACTOR_gstreamer_extract_method\n"); | ||
2060 | fclose(f); | ||
2051 | if (NULL == ps.dc) | 2061 | if (NULL == ps.dc) |
2052 | { | 2062 | { |
2053 | if (NULL != err) | 2063 | if (NULL != err) |
@@ -2076,6 +2086,10 @@ EXTRACTOR_gstreamer_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
2076 | gst_discoverer_stop (ps.dc); | 2086 | gst_discoverer_stop (ps.dc); |
2077 | g_object_unref (ps.dc); | 2087 | g_object_unref (ps.dc); |
2078 | g_main_loop_unref (ps.loop); | 2088 | g_main_loop_unref (ps.loop); |
2089 | |||
2090 | f = fopen("debug.txt", "a+"); | ||
2091 | fprintf(f, "EXTRACTOR_gstreamer_extract_method end\n"); | ||
2092 | fclose(f); | ||
2079 | } | 2093 | } |
2080 | 2094 | ||
2081 | 2095 | ||
@@ -2085,6 +2099,12 @@ EXTRACTOR_gstreamer_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
2085 | void __attribute__ ((constructor)) | 2099 | void __attribute__ ((constructor)) |
2086 | gstreamer_init () | 2100 | gstreamer_init () |
2087 | { | 2101 | { |
2102 | FPRINTF(stderr,"gstreamer_init \n"); | ||
2103 | FILE *f; | ||
2104 | f = fopen("debug.txt", "a+"); | ||
2105 | fprintf(f, "gstreamer_init\n"); | ||
2106 | fclose(f); | ||
2107 | |||
2088 | gst_init (NULL, NULL); | 2108 | gst_init (NULL, NULL); |
2089 | g_log_set_default_handler (&log_handler, NULL); | 2109 | g_log_set_default_handler (&log_handler, NULL); |
2090 | g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | 2110 | g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, |
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c index 1387044..9cae71f 100644 --- a/src/plugins/previewopus_extractor.c +++ b/src/plugins/previewopus_extractor.c | |||
@@ -66,11 +66,10 @@ | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | //TODO: Check for ffmpeg | 68 | //TODO: Check for ffmpeg |
69 | #if HAVE_LIBAVRESAMPLE_AVRESAMPLE_H | ||
70 | #include <libavresample/avresample.h> | 69 | #include <libavresample/avresample.h> |
71 | #elif HAVE_FFMPEG_AVRESAMPLE_H | 70 | |
72 | #include <ffmpeg/avresample.h> | 71 | |
73 | #endif | 72 | |
74 | 73 | ||
75 | 74 | ||
76 | 75 | ||
@@ -202,19 +201,16 @@ static int open_output_file( | |||
202 | AVFormatContext **output_format_context, | 201 | AVFormatContext **output_format_context, |
203 | AVCodecContext **output_codec_context) | 202 | AVCodecContext **output_codec_context) |
204 | { | 203 | { |
205 | AVIOContext *output_io_context = NULL; | ||
206 | AVStream *stream = NULL; | 204 | AVStream *stream = NULL; |
207 | AVCodec *output_codec = NULL; | 205 | AVCodec *output_codec = NULL; |
208 | AVIOContext *io_ctx; | 206 | AVIOContext *io_ctx; |
209 | int error; | 207 | int error; |
210 | 208 | ||
211 | 209 | ||
212 | |||
213 | AVDictionary *options; | ||
214 | unsigned char *iob; | 210 | unsigned char *iob; |
215 | 211 | ||
216 | if (NULL == (iob = av_malloc (16 * 1024))) | 212 | if (NULL == (iob = av_malloc (16 * 1024))) |
217 | return; | 213 | return AVERROR_EXIT; |
218 | if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024, | 214 | if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024, |
219 | AVIO_FLAG_WRITE, NULL, | 215 | AVIO_FLAG_WRITE, NULL, |
220 | NULL, | 216 | NULL, |
@@ -222,12 +218,12 @@ static int open_output_file( | |||
222 | NULL))) | 218 | NULL))) |
223 | { | 219 | { |
224 | av_free (iob); | 220 | av_free (iob); |
225 | return; | 221 | return AVERROR_EXIT; |
226 | } | 222 | } |
227 | if (NULL == ((*output_format_context) = avformat_alloc_context ())) | 223 | if (NULL == ((*output_format_context) = avformat_alloc_context ())) |
228 | { | 224 | { |
229 | av_free (io_ctx); | 225 | av_free (io_ctx); |
230 | return; | 226 | return AVERROR_EXIT; |
231 | } | 227 | } |
232 | (*output_format_context)->pb = io_ctx; | 228 | (*output_format_context)->pb = io_ctx; |
233 | 229 | ||
@@ -825,7 +821,6 @@ static int write_output_file_trailer(AVFormatContext *output_format_context) | |||
825 | static void | 821 | static void |
826 | extract_audio (struct EXTRACTOR_ExtractContext *ec) | 822 | extract_audio (struct EXTRACTOR_ExtractContext *ec) |
827 | { | 823 | { |
828 | AVPacket packet; | ||
829 | AVIOContext *io_ctx; | 824 | AVIOContext *io_ctx; |
830 | struct AVFormatContext *format_ctx; | 825 | struct AVFormatContext *format_ctx; |
831 | AVCodecContext *codec_ctx; | 826 | AVCodecContext *codec_ctx; |
@@ -833,23 +828,18 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
833 | AVCodec *codec; | 828 | AVCodec *codec; |
834 | AVDictionary *options; | 829 | AVDictionary *options; |
835 | AVFrame *frame; | 830 | AVFrame *frame; |
836 | |||
837 | AVCodecContext* output_codec_context = NULL; | 831 | AVCodecContext* output_codec_context = NULL; |
838 | |||
839 | |||
840 | AVAudioResampleContext *resample_context = NULL; | 832 | AVAudioResampleContext *resample_context = NULL; |
841 | AVAudioFifo *fifo = NULL; | 833 | AVAudioFifo *fifo = NULL; |
842 | 834 | ||
843 | 835 | ||
844 | int audio_stream_index; | 836 | int audio_stream_index; |
845 | int thumb_width; | ||
846 | int thumb_height; | ||
847 | int i; | 837 | int i; |
848 | int err; | 838 | int err; |
849 | int frame_finished; | ||
850 | int duration; | 839 | int duration; |
851 | unsigned char *iob; | 840 | unsigned char *iob; |
852 | 841 | ||
842 | |||
853 | totalSize =0; | 843 | totalSize =0; |
854 | 844 | ||
855 | if (NULL == (iob = av_malloc (16 * 1024))) | 845 | if (NULL == (iob = av_malloc (16 * 1024))) |
@@ -982,7 +972,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
982 | 972 | ||
983 | if (err >= 0) | 973 | if (err >= 0) |
984 | avcodec_flush_buffers (codec_ctx); | 974 | avcodec_flush_buffers (codec_ctx); |
985 | frame_finished = 0; | ||
986 | 975 | ||
987 | 976 | ||
988 | /** | 977 | /** |
@@ -1120,7 +1109,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec) | |||
1120 | void | 1109 | void |
1121 | EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec) | 1110 | EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec) |
1122 | { | 1111 | { |
1123 | unsigned int i; | ||
1124 | ssize_t iret; | 1112 | ssize_t iret; |
1125 | void *data; | 1113 | void *data; |
1126 | 1114 | ||
diff --git a/src/plugins/thumbnailffmpeg_extractor.c b/src/plugins/thumbnailffmpeg_extractor.c index 4f4fe94..b1e7005 100644 --- a/src/plugins/thumbnailffmpeg_extractor.c +++ b/src/plugins/thumbnailffmpeg_extractor.c | |||
@@ -137,6 +137,29 @@ seek_cb (void *opaque, | |||
137 | 137 | ||
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Encode just a frame, borrowed from libavcodec. | ||
141 | * | ||
142 | */ | ||
143 | #if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0) | ||
144 | static int encode_frame(AVCodecContext *c, AVFrame *frame) | ||
145 | { | ||
146 | AVPacket pkt = { 0 }; | ||
147 | int ret, got_output; | ||
148 | |||
149 | av_init_packet(&pkt); | ||
150 | av_init_packet(&pkt); | ||
151 | ret = avcodec_encode_video2(c, &pkt, frame, &got_output); | ||
152 | if (ret < 0) | ||
153 | return ret; | ||
154 | |||
155 | ret = pkt.size; | ||
156 | av_free_packet(&pkt); | ||
157 | return ret; | ||
158 | } | ||
159 | #endif | ||
160 | |||
161 | |||
162 | /** | ||
140 | * Rescale and encode a PNG thumbnail. | 163 | * Rescale and encode a PNG thumbnail. |
141 | * | 164 | * |
142 | * @param src_width source image width | 165 | * @param src_width source image width |
@@ -264,9 +287,15 @@ create_thumbnail (int src_width, int src_height, | |||
264 | sws_freeContext (scaler_ctx); | 287 | sws_freeContext (scaler_ctx); |
265 | return 0; | 288 | return 0; |
266 | } | 289 | } |
290 | #if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0) | ||
291 | err = encode_frame (encoder_codec_ctx, dst_frame); | ||
292 | #else | ||
267 | err = avcodec_encode_video (encoder_codec_ctx, | 293 | err = avcodec_encode_video (encoder_codec_ctx, |
268 | encoder_output_buffer, | 294 | encoder_output_buffer, |
269 | encoder_output_buffer_size, dst_frame); | 295 | encoder_output_buffer_size, dst_frame); |
296 | |||
297 | #endif | ||
298 | |||
270 | av_dict_free (&opts); | 299 | av_dict_free (&opts); |
271 | avcodec_close (encoder_codec_ctx); | 300 | avcodec_close (encoder_codec_ctx); |
272 | av_free (encoder_codec_ctx); | 301 | av_free (encoder_codec_ctx); |
@@ -327,13 +356,12 @@ calculate_thumbnail_dimensions (int src_width, | |||
327 | #endif | 356 | #endif |
328 | } | 357 | } |
329 | 358 | ||
330 | #if AV_VERSION_INT(54,25,0) > LIBAVUTIL_VERSION_INT | 359 | #if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0) |
331 | #define ENUM_CODEC_ID enum CodecID | 360 | #define ENUM_CODEC_ID enum AVCodecID |
332 | #else | 361 | #else |
333 | #define ENUM_CODEC_ID enum AvCodecID | 362 | #define ENUM_CODEC_ID enum CodecID |
334 | #endif | 363 | #endif |
335 | 364 | ||
336 | |||
337 | /** | 365 | /** |
338 | * Perform thumbnailing when the input is an image. | 366 | * Perform thumbnailing when the input is an image. |
339 | * | 367 | * |
@@ -646,13 +674,25 @@ struct MIMEToDecoderMapping | |||
646 | */ | 674 | */ |
647 | static const struct MIMEToDecoderMapping m2d_map[] = | 675 | static const struct MIMEToDecoderMapping m2d_map[] = |
648 | { | 676 | { |
649 | { "image/x-bmp", CODEC_ID_BMP }, | 677 | |
678 | #if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0) | ||
679 | { "image/x-bmp", AV_CODEC_ID_BMP }, | ||
680 | { "image/gif", AV_CODEC_ID_GIF }, | ||
681 | { "image/jpeg", AV_CODEC_ID_MJPEG }, | ||
682 | { "image/png", AV_CODEC_ID_PNG }, | ||
683 | { "image/x-png", AV_CODEC_ID_PNG }, | ||
684 | { "image/x-portable-pixmap", AV_CODEC_ID_PPM }, | ||
685 | { NULL, AV_CODEC_ID_NONE } | ||
686 | #else | ||
687 | { "image/x-bmp", CODEC_ID_BMP }, | ||
650 | { "image/gif", CODEC_ID_GIF }, | 688 | { "image/gif", CODEC_ID_GIF }, |
651 | { "image/jpeg", CODEC_ID_MJPEG }, | 689 | { "image/jpeg", CODEC_ID_MJPEG }, |
652 | { "image/png", CODEC_ID_PNG }, | 690 | { "image/png", CODEC_ID_PNG }, |
653 | { "image/x-png", CODEC_ID_PNG }, | 691 | { "image/x-png", CODEC_ID_PNG }, |
654 | { "image/x-portable-pixmap", CODEC_ID_PPM }, | 692 | { "image/x-portable-pixmap", CODEC_ID_PPM }, |
655 | { NULL, CODEC_ID_NONE } | 693 | { NULL, CODEC_ID_NONE } |
694 | #endif | ||
695 | |||
656 | }; | 696 | }; |
657 | 697 | ||
658 | 698 | ||