db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / opal / trunk / ffmpeg_2.9.patch
blob514399ec7cefe6f2732d70c77d50cd613e3e446c
1 Description: Replace deprecated FFmpeg API
2 Author: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
3 Last-Update: <2015-11-02>
5 --- opal-3.10.10~dfsg2.orig/plugins/video/H.263-1998/h263-1998.cxx
6 +++ opal-3.10.10~dfsg2/plugins/video/H.263-1998/h263-1998.cxx
7 @@ -230,11 +230,10 @@ bool H263_Base_EncoderContext::Init(AVCo
9 m_context->opaque = this;
11 - m_context->flags = CODEC_FLAG_EMU_EDGE // don't draw edges
12 - | CODEC_FLAG_TRUNCATED // Possible missing packets
13 + m_context->flags = CODEC_FLAG_TRUNCATED // Possible missing packets
16 - m_context->pix_fmt = PIX_FMT_YUV420P;
17 + m_context->pix_fmt = AV_PIX_FMT_YUV420P;
18 m_context->gop_size = H263_KEY_FRAME_INTERVAL;
20 // X-Lite does not like Custom Picture frequency clocks... stick to 29.97Hz
21 @@ -440,9 +439,6 @@ bool H263_Base_EncoderContext::OpenCodec
22 m_inputFrame->data[1] = m_inputFrame->data[0] + planeSize;
23 m_inputFrame->data[2] = m_inputFrame->data[1] + (planeSize / 4);
25 - if (m_context->width > 352)
26 - m_context->flags &= ~CODEC_FLAG_EMU_EDGE; // Totally bizarre! FFMPEG crashes if on for CIF4
28 // Dump info
29 PTRACE(5, m_prefix, "Size is " << m_context->width << "x" << m_context->height);
30 PTRACE(5, m_prefix, "GOP is " << m_context->gop_size);
31 @@ -456,7 +452,7 @@ bool H263_Base_EncoderContext::OpenCodec
32 PTRACE(5, m_prefix, "qmax set to " << m_context->qmax);
33 PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size);
35 - return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0;
36 + return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) == 0;
39 void H263_Base_EncoderContext::CloseCodec()
40 @@ -707,7 +703,7 @@ bool H263_Base_DecoderContext::OpenCodec
41 return 0;
44 - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0) {
45 + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0) {
46 PTRACE(1, m_prefix, "Failed to open H.263 decoder");
47 return false;
49 --- opal-3.10.10~dfsg2.orig/plugins/video/H.264/h264-x264.cxx
50 +++ opal-3.10.10~dfsg2/plugins/video/H.264/h264-x264.cxx
51 @@ -1074,7 +1074,6 @@ class MyDecoder : public PluginCodec<MY_
52 m_context->workaround_bugs = FF_BUG_AUTODETECT;
53 m_context->idct_algo = FF_IDCT_AUTO;
54 m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
55 - m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
56 m_context->flags2 =
57 #ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
58 CODEC_FLAG2_DROP_FRAME_TIMECODE |
59 @@ -1084,7 +1083,7 @@ class MyDecoder : public PluginCodec<MY_
60 if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL)
61 return false;
63 - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0)
64 + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0)
65 return false;
67 PTRACE(4, MY_CODEC_LOG, "Opened decoder (SVN $Revision: 28048 $)");
68 --- opal-3.10.10~dfsg2.orig/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
69 +++ opal-3.10.10~dfsg2/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
70 @@ -539,7 +539,7 @@ void MPEG4EncoderContext::ResetBitCounte
73 void MPEG4EncoderContext::SetStaticEncodingParams(){
74 - m_avcontext->pix_fmt = PIX_FMT_YUV420P;
75 + m_avcontext->pix_fmt = AV_PIX_FMT_YUV420P;
76 m_avcontext->mb_decision = FF_MB_DECISION_SIMPLE; // high quality off
77 m_avcontext->rtp_payload_size = 750; // ffh263 uses 750
78 m_avcontext->rtp_callback = &MPEG4EncoderContext::RtpCallback;
79 @@ -595,7 +595,6 @@ void MPEG4EncoderContext::SetStaticEncod
80 m_avcontext->flags|=CODEC_FLAG_AC_PRED;
81 /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
82 m_avcontext->flags|=CODEC_FLAG_4MV;
83 - m_avcontext->flags|=CODEC_FLAG_GMC;
84 m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
85 #endif
86 m_avcontext->opaque = this; // for use in RTP callback
87 @@ -710,13 +709,15 @@ bool MPEG4EncoderContext::OpenCodec()
88 if (PTRACE_CHECK(4)) {
89 m_avcontext->debug |= FF_DEBUG_RC;
90 m_avcontext->debug |= FF_DEBUG_PICT_INFO;
91 - m_avcontext->debug |= FF_DEBUG_MV;
92 +// m_avcontext->debug |= FF_DEBUG_MV;
94 #endif
96 SetStaticEncodingParams();
97 SetDynamicEncodingParams(false); // don't force a restart, it's not open
98 - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0)
99 + AVDictionary *opts = NULL;
100 + av_dict_set_int(&opts, "gmc", 1, 0);
101 + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, &opts) < 0)
103 PTRACE(1, "MPEG4", "Encoder could not be opened");
104 return false;
105 @@ -1411,7 +1412,7 @@ bool MPEG4DecoderContext::OpenCodec()
107 SetStaticDecodingParams();
108 SetDynamicDecodingParams(false); // don't force a restart, it's not open
109 - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0) {
110 + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, NULL) < 0) {
111 PTRACE(1, "MPEG4", "Decoder failed to open");
112 return false;
114 --- opal-3.10.10~dfsg2.orig/plugins/video/common/dyna.cxx
115 +++ opal-3.10.10~dfsg2/plugins/video/common/dyna.cxx
116 @@ -291,14 +291,14 @@ AVFrame *FFMPEGLibrary::AvcodecAllocFram
118 WaitAndSignal m(processLock);
120 - return avcodec_alloc_frame();
121 + return av_frame_alloc();
124 -int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec)
125 +int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options)
127 WaitAndSignal m(processLock);
129 - return avcodec_open2(ctx, codec, NULL);
130 + return avcodec_open2(ctx, codec, options);
133 int FFMPEGLibrary::AvcodecClose(AVCodecContext *ctx)
134 @@ -344,7 +344,15 @@ void FFMPEGLibrary::AvSetDimensions(AVCo
136 WaitAndSignal m(processLock);
138 - avcodec_set_dimensions(s, width, height);
139 + if (av_image_check_size(width, height, 0, s) < 0) {
140 + av_log(s, AV_LOG_WARNING, "Failed to set dimensions %d %d\n", width, height);
141 + width = height = 0;
144 + s->coded_width = width;
145 + s->coded_height = height;
146 + s->width = (width + (1 << av_codec_get_lowres(s)) - 1) >> av_codec_get_lowres(s);
147 + s->height = (height + (1 << av_codec_get_lowres(s)) - 1) >> av_codec_get_lowres(s);
150 void FFMPEGLibrary::AvLogSetLevel(int level)
151 --- opal-3.10.10~dfsg2.orig/plugins/video/common/dyna.h
152 +++ opal-3.10.10~dfsg2/plugins/video/common/dyna.h
153 @@ -97,7 +97,7 @@ class FFMPEGLibrary
154 AVCodec *AvcodecFindDecoder(enum AVCodecID id);
155 AVCodecContext *AvcodecAllocContext(AVCodec*);
156 AVFrame *AvcodecAllocFrame(void);
157 - int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
158 + int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options);
159 int AvcodecClose(AVCodecContext *ctx);
160 int AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict);
161 int AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size);
162 --- opal-3.10.10~dfsg2.orig/plugins/video/common/ffmpeg.h
163 +++ opal-3.10.10~dfsg2/plugins/video/common/ffmpeg.h
164 @@ -47,6 +47,7 @@
166 extern "C" {
167 #include <libavcodec/avcodec.h>
168 +#include <libavutil/imgutils.h>
169 // AVPacket was declared in avformat.h before April 2009
170 #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0)
171 #include <libavformat/avformat.h>