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