commit d07e0d17678a99816962687d75c085b1b690efe7
parent 11d6ea836b572d758352240d2cb9f08107d15297
Author: Bruno Cabral <brataoufba@gmail.com>
Date: Sat, 21 Dec 2013 03:11:12 +0000
Build only with libav , remove unused variables.
Diffstat:
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -672,11 +672,13 @@ if test x$ffmpeg_enabled = x1
then
ffmpeg_enabled=0
new_ffmpeg=0
- AC_CHECK_HEADERS([libavutil/frame.h],new_ffmpeg=1)
+ AC_CHECK_HEADERS([libavutil/frame.h],
+ AC_CHECK_HEADERS([libavresample/avresample.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 libavresample/avresample.h ffmpeg/avresample.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])
fi
AM_CONDITIONAL(HAVE_FFMPEG, test x$ffmpeg_enabled != x0)
AM_CONDITIONAL(HAVE_FFMPEG_NEW, test x$new_ffmpeg != x0)
@@ -805,7 +807,7 @@ fi
if test "x$new_ffmpeg" = "x0"
then
- AC_MSG_NOTICE([NOTICE: FFmpeg/opus audio preview plugin disabled])
+ AC_MSG_NOTICE([NOTICE: FFmpeg/opus audio preview plugin disabled, It needs libav > 10, or a FFmpeg with --enable-libavresample])
fi
if test "x$without_gtk" = "xtrue"
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c
@@ -66,11 +66,10 @@
#endif
//TODO: Check for ffmpeg
-#if HAVE_LIBAVRESAMPLE_AVRESAMPLE_H
#include <libavresample/avresample.h>
-#elif HAVE_FFMPEG_AVRESAMPLE_H
-#include <ffmpeg/avresample.h>
-#endif
+
+
+
@@ -202,19 +201,16 @@ static int open_output_file(
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;
+ return AVERROR_EXIT;
if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024,
AVIO_FLAG_WRITE, NULL,
NULL,
@@ -222,12 +218,12 @@ static int open_output_file(
NULL)))
{
av_free (iob);
- return;
+ return AVERROR_EXIT;
}
if (NULL == ((*output_format_context) = avformat_alloc_context ()))
{
av_free (io_ctx);
- return;
+ return AVERROR_EXIT;
}
(*output_format_context)->pb = io_ctx;
@@ -825,7 +821,6 @@ static int write_output_file_trailer(AVFormatContext *output_format_context)
static void
extract_audio (struct EXTRACTOR_ExtractContext *ec)
{
- AVPacket packet;
AVIOContext *io_ctx;
struct AVFormatContext *format_ctx;
AVCodecContext *codec_ctx;
@@ -833,23 +828,18 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
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)))
@@ -982,7 +972,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
if (err >= 0)
avcodec_flush_buffers (codec_ctx);
- frame_finished = 0;
/**
@@ -1120,7 +1109,6 @@ extract_audio (struct EXTRACTOR_ExtractContext *ec)
void
EXTRACTOR_previewopus_extract_method (struct EXTRACTOR_ExtractContext *ec)
{
- unsigned int i;
ssize_t iret;
void *data;