opal: bump version and fix build for ZHF

+787 -40
+22 -40
pkgs/development/libraries/opal/default.nix
··· 1 - x@{builderDefsPackage 2 - , doxygen, pkgconfig, ptlib, srtp, libtheora, speex 3 - , ffmpeg, x264, cyrus_sasl, openldap, openssl, expat, unixODBC 4 - , ...}: 5 - builderDefsPackage 6 - (a : 7 - let 8 - helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 9 - []; 10 11 - buildInputs = map (n: builtins.getAttr n x) 12 - (builtins.attrNames (builtins.removeAttrs x helperArgNames)); 13 - sourceInfo = rec { 14 - baseName="opal"; 15 - baseVersion="3.6"; 16 - patchlevel="8"; 17 - version="${baseVersion}.${patchlevel}"; 18 - name="${baseName}-${version}"; 19 - url="mirror://gnome/sources/${baseName}/${baseVersion}/${name}.tar.bz2"; 20 - hash="0359wqmrxqajd94sw3q2dn6n6y3caggavwdcmzyn6maw7srspgwc"; 21 - }; 22 - in 23 - rec { 24 - src = a.fetchurl { 25 - url = sourceInfo.url; 26 - sha256 = sourceInfo.hash; 27 }; 28 29 - inherit (sourceInfo) name version; 30 - inherit buildInputs; 31 32 - /* doConfigure should be removed if not needed */ 33 - phaseNames = ["setVars" "doConfigure" "doMakeInstall"]; 34 - configureFlags = [ 35 - "--enable-h323" 36 - ]; 37 - setVars = a.noDepEntry ('' 38 - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D__STDC_CONSTANT_MACROS=1" 39 - ''); 40 41 - meta = { 42 description = "OPAL VoIP library"; 43 - maintainers = [ a.lib.maintainers.raskin ]; 44 - platforms = a.lib.platforms.linux; 45 - broken = true; 46 }; 47 passthru = { 48 updateInfo = { 49 downloadPage = "http://ftp.gnome.org/pub/GNOME/sources/opal"; 50 }; 51 }; 52 - }) x 53
··· 1 + { stdenv, fetchurl, pkgconfig, ptlib, srtp, libtheora, speex 2 + , ffmpeg, x264, cyrus_sasl, openldap, openssl, expat, unixODBC }: 3 4 + stdenv.mkDerivation rec { 5 + name = "opal-3.10.10"; 6 + 7 + src = fetchurl { 8 + url = "mirror://gnome/sources/opal/3.10/${name}.tar.xz"; 9 + sha256 = "f208985003461b2743575eccac13ad890b3e5baac35b68ddef17162460aff864"; 10 }; 11 12 + buildInputs = [ pkgconfig ptlib srtp libtheora speex 13 + ffmpeg x264 cyrus_sasl openldap openssl expat unixODBC ]; 14 15 + configureFlags = [ "--enable-h323" ]; 16 + 17 + enableParallelBuilding = true; 18 + 19 + NIX_CFLAGS = "-D__STDC_CONSTANT_MACROS=1"; 20 + 21 + patches = [ ./disable-samples-ftbfs.diff ./libav9.patch ./libav10.patch ]; 22 23 + meta = with stdenv.lib; { 24 description = "OPAL VoIP library"; 25 + maintainers = [ maintainers.raskin ]; 26 + platforms = platforms.linux; 27 }; 28 + 29 passthru = { 30 updateInfo = { 31 downloadPage = "http://ftp.gnome.org/pub/GNOME/sources/opal"; 32 }; 33 }; 34 + } 35
+14
pkgs/development/libraries/opal/disable-samples-ftbfs.diff
···
··· 1 + Index: opal-3.10.4~dfsg/Makefile.in 2 + =================================================================== 3 + --- opal-3.10.4~dfsg.orig/Makefile.in 2012-02-22 10:08:36.000000000 +1100 4 + +++ opal-3.10.4~dfsg/Makefile.in 2012-03-08 08:32:44.000000000 +1100 5 + @@ -45,8 +45,7 @@ 6 + samples/codectest \ 7 + samples/callgen \ 8 + samples/opalecho \ 9 + - samples/faxopal \ 10 + - samples/c_api 11 + + samples/faxopal 12 + ifeq ($(OPAL_IVR),yes) 13 + SUBDIRS += samples/opalmcu \ 14 + samples/ivropal \
+208
pkgs/development/libraries/opal/libav10.patch
···
··· 1 + Description: Fix compilation against libav10 2 + Author: Reinhard Tartler <siretart@tauware.de> 3 + Bug-Debian: http://bugs.debian.org/739439 4 + 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 + }; 10 + 11 + -static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P); 12 + +static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P); 13 + 14 + 15 + ///////////////////////////////////////////////////////////////////////////// 16 + @@ -203,7 +203,7 @@ H263_Base_EncoderContext::~H263_Base_Enc 17 + PTRACE(4, m_prefix, "Encoder closed"); 18 + } 19 + 20 + -bool H263_Base_EncoderContext::Init(CodecID codecId) 21 + +bool H263_Base_EncoderContext::Init(AVCodecID codecId) 22 + { 23 + PTRACE(5, m_prefix, "Opening encoder"); 24 + 25 + @@ -589,7 +589,7 @@ void H263_RFC2190_EncoderContext::RTPCal 26 + 27 + bool H263_RFC2190_EncoderContext::Init() 28 + { 29 + - if (!H263_Base_EncoderContext::Init(CODEC_ID_H263)) 30 + + if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263)) 31 + return false; 32 + 33 + #if LIBAVCODEC_RTP_MODE 34 + @@ -632,7 +632,7 @@ H263_RFC2429_EncoderContext::~H263_RFC24 35 + 36 + bool H263_RFC2429_EncoderContext::Init() 37 + { 38 + - return H263_Base_EncoderContext::Init(CODEC_ID_H263P); 39 + + return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P); 40 + } 41 + 42 + 43 + @@ -656,7 +656,7 @@ H263_Base_DecoderContext::H263_Base_Deco 44 + if (!FFMPEGLibraryInstance.Load()) 45 + return; 46 + 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; 51 + } 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 55 + 56 + /////////////////////////////////////////////////////////////////////////////// 57 + 58 + -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264); 59 + +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264); 60 + 61 + PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF 62 + 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. */ 66 + 67 + - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL) 68 + + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL) 69 + return false; 70 + 71 + if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL) 72 + return false; 73 + 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 } 88 + }; 89 + 90 + -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4); 91 + +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4); 92 + 93 + 94 + static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen ) 95 + @@ -688,7 +688,7 @@ void MPEG4EncoderContext::ResizeEncoding 96 + 97 + bool MPEG4EncoderContext::OpenCodec() 98 + { 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; 103 + } 104 + @@ -1390,7 +1390,7 @@ void MPEG4DecoderContext::ResizeDecoding 105 + 106 + bool MPEG4DecoderContext::OpenCodec() 107 + { 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; 112 + } 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(); 117 + 118 + virtual bool Init() = 0; 119 + - virtual bool Init(CodecID codecId); 120 + + virtual bool Init(AVCodecID codecId); 121 + 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 128 + 129 + 130 + -FFMPEGLibrary::FFMPEGLibrary(CodecID codec) 131 + +FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec) 132 + { 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; 144 + } 145 + @@ -268,12 +268,12 @@ bool FFMPEGLibrary::Load() 146 + return true; 147 + } 148 + 149 + -AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id) 150 + +AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id) 151 + { 152 + return avcodec_find_encoder(id); 153 + } 154 + 155 + -AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id) 156 + +AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id) 157 + { 158 + WaitAndSignal m(processLock); 159 + 160 + @@ -308,13 +308,18 @@ int FFMPEGLibrary::AvcodecClose(AVCodecC 161 + return avcodec_close(ctx); 162 + } 163 + 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) 167 + { 168 + + AVPacket pkt = { 0 }; 169 + + int ret, got_output; 170 + int res; 171 + 172 + - res = avcodec_encode_video(ctx, buf, buf_size, pict); 173 + + ret = avcodec_encode_video2(ctx, &pkt, pict, &got_output); 174 + 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; 179 + } 180 + 181 + --- a/plugins/video/common/dyna.h 182 + +++ b/plugins/video/common/dyna.h 183 + @@ -88,13 +88,13 @@ class DynaLink 184 + class FFMPEGLibrary 185 + { 186 + public: 187 + - FFMPEGLibrary(CodecID codec); 188 + + FFMPEGLibrary(AVCodecID codec); 189 + ~FFMPEGLibrary(); 190 + 191 + bool Load(); 192 + 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; 203 + 204 + - CodecID m_codec; 205 + + AVCodecID m_codec; 206 + char m_codecString[32]; 207 + 208 + bool m_isLoadedOK;
+543
pkgs/development/libraries/opal/libav9.patch
···
··· 1 + Description: Backport changes for the libav 9 API 2 + Also replace loading of libavcodec and libavutil via dlopen by linking against 3 + it. 4 + Author: Sebastian Ramacher <sramacher@debian.org> 5 + Bug-Debian: http://bugs.debian.org/720824 6 + Last-Update: 2013-09-12 7 + 8 + --- a/plugins/video/H.263-1998/h263-1998.cxx 9 + +++ b/plugins/video/H.263-1998/h263-1998.cxx 10 + @@ -216,7 +216,7 @@ 11 + return false; 12 + } 13 + 14 + - m_context = FFMPEGLibraryInstance.AvcodecAllocContext(); 15 + + m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec); 16 + if (m_context == NULL) { 17 + PTRACE(1, m_prefix, "Failed to allocate context for encoder"); 18 + return false; 19 + @@ -312,6 +312,7 @@ 20 + return; 21 + } 22 + 23 + +#ifdef CODEC_FLAG_H263P_UMV 24 + if (STRCMPI(option, H263_ANNEX_D) == 0) { 25 + // Annex D: Unrestructed Motion Vectors 26 + // Level 2+ 27 + @@ -322,6 +323,7 @@ 28 + m_context->flags &= ~CODEC_FLAG_H263P_UMV; 29 + return; 30 + } 31 + +#endif 32 + 33 + #if 0 // DO NOT ENABLE THIS FLAG. FFMPEG IS NOT THREAD_SAFE WHEN THIS FLAG IS SET 34 + if (STRCMPI(option, H263_ANNEX_F) == 0) { 35 + @@ -356,6 +358,7 @@ 36 + return; 37 + } 38 + 39 + +#ifdef CODEC_FLAG_H263P_SLICE_STRUCT 40 + if (STRCMPI(option, H263_ANNEX_K) == 0) { 41 + // Annex K: Slice Structure 42 + // does not work with eyeBeam 43 + @@ -365,7 +368,9 @@ 44 + m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; 45 + return; 46 + } 47 + +#endif 48 + 49 + +#ifdef CODEC_FLAG_H263P_AIV 50 + if (STRCMPI(option, H263_ANNEX_S) == 0) { 51 + // Annex S: Alternative INTER VLC mode 52 + // does not work with eyeBeam 53 + @@ -375,6 +380,7 @@ 54 + m_context->flags &= ~CODEC_FLAG_H263P_AIV; 55 + return; 56 + } 57 + +#endif 58 + 59 + if (STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATION) == 0 || 60 + STRCMPI(option, PLUGINCODEC_MEDIA_PACKETIZATIONS) == 0) { 61 + @@ -450,15 +456,6 @@ 62 + PTRACE(5, m_prefix, "qmax set to " << m_context->qmax); 63 + PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size); 64 + 65 + - #define CODEC_TRACER_FLAG(tracer, flag) \ 66 + - PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled")); 67 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV); 68 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC); 69 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED); 70 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT) 71 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER); 72 + - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV); 73 + - 74 + return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0; 75 + } 76 + 77 + @@ -521,7 +518,7 @@ 78 + 79 + // Need to copy to local buffer to guarantee 16 byte alignment 80 + memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2); 81 + - m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE; 82 + + m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE; 83 + 84 + /* 85 + m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE; 86 + @@ -603,13 +600,19 @@ 87 + m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack; 88 + m_context->opaque = this; // used to separate out packets from different encode threads 89 + 90 + +#ifdef CODEC_FLAG_H263P_UMV 91 + m_context->flags &= ~CODEC_FLAG_H263P_UMV; 92 + +#endif 93 + m_context->flags &= ~CODEC_FLAG_4MV; 94 + #if LIBAVCODEC_RTP_MODE 95 + m_context->flags &= ~CODEC_FLAG_H263P_AIC; 96 + #endif 97 + +#ifdef CODEC_FLAG_H263P_AIV 98 + m_context->flags &= ~CODEC_FLAG_H263P_AIV; 99 + +#endif 100 + +#ifdef CODEC_FLAG_H263P_SLICE_STRUCT 101 + m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; 102 + +#endif 103 + 104 + return true; 105 + } 106 + @@ -658,7 +661,7 @@ 107 + return; 108 + } 109 + 110 + - m_context = FFMPEGLibraryInstance.AvcodecAllocContext(); 111 + + m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec); 112 + if (m_context == NULL) { 113 + PTRACE(1, m_prefix, "Failed to allocate context for decoder"); 114 + return; 115 + --- a/plugins/video/H.264/h264-x264.cxx 116 + +++ b/plugins/video/H.264/h264-x264.cxx 117 + @@ -48,6 +48,7 @@ 118 + #include "shared/h264frame.h" 119 + #include "shared/x264wrap.h" 120 + 121 + +#include <cstdio> 122 + 123 + #define MY_CODEC x264 // Name of codec (use C variable characters) 124 + #define MY_CODEC_LOG "x264" 125 + @@ -1067,18 +1068,17 @@ 126 + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL) 127 + return false; 128 + 129 + - if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext()) == NULL) 130 + + if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext(m_codec)) == NULL) 131 + return false; 132 + 133 + m_context->workaround_bugs = FF_BUG_AUTODETECT; 134 + - m_context->error_recognition = FF_ER_AGGRESSIVE; 135 + m_context->idct_algo = FF_IDCT_H264; 136 + m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; 137 + m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE; 138 + - m_context->flags2 = CODEC_FLAG2_BRDO | 139 + - CODEC_FLAG2_MEMC_ONLY | 140 + + m_context->flags2 = CODEC_FLAG2_SKIP_RD | 141 + +#ifdef CODEC_FLAG2_DROP_FRAME_TIMECODE 142 + CODEC_FLAG2_DROP_FRAME_TIMECODE | 143 + - CODEC_FLAG2_SKIP_RD | 144 + +#endif 145 + CODEC_FLAG2_CHUNKS; 146 + 147 + if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL) 148 + --- a/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 149 + +++ b/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 150 + @@ -589,17 +589,14 @@ 151 + m_avpicture->quality = m_videoQMin; 152 + 153 + #ifdef USE_ORIG 154 + - m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning 155 + m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors 156 + #else 157 + m_avcontext->max_b_frames=0; /*don't use b frames*/ 158 + m_avcontext->flags|=CODEC_FLAG_AC_PRED; 159 + - m_avcontext->flags|=CODEC_FLAG_H263P_UMV; 160 + /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */ 161 + m_avcontext->flags|=CODEC_FLAG_4MV; 162 + m_avcontext->flags|=CODEC_FLAG_GMC; 163 + m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER; 164 + - m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT; 165 + #endif 166 + m_avcontext->opaque = this; // for use in RTP callback 167 + } 168 + @@ -691,7 +688,12 @@ 169 + 170 + bool MPEG4EncoderContext::OpenCodec() 171 + { 172 + - m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(); 173 + + if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){ 174 + + PTRACE(1, "MPEG4", "Encoder not found"); 175 + + return false; 176 + + } 177 + + 178 + + m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec); 179 + if (m_avcontext == NULL) { 180 + PTRACE(1, "MPEG4", "Encoder failed to allocate context for encoder"); 181 + return false; 182 + @@ -703,11 +705,6 @@ 183 + return false; 184 + } 185 + 186 + - if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){ 187 + - PTRACE(1, "MPEG4", "Encoder not found"); 188 + - return false; 189 + - } 190 + - 191 + #if PLUGINCODEC_TRACING 192 + // debugging flags 193 + if (PTRACE_CHECK(4)) { 194 + @@ -804,7 +801,7 @@ 195 + // Should the next frame be an I-Frame? 196 + if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0)) 197 + { 198 + - m_avpicture->pict_type = FF_I_TYPE; 199 + + m_avpicture->pict_type = AV_PICTURE_TYPE_I; 200 + } 201 + else // No IFrame requested, let avcodec decide what to do 202 + { 203 + @@ -1325,7 +1322,6 @@ 204 + 205 + void MPEG4DecoderContext::SetStaticDecodingParams() { 206 + m_avcontext->flags |= CODEC_FLAG_4MV; 207 + - m_avcontext->flags |= CODEC_FLAG_PART; 208 + m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations 209 + } 210 + 211 + @@ -1399,7 +1395,7 @@ 212 + return false; 213 + } 214 + 215 + - m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(); 216 + + m_avcontext = FFMPEGLibraryInstance.AvcodecAllocContext(m_avcodec); 217 + if (m_avcontext == NULL) { 218 + PTRACE(1, "MPEG4", "Decoder failed to allocate context"); 219 + return false; 220 + --- a/plugins/video/common/dyna.cxx 221 + +++ b/plugins/video/common/dyna.cxx 222 + @@ -38,6 +38,13 @@ 223 + * Matthias Schneider (ma30002000@yahoo.de) 224 + */ 225 + #include "dyna.h" 226 + +#include <cstdio> 227 + +#include <cstdarg> 228 + + 229 + +extern "C" { 230 + +#include <libavcodec/avcodec.h> 231 + +#include <libavutil/mem.h> 232 + +} 233 + 234 + bool DynaLink::Open(const char *name) 235 + { 236 + @@ -228,101 +235,15 @@ 237 + m_libAvutil.Close(); 238 + } 239 + 240 + -#define CHECK_AVUTIL(name, func) \ 241 + - (seperateLibAvutil ? \ 242 + - m_libAvutil.GetFunction(name, (DynaLink::Function &)func) : \ 243 + - m_libAvcodec.GetFunction(name, (DynaLink::Function &)func) \ 244 + - ) \ 245 + - 246 + - 247 + bool FFMPEGLibrary::Load() 248 + { 249 + WaitAndSignal m(processLock); 250 + if (IsLoaded()) 251 + return true; 252 + 253 + - bool seperateLibAvutil = false; 254 + - 255 + -#ifdef LIBAVCODEC_LIB_NAME 256 + - if (m_libAvcodec.Open(LIBAVCODEC_LIB_NAME)) 257 + - seperateLibAvutil = true; 258 + - else 259 + -#endif 260 + - if (m_libAvcodec.Open("libavcodec")) 261 + - seperateLibAvutil = false; 262 + - else if (m_libAvcodec.Open("avcodec-" AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR))) 263 + - seperateLibAvutil = true; 264 + - else { 265 + - PTRACE(1, m_codecString, "Failed to load FFMPEG libavcodec library"); 266 + - return false; 267 + - } 268 + - 269 + - if (seperateLibAvutil && 270 + - !( 271 + -#ifdef LIBAVUTIL_LIB_NAME 272 + - m_libAvutil.Open(LIBAVUTIL_LIB_NAME) || 273 + -#endif 274 + - m_libAvutil.Open("libavutil") || 275 + - m_libAvutil.Open("avutil-" AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR)) 276 + - ) ) { 277 + - PTRACE(1, m_codecString, "Failed to load FFMPEG libavutil library"); 278 + - return false; 279 + - } 280 + - 281 + - strcpy(m_libAvcodec.m_codecString, m_codecString); 282 + - strcpy(m_libAvutil.m_codecString, m_codecString); 283 + - 284 + - if (!m_libAvcodec.GetFunction("avcodec_init", (DynaLink::Function &)Favcodec_init)) 285 + - return false; 286 + - 287 + - if (!m_libAvcodec.GetFunction("av_init_packet", (DynaLink::Function &)Fav_init_packet)) 288 + - return false; 289 + - 290 + - if (!m_libAvcodec.GetFunction("avcodec_register_all", (DynaLink::Function &)Favcodec_register_all)) 291 + - return false; 292 + - 293 + - if (!m_libAvcodec.GetFunction("avcodec_find_encoder", (DynaLink::Function &)Favcodec_find_encoder)) 294 + - return false; 295 + - 296 + - if (!m_libAvcodec.GetFunction("avcodec_find_decoder", (DynaLink::Function &)Favcodec_find_decoder)) 297 + - return false; 298 + - 299 + - if (!m_libAvcodec.GetFunction("avcodec_alloc_context", (DynaLink::Function &)Favcodec_alloc_context)) 300 + - return false; 301 + - 302 + - if (!m_libAvcodec.GetFunction("avcodec_alloc_frame", (DynaLink::Function &)Favcodec_alloc_frame)) 303 + - return false; 304 + - 305 + - if (!m_libAvcodec.GetFunction("avcodec_open", (DynaLink::Function &)Favcodec_open)) 306 + - return false; 307 + - 308 + - if (!m_libAvcodec.GetFunction("avcodec_close", (DynaLink::Function &)Favcodec_close)) 309 + - return false; 310 + - 311 + - if (!m_libAvcodec.GetFunction("avcodec_encode_video", (DynaLink::Function &)Favcodec_encode_video)) 312 + - return false; 313 + - 314 + - if (!m_libAvcodec.GetFunction("avcodec_decode_video2", (DynaLink::Function &)Favcodec_decode_video)) 315 + - return false; 316 + - 317 + - if (!m_libAvcodec.GetFunction("avcodec_set_dimensions", (DynaLink::Function &)Favcodec_set_dimensions)) 318 + - return false; 319 + - 320 + - if (!CHECK_AVUTIL("av_free", Favcodec_free)) 321 + - return false; 322 + - 323 + - if(!m_libAvcodec.GetFunction("avcodec_version", (DynaLink::Function &)Favcodec_version)) 324 + - return false; 325 + - 326 + - if (!CHECK_AVUTIL("av_log_set_level", FAv_log_set_level)) 327 + - return false; 328 + - 329 + - if (!CHECK_AVUTIL("av_log_set_callback", FAv_log_set_callback)) 330 + - return false; 331 + - 332 + // must be called before using avcodec lib 333 + 334 + - unsigned libVer = Favcodec_version(); 335 + + unsigned libVer = avcodec_version(); 336 + if (libVer != LIBAVCODEC_VERSION_INT) { 337 + PTRACE(2, m_codecString, "Warning: compiled against libavcodec headers from version " 338 + << LIBAVCODEC_VERSION_MAJOR << '.' << LIBAVCODEC_VERSION_MINOR << '.' << LIBAVCODEC_VERSION_MICRO 339 + @@ -334,8 +255,7 @@ 340 + << (libVer >> 16) << ((libVer>>8) & 0xff) << (libVer & 0xff)); 341 + } 342 + 343 + - Favcodec_init(); 344 + - Favcodec_register_all (); 345 + + avcodec_register_all(); 346 + 347 + #if PLUGINCODEC_TRACING 348 + AvLogSetLevel(AV_LOG_DEBUG); 349 + @@ -350,49 +270,49 @@ 350 + 351 + AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id) 352 + { 353 + - return Favcodec_find_encoder(id); 354 + + return avcodec_find_encoder(id); 355 + } 356 + 357 + AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id) 358 + { 359 + WaitAndSignal m(processLock); 360 + 361 + - return Favcodec_find_decoder(id); 362 + + return avcodec_find_decoder(id); 363 + } 364 + 365 + -AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(void) 366 + +AVCodecContext *FFMPEGLibrary::AvcodecAllocContext(AVCodec *codec) 367 + { 368 + WaitAndSignal m(processLock); 369 + 370 + - return Favcodec_alloc_context(); 371 + + return avcodec_alloc_context3(codec); 372 + } 373 + 374 + AVFrame *FFMPEGLibrary::AvcodecAllocFrame(void) 375 + { 376 + WaitAndSignal m(processLock); 377 + 378 + - return Favcodec_alloc_frame(); 379 + + return avcodec_alloc_frame(); 380 + } 381 + 382 + int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec) 383 + { 384 + WaitAndSignal m(processLock); 385 + 386 + - return Favcodec_open(ctx, codec); 387 + + return avcodec_open2(ctx, codec, NULL); 388 + } 389 + 390 + int FFMPEGLibrary::AvcodecClose(AVCodecContext *ctx) 391 + { 392 + WaitAndSignal m(processLock); 393 + 394 + - return Favcodec_close(ctx); 395 + + return avcodec_close(ctx); 396 + } 397 + 398 + int FFMPEGLibrary::AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict) 399 + { 400 + int res; 401 + 402 + - res = Favcodec_encode_video(ctx, buf, buf_size, pict); 403 + + res = avcodec_encode_video(ctx, buf, buf_size, pict); 404 + 405 + PTRACE(6, m_codecString, "DYNA\tEncoded into " << res << " bytes, max " << buf_size); 406 + return res; 407 + @@ -401,35 +321,35 @@ 408 + int FFMPEGLibrary::AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size) 409 + { 410 + AVPacket avpkt; 411 + - Fav_init_packet(&avpkt); 412 + + av_init_packet(&avpkt); 413 + avpkt.data = buf; 414 + avpkt.size = buf_size; 415 + 416 + - return Favcodec_decode_video(ctx, pict, got_picture_ptr, &avpkt); 417 + + return avcodec_decode_video2(ctx, pict, got_picture_ptr, &avpkt); 418 + } 419 + 420 + void FFMPEGLibrary::AvcodecFree(void * ptr) 421 + { 422 + WaitAndSignal m(processLock); 423 + 424 + - Favcodec_free(ptr); 425 + + av_free(ptr); 426 + } 427 + 428 + void FFMPEGLibrary::AvSetDimensions(AVCodecContext *s, int width, int height) 429 + { 430 + WaitAndSignal m(processLock); 431 + 432 + - Favcodec_set_dimensions(s, width, height); 433 + + avcodec_set_dimensions(s, width, height); 434 + } 435 + 436 + void FFMPEGLibrary::AvLogSetLevel(int level) 437 + { 438 + - FAv_log_set_level(level); 439 + + av_log_set_level(level); 440 + } 441 + 442 + void FFMPEGLibrary::AvLogSetCallback(void (*callback)(void*, int, const char*, va_list)) 443 + { 444 + - FAv_log_set_callback(callback); 445 + + av_log_set_callback(callback); 446 + } 447 + 448 + bool FFMPEGLibrary::IsLoaded() 449 + --- a/plugins/video/common/dyna.h 450 + +++ b/plugins/video/common/dyna.h 451 + @@ -95,7 +95,7 @@ 452 + 453 + AVCodec *AvcodecFindEncoder(enum CodecID id); 454 + AVCodec *AvcodecFindDecoder(enum CodecID id); 455 + - AVCodecContext *AvcodecAllocContext(void); 456 + + AVCodecContext *AvcodecAllocContext(AVCodec*); 457 + AVFrame *AvcodecAllocFrame(void); 458 + int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec); 459 + int AvcodecClose(AVCodecContext *ctx); 460 + @@ -120,26 +120,6 @@ 461 + CodecID m_codec; 462 + char m_codecString[32]; 463 + 464 + - void (*Favcodec_init)(void); 465 + - void (*Fav_init_packet)(AVPacket *pkt); 466 + - 467 + - void (*Favcodec_register_all)(void); 468 + - AVCodec *(*Favcodec_find_encoder)(enum CodecID id); 469 + - AVCodec *(*Favcodec_find_decoder)(enum CodecID id); 470 + - AVCodecContext *(*Favcodec_alloc_context)(void); 471 + - AVFrame *(*Favcodec_alloc_frame)(void); 472 + - int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec); 473 + - int (*Favcodec_close)(AVCodecContext *ctx); 474 + - int (*Favcodec_encode_video)(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict); 475 + - int (*Favcodec_decode_video)(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, AVPacket *avpkt); 476 + - unsigned (*Favcodec_version)(void); 477 + - void (*Favcodec_set_dimensions)(AVCodecContext *ctx, int width, int height); 478 + - 479 + - void (*Favcodec_free)(void *); 480 + - 481 + - void (*FAv_log_set_level)(int level); 482 + - void (*FAv_log_set_callback)(void (*callback)(void*, int, const char*, va_list)); 483 + - 484 + bool m_isLoadedOK; 485 + }; 486 + 487 + --- a/plugins/video/common/ffmpeg.h 488 + +++ b/plugins/video/common/ffmpeg.h 489 + @@ -45,11 +45,13 @@ 490 + 491 + #include "platform.h" 492 + 493 + -#include "libavcodec/avcodec.h" 494 + +extern "C" { 495 + +#include <libavcodec/avcodec.h> 496 + // AVPacket was declared in avformat.h before April 2009 497 + #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0) 498 + -#include "libavformat/avformat.h" 499 + +#include <libavformat/avformat.h> 500 + #endif 501 + +} 502 + 503 + #ifndef LIBAVCODEC_VERSION_INT 504 + #error Libavcodec include is not correct 505 + --- a/plugins/video/H.263-1998/Makefile.in 506 + +++ b/plugins/video/H.263-1998/Makefile.in 507 + @@ -34,8 +34,8 @@ 508 + $(COMMONDIR)/mpi.cxx \ 509 + $(COMMONDIR)/dyna.cxx 510 + 511 + -CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) 512 + -LIBS += @DL_LIBS@ 513 + +CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR) 514 + +LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@ 515 + 516 + HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@ 517 + ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes) 518 + --- a/plugins/video/H.264/Makefile.in 519 + +++ b/plugins/video/H.264/Makefile.in 520 + @@ -34,8 +34,8 @@ 521 + $(SHAREDDIR)/x264wrap.cxx \ 522 + $(COMMONDIR)/dyna.cxx \ 523 + 524 + -CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"' 525 + -LIBS += @DL_LIBS@ 526 + +CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR) -DLIB_DIR='"$(libdir)"' -DVC_PLUGIN_DIR='"@VC_PLUGIN_DIR@"' 527 + +LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@ 528 + 529 + IS_H264_LICENSED:=@IS_H264_LICENSED@ 530 + ifeq ($(IS_H264_LICENSED),yes) 531 + --- a/plugins/video/MPEG4-ffmpeg/Makefile.in 532 + +++ b/plugins/video/MPEG4-ffmpeg/Makefile.in 533 + @@ -30,8 +30,8 @@ 534 + SRCDIR := . 535 + SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx 536 + 537 + -CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) 538 + -LIBS += @DL_LIBS@ 539 + +CFLAGS += @LIBAVCODEC_CFLAGS@ @LIBAVUTIL_CFLAGS@ -I$(COMMONDIR) 540 + +LIBS += @DL_LIBS@ @LIBAVCODEC_LIBS@ @LIBAVUTIL_LIBS@ 541 + 542 + # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h> 543 + # Also add libavutil, so ffmpeg headers can #include "log.h".