--- Begin Message ---
Package: libavg
Version: 1.8.1-2
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 0000000..dcef95b
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,314 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2015-11-02>
+
+--- libavg-1.8.1.orig/src/player/VideoWriterThread.cpp
++++ libavg-1.8.1/src/player/VideoWriterThread.cpp
+@@ -35,7 +35,7 @@ using namespace std;
+ namespace avg {
+
+ const unsigned int VIDEO_BUFFER_SIZE = 400000;
+-const AVPixelFormat STREAM_PIXEL_FORMAT = ::PIX_FMT_YUVJ420P;
++const AVPixelFormat STREAM_PIXEL_FORMAT = ::AV_PIX_FMT_YUVJ420P;
+
+ VideoWriterThread::VideoWriterThread(CQueue& cmdQueue, const string& sFilename,
+ IntPoint size, int frameRate, int qMin, int qMax)
+@@ -95,7 +95,7 @@ void VideoWriterThread::close()
+
+ av_free(m_pOutputFormatContext);
+ av_free(m_pVideoBuffer);
+- av_free(m_pConvertedFrame);
++ av_frame_free(&m_pConvertedFrame);
+ av_free(m_pPictureBuffer);
+ sws_freeContext(m_pFrameConversionContext);
+ m_pOutputFormatContext = 0;
+@@ -174,7 +174,7 @@ void VideoWriterThread::open()
+ }
+
+ m_pFrameConversionContext = sws_getContext(m_Size.x, m_Size.y,
+- ::PIX_FMT_RGB32, m_Size.x, m_Size.y, STREAM_PIXEL_FORMAT,
++ ::AV_PIX_FMT_RGB32, m_Size.x, m_Size.y, STREAM_PIXEL_FORMAT,
+ SWS_BILINEAR, NULL, NULL, NULL);
+
+ m_pConvertedFrame = createFrame(STREAM_PIXEL_FORMAT, m_Size);
+@@ -234,7 +234,7 @@ AVFrame* VideoWriterThread::createFrame(
+ {
+ AVFrame* pPicture;
+
+- pPicture = avcodec_alloc_frame();
++ pPicture = av_frame_alloc();
+
+ int memNeeded = avpicture_get_size(pixelFormat, size.x, size.y);
+ m_pPictureBuffer = static_cast<unsigned char*>(av_malloc(memNeeded));
+--- libavg-1.8.1.orig/src/video/AudioDecoderThread.cpp
++++ libavg-1.8.1/src/video/AudioDecoderThread.cpp
+@@ -134,7 +134,7 @@ void AudioDecoderThread::decodePacket(AV
+ #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 25, 0)
+ int gotFrame = 0;
+ AVFrame* pDecodedFrame;
+- pDecodedFrame = avcodec_alloc_frame();
++ pDecodedFrame = av_frame_alloc();
+ #endif
+ while (pTempPacket->size > 0) {
+ int bytesDecoded = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+@@ -192,7 +192,7 @@ void AudioDecoderThread::decodePacket(AV
+ }
+ av_free(pDecodedData);
+ #if LIBAVCODEC_VERSION_MAJOR > 53
+- avcodec_free_frame(&pDecodedFrame);
++ av_frame_free(&pDecodedFrame);
+ #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53, 25, 0)
+ delete pDecodedFrame;
+ #endif
+--- libavg-1.8.1.orig/src/video/FFMpegFrameDecoder.cpp
++++ libavg-1.8.1/src/video/FFMpegFrameDecoder.cpp
+@@ -119,29 +119,29 @@ void FFMpegFrameDecoder::convertFrameToB
+ switch (pBmp->getPixelFormat()) {
+ case R8G8B8X8:
+ case R8G8B8A8:
+- destFmt = PIX_FMT_RGBA;
++ destFmt = AV_PIX_FMT_RGBA;
+ break;
+ case B8G8R8X8:
+ case B8G8R8A8:
+- destFmt = PIX_FMT_BGRA;
++ destFmt = AV_PIX_FMT_BGRA;
+ break;
+ case R8G8B8:
+- destFmt = PIX_FMT_RGB24;
++ destFmt = AV_PIX_FMT_RGB24;
+ break;
+ case B8G8R8:
+- destFmt = PIX_FMT_BGR24;
++ destFmt = AV_PIX_FMT_BGR24;
+ break;
+ case YCbCr422:
+- destFmt = PIX_FMT_YUYV422;
++ destFmt = AV_PIX_FMT_YUYV422;
+ break;
+ default:
+ AVG_ASSERT_MSG(false, (string("FFMpegFrameDecoder: Dest format ") +
+ toString(pBmp->getPixelFormat()) + " not supported.").c_str());
+- destFmt = PIX_FMT_BGRA;
++ destFmt = AV_PIX_FMT_BGRA;
+ }
+ AVCodecContext const* pContext = m_pStream->codec;
+- if (destFmt == PIX_FMT_BGRA && (pContext->pix_fmt == PIX_FMT_YUV420P ||
+- pContext->pix_fmt == PIX_FMT_YUVJ420P))
++ if (destFmt == AV_PIX_FMT_BGRA && (pContext->pix_fmt == AV_PIX_FMT_YUV420P ||
++ pContext->pix_fmt == AV_PIX_FMT_YUVJ420P))
+ {
+ ScopeTimer timer(ConvertImageLibavgProfilingZone);
+ BitmapPtr pBmpY(new Bitmap(pBmp->getSize(), I8, pFrame->data[0],
+@@ -151,7 +151,7 @@ void FFMpegFrameDecoder::convertFrameToB
+ BitmapPtr pBmpV(new Bitmap(pBmp->getSize(), I8, pFrame->data[2],
+ pFrame->linesize[2], false));
+ pBmp->copyYUVPixels(*pBmpY, *pBmpU, *pBmpV,
+- pContext->pix_fmt == PIX_FMT_YUVJ420P);
++ pContext->pix_fmt == AV_PIX_FMT_YUVJ420P);
+ } else {
+ if (!m_pSwsContext) {
+ m_pSwsContext = sws_getContext(pContext->width, pContext->height,
+--- libavg-1.8.1.orig/src/video/SyncVideoDecoder.cpp
++++ libavg-1.8.1/src/video/SyncVideoDecoder.cpp
+@@ -82,7 +82,7 @@ void SyncVideoDecoder::startDecoding(boo
+ m_pFrameDecoder = FFMpegFrameDecoderPtr(new FFMpegFrameDecoder(getVideoStream()));
+ m_pFrameDecoder->setFPS(m_FPS);
+ #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+- m_pFrame = avcodec_alloc_frame();
++ m_pFrame = av_frame_alloc();
+ #else
+ m_pFrame = new AVFrame;
+ #endif
+@@ -96,7 +96,7 @@ void SyncVideoDecoder::close()
+ m_pFrameDecoder = FFMpegFrameDecoderPtr();
+ VideoDecoder::close();
+ #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+- avcodec_free_frame(&m_pFrame);
++ av_frame_free(&m_pFrame);
+ #else
+ delete m_pFrame;
+ #endif
+--- libavg-1.8.1.orig/src/video/VDPAUDecoder.cpp
++++ libavg-1.8.1/src/video/VDPAUDecoder.cpp
+@@ -43,7 +43,7 @@ namespace avg {
+ VDPAUDecoder::VDPAUDecoder()
+ : m_VDPDecoder(VDP_INVALID_HANDLE),
+ m_VDPMixer(VDP_INVALID_HANDLE),
+- m_PixFmt(PIX_FMT_NONE),
++ m_PixFmt(AV_PIX_FMT_NONE),
+ m_Size(-1,-1)
+ {
+ }
+@@ -92,8 +92,7 @@ AVCodec* VDPAUDecoder::openCodec(AVCodec
+ pCodec = 0;
+ }
+ if (pCodec) {
+- pContext->get_buffer = VDPAUDecoder::getBuffer;
+- pContext->release_buffer = VDPAUDecoder::releaseBuffer;
++ pContext->get_buffer2 = VDPAUDecoder::getBuffer2;
+ pContext->draw_horiz_band = VDPAUDecoder::drawHorizBand;
+ pContext->get_format = VDPAUDecoder::getFormat;
+ pContext->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
+@@ -111,19 +110,19 @@ bool VDPAUDecoder::isAvailable()
+ #endif
+ }
+
+-int VDPAUDecoder::getBuffer(AVCodecContext* pContext, AVFrame* pFrame)
++int VDPAUDecoder::getBuffer2(AVCodecContext* pContext, AVFrame* pFrame, int flags)
+ {
+ VDPAUDecoder* pVDPAUDecoder = (VDPAUDecoder*)pContext->opaque;
+ return pVDPAUDecoder->getBufferInternal(pContext, pFrame);
+ }
+
+ // does not release the render structure, that will be unlocked after getting data
+-void VDPAUDecoder::releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame)
++void VDPAUDecoder::dummy_free_buffer(void *opaque, uint8_t *data)
+ {
++ AVFrame* pFrame = (AVFrame*)opaque;
+ pFrame->data[0] = 0;
+ }
+
+-
+ // main rendering routine
+ void VDPAUDecoder::drawHorizBand(struct AVCodecContext* pContext, const AVFrame* src,
+ int offset[4], int y, int type, int height)
+@@ -136,15 +135,15 @@ AVPixelFormat VDPAUDecoder::getFormat(AV
+ {
+ switch (pContext->codec_id) {
+ case AV_CODEC_ID_H264:
+- return PIX_FMT_VDPAU_H264;
++ return AV_PIX_FMT_VDPAU_H264;
+ case AV_CODEC_ID_MPEG1VIDEO:
+- return PIX_FMT_VDPAU_MPEG1;
++ return AV_PIX_FMT_VDPAU_MPEG1;
+ case AV_CODEC_ID_MPEG2VIDEO:
+- return PIX_FMT_VDPAU_MPEG2;
++ return AV_PIX_FMT_VDPAU_MPEG2;
+ case AV_CODEC_ID_WMV3:
+- return PIX_FMT_VDPAU_WMV3;
++ return AV_PIX_FMT_VDPAU_WMV3;
+ case AV_CODEC_ID_VC1:
+- return PIX_FMT_VDPAU_VC1;
++ return AV_PIX_FMT_VDPAU_VC1;
+ default:
+ return pFmt[0];
+ }
+@@ -174,8 +173,8 @@ vdpau_render_state* VDPAUDecoder::getFre
+ int VDPAUDecoder::getBufferInternal(AVCodecContext* pContext, AVFrame* pFrame)
+ {
+ vdpau_render_state* pRenderState = getFreeRenderState();
+- pFrame->data[0] = (uint8_t*)pRenderState;
+- pFrame->type = FF_BUFFER_TYPE_USER;
++ pFrame->buf[0] = av_buffer_create((uint8_t*)pRenderState, 0, VDPAUDecoder::dummy_free_buffer, pFrame, 0);
++ pFrame->data[0] = pFrame->buf[0]->data;
+
+ pRenderState->state |= FF_VDPAU_STATE_USED_FOR_REFERENCE;
+ return 0;
+@@ -202,19 +201,19 @@ void VDPAUDecoder::setupDecoder(AVCodecC
+ // Create new decoder and mixer.
+ VdpDecoderProfile profile = 0;
+ switch (pContext->pix_fmt) {
+- case PIX_FMT_VDPAU_MPEG1:
++ case AV_PIX_FMT_VDPAU_MPEG1:
+ profile = VDP_DECODER_PROFILE_MPEG1;
+ break;
+- case PIX_FMT_VDPAU_MPEG2:
++ case AV_PIX_FMT_VDPAU_MPEG2:
+ profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
+ break;
+- case PIX_FMT_VDPAU_H264:
++ case AV_PIX_FMT_VDPAU_H264:
+ profile = VDP_DECODER_PROFILE_H264_HIGH;
+ break;
+- case PIX_FMT_VDPAU_WMV3:
++ case AV_PIX_FMT_VDPAU_WMV3:
+ profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
+ break;
+- case PIX_FMT_VDPAU_VC1:
++ case AV_PIX_FMT_VDPAU_VC1:
+ profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
+ break;
+ default:
+--- libavg-1.8.1.orig/src/video/VDPAUDecoder.h
++++ libavg-1.8.1/src/video/VDPAUDecoder.h
+@@ -43,8 +43,8 @@ public:
+
+ private:
+ // Callbacks
+- static int getBuffer(AVCodecContext* pContext, AVFrame* pFrame);
+- static void releaseBuffer(struct AVCodecContext* pContext, AVFrame* pFrame);
++ static int getBuffer2(AVCodecContext* pContext, AVFrame* pFrame, int flags);
++ static void dummy_free_buffer(void *opaque, uint8_t *data);
+ static void drawHorizBand(AVCodecContext* pContext, const AVFrame* pFrame,
+ int offset[4], int y, int type, int height);
+ static AVPixelFormat getFormat(AVCodecContext* pContext, const AVPixelFormat* pFmt);
+--- libavg-1.8.1.orig/src/video/VideoDecoder.cpp
++++ libavg-1.8.1/src/video/VideoDecoder.cpp
+@@ -439,25 +439,25 @@ PixelFormat VideoDecoder::calcPixelForma
+ AVCodecContext const* pContext = getCodecContext();
+ if (bUseYCbCr) {
+ switch(pContext->pix_fmt) {
+- case PIX_FMT_YUV420P:
++ case AV_PIX_FMT_YUV420P:
+ #ifdef AVG_ENABLE_VDPAU
+- case PIX_FMT_VDPAU_H264:
+- case PIX_FMT_VDPAU_MPEG1:
+- case PIX_FMT_VDPAU_MPEG2:
+- case PIX_FMT_VDPAU_WMV3:
+- case PIX_FMT_VDPAU_VC1:
++ case AV_PIX_FMT_VDPAU_H264:
++ case AV_PIX_FMT_VDPAU_MPEG1:
++ case AV_PIX_FMT_VDPAU_MPEG2:
++ case AV_PIX_FMT_VDPAU_WMV3:
++ case AV_PIX_FMT_VDPAU_VC1:
+ #endif
+ return YCbCr420p;
+- case PIX_FMT_YUVJ420P:
++ case AV_PIX_FMT_YUVJ420P:
+ return YCbCrJ420p;
+- case PIX_FMT_YUVA420P:
++ case AV_PIX_FMT_YUVA420P:
+ return YCbCrA420p;
+ default:
+ break;
+ }
+ }
+- bool bAlpha = (pContext->pix_fmt == PIX_FMT_BGRA ||
+- pContext->pix_fmt == PIX_FMT_YUVA420P);
++ bool bAlpha = (pContext->pix_fmt == AV_PIX_FMT_BGRA ||
++ pContext->pix_fmt == AV_PIX_FMT_YUVA420P);
+ return BitmapLoader::get()->getDefaultPixelFormat(bAlpha);
+ }
+
+--- libavg-1.8.1.orig/src/video/VideoDecoderThread.cpp
++++ libavg-1.8.1/src/video/VideoDecoderThread.cpp
+@@ -59,7 +59,7 @@ VideoDecoderThread::~VideoDecoderThread(
+ bool VideoDecoderThread::init()
+ {
+ #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+- m_pFrame = avcodec_alloc_frame();
++ m_pFrame = av_frame_alloc();
+ #else
+ m_pFrame = new AVFrame;
+ #endif
+@@ -69,7 +69,7 @@ bool VideoDecoderThread::init()
+ void VideoDecoderThread::deinit()
+ {
+ #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 28, 0)
+- avcodec_free_frame(&m_pFrame);
++ av_frame_free(&m_pFrame);
+ #else
+ delete m_pFrame;
+ #endif
+--- libavg-1.8.1.orig/src/video/WrapFFMpeg.h
++++ libavg-1.8.1/src/video/WrapFFMpeg.h
+@@ -86,8 +86,6 @@ extern "C" {
+
+ #ifdef PixelFormat
+ #undef PixelFormat
+-#else
+-#define AVPixelFormat ::PixelFormat
+ #endif
+
+ #endif
diff --git a/debian/patches/series b/debian/patches/series
index abe4148..a9e9e36 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
foreign.patch
reproducible_build.patch
+ffmpeg_2.9.patch
--- End Message ---