summaryrefslogtreecommitdiff
path: root/src/plugins/thumbnailffmpeg_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/thumbnailffmpeg_extractor.c')
-rw-r--r--src/plugins/thumbnailffmpeg_extractor.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/src/plugins/thumbnailffmpeg_extractor.c b/src/plugins/thumbnailffmpeg_extractor.c
index 72f0137..9bed4ec 100644
--- a/src/plugins/thumbnailffmpeg_extractor.c
+++ b/src/plugins/thumbnailffmpeg_extractor.c
@@ -38,26 +38,11 @@
#include "extractor.h"
#include <magic.h>
-#if HAVE_LIBAVUTIL_AVUTIL_H
#include <libavutil/avutil.h>
-#elif HAVE_FFMPEG_AVUTIL_H
-#include <ffmpeg/avutil.h>
-#endif
-#if HAVE_LIBAVFORMAT_AVFORMAT_H
+#include <libavutil/imgutils.h>
#include <libavformat/avformat.h>
-#elif HAVE_FFMPEG_AVFORMAT_H
-#include <ffmpeg/avformat.h>
-#endif
-#if HAVE_LIBAVCODEC_AVCODEC_H
#include <libavcodec/avcodec.h>
-#elif HAVE_FFMPEG_AVCODEC_H
-#include <ffmpeg/avcodec.h>
-#endif
-#if HAVE_LIBSWSCALE_SWSCALE_H
#include <libswscale/swscale.h>
-#elif HAVE_FFMPEG_SWSCALE_H
-#include <ffmpeg/swscale.h>
-#endif
#if USE_JPEG
#ifdef PIX_FMT_YUVJ420P
@@ -257,8 +242,10 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
return 0;
}
if (NULL == (dst_buffer =
- av_malloc (avpicture_get_size (PIX_OUTPUT_FORMAT,
- dst_width, dst_height))))
+ av_malloc (av_image_get_buffer_size (PIX_OUTPUT_FORMAT,
+ dst_width,
+ dst_height,
+ 1))))
{
#if DEBUG
fprintf (stderr,
@@ -272,9 +259,13 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
sws_freeContext (scaler_ctx);
return 0;
}
- avpicture_fill ((AVPicture *) dst_frame, dst_buffer,
- PIX_OUTPUT_FORMAT,
- dst_width, dst_height);
+ av_image_fill_arrays (dst_frame->data,
+ dst_frame->linesize,
+ dst_buffer,
+ PIX_OUTPUT_FORMAT,
+ dst_width,
+ dst_height,
+ 1);
sws_scale (scaler_ctx,
src_data,
src_stride,
@@ -383,7 +374,7 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
err = pkt.size;
memcpy (encoder_output_buffer,pkt.data, pkt.size);
- av_free_packet (&pkt);
+ av_packet_unref (&pkt);
#else
@@ -622,6 +613,7 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
AVIOContext *io_ctx;
struct AVFormatContext *format_ctx;
AVCodecContext *codec_ctx;
+ AVCodecParameters *codecpar;
AVCodec *codec;
AVDictionary *options;
AVFrame *frame;
@@ -675,10 +667,11 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
video_stream_index = -1;
for (i = 0; i<format_ctx->nb_streams; i++)
{
+ codecpar = format_ctx->streams[i]->codecpar;
codec_ctx = format_ctx->streams[i]->codec;
if (AVMEDIA_TYPE_VIDEO != codec_ctx->codec_type)
continue;
- if (NULL == (codec = avcodec_find_decoder (codec_ctx->codec_id)))
+ if (NULL == (codec = avcodec_find_decoder (codecpar->codec_id)))
continue;
options = NULL;
if (0 != (err = avcodec_open2 (codec_ctx, codec, &options)))
@@ -760,11 +753,11 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
&packet);
if (frame_finished && frame->key_frame)
{
- av_free_packet (&packet);
+ av_packet_unref (&packet);
break;
}
}
- av_free_packet (&packet);
+ av_packet_unref (&packet);
}
if (! frame_finished)
@@ -945,7 +938,6 @@ void __attribute__ ((constructor))
thumbnailffmpeg_lib_init (void)
{
av_log_set_callback (&thumbnailffmpeg_av_log_callback);
- av_register_all ();
magic = magic_open (MAGIC_MIME_TYPE);
if (0 != magic_load (magic, NULL))
{