Package: openmw
Version: 0.36.1-1
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..0ec0168
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,80 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2015-11-02>
+
+--- openmw-0.36.1.orig/extern/ogre-ffmpeg-videoplayer/videostate.cpp
++++ openmw-0.36.1/extern/ogre-ffmpeg-videoplayer/videostate.cpp
+@@ -95,7 +95,7 @@ void PacketQueue::put(AVPacket *pkt)
+     pkt1->pkt = *pkt;
+     pkt1->next = NULL;
+ 
+-    if(pkt->data != flush_pkt.data && pkt1->pkt.destruct == NULL)
++    if(pkt->data != flush_pkt.data)
+     {
+         if(av_dup_packet(&pkt1->pkt) < 0)
+         {
+@@ -314,7 +314,7 @@ int VideoState::queue_picture(AVFrame *p
+         int w = (*this->video_st)->codec->width;
+         int h = (*this->video_st)->codec->height;
+         this->sws_context = sws_getContext(w, h, (*this->video_st)->codec->pix_fmt,
+-                                           w, h, PIX_FMT_RGBA, SWS_BICUBIC,
++                                           w, h, AV_PIX_FMT_RGBA, SWS_BICUBIC,
+                                            NULL, NULL, NULL);
+         if(this->sws_context == NULL)
+             throw std::runtime_error("Cannot initialize the conversion context!\n");
+@@ -356,26 +356,30 @@ double VideoState::synchronize_video(AVF
+ }
+ 
+ 
++static void our_free_buffer(void *opaque, uint8_t *data);
+ /* These are called whenever we allocate a frame
+  * buffer. We use this to store the global_pts in
+  * a frame at the time it is allocated.
+  */
+ static int64_t global_video_pkt_pts = AV_NOPTS_VALUE;
+-static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic)
++static int our_get_buffer(struct AVCodecContext *c, AVFrame *pic, int flags)
+ {
+-    int ret = avcodec_default_get_buffer(c, pic);
++    AVBufferRef *ref;
++    int ret = avcodec_default_get_buffer2(c, pic, flags);
+     int64_t *pts = (int64_t*)av_malloc(sizeof(int64_t));
+     *pts = global_video_pkt_pts;
+     pic->opaque = pts;
++    ref = av_buffer_create((uint8_t *)pic->opaque, sizeof(int64_t), our_free_buffer, pic->buf[0], flags);
++    pic->buf[0] = ref;
+     return ret;
+ }
+-static void our_release_buffer(struct AVCodecContext *c, AVFrame *pic)
++static void our_free_buffer(void *opaque, uint8_t *data)
+ {
+-    if(pic) av_freep(&pic->opaque);
+-    avcodec_default_release_buffer(c, pic);
++    AVBufferRef *ref = (AVBufferRef *)opaque;
++    av_buffer_unref(&ref);
++    av_free(data);
+ }
+ 
+-
+ void VideoState::video_thread_loop(VideoState *self)
+ {
+     AVPacket pkt1, *packet = &pkt1;
+@@ -385,7 +389,7 @@ void VideoState::video_thread_loop(Video
+     pFrame = av_frame_alloc();
+ 
+     self->rgbaFrame = av_frame_alloc();
+-    avpicture_alloc((AVPicture*)self->rgbaFrame, PIX_FMT_RGBA, (*self->video_st)->codec->width, (*self->video_st)->codec->height);
++    avpicture_alloc((AVPicture*)self->rgbaFrame, AV_PIX_FMT_RGBA, (*self->video_st)->codec->width, (*self->video_st)->codec->height);
+ 
+     while(self->videoq.get(packet, self) >= 0)
+     {
+@@ -593,8 +597,7 @@ int VideoState::stream_open(int stream_i
+     case AVMEDIA_TYPE_VIDEO:
+         this->video_st = pFormatCtx->streams + stream_index;
+ 
+-        codecCtx->get_buffer = our_get_buffer;
+-        codecCtx->release_buffer = our_release_buffer;
++        codecCtx->get_buffer2 = our_get_buffer;
+         this->video_thread = boost::thread(video_thread_loop, this);
+         break;
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f762d21
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+ffmpeg_2.9.patch

Reply via email to