opal-3.10.10-ffmpeg2-1.patch (15039B)
1 Submitted By: Igor Živković <contact@igor-zivkovic.from.hr> 2 Date: 2013-10-08 3 Initial Package Version: 3.10.10 4 Upstream Status: Unknown 5 Origin: Gentoo 6 Description: Fixes building against FFmpeg version >= 2.0.0 7 8 diff -Naur opal-3.10.10.orig/plugins/video/common/dyna.cxx opal-3.10.10/plugins/video/common/dyna.cxx 9 --- opal-3.10.10.orig/plugins/video/common/dyna.cxx 2013-02-20 03:18:05.000000000 +0100 10 +++ opal-3.10.10/plugins/video/common/dyna.cxx 2013-10-08 12:57:25.058873513 +0200 11 @@ -210,7 +210,7 @@ 12 #endif 13 14 15 -FFMPEGLibrary::FFMPEGLibrary(CodecID codec) 16 +FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec) 17 { 18 m_codec = codec; 19 if (m_codec==CODEC_ID_H264) 20 @@ -348,12 +348,12 @@ 21 return true; 22 } 23 24 -AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id) 25 +AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id) 26 { 27 return Favcodec_find_encoder(id); 28 } 29 30 -AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id) 31 +AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id) 32 { 33 WaitAndSignal m(processLock); 34 35 diff -Naur opal-3.10.10.orig/plugins/video/common/dyna.h opal-3.10.10/plugins/video/common/dyna.h 36 --- opal-3.10.10.orig/plugins/video/common/dyna.h 2013-02-20 03:18:05.000000000 +0100 37 +++ opal-3.10.10/plugins/video/common/dyna.h 2013-10-08 12:57:25.058873513 +0200 38 @@ -88,13 +88,13 @@ 39 class FFMPEGLibrary 40 { 41 public: 42 - FFMPEGLibrary(CodecID codec); 43 + FFMPEGLibrary(AVCodecID codec); 44 ~FFMPEGLibrary(); 45 46 bool Load(); 47 48 - AVCodec *AvcodecFindEncoder(enum CodecID id); 49 - AVCodec *AvcodecFindDecoder(enum CodecID id); 50 + AVCodec *AvcodecFindEncoder(enum AVCodecID id); 51 + AVCodec *AvcodecFindDecoder(enum AVCodecID id); 52 AVCodecContext *AvcodecAllocContext(void); 53 AVFrame *AvcodecAllocFrame(void); 54 int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec); 55 @@ -117,15 +117,15 @@ 56 DynaLink m_libAvcodec; 57 DynaLink m_libAvutil; 58 59 - CodecID m_codec; 60 + AVCodecID m_codec; 61 char m_codecString[32]; 62 63 void (*Favcodec_init)(void); 64 void (*Fav_init_packet)(AVPacket *pkt); 65 66 void (*Favcodec_register_all)(void); 67 - AVCodec *(*Favcodec_find_encoder)(enum CodecID id); 68 - AVCodec *(*Favcodec_find_decoder)(enum CodecID id); 69 + AVCodec *(*Favcodec_find_encoder)(enum AVCodecID id); 70 + AVCodec *(*Favcodec_find_decoder)(enum AVCodecID id); 71 AVCodecContext *(*Favcodec_alloc_context)(void); 72 AVFrame *(*Favcodec_alloc_frame)(void); 73 int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec); 74 diff -Naur opal-3.10.10.orig/plugins/video/common/ffmpeg/libavcodec/avcodec.h opal-3.10.10/plugins/video/common/ffmpeg/libavcodec/avcodec.h 75 --- opal-3.10.10.orig/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-02-20 03:18:04.000000000 +0100 76 +++ opal-3.10.10/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-10-08 12:57:25.060873488 +0200 77 @@ -101,7 +101,7 @@ 78 * 1. no value of a existing codec ID changes (that would break ABI), 79 * 2. it is as close as possible to similar codecs. 80 */ 81 -enum CodecID { 82 +enum AVCodecID { 83 CODEC_ID_NONE, 84 85 /* video codecs */ 86 @@ -1390,7 +1390,7 @@ 87 88 char codec_name[32]; 89 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ 90 - enum CodecID codec_id; /* see CODEC_ID_xxx */ 91 + enum AVCodecID codec_id; /* see CODEC_ID_xxx */ 92 93 /** 94 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). 95 @@ -2843,7 +2843,7 @@ 96 */ 97 const char *name; 98 enum AVMediaType type; 99 - enum CodecID id; 100 + enum AVCodecID id; 101 int priv_data_size; 102 int (*init)(AVCodecContext *); 103 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); 104 @@ -2898,7 +2898,7 @@ 105 * 106 * See CODEC_ID_xxx 107 */ 108 - enum CodecID id; 109 + enum AVCodecID id; 110 111 /** 112 * Supported pixel format. 113 @@ -3402,10 +3402,10 @@ 114 /** 115 * Find a registered encoder with a matching codec ID. 116 * 117 - * @param id CodecID of the requested encoder 118 + * @param id AVCodecID of the requested encoder 119 * @return An encoder if one was found, NULL otherwise. 120 */ 121 -AVCodec *avcodec_find_encoder(enum CodecID id); 122 +AVCodec *avcodec_find_encoder(enum AVCodecID id); 123 124 /** 125 * Find a registered encoder with the specified name. 126 @@ -3418,10 +3418,10 @@ 127 /** 128 * Find a registered decoder with a matching codec ID. 129 * 130 - * @param id CodecID of the requested decoder 131 + * @param id AVCodecID of the requested decoder 132 * @return A decoder if one was found, NULL otherwise. 133 */ 134 -AVCodec *avcodec_find_decoder(enum CodecID id); 135 +AVCodec *avcodec_find_decoder(enum AVCodecID id); 136 137 /** 138 * Find a registered decoder with the specified name. 139 @@ -3822,7 +3822,7 @@ 140 * @param[in] codec_id the codec 141 * @return Number of bits per sample or zero if unknown for the given codec. 142 */ 143 -int av_get_bits_per_sample(enum CodecID codec_id); 144 +int av_get_bits_per_sample(enum AVCodecID codec_id); 145 146 #if FF_API_OLD_SAMPLE_FMT 147 /** 148 diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.cxx opal-3.10.10/plugins/video/H.263-1998/h263-1998.cxx 149 --- opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.cxx 2013-02-20 03:18:03.000000000 +0100 150 +++ opal-3.10.10/plugins/video/H.263-1998/h263-1998.cxx 2013-10-08 12:57:25.061873475 +0200 151 @@ -48,6 +48,10 @@ 152 #endif 153 154 #include "h263-1998.h" 155 +extern "C" 156 +{ 157 +#include <libavutil/opt.h> 158 +} 159 #include <limits> 160 #include <iomanip> 161 #include <stdio.h> 162 @@ -203,7 +207,7 @@ 163 PTRACE(4, m_prefix, "Encoder closed"); 164 } 165 166 -bool H263_Base_EncoderContext::Init(CodecID codecId) 167 +bool H263_Base_EncoderContext::Init(AVCodecID codecId) 168 { 169 PTRACE(5, m_prefix, "Opening encoder"); 170 171 @@ -317,9 +321,9 @@ 172 // Level 2+ 173 // works with eyeBeam, signaled via non-standard "D" 174 if (atoi(value) == 1) 175 - m_context->flags |= CODEC_FLAG_H263P_UMV; 176 + av_opt_set_int(m_context->priv_data, "umv", 1, 0); 177 else 178 - m_context->flags &= ~CODEC_FLAG_H263P_UMV; 179 + av_opt_set_int(m_context->priv_data, "umv", 0, 0); 180 return; 181 } 182 183 @@ -328,9 +332,9 @@ 184 // Annex F: Advanced Prediction Mode 185 // does not work with eyeBeam 186 if (atoi(value) == 1) 187 - m_context->flags |= CODEC_FLAG_OBMC; 188 + av_opt_set_int(m_context->priv_data, "obmc", 1, 0); 189 else 190 - m_context->flags &= ~CODEC_FLAG_OBMC; 191 + av_opt_set_int(m_context->priv_data, "obmc", 0, 0); 192 return; 193 } 194 #endif 195 @@ -360,9 +364,9 @@ 196 // Annex K: Slice Structure 197 // does not work with eyeBeam 198 if (atoi(value) != 0) 199 - m_context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; 200 + av_opt_set_int(m_context->priv_data, "structured_slices", 1, 0); 201 else 202 - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; 203 + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); 204 return; 205 } 206 207 @@ -370,9 +374,9 @@ 208 // Annex S: Alternative INTER VLC mode 209 // does not work with eyeBeam 210 if (atoi(value) == 1) 211 - m_context->flags |= CODEC_FLAG_H263P_AIV; 212 + av_opt_set_int(m_context->priv_data, "aiv", 1, 0); 213 else 214 - m_context->flags &= ~CODEC_FLAG_H263P_AIV; 215 + av_opt_set_int(m_context->priv_data, "aiv", 0, 0); 216 return; 217 } 218 219 @@ -450,15 +454,6 @@ 220 PTRACE(5, m_prefix, "qmax set to " << m_context->qmax); 221 PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size); 222 223 - #define CODEC_TRACER_FLAG(tracer, flag) \ 224 - PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled")); 225 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV); 226 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC); 227 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED); 228 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT) 229 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER); 230 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV); 231 - 232 return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0; 233 } 234 235 @@ -521,7 +516,7 @@ 236 237 // Need to copy to local buffer to guarantee 16 byte alignment 238 memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2); 239 - m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE; 240 + m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE; 241 242 /* 243 m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE; 244 @@ -603,13 +598,13 @@ 245 m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack; 246 m_context->opaque = this; // used to separate out packets from different encode threads 247 248 - m_context->flags &= ~CODEC_FLAG_H263P_UMV; 249 + av_opt_set_int(m_context->priv_data, "umv", 0, 0); 250 m_context->flags &= ~CODEC_FLAG_4MV; 251 #if LIBAVCODEC_RTP_MODE 252 m_context->flags &= ~CODEC_FLAG_H263P_AIC; 253 #endif 254 - m_context->flags &= ~CODEC_FLAG_H263P_AIV; 255 - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; 256 + av_opt_set_int(m_context->priv_data, "aiv", 0, 0); 257 + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); 258 259 return true; 260 } 261 diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.h opal-3.10.10/plugins/video/H.263-1998/h263-1998.h 262 --- opal-3.10.10.orig/plugins/video/H.263-1998/h263-1998.h 2013-02-20 03:18:03.000000000 +0100 263 +++ opal-3.10.10/plugins/video/H.263-1998/h263-1998.h 2013-10-08 12:57:25.062873463 +0200 264 @@ -115,7 +115,7 @@ 265 virtual ~H263_Base_EncoderContext(); 266 267 virtual bool Init() = 0; 268 - virtual bool Init(CodecID codecId); 269 + virtual bool Init(AVCodecID codecId); 270 271 virtual bool SetOptions(const char * const * options); 272 virtual void SetOption(const char * option, const char * value); 273 diff -Naur opal-3.10.10.orig/plugins/video/H.263-1998/Makefile.in opal-3.10.10/plugins/video/H.263-1998/Makefile.in 274 --- opal-3.10.10.orig/plugins/video/H.263-1998/Makefile.in 2013-02-20 03:18:03.000000000 +0100 275 +++ opal-3.10.10/plugins/video/H.263-1998/Makefile.in 2013-10-08 12:57:25.062873463 +0200 276 @@ -35,7 +35,7 @@ 277 $(COMMONDIR)/dyna.cxx 278 279 CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) 280 -LIBS += @DL_LIBS@ 281 +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@ 282 283 HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@ 284 ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes) 285 diff -Naur opal-3.10.10.orig/plugins/video/H.264/gpl/h264_helper.cxx opal-3.10.10/plugins/video/H.264/gpl/h264_helper.cxx 286 --- opal-3.10.10.orig/plugins/video/H.264/gpl/h264_helper.cxx 2013-02-20 03:18:02.000000000 +0100 287 +++ opal-3.10.10/plugins/video/H.264/gpl/h264_helper.cxx 2013-10-08 12:57:25.062873463 +0200 288 @@ -27,6 +27,7 @@ 289 #include <fstream> 290 #include <stdlib.h> 291 #include <sys/stat.h> 292 +#include <unistd.h> 293 294 #ifdef HAVE_UNISTD_H 295 #include <unistd.h> 296 diff -Naur opal-3.10.10.orig/plugins/video/H.264/h264-x264.cxx opal-3.10.10/plugins/video/H.264/h264-x264.cxx 297 --- opal-3.10.10.orig/plugins/video/H.264/h264-x264.cxx 2013-02-20 03:18:02.000000000 +0100 298 +++ opal-3.10.10/plugins/video/H.264/h264-x264.cxx 2013-10-08 12:57:25.063873450 +0200 299 @@ -40,6 +40,9 @@ 300 #include "plugin-config.h" 301 #endif 302 303 +#define FF_IDCT_H264 11 304 +#define CODEC_FLAG2_SKIP_RD 0x00004000 305 + 306 #include <codec/opalplugin.hpp> 307 308 #include "../common/ffmpeg.h" 309 @@ -1071,13 +1074,10 @@ 310 return false; 311 312 m_context->workaround_bugs = FF_BUG_AUTODETECT; 313 - m_context->error_recognition = FF_ER_AGGRESSIVE; 314 m_context->idct_algo = FF_IDCT_H264; 315 m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; 316 m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE; 317 - m_context->flags2 = CODEC_FLAG2_BRDO | 318 - CODEC_FLAG2_MEMC_ONLY | 319 - CODEC_FLAG2_DROP_FRAME_TIMECODE | 320 + m_context->flags2 = CODEC_FLAG2_DROP_FRAME_TIMECODE | 321 CODEC_FLAG2_SKIP_RD | 322 CODEC_FLAG2_CHUNKS; 323 324 diff -Naur opal-3.10.10.orig/plugins/video/H.264/shared/x264wrap.cxx opal-3.10.10/plugins/video/H.264/shared/x264wrap.cxx 325 --- opal-3.10.10.orig/plugins/video/H.264/shared/x264wrap.cxx 2013-02-20 03:18:02.000000000 +0100 326 +++ opal-3.10.10/plugins/video/H.264/shared/x264wrap.cxx 2013-10-08 12:57:25.064873438 +0200 327 @@ -33,6 +33,7 @@ 328 329 #include <codec/opalplugin.hpp> 330 #include <stdio.h> 331 +#include <unistd.h> 332 333 #ifdef HAVE_UNISTD_H 334 #include <unistd.h> 335 diff -Naur opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/Makefile.in opal-3.10.10/plugins/video/MPEG4-ffmpeg/Makefile.in 336 --- opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-02-20 03:18:07.000000000 +0100 337 +++ opal-3.10.10/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-10-08 12:57:25.064873438 +0200 338 @@ -31,7 +31,7 @@ 339 SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx 340 341 CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) 342 -LIBS += @DL_LIBS@ 343 +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@ 344 345 # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h> 346 # Also add libavutil, so ffmpeg headers can #include "log.h". 347 diff -Naur opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/mpeg4.cxx opal-3.10.10/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 348 --- opal-3.10.10.orig/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-02-20 03:18:07.000000000 +0100 349 +++ opal-3.10.10/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-10-08 12:57:25.065873425 +0200 350 @@ -103,6 +103,7 @@ 351 352 #else /* LIBAVCODEC_HAVE_SOURCE_DIR */ 353 #include "../common/ffmpeg.h" 354 +#include <libavutil/opt.h> 355 #endif /* LIBAVCODEC_HAVE_SOURCE_DIR */ 356 } 357 358 @@ -589,17 +590,17 @@ 359 m_avpicture->quality = m_videoQMin; 360 361 #ifdef USE_ORIG 362 - m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning 363 + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0); 364 m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors 365 #else 366 m_avcontext->max_b_frames=0; /*don't use b frames*/ 367 m_avcontext->flags|=CODEC_FLAG_AC_PRED; 368 - m_avcontext->flags|=CODEC_FLAG_H263P_UMV; 369 + av_opt_set_int(m_avcontext->priv_data, "umv", 1, 0); 370 /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */ 371 m_avcontext->flags|=CODEC_FLAG_4MV; 372 m_avcontext->flags|=CODEC_FLAG_GMC; 373 m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER; 374 - m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT; 375 + av_opt_set_int(m_avcontext->priv_data, "structured_slices", 1, 0); 376 #endif 377 m_avcontext->opaque = this; // for use in RTP callback 378 } 379 @@ -804,7 +805,7 @@ 380 // Should the next frame be an I-Frame? 381 if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0)) 382 { 383 - m_avpicture->pict_type = FF_I_TYPE; 384 + m_avpicture->pict_type = AV_PICTURE_TYPE_I; 385 } 386 else // No IFrame requested, let avcodec decide what to do 387 { 388 @@ -1325,7 +1326,7 @@ 389 390 void MPEG4DecoderContext::SetStaticDecodingParams() { 391 m_avcontext->flags |= CODEC_FLAG_4MV; 392 - m_avcontext->flags |= CODEC_FLAG_PART; 393 + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0); 394 m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations 395 } 396