--- Begin Message ---
Package: avifile
Version: 0.7.48~20090503.ds-17
Severity: important
Tags: patch
User: [email protected]
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 0000000..a6dfa80
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,177 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2015-11-02>
+
+--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/FFVideoDecoder.cpp
++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/FFVideoDecoder.cpp
+@@ -18,6 +18,11 @@ static float ftm = 0;
+
+ #define Debug if (0)
+
++typedef struct BufferData_ {
++ void *decoder;
++ AVFrame *pic;
++} BufferData;
++
+ AVM_BEGIN_NAMESPACE;
+
+ FFVideoDecoder::FFVideoDecoder(AVCodec* av, const CodecInfo& info, const BITMAPINFOHEADER& bh, int flip)
+@@ -77,23 +82,26 @@ static void draw_slice(struct AVCodecCon
+ d->m_pImg->Slice(&ci);
+ }
+
++static void free_buffer(void *opaque, uint8_t *data);
++
+ // callback to supply rendering buffer to ffmpeg
+-static int get_buffer(AVCodecContext* avctx, AVFrame* pic)
++static int get_buffer(AVCodecContext* avctx, AVFrame* pic, int flags)
+ {
+ static const char ftypes[][3] = { "I", "P", "B", "S", "SI", "SP" };
+
++ BufferData *buf_dat;
++
+ FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque;
+ CImage* pImage = d->m_pImg;
+- if ((avctx->pix_fmt != PIX_FMT_YUV420P
+- && avctx->pix_fmt != PIX_FMT_YUVJ420P)
++ if ((avctx->pix_fmt != AV_PIX_FMT_YUV420P
++ && avctx->pix_fmt != AV_PIX_FMT_YUVJ420P)
+ || !pImage || !d->m_bDirect)
+ {
+ Debug printf("FF: Unsupported pixel format for Dr1 %d\n", avctx->pix_fmt); //abort();
+- return avcodec_default_get_buffer(avctx, pic);
++ return avcodec_default_get_buffer2(avctx, pic, flags);
+ }
+
+ d->m_bUsed = true;
+- Debug if (pic->buffer_hints) printf("FF bufhints 0x%x\n", pic->buffer_hints);
+
+ pic->opaque = pImage;
+ #if 0
+@@ -107,41 +115,38 @@ static int get_buffer(AVCodecContext* av
+ }
+ #endif
+ // we are using YV12 - ffmpeg uses I420
+- pic->data[0] = pImage->Data(0);
+- pic->data[1] = pImage->Data(2);
+- pic->data[2] = pImage->Data(1);
++ buf_dat = (BufferData*)av_malloc(sizeof(*buf_dat));
++ buf_dat->decoder = d;
++ buf_dat->pic = pic;
++ pic->buf[0] = av_buffer_create (pImage->Data(0), 0, free_buffer, buf_dat, 0);
++ pic->buf[1] = av_buffer_create (pImage->Data(1), 0, free_buffer, NULL, 0);
++ pic->buf[2] = av_buffer_create (pImage->Data(2), 0, free_buffer, NULL, 0);
++ pic->data[0] = pic->buf[0]->data;
++ pic->data[1] = pic->buf[1]->data;
++ pic->data[2] = pic->buf[2]->data;
+ pic->linesize[0] = pImage->Stride(0);
+ pic->linesize[1] = pImage->Stride(2); // Note: for ffmpeg linsize[1] == linesize[2]!
+ pic->linesize[2] = pImage->Stride(1);
+ pic->pts = pImage->m_lTimestamp;
+- pic->type = FF_BUFFER_TYPE_USER;
+ pImage->m_iType = pic->pict_type;
+
+- if (pic->reference)
+- pImage->Age(pic->coded_picture_number);
+- else
+ pImage->Age();
+
+- Debug printf("FF: <<<< GetBuffer %p %s %dx%d %p:%p:%p s:%f f:%d r:%d age:%d\n", pImage, ftypes[pic->pict_type],
++ Debug printf("FF: <<<< GetBuffer %p %s %dx%d %p:%p:%p s:%f f:%d\n", pImage, ftypes[pic->pict_type],
+ avctx->width, avctx->height, pImage->Data(0), pImage->Data(2), pImage->Data(1),
+- (double)pImage->m_lTimestamp / 1000000., avctx->pix_fmt, pic->reference);
++ (double)pImage->m_lTimestamp / 1000000., avctx->pix_fmt);
+ return 0;
+ }
+
+-static void release_buffer(struct AVCodecContext* avctx, AVFrame* pic)
++static void free_buffer(void *opaque, uint8_t *data)
+ {
+- if (pic->type == FF_BUFFER_TYPE_USER)
+- {
+- FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque;
+- d->m_pReleased = (CImage*) pic->opaque;
+- Debug printf("FF: >>>> Released buffer %p %p\n", pic->opaque, pic);
+- memset(pic->data, 0, sizeof(void*) * 4);
+- pic->opaque = NULL;
+- }
+- else
+- {
+- Debug printf(">>>> released default buffer *****************\n");
+- avcodec_default_release_buffer(avctx, pic);
++ if (opaque) {
++ BufferData *buf_dat = (BufferData *) opaque;
++ FFVideoDecoder* d = (FFVideoDecoder*) buf_dat->decoder;
++ d->m_pReleased = (CImage*) buf_dat->pic->opaque;
++ Debug printf("FF: >>>> Released buffer %p %p\n", buf_dat->pic->opaque, buf_dat->pic);
++ buf_dat->pic->opaque = NULL;
++ av_free(buf_dat);
+ }
+ }
+
+@@ -205,7 +210,6 @@ int FFVideoDecoder::DecodeFrame(CImage*
+ {
+ // for DR we needs some special width aligment
+ // also there are some more limitation
+- m_pAvContext->flags |= CODEC_FLAG_EMU_EDGE;
+ drtxt = "using";
+ m_bDirect = true;
+ //m_pAvContext->skip_top = 32;
+@@ -214,9 +218,7 @@ int FFVideoDecoder::DecodeFrame(CImage*
+ m_pAvContext->skip_idct = AVDISCARD_BIDIR;
+ m_pAvContext->skip_frame = AVDISCARD_BIDIR;
+ */
+- m_pAvContext->get_buffer = get_buffer;
+- m_pAvContext->reget_buffer = get_buffer;
+- m_pAvContext->release_buffer = release_buffer;
++ m_pAvContext->get_buffer2 = get_buffer;
+ }
+ }
+ }
+@@ -369,7 +371,6 @@ int FFVideoDecoder::DecodeFrame(CImage*
+ return hr | NO_PICTURE;
+ // let's fake got_picture;
+ if (!pic.opaque) {
+- pic.type = FF_BUFFER_TYPE_USER;
+ pic.opaque = m_pReleased;
+ }
+ got_picture = true;
+@@ -384,15 +385,15 @@ int FFVideoDecoder::DecodeFrame(CImage*
+ Debug printf("PIXFMPT %d\n", m_pAvContext->pix_fmt);
+ switch (m_pAvContext->pix_fmt)
+ {
+- case PIX_FMT_BGR24: imfmt = IMG_FMT_BGR24; break;
+- case PIX_FMT_RGBA: imfmt = IMG_FMT_BGR32; break;
+- case PIX_FMT_YUYV422: imfmt = IMG_FMT_YUY2; break;
+- case PIX_FMT_YUV410P: imfmt = IMG_FMT_I410; break;
+- case PIX_FMT_YUV411P: imfmt = IMG_FMT_I411; break;
+- case PIX_FMT_YUV420P: imfmt = IMG_FMT_I420; break;
+- case PIX_FMT_YUVJ420P: imfmt = IMG_FMT_I420; break; // strange
+- case PIX_FMT_YUV422P: imfmt = IMG_FMT_I422; break;
+- case PIX_FMT_YUV444P: imfmt = IMG_FMT_I444; break;
++ case AV_PIX_FMT_BGR24: imfmt = IMG_FMT_BGR24; break;
++ case AV_PIX_FMT_RGBA: imfmt = IMG_FMT_BGR32; break;
++ case AV_PIX_FMT_YUYV422: imfmt = IMG_FMT_YUY2; break;
++ case AV_PIX_FMT_YUV410P: imfmt = IMG_FMT_I410; break;
++ case AV_PIX_FMT_YUV411P: imfmt = IMG_FMT_I411; break;
++ case AV_PIX_FMT_YUV420P: imfmt = IMG_FMT_I420; break;
++ case AV_PIX_FMT_YUVJ420P: imfmt = IMG_FMT_I420; break; // strange
++ case AV_PIX_FMT_YUV422P: imfmt = IMG_FMT_I422; break;
++ case AV_PIX_FMT_YUV444P: imfmt = IMG_FMT_I444; break;
+ default: break;
+ }
+ if (imfmt) {
+@@ -416,11 +417,9 @@ int FFVideoDecoder::DecodeFrame(CImage*
+ //printf("SWAP %d %d\n", m_Order.front().position, pImage->m_uiPosition);
+ //printf("P %d %lld\n", p, m_Order[0].timestamp, m_Order.size());
+
+- Debug printf("FF: release:%p out:%p tuc:%d(%d/%d)\n", m_pReleased, pOut, pic.type, FF_BUFFER_TYPE_USER, FF_BUFFER_TYPE_COPY);
++ Debug printf("FF: release:%p out:%p\n", m_pReleased, pOut);
+ #if 1
+- if (pOut && pic.opaque &&
+- ((pic.type == FF_BUFFER_TYPE_USER)
+- || (pic.type == FF_BUFFER_TYPE_COPY)))
++ if (pOut && pic.opaque)
+ {
+ *pOut = (CImage*) pic.opaque;
+ (*pOut)->m_lTimestamp = m_Order[0].timestamp;
diff --git a/debian/patches/series b/debian/patches/series
index 9a1921a..f59114b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ ftbfs-freebsd.patch
ftbfs-gcc4.7.patch
fix-ftbfs-libav9.patch
libav10.patch
+ffmpeg_2.9.patch
--- End Message ---