2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <libavfilter/avfiltergraph.h>
23 #include "exceptions.h"
25 #ifdef DVDOMATIC_FFMPEG_0_8_3
28 enum PixelFormat pix_fmt;
32 avsink_init (AVFilterContext* ctx, const char* args, void* opaque)
34 AVSinkContext* priv = (AVSinkContext *) ctx->priv;
36 return AVERROR (EINVAL);
39 *priv = *(AVSinkContext *) opaque;
44 null_end_frame (AVFilterLink *)
50 avsink_query_formats (AVFilterContext* ctx)
52 AVSinkContext* priv = (AVSinkContext *) ctx->priv;
53 enum PixelFormat pix_fmts[] = {
58 avfilter_set_common_formats (ctx, avfilter_make_format_list ((int *) pix_fmts));
67 #ifdef DVDOMATIC_FFMPEG_0_8_3
68 /* XXX does this leak stuff? */
69 AVFilter* buffer_sink = new AVFilter;
70 buffer_sink->name = av_strdup ("avsink");
71 buffer_sink->priv_size = sizeof (AVSinkContext);
72 buffer_sink->init = avsink_init;
73 buffer_sink->query_formats = avsink_query_formats;
74 buffer_sink->inputs = new AVFilterPad[2];
75 AVFilterPad* i0 = const_cast<AVFilterPad*> (&buffer_sink->inputs[0]);
77 i0->type = AVMEDIA_TYPE_VIDEO;
78 i0->min_perms = AV_PERM_READ;
81 i0->get_video_buffer = 0;
82 i0->get_audio_buffer = 0;
83 i0->end_frame = null_end_frame;
85 i0->filter_samples = 0;
87 i0->request_frame = 0;
89 const_cast<AVFilterPad*> (&buffer_sink->inputs[1])->name = 0;
90 buffer_sink->outputs = new AVFilterPad[1];
91 const_cast<AVFilterPad*> (&buffer_sink->outputs[0])->name = 0;
94 AVFilter* buffer_sink = avfilter_get_by_name("buffersink");
95 if (buffer_sink == 0) {
96 throw DecodeError ("Could not create buffer sink filter");
103 #ifdef DVDOMATIC_FFMPEG_0_8_3
105 avfilter_inout_alloc ()
107 return (AVFilterInOut *) av_malloc (sizeof (AVFilterInOut));