[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r31642 - in Extractor: . src/main src/plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r31642 - in Extractor: . src/main src/plugins |
Date: |
Sat, 21 Dec 2013 04:07:10 +0100 |
Author: bratao
Date: 2013-12-21 04:07:10 +0100 (Sat, 21 Dec 2013)
New Revision: 31642
Modified:
Extractor/configure.ac
Extractor/src/main/extractor.c
Extractor/src/main/extractor_ipc_gnu.c
Extractor/src/main/extractor_ipc_w32.c
Extractor/src/main/extractor_logging.h
Extractor/src/main/extractor_plugin_main.c
Extractor/src/main/extractor_plugins.c
Extractor/src/plugins/gstreamer_extractor.c
Extractor/src/plugins/previewopus_extractor.c
Extractor/src/plugins/thumbnailffmpeg_extractor.c
Log:
Wrong commit, reverting changes.
Modified: Extractor/configure.ac
===================================================================
--- Extractor/configure.ac 2013-12-21 02:52:06 UTC (rev 31641)
+++ Extractor/configure.ac 2013-12-21 03:07:10 UTC (rev 31642)
@@ -672,13 +672,11 @@
then
ffmpeg_enabled=0
new_ffmpeg=0
- AC_CHECK_HEADERS([libavutil/frame.h],
- AC_CHECK_HEADERS([libavresample/avresample.h],new_ffmpeg=1))
-
+ AC_CHECK_HEADERS([libavutil/frame.h],new_ffmpeg=1)
AC_CHECK_LIB(swscale, sws_getContext,
AC_CHECK_LIB(avcodec, avcodec_alloc_context3,
ffmpeg_enabled=1))
- 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])
+ 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])
fi
AM_CONDITIONAL(HAVE_FFMPEG, test x$ffmpeg_enabled != x0)
AM_CONDITIONAL(HAVE_FFMPEG_NEW, test x$new_ffmpeg != x0)
@@ -807,7 +805,7 @@
if test "x$new_ffmpeg" = "x0"
then
- AC_MSG_NOTICE([NOTICE: FFmpeg/opus audio preview plugin disabled, It needs
libav > 10, or a FFmpeg with --enable-libavresample])
+ AC_MSG_NOTICE([NOTICE: FFmpeg/opus audio preview plugin disabled])
fi
if test "x$without_gtk" = "xtrue"
Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c 2013-12-21 02:52:06 UTC (rev 31641)
+++ Extractor/src/main/extractor.c 2013-12-21 03:07:10 UTC (rev 31642)
@@ -35,7 +35,7 @@
/**
* Size used for the shared memory segment.
*/
-#define DEFAULT_SHM_SIZE (160 * 1024)
+#define DEFAULT_SHM_SIZE (16 * 1024)
/**
@@ -382,8 +382,6 @@
ssize_t ready;
int done;
int have_in_memory;
-
- LOG ("Stating !\n");
plugin_count = 0;
for (pos = plugins; NULL != pos; pos = pos->next)
@@ -403,7 +401,6 @@
start.reserved2 = 0;
start.shm_ready_bytes = (uint32_t) ready;
start.file_size = EXTRACTOR_datasource_get_size_ (ds, 0);
- LOG ("Have %d\ !\n",plugin_count);
for (pos = plugins; NULL != pos; pos = pos->next)
{
if (EXTRACTOR_OPTION_IN_PROCESS == pos->flags)
@@ -427,7 +424,6 @@
done = 0;
while (! done)
{
- //LOG ("In !done while\n");
struct EXTRACTOR_Channel *channels[plugin_count];
/* calculate current 'channels' array */
@@ -437,18 +433,15 @@
if (-1 == pos->seek_request)
{
/* channel is not seeking, must be running or done */
- //LOG ("No seeking, done\n");
channels[plugin_off] = pos->channel;
}
else
{
/* not running this round, seeking! */
- //LOG ("Nor running, seeking\n");
channels[plugin_off] = NULL;
}
plugin_off++;
}
- //LOG ("Will call EXTRACTOR_IPC_channel_recv_\n");
/* give plugins chance to send us meta data, seek or finished messages */
if (-1 ==
EXTRACTOR_IPC_channel_recv_ (channels,
@@ -457,7 +450,7 @@
&prp))
{
/* serious problem in IPC; reset *all* channels */
- //LOG ("Failed to receive message from channels; full reset\n");
+ LOG ("Failed to receive message from channels; full reset\n");
abort_all_channels (plugins);
break;
}
@@ -470,14 +463,10 @@
{
plugin_off++;
if ( (1 == pos->round_finished) ||
- (NULL == pos->channel) ){
- //LOG ("Inative plugin\n");
+ (NULL == pos->channel) )
continue; /* inactive plugin */
-
- }
if (-1 == pos->seek_request)
{
- //LOG ("pos->seek_request\n");
/* possibly more meta data at current position, at least
this plugin is still working on it... */
done = 0;
Modified: Extractor/src/main/extractor_ipc_gnu.c
===================================================================
--- Extractor/src/main/extractor_ipc_gnu.c 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/main/extractor_ipc_gnu.c 2013-12-21 03:07:10 UTC (rev
31642)
@@ -464,7 +464,7 @@
return 1; /* nothing left to do! */
}
tv.tv_sec = 0;
- tv.tv_usec = 5000000; /* 500 ms */
+ tv.tv_usec = 500000; /* 500 ms */
if (0 >= select (max + 1, &to_check, NULL, NULL, &tv))
{
/* an error or timeout -> something's wrong or all plugins hung up */
Modified: Extractor/src/main/extractor_ipc_w32.c
===================================================================
--- Extractor/src/main/extractor_ipc_w32.c 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/main/extractor_ipc_w32.c 2013-12-21 03:07:10 UTC (rev
31642)
@@ -725,17 +725,12 @@
if (c == 0)
return 1; /* nothing left to do! */
- ms = 1000000;
+ ms = 10000;
first_ready = WaitForMultipleObjects (c, events, FALSE, ms);
if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED)
{
/* an error or timeout -> something's wrong or all plugins hung up */
LOG_STRERROR ("WaitForMultipleObjects");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "WaitForMultipleObjects \n");
- fclose(f);
-
return -1;
}
@@ -754,10 +749,6 @@
if (MAX_META_DATA == channels[i]->mdata_size)
{
LOG ("Inbound message from channel too large, aborting\n");
-
FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Inbound message from channel too large, aborting \n");
- fclose(f);
EXTRACTOR_IPC_channel_destroy_ (channels[i]);
channels[i] = NULL;
}
@@ -770,11 +761,6 @@
LOG_STRERROR ("realloc");
EXTRACTOR_IPC_channel_destroy_ (channels[i]);
channels[i] = NULL;
-
-
FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Realloc \n");
- fclose(f);
}
channels[i]->mdata = ndata;
}
Modified: Extractor/src/main/extractor_logging.h
===================================================================
--- Extractor/src/main/extractor_logging.h 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/main/extractor_logging.h 2013-12-21 03:07:10 UTC (rev
31642)
@@ -25,7 +25,7 @@
#ifndef EXTRACTOR_LOGGING_H
#define EXTRACTOR_LOGGING_H
-#define DEBUG 1
+#define DEBUG 0
#if DEBUG
Modified: Extractor/src/main/extractor_plugin_main.c
===================================================================
--- Extractor/src/main/extractor_plugin_main.c 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/main/extractor_plugin_main.c 2013-12-21 03:07:10 UTC (rev
31642)
@@ -460,7 +460,6 @@
LOG ("Failed to read 'start' message\n");
return -1;
}
- fprintf (stderr, "Got start msg\n");
pc->shm_ready_bytes = start.shm_ready_bytes;
pc->file_size = start.file_size;
pc->read_position = 0;
@@ -476,10 +475,6 @@
if (-1 == EXTRACTOR_write_all_ (pc->out, &done, sizeof (done)))
{
LOG ("Failed to write 'done' message\n");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Failed to write 'done' message' \n");
- fclose(f);
return -1;
}
if ( (NULL != pc->plugin->specials) &&
@@ -529,33 +524,18 @@
if (0 != handle_start_message (pc))
{
LOG ("Failure to handle START\n");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Failure to handle START' \n");
- fclose(f);
return;
}
break;
- case MESSAGE_UPDATED_SHM:{
+ case MESSAGE_UPDATED_SHM:
LOG ("Illegal message\n");
/* not allowed here, we're not waiting for SHM to move! */
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Illegal message' \n");
- fclose(f);
-
return;
- }
case MESSAGE_DISCARD_STATE:
/* odd, we're already in the start state... */
continue;
default:
LOG ("Received invalid messag %d\n", (int) code);
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Received invalid messag' \n");
- fclose(f);
-
/* error, unexpected message */
return;
}
@@ -645,14 +625,6 @@
process_requests (&pc);
LOG ("IPC error; plugin `%s' terminates!\n",
plugin->short_libname);
-
-
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "IPC error; plugin `%s' terminates!\n",
- plugin->short_libname);
- fclose(f);
-
#if WINDOWS
if (NULL != pc.shm)
UnmapViewOfFile (pc.shm);
Modified: Extractor/src/main/extractor_plugins.c
===================================================================
--- Extractor/src/main/extractor_plugins.c 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/main/extractor_plugins.c 2013-12-21 03:07:10 UTC (rev
31642)
@@ -120,14 +120,6 @@
int
EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin)
{
-
-LOG ("In EXTRACTOR_plugin_load_");
-
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "EXTRACTOR_plugin_load_\n");
- fclose(f);
-
#if WINDOWS
wchar_t wlibname[4097];
char llibname[4097];
@@ -145,11 +137,6 @@
plugin->flags = EXTRACTOR_OPTION_DISABLED;
return -1;
}
-
- LOG ("Loading plugin `%s' \n", plugin->short_libname);
- lt_dlclose (plugin->libraryHandle);
-
-
lt_dladvise_init (&advise);
lt_dladvise_ext (&advise);
lt_dladvise_local (&advise);
@@ -164,11 +151,6 @@
LOG ("Loading `%s' plugin failed: %s\n",
plugin->short_libname,
"can't convert plugin name to local encoding");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Loading `%s' plugin failed!\n",
- plugin->short_libname);
- fclose(f);
free (plugin->libname);
plugin->libname = NULL;
plugin->flags = EXTRACTOR_OPTION_DISABLED;
@@ -207,15 +189,6 @@
plugin->flags = EXTRACTOR_OPTION_DISABLED;
return -1;
}
-
- LOG ("Loaded plugin `%s' \n", plugin->short_libname);
-
-
- f = fopen("debug.txt", "a+");
- fprintf(f, "Loaded plugin `%s' \n", plugin->short_libname);
- fclose(f);
-
-
return 0;
}
@@ -238,12 +211,6 @@
struct EXTRACTOR_PluginList *plugin;
struct EXTRACTOR_PluginList *pos;
char *libname;
-
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "EXTRACTOR_plugin_add\n");
- fclose(f);
-
for (pos = prev; NULL != pos; pos = pos->next)
if (0 == strcmp (pos->short_libname, library))
@@ -377,9 +344,6 @@
struct EXTRACTOR_PluginList *pos;
struct EXTRACTOR_PluginList *first;
-
-
-
pos = prev;
first = prev;
while ( (NULL != pos) &&
@@ -394,13 +358,6 @@
library);
return first;
}
-
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "Closoing %s\n",pos->short_libname);
- fclose(f);
-
-
/* found, close library */
if (first == pos)
first = pos->next;
Modified: Extractor/src/plugins/gstreamer_extractor.c
===================================================================
--- Extractor/src/plugins/gstreamer_extractor.c 2013-12-21 02:52:06 UTC (rev
31641)
+++ Extractor/src/plugins/gstreamer_extractor.c 2013-12-21 03:07:10 UTC (rev
31642)
@@ -1127,11 +1127,6 @@
const gchar *ctmp;
guint u;
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "send_audio_info\n");
- fclose(f);
-
ctmp = gst_discoverer_audio_info_get_language (info);
if (ctmp)
if ((ps->time_to_leave = ps->ec->proc (ps->ec->cls, "gstreamer",
@@ -2053,11 +2048,6 @@
memset (&ps, 0, sizeof (ps));
ps.dc = gst_discoverer_new (8 * GST_SECOND, &err);
- FPRINTF(stderr,"gstreamer_init \n");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "EXTRACTOR_gstreamer_extract_method\n");
- fclose(f);
if (NULL == ps.dc)
{
if (NULL != err)
@@ -2086,10 +2076,6 @@
gst_discoverer_stop (ps.dc);
g_object_unref (ps.dc);
g_main_loop_unref (ps.loop);
-
- f = fopen("debug.txt", "a+");
- fprintf(f, "EXTRACTOR_gstreamer_extract_method end\n");
- fclose(f);
}
@@ -2099,12 +2085,6 @@
void __attribute__ ((constructor))
gstreamer_init ()
{
-FPRINTF(stderr,"gstreamer_init \n");
- FILE *f;
- f = fopen("debug.txt", "a+");
- fprintf(f, "gstreamer_init\n");
- fclose(f);
-
gst_init (NULL, NULL);
g_log_set_default_handler (&log_handler, NULL);
g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION,
Modified: Extractor/src/plugins/previewopus_extractor.c
===================================================================
--- Extractor/src/plugins/previewopus_extractor.c 2013-12-21 02:52:06 UTC
(rev 31641)
+++ Extractor/src/plugins/previewopus_extractor.c 2013-12-21 03:07:10 UTC
(rev 31642)
@@ -66,14 +66,15 @@
#endif
//TODO: Check for ffmpeg
+#if HAVE_LIBAVRESAMPLE_AVRESAMPLE_H
#include <libavresample/avresample.h>
+#elif HAVE_FFMPEG_AVRESAMPLE_H
+#include <ffmpeg/avresample.h>
+#endif
-
-
-
/**
* Set to 1 to enable debug output.
*/
@@ -201,16 +202,19 @@
AVFormatContext **output_format_context,
AVCodecContext **output_codec_context)
{
+ AVIOContext *output_io_context = NULL;
AVStream *stream = NULL;
AVCodec *output_codec = NULL;
AVIOContext *io_ctx;
int error;
-
+
+
+ AVDictionary *options;
unsigned char *iob;
if (NULL == (iob = av_malloc (16 * 1024)))
- return AVERROR_EXIT;
+ return;
if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024,
AVIO_FLAG_WRITE, NULL,
NULL,
@@ -218,12 +222,12 @@
NULL)))
{
av_free (iob);
- return AVERROR_EXIT;
+ return;
}
if (NULL == ((*output_format_context) = avformat_alloc_context ()))
{
av_free (io_ctx);
- return AVERROR_EXIT;
+ return;
}
(*output_format_context)->pb = io_ctx;
@@ -821,6 +825,7 @@
static void
extract_audio (struct EXTRACTOR_ExtractContext *ec)
{
+ AVPacket packet;
AVIOContext *io_ctx;
struct AVFormatContext *format_ctx;
AVCodecContext *codec_ctx;
@@ -828,18 +833,23 @@
AVCodec *codec;
AVDictionary *options;
AVFrame *frame;
+
AVCodecContext* output_codec_context = NULL;
+
+
AVAudioResampleContext *resample_context = NULL;
AVAudioFifo *fifo = NULL;
int audio_stream_index;
+ int thumb_width;
+ int thumb_height;
int i;
int err;
+ int frame_finished;
int duration;
unsigned char *iob;
-
-
+
totalSize =0;
if (NULL == (iob = av_malloc (16 * 1024)))
@@ -972,6 +982,7 @@
if (err >= 0)
avcodec_flush_buffers (codec_ctx);
+ frame_finished = 0;
/**
@@ -1109,6 +1120,7 @@
void
EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec)
{
+ unsigned int i;
ssize_t iret;
void *data;
Modified: Extractor/src/plugins/thumbnailffmpeg_extractor.c
===================================================================
--- Extractor/src/plugins/thumbnailffmpeg_extractor.c 2013-12-21 02:52:06 UTC
(rev 31641)
+++ Extractor/src/plugins/thumbnailffmpeg_extractor.c 2013-12-21 03:07:10 UTC
(rev 31642)
@@ -137,29 +137,6 @@
/**
- * Encode just a frame, borrowed from libavcodec.
- *
- */
- #if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0)
-static int encode_frame(AVCodecContext *c, AVFrame *frame)
-{
- AVPacket pkt = { 0 };
- int ret, got_output;
-
- av_init_packet(&pkt);
- av_init_packet(&pkt);
- ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
- if (ret < 0)
- return ret;
-
- ret = pkt.size;
- av_free_packet(&pkt);
- return ret;
-}
-#endif
-
-
-/**
* Rescale and encode a PNG thumbnail.
*
* @param src_width source image width
@@ -287,15 +264,9 @@
sws_freeContext (scaler_ctx);
return 0;
}
-#if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0)
- err = encode_frame (encoder_codec_ctx, dst_frame);
-#else
err = avcodec_encode_video (encoder_codec_ctx,
encoder_output_buffer,
encoder_output_buffer_size, dst_frame);
-
-#endif
-
av_dict_free (&opts);
avcodec_close (encoder_codec_ctx);
av_free (encoder_codec_ctx);
@@ -356,12 +327,13 @@
#endif
}
-#if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0)
- #define ENUM_CODEC_ID enum AVCodecID
+#if AV_VERSION_INT(54,25,0) > LIBAVUTIL_VERSION_INT
+#define ENUM_CODEC_ID enum CodecID
#else
- #define ENUM_CODEC_ID enum CodecID
+#define ENUM_CODEC_ID enum AvCodecID
#endif
+
/**
* Perform thumbnailing when the input is an image.
*
@@ -674,25 +646,13 @@
*/
static const struct MIMEToDecoderMapping m2d_map[] =
{
-
-#if LIBAVCODEC_BUILD >= AV_VERSION_INT(54,25,0)
- { "image/x-bmp", AV_CODEC_ID_BMP },
- { "image/gif", AV_CODEC_ID_GIF },
- { "image/jpeg", AV_CODEC_ID_MJPEG },
- { "image/png", AV_CODEC_ID_PNG },
- { "image/x-png", AV_CODEC_ID_PNG },
- { "image/x-portable-pixmap", AV_CODEC_ID_PPM },
- { NULL, AV_CODEC_ID_NONE }
-#else
- { "image/x-bmp", CODEC_ID_BMP },
+ { "image/x-bmp", CODEC_ID_BMP },
{ "image/gif", CODEC_ID_GIF },
{ "image/jpeg", CODEC_ID_MJPEG },
{ "image/png", CODEC_ID_PNG },
{ "image/x-png", CODEC_ID_PNG },
{ "image/x-portable-pixmap", CODEC_ID_PPM },
{ NULL, CODEC_ID_NONE }
-#endif
-
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r31642 - in Extractor: . src/main src/plugins,
gnunet <=