Package: ffmpeg2theora
Version: 0.29.0~git+20140316-3
Severity: important
Tags: patch
User: pkg-multimedia-maintain...@lists.alioth.debian.org
Usertags: ffmpeg2.9
Dear Maintainer,
your package fails to build with the upcoming ffmpeg 2.9.
This bug will become release-critical at some point when the
ffmpeg2.9 transition gets closer.
Attached is a patch replacing the deprecated functionality.
It also works with ffmpeg 2.8.
Please apply this patch and forward it upstream, if necessary.
These changes are non-trivial and should be runtime-tested.
Best regards,
Andreas
diff --git a/debian/patches/ffmpeg_2.9.patch b/debian/patches/ffmpeg_2.9.patch
new file mode 100644
index 000..9c0dfb0
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,205 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun
+Last-Update: <2015-11-02>
+
+--- ffmpeg2theora-0.29.0~git+20140316.orig/src/avinfo.c
ffmpeg2theora-0.29.0~git+20140316/src/avinfo.c
+@@ -178,8 +178,6 @@ void json_codec_info(FILE *output, AVCod
+ /* fake mpeg2 transport stream codec (currently not
+registered) */
+ codec_name = "mpeg2ts";
+-} else if (enc->codec_name[0] != '\0') {
+-codec_name = enc->codec_name;
+ } else {
+ /* output avi tags */
+ if( isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF)
+@@ -200,7 +198,7 @@ void json_codec_info(FILE *output, AVCod
+ case AVMEDIA_TYPE_VIDEO:
+ codec_name = fix_codec_name(codec_name);
+ json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
+-if (enc->pix_fmt != PIX_FMT_NONE) {
++if (enc->pix_fmt != AV_PIX_FMT_NONE) {
+ json_add_key_value(output, "pixel_format", (void *)av_get_pix_fmt_name(enc->pix_fmt), JSON_STRING, 0, indent);
+ }
+ if (enc->width) {
+--- ffmpeg2theora-0.29.0~git+20140316.orig/src/ffmpeg2theora.c
ffmpeg2theora-0.29.0~git+20140316/src/ffmpeg2theora.c
+@@ -148,13 +148,13 @@ static AVFrame *frame_alloc(int pix_fmt,
+ uint8_t *picture_buf;
+ int size;
+
+-picture = avcodec_alloc_frame();
++picture = av_frame_alloc();
+ if (!picture)
+ return NULL;
+ size = avpicture_get_size (pix_fmt, width, height);
+ picture_buf = av_malloc (size);
+ if (!picture_buf) {
+-av_free (picture);
++av_frame_free ();
+ return NULL;
+ }
+ avpicture_fill((AVPicture *) picture, picture_buf, pix_fmt, width, height);
+@@ -167,7 +167,7 @@ static AVFrame *frame_alloc(int pix_fmt,
+ static void frame_dealloc(AVFrame *frame) {
+ if (frame) {
+ avpicture_free((AVPicture*)frame);
+-av_free(frame);
++av_frame_free();
+ }
+ }
+
+@@ -231,7 +231,7 @@ static ff2theora ff2theora_init() {
+ this->kate_streams=NULL;
+ this->ignore_non_utf8 = 0;
+
+-this->pix_fmt = PIX_FMT_YUV420P;
++this->pix_fmt = AV_PIX_FMT_YUV420P;
+
+ // ffmpeg2theora --nosound -f dv -H 32000 -S 0 -v 8 -x 384 -y 288 -G 1.5 input.dv
+ this->video_gamma = 0.0;
+@@ -521,6 +521,74 @@ static const char *find_language_for_sub
+ return lang;
+ }
+
++static void delete_filter_graph(ff2theora this) {
++if (this->filter_graph) {
++av_frame_free(>filter_frame);
++avfilter_graph_free(>filter_graph);
++}
++}
++
++static int init_filter_graph(ff2theora this, enum AVPixelFormat pixfmt, int width, int height) {
++AVFilterInOut *inputs = NULL, *outputs = NULL;
++char args[512];
++int res;
++
++delete_filter_graph(this);
++this->filter_graph = avfilter_graph_alloc();
++snprintf(args, sizeof(args),
++ "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
++ "[in]yadif[out];"
++ "[out]buffersink",
++ width, height, pixfmt);
++res = avfilter_graph_parse2(this->filter_graph, args, , );
++if (res < 0)
++return res;
++if(inputs || outputs)
++return -1;
++res = avfilter_graph_config(this->filter_graph, NULL);
++if (res < 0)
++return res;
++
++this->buffersrc_ctx = avfilter_graph_get_filter(this->filter_graph, "Parsed_buffer_0");
++this->buffersink_ctx = avfilter_graph_get_filter(this->filter_graph, "Parsed_buffersink_2");
++if (!this->buffersrc_ctx || !this->buffersink_ctx)
++return -1;
++this->filter_frame = av_frame_alloc();
++this->last_width = width;
++this->last_height = height;
++this->last_pixfmt = pixfmt;
++
++return 0;
++}
++
++static int process_filter_graph(ff2theora this, AVPicture *dst, const AVPicture *src,
++enum AVPixelFormat pixfmt, int width, int height) {
++int res;
++
++if (!this->filter_graph || width != this->last_width ||
++height != this->last_height || pixfmt != this->last_pixfmt) {
++res = init_filter_graph(this, pixfmt,