archrelease: copy trunk to extra-x86_64
[arch-packages.git] / opal / trunk / libav10.patch
blob3e02704f8998916c66276bc4cede4038c467208b
1 Description: Fix compilation against libav10
2 Author: Reinhard Tartler <siretart@tauware.de>
3 Bug-Debian: http://bugs.debian.org/739439
5 --- a/plugins/video/H.263-1998/h263-1998.cxx
6 +++ b/plugins/video/H.263-1998/h263-1998.cxx
7 @@ -94,7 +94,7 @@ static struct StdSizes {
8 { CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI },
9 };
11 -static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P);
12 +static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P);
15 /////////////////////////////////////////////////////////////////////////////
16 @@ -203,7 +203,7 @@ H263_Base_EncoderContext::~H263_Base_Enc
17 PTRACE(4, m_prefix, "Encoder closed");
20 -bool H263_Base_EncoderContext::Init(CodecID codecId)
21 +bool H263_Base_EncoderContext::Init(AVCodecID codecId)
23 PTRACE(5, m_prefix, "Opening encoder");
25 @@ -589,7 +589,7 @@ void H263_RFC2190_EncoderContext::RTPCal
27 bool H263_RFC2190_EncoderContext::Init()
29 - if (!H263_Base_EncoderContext::Init(CODEC_ID_H263))
30 + if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263))
31 return false;
33 #if LIBAVCODEC_RTP_MODE
34 @@ -632,7 +632,7 @@ H263_RFC2429_EncoderContext::~H263_RFC24
36 bool H263_RFC2429_EncoderContext::Init()
38 - return H263_Base_EncoderContext::Init(CODEC_ID_H263P);
39 + return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P);
43 @@ -656,7 +656,7 @@ H263_Base_DecoderContext::H263_Base_Deco
44 if (!FFMPEGLibraryInstance.Load())
45 return;
47 - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) {
48 + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) {
49 PTRACE(1, m_prefix, "Codec not found for decoder");
50 return;
52 --- a/plugins/video/H.264/h264-x264.cxx
53 +++ b/plugins/video/H.264/h264-x264.cxx
54 @@ -105,7 +105,7 @@ static struct PluginCodec_information Li
56 ///////////////////////////////////////////////////////////////////////////////
58 -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264);
59 +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264);
61 PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF
63 @@ -1065,17 +1065,17 @@ class MyDecoder : public PluginCodec<MY_
64 allows you to fail the create operation (return false), which cannot
65 be done in the normal C++ constructor. */
67 - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
68 + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL)
69 return false;
71 if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL)
72 return false;
74 m_context->workaround_bugs = FF_BUG_AUTODETECT;
75 - m_context->idct_algo = FF_IDCT_H264;
76 + m_context->idct_algo = FF_IDCT_AUTO;
77 m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
78 m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
79 - m_context->flags2 = CODEC_FLAG2_SKIP_RD |
80 + m_context->flags2 =
81 #ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE
82 CODEC_FLAG2_DROP_FRAME_TIMECODE |
83 #endif
84 --- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
85 +++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
86 @@ -205,7 +205,7 @@ const static struct mpeg4_resolution {
87 { 0 }
90 -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4);
91 +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4);
94 static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen )
95 @@ -688,7 +688,7 @@ void MPEG4EncoderContext::ResizeEncoding
97 bool MPEG4EncoderContext::OpenCodec()
99 - if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
100 + if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){
101 PTRACE(1, "MPEG4", "Encoder not found");
102 return false;
104 @@ -1390,7 +1390,7 @@ void MPEG4DecoderContext::ResizeDecoding
106 bool MPEG4DecoderContext::OpenCodec()
108 - if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) {
109 + if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) {
110 PTRACE(1, "MPEG4", "Decoder not found for encoder");
111 return false;
113 --- a/plugins/video/H.263-1998/h263-1998.h
114 +++ b/plugins/video/H.263-1998/h263-1998.h
115 @@ -115,7 +115,7 @@ class H263_Base_EncoderContext
116 virtual ~H263_Base_EncoderContext();
118 virtual bool Init() = 0;
119 - virtual bool Init(CodecID codecId);
120 + virtual bool Init(AVCodecID codecId);
122 virtual bool SetOptions(const char * const * options);
123 virtual void SetOption(const char * option, const char * value);
124 --- a/plugins/video/common/dyna.cxx
125 +++ b/plugins/video/common/dyna.cxx
126 @@ -217,14 +217,14 @@ static void logCallbackFFMPEG(void * avc
127 #endif
130 -FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
131 +FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
133 m_codec = codec;
134 - if (m_codec==CODEC_ID_H264)
135 + if (m_codec==AV_CODEC_ID_H264)
136 snprintf( m_codecString, sizeof(m_codecString), "H264");
137 - if (m_codec==CODEC_ID_H263P)
138 + if (m_codec==AV_CODEC_ID_H263P)
139 snprintf( m_codecString, sizeof(m_codecString), "H263+");
140 - if (m_codec==CODEC_ID_MPEG4)
141 + if (m_codec==AV_CODEC_ID_MPEG4)
142 snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
143 m_isLoadedOK = false;
145 @@ -268,12 +268,12 @@ bool FFMPEGLibrary::Load()
146 return true;
149 -AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
150 +AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
152 return avcodec_find_encoder(id);
155 -AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
156 +AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
158 WaitAndSignal m(processLock);
160 @@ -308,13 +308,18 @@ int FFMPEGLibrary::AvcodecClose(AVCodecC
161 return avcodec_close(ctx);
164 +#undef FFMAX
165 +#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
166 int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict)
168 + AVPacket pkt = { 0 };
169 + int ret, got_output;
170 int res;
172 - res = avcodec_encode_video(ctx, buf, buf_size, pict);
173 + ret = avcodec_encode_video2(ctx, &pkt, pict, &got_output);
175 - PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size);
176 + PTRACE(6, m_codecString, "DYNA\tEncoded into " << ret << " bytes, max " << buf_size);
177 + memcpy(buf, pkt.data, FFMAX(pkt.size, buf_size));
178 return res;
181 --- a/plugins/video/common/dyna.h
182 +++ b/plugins/video/common/dyna.h
183 @@ -88,13 +88,13 @@ class DynaLink
184 class FFMPEGLibrary
186 public:
187 - FFMPEGLibrary(CodecID codec);
188 + FFMPEGLibrary(AVCodecID codec);
189 ~FFMPEGLibrary();
191 bool Load();
193 - AVCodec *AvcodecFindEncoder(enum CodecID id);
194 - AVCodec *AvcodecFindDecoder(enum CodecID id);
195 + AVCodec *AvcodecFindEncoder(enum AVCodecID id);
196 + AVCodec *AvcodecFindDecoder(enum AVCodecID id);
197 AVCodecContext *AvcodecAllocContext(AVCodec*);
198 AVFrame *AvcodecAllocFrame(void);
199 int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
200 @@ -117,7 +117,7 @@ class FFMPEGLibrary
201 DynaLink m_libAvcodec;
202 DynaLink m_libAvutil;
204 - CodecID m_codec;
205 + AVCodecID m_codec;
206 char m_codecString[32];
208 bool m_isLoadedOK;