Hi Bret,

On 10.11.2015 12:52, bret curtis wrote:
> thank you for taking the time to create the patch.
> I did test it against upstream since we are about to make a 0.37 release
> soon and it fails. Reverting the patch solves the problem. I'm going to
> assume that the patch is not yet ready.

Thanks for testing the patch. Too bad that it doesn't work.

Can you please test attached new patch?

By the way, openmw doesn't start here due to #803513, which is actually #793641.

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..a42c731
--- /dev/null
+++ b/debian/patches/ffmpeg_2.9.patch
@@ -0,0 +1,88 @@
+Description: Replace deprecated FFmpeg API
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2015-11-10>
+
+--- openmw-0.36.1.orig/extern/ogre-ffmpeg-videoplayer/videostate.cpp
++++ openmw-0.36.1/extern/ogre-ffmpeg-videoplayer/videostate.cpp
+@@ -95,16 +95,6 @@ void PacketQueue::put(AVPacket *pkt)
+     pkt1->pkt = *pkt;
+     pkt1->next = NULL;
+ 
+-    if(pkt->data != flush_pkt.data && pkt1->pkt.destruct == NULL)
+-    {
+-        if(av_dup_packet(&pkt1->pkt) < 0)
+-        {
+-            av_free(pkt1);
+-            throw std::runtime_error("Failed to duplicate packet");
+-        }
+-        av_free_packet(pkt);
+-    }
+-
+     this->mutex.lock ();
+ 
+     if(!last_pkt)
+@@ -314,7 +304,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 +346,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 +379,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 +587,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..a827249
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+ffmpeg_2.9.patch

Reply via email to