Remove old ffmpeg compatibility stuff.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2013 14:47:41 +0000 (15:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2013 14:47:41 +0000 (15:47 +0100)
src/lib/ffmpeg_compatibility.cc [deleted file]
src/lib/ffmpeg_compatibility.h [deleted file]
src/lib/filter_graph.cc
src/lib/filter_graph.h
src/lib/image.h
src/lib/matcher.h
src/lib/wscript
wscript

diff --git a/src/lib/ffmpeg_compatibility.cc b/src/lib/ffmpeg_compatibility.cc
deleted file mode 100644 (file)
index 361fa74..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-extern "C" {
-#include <libavfilter/avfiltergraph.h>
-}
-#include "exceptions.h"
-
-#include "i18n.h"
-
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-
-typedef struct {
-       enum PixelFormat pix_fmt;
-} AVSinkContext;
-
-static int
-avsink_init (AVFilterContext* ctx, const char* args, void* opaque)
-{
-       AVSinkContext* priv = (AVSinkContext *) ctx->priv;
-       if (!opaque) {
-               return AVERROR (EINVAL);
-       }
-
-       *priv = *(AVSinkContext *) opaque;
-       return 0;
-}
-
-static void
-null_end_frame (AVFilterLink *)
-{
-
-}
-
-static int
-avsink_query_formats (AVFilterContext* ctx)
-{
-       AVSinkContext* priv = (AVSinkContext *) ctx->priv;
-       enum PixelFormat pix_fmts[] = {
-               priv->pix_fmt,
-               PIX_FMT_NONE
-       };
-
-       avfilter_set_common_formats (ctx, avfilter_make_format_list ((int *) pix_fmts));
-       return 0;
-}
-
-#endif
-
-AVFilter*
-get_sink ()
-{
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-       /* XXX does this leak stuff? */
-       AVFilter* buffer_sink = new AVFilter;
-       buffer_sink->name = av_strdup (N_("avsink"));
-       buffer_sink->priv_size = sizeof (AVSinkContext);
-       buffer_sink->init = avsink_init;
-       buffer_sink->query_formats = avsink_query_formats;
-       buffer_sink->inputs = new AVFilterPad[2];
-       AVFilterPad* i0 = const_cast<AVFilterPad*> (&buffer_sink->inputs[0]);
-       i0->name = N_("default");
-       i0->type = AVMEDIA_TYPE_VIDEO;
-       i0->min_perms = AV_PERM_READ;
-       i0->rej_perms = 0;
-       i0->start_frame = 0;
-       i0->get_video_buffer = 0;
-       i0->get_audio_buffer = 0;
-       i0->end_frame = null_end_frame;
-       i0->draw_slice = 0;
-       i0->filter_samples = 0;
-       i0->poll_frame = 0;
-       i0->request_frame = 0;
-       i0->config_props = 0;
-       const_cast<AVFilterPad*> (&buffer_sink->inputs[1])->name = 0;
-       buffer_sink->outputs = new AVFilterPad[1];
-       const_cast<AVFilterPad*> (&buffer_sink->outputs[0])->name = 0;
-       return buffer_sink;
-#else
-       AVFilter* buffer_sink = avfilter_get_by_name(N_("buffersink"));
-       if (buffer_sink == 0) {
-               throw DecodeError (N_("Could not create buffer sink filter"));
-       }
-
-       return buffer_sink;
-#endif
-}
-
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-AVFilterInOut *
-avfilter_inout_alloc ()
-{
-       return (AVFilterInOut *) av_malloc (sizeof (AVFilterInOut));
-}
-#endif
-
-#ifndef HAVE_AV_FRAME_GET_BEST_EFFORT_TIMESTAMP
-int64_t av_frame_get_best_effort_timestamp (AVFrame const * f)
-{
-       return f->best_effort_timestamp;
-}
-
-#endif
diff --git a/src/lib/ffmpeg_compatibility.h b/src/lib/ffmpeg_compatibility.h
deleted file mode 100644 (file)
index 772d22c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-struct AVFilterInOut;
-
-extern AVFilter* get_sink ();
-extern AVFilterInOut* avfilter_inout_alloc ();
-
-#ifndef HAVE_AV_PIXEL_FORMAT
-#define AVPixelFormat PixelFormat
-#endif
-
-#ifndef HAVE_AV_FRAME_GET_BEST_EFFORT_TIMESTAMP
-extern int64_t av_frame_get_best_effort_timestamp (AVFrame const *);
-#endif
index 045cbaa6a0ba504c6f4acda30adbaba711884e8e..c57d26e8d09f8228aafb097f7298447844a22667 100644 (file)
 
 extern "C" {
 #include <libavfilter/avfiltergraph.h>
-#ifdef HAVE_BUFFERSRC_H        
 #include <libavfilter/buffersrc.h>
-#endif 
-#if (LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 53 && LIBAVFILTER_VERSION_MINOR <= 77) || LIBAVFILTER_VERSION_MAJOR == 3
 #include <libavfilter/avcodec.h>
 #include <libavfilter/buffersink.h>
-#elif LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-#include <libavfilter/vsrc_buffer.h>
-#endif
 #include <libavformat/avio.h>
 }
 #include "decoder.h"
 #include "filter_graph.h"
-#include "ffmpeg_compatibility.h"
 #include "filter.h"
 #include "exceptions.h"
 #include "image.h"
@@ -80,7 +73,10 @@ FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, libdcp:
                throw DecodeError (N_("could not find buffer src filter"));
        }
 
-       AVFilter* buffer_sink = get_sink ();
+       AVFilter* buffer_sink = avfilter_get_by_name(N_("buffersink"));
+       if (buffer_sink == 0) {
+               throw DecodeError (N_("Could not create buffer sink filter"));
+       }
 
        stringstream a;
        a << _size.width << N_(":")
@@ -119,15 +115,9 @@ FilterGraph::FilterGraph (shared_ptr<Film> film, FFmpegDecoder* decoder, libdcp:
        inputs->pad_idx = 0;
        inputs->next = 0;
 
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-       if (avfilter_graph_parse (graph, filters.c_str(), inputs, outputs, 0) < 0) {
-               throw DecodeError (N_("could not set up filter graph."));
-       }
-#else  
        if (avfilter_graph_parse (graph, filters.c_str(), &inputs, &outputs, 0) < 0) {
                throw DecodeError (N_("could not set up filter graph."));
        }
-#endif 
        
        if (avfilter_graph_config (graph, 0) < 0) {
                throw DecodeError (N_("could not configure filter graph."));
@@ -144,54 +134,17 @@ FilterGraph::process (AVFrame const * frame)
 {
        list<shared_ptr<Image> > images;
        
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 53 && LIBAVFILTER_VERSION_MINOR <= 61
-
-       if (av_vsrc_buffer_add_frame (_buffer_src_context, frame, 0) < 0) {
-               throw DecodeError (N_("could not push buffer into filter chain."));
-       }
-
-#elif LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR == 15
-
-       AVRational par;
-       par.num = sample_aspect_ratio_numerator ();
-       par.den = sample_aspect_ratio_denominator ();
-
-       if (av_vsrc_buffer_add_frame (_buffer_src_context, frame, 0, par) < 0) {
-               throw DecodeError (N_("could not push buffer into filter chain."));
-       }
-
-#else
 
        if (av_buffersrc_write_frame (_buffer_src_context, frame) < 0) {
                throw DecodeError (N_("could not push buffer into filter chain."));
        }
 
-#endif 
-       
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 15 && LIBAVFILTER_VERSION_MINOR <= 61       
-       while (avfilter_poll_frame (_buffer_sink_context->inputs[0])) {
-#else
        while (av_buffersink_read (_buffer_sink_context, 0)) {
-#endif         
-
-#if LIBAVFILTER_VERSION_MAJOR == 2 && LIBAVFILTER_VERSION_MINOR >= 15
-               
-               int r = avfilter_request_frame (_buffer_sink_context->inputs[0]);
-               if (r < 0) {
-                       throw DecodeError (N_("could not request filtered frame"));
-               }
-               
-               AVFilterBufferRef* filter_buffer = _buffer_sink_context->inputs[0]->cur_buf;
-               
-#else
-
                AVFilterBufferRef* filter_buffer;
                if (av_buffersink_get_buffer_ref (_buffer_sink_context, &filter_buffer, 0) < 0) {
                        filter_buffer = 0;
                }
 
-#endif         
-               
                if (filter_buffer) {
                        /* This takes ownership of filter_buffer */
                        images.push_back (shared_ptr<Image> (new FilterBufferImage ((PixelFormat) frame->format, filter_buffer)));
index 7e4e8422b07d36236b2185c588f2a23311eab18e..ffd6855deadee9ed8f99aa1621ad018f7fcda15a 100644 (file)
@@ -25,7 +25,6 @@
 #define DVDOMATIC_FILTER_GRAPH_H
 
 #include "util.h"
-#include "ffmpeg_compatibility.h"
 
 class Image;
 class VideoFilter;
index 62961a92e12d56cd5d9ac658bb12d1c47e27658d..ad2aa79bd0bd6de3cd7e517ce236766a0deb0e49 100644 (file)
@@ -32,7 +32,6 @@ extern "C" {
 #include <libavfilter/avfilter.h>
 }
 #include "util.h"
-#include "ffmpeg_compatibility.h"
 
 class Scaler;
 class RGBFrameImage;
index 41aa373a412cd51808dc5d7967e3c04640cc7a80..21e42f53d1ee12a35010f60661f950a1dff0c755 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <boost/optional.hpp>
 #include "processor.h"
-#include "ffmpeg_compatibility.h"
 
 class Matcher : public Processor, public TimedAudioSink, public TimedVideoSink, public AudioSource, public VideoSource 
 {
index 51b103afdc3e639fb357a8e09551551e6f3864b9..a4b68801fe19d3e43f13184c775a3f8234523baa 100644 (file)
@@ -22,7 +22,6 @@ sources = """
           examine_content_job.cc
           exceptions.cc
           filter_graph.cc
-          ffmpeg_compatibility.cc
           ffmpeg_decoder.cc
           film.cc
           filter.cc
diff --git a/wscript b/wscript
index 097474563e6a31bc69acf1a5d923300ebd6771cb..e10c6863997ef4aced52e240297badfba246463d 100644 (file)
--- a/wscript
+++ b/wscript
@@ -171,36 +171,6 @@ def configure(conf):
                              define_name = 'HAVE_G_FORMAT_SIZE',
                              mandatory = False)
 
-    conf.check_cc(fragment = """
-                             extern "C" {
-                               #include <libavutil/avutil.h>
-                             }
-                             int main() { AVPixelFormat f; }
-                             """, msg = 'Checking for AVPixelFormat',
-                             uselib = 'AVUTIL',
-                             define_name = 'HAVE_AV_PIXEL_FORMAT',
-                             mandatory = False)
-
-    conf.check_cc(fragment = """
-                             extern "C" {
-                               #include <libavcodec/avcodec.h>
-                             }
-                             int main() { AVFrame* f; av_frame_get_best_effort_timestamp(f); }
-                             """, msg = 'Checking for av_frame_get_best_effort_timestamp',
-                             uselib = 'AVCODEC',
-                             define_name = 'HAVE_AV_FRAME_GET_BEST_EFFORT_TIMESTAMP',
-                             mandatory = False)
-
-    conf.check_cc(fragment = """
-                             extern "C" {
-                               #include <libavfilter/buffersrc.h>
-                             }
-                             int main() { } 
-                             """, msg = 'Checking for buffersrc.h',
-                             uselib = 'AVCODEC',
-                             define_name = 'HAVE_BUFFERSRC_H',
-                             mandatory = False)
-
     conf.find_program('msgfmt', var='MSGFMT')
     
     datadir = conf.env.DATADIR