diff -ur opal-3.10.11.org/plugins/audio/G.722.2/G7222Codec.cpp opal-3.10.11/plugins/audio/G.722.2/G7222Codec.cpp --- opal-3.10.11.org/plugins/audio/G.722.2/G7222Codec.cpp 2013-08-15 01:22:45.000000000 +0200 +++ opal-3.10.11/plugins/audio/G.722.2/G7222Codec.cpp 2018-09-29 11:58:07.796456792 +0200 @@ -109,7 +109,7 @@ const UWord16 AMRWB_efficient_ToC_bits = 6; const UWord16 AMRWB_efficient_CMR_bits = 4; -const UWord8 AMRWB_block_size_octet[16]= { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 }; +const unsigned AMRWB_block_size_octet[16]= { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 }; // RFC 3267 octet-aligned ToC adds 8 bits to each core speech bits frame and 8 per packet for header // RFC 3267 bandwidth-efficient adds 6 bits to each core speech bits frame and 4 per packet for header @@ -186,7 +186,7 @@ //PTRACE(2, "Codec\tAMR-WB encoder: Audio data of size " << *fromLen << " did not match expected " << AMRWB_FRAME_SAMPLES * sizeof(short)); return 0; } - if (*toLen < (unsigned) AMRWB_block_size_octet[Context->mode] + 1) + if (*toLen < AMRWB_block_size_octet[Context->mode] + 1) { //PTRACE(2,"Codec\tAMR-WB encoder: Output buffer of size " << *toLen << " too short for mode " << mode); return 0; @@ -346,7 +346,7 @@ return 0; case -2: - //PTRACE(2, "Codec\tAMR-WB decoder: Packet size " << *fromLen << " did not match expected " << (unsigned)(AMRWB_block_size_octet[FrameType] + 1) << " for frame type " << FrameType); + //PTRACE(2, "Codec\tAMR-WB decoder: Packet size " << *fromLen << " did not match expected " << (AMRWB_block_size_octet[FrameType] + 1) << " for frame type " << FrameType); return 0; case -3: diff -ur opal-3.10.11.org/plugins/audio/Speex/speexcodec.cxx opal-3.10.11/plugins/audio/Speex/speexcodec.cxx --- opal-3.10.11.org/plugins/audio/Speex/speexcodec.cxx 2013-08-15 01:22:44.000000000 +0200 +++ opal-3.10.11/plugins/audio/Speex/speexcodec.cxx 2018-09-29 11:58:07.796456792 +0200 @@ -756,18 +756,19 @@ //////////////////////////////////////////////////////////////////////////////////////////////// -#define NARROW_BITSPERFRAME_MODE2 (Speex_Bits_Per_Second(2, 8000)/50) // 119 // 5950 -#define NARROW_BITSPERFRAME_MODE3 (Speex_Bits_Per_Second(3, 8000)/50) // 160 // 8000 -#define NARROW_BITSPERFRAME_MODE4 (Speex_Bits_Per_Second(4, 8000)/50) // 220 // 11000 -#define NARROW_BITSPERFRAME_MODE5 (Speex_Bits_Per_Second(5, 8000)/50) // 300 // 15000 -#define NARROW_BITSPERFRAME_MODE6 (Speex_Bits_Per_Second(6, 8000)/50) // 364 // 18200 -#define NARROW_BITSPERFRAME_MODE7 (Speex_Bits_Per_Second(7, 8000)/50) // 492 // 26400 +#define NARROW_BITSPERFRAME_MODE(m) ((unsigned)Speex_Bits_Per_Second(m, 8000)/50) +#define NARROW_BITSPERFRAME_MODE2 NARROW_BITSPERFRAME_MODE(2) // 119 // 5950 +#define NARROW_BITSPERFRAME_MODE3 NARROW_BITSPERFRAME_MODE(3) // 160 // 8000 +#define NARROW_BITSPERFRAME_MODE4 NARROW_BITSPERFRAME_MODE(4) // 220 // 11000 +#define NARROW_BITSPERFRAME_MODE5 NARROW_BITSPERFRAME_MODE(5) // 300 // 15000 +#define NARROW_BITSPERFRAME_MODE6 NARROW_BITSPERFRAME_MODE(6) // 364 // 18200 +#define NARROW_BITSPERFRAME_MODE7 NARROW_BITSPERFRAME_MODE(7) // 492 // 26400 //#define WIDE_BITSPERFRAME_MODE2 ((Speex_Bytes_Per_Frame(2, 16000)/50) // NARROW_BITSPERFRAME_MODE2 + 112) // 11550 //#define WIDE_BITSPERFRAME_MODE3 ((Speex_Bytes_Per_Frame(3, 16000)/50) // 17600 //#define WIDE_BITSPERFRAME_MODE4 ((Speex_Bytes_Per_Frame(4, 16000)/50) // 28600 //#define WIDE_BITSPERFRAME_MODE5 ((Speex_Bytes_Per_Frame(5, 16000)/50) // 28600 -#define WIDE_BITSPERFRAME_MODE6 (Speex_Bits_Per_Second(6, 16000)/50) // 20600 +#define WIDE_BITSPERFRAME_MODE6 ((unsigned)Speex_Bits_Per_Second(6, 16000)/50) // 20600 static struct PluginCodec_Definition ver1SpeexCodecDefn[] = { diff -ur opal-3.10.11.org/plugins/video/common/dyna.cxx opal-3.10.11/plugins/video/common/dyna.cxx --- opal-3.10.11.org/plugins/video/common/dyna.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/common/dyna.cxx 2018-09-29 11:58:52.681123038 +0200 @@ -210,14 +210,14 @@ #endif -FFMPEGLibrary::FFMPEGLibrary(CodecID codec) +FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec) { m_codec = codec; - if (m_codec==CODEC_ID_H264) + if (m_codec==AV_CODEC_ID_H264) snprintf( m_codecString, sizeof(m_codecString), "H264"); - if (m_codec==CODEC_ID_H263P) + if (m_codec==AV_CODEC_ID_H263P) snprintf( m_codecString, sizeof(m_codecString), "H263+"); - if (m_codec==CODEC_ID_MPEG4) + if (m_codec==AV_CODEC_ID_MPEG4) snprintf( m_codecString, sizeof(m_codecString), "MPEG4"); m_isLoadedOK = false; } @@ -348,12 +348,12 @@ return true; } -AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id) +AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id) { return Favcodec_find_encoder(id); } -AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id) +AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id) { WaitAndSignal m(processLock); @@ -374,7 +374,7 @@ return Favcodec_alloc_frame(); } -int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec) +int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options) { WaitAndSignal m(processLock); diff -ur opal-3.10.11.org/plugins/video/common/dyna.h opal-3.10.11/plugins/video/common/dyna.h --- opal-3.10.11.org/plugins/video/common/dyna.h 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/common/dyna.h 2018-09-29 11:58:52.681123038 +0200 @@ -88,16 +88,16 @@ class FFMPEGLibrary { public: - FFMPEGLibrary(CodecID codec); + FFMPEGLibrary(AVCodecID codec); ~FFMPEGLibrary(); bool Load(); - AVCodec *AvcodecFindEncoder(enum CodecID id); - AVCodec *AvcodecFindDecoder(enum CodecID id); + AVCodec *AvcodecFindEncoder(enum AVCodecID id); + AVCodec *AvcodecFindDecoder(enum AVCodecID id); AVCodecContext *AvcodecAllocContext(void); AVFrame *AvcodecAllocFrame(void); - int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec); + int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options); int AvcodecClose(AVCodecContext *ctx); int AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict); int AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size); @@ -117,15 +117,15 @@ DynaLink m_libAvcodec; DynaLink m_libAvutil; - CodecID m_codec; + AVCodecID m_codec; char m_codecString[32]; void (*Favcodec_init)(void); void (*Fav_init_packet)(AVPacket *pkt); void (*Favcodec_register_all)(void); - AVCodec *(*Favcodec_find_encoder)(enum CodecID id); - AVCodec *(*Favcodec_find_decoder)(enum CodecID id); + AVCodec *(*Favcodec_find_encoder)(enum AVCodecID id); + AVCodec *(*Favcodec_find_decoder)(enum AVCodecID id); AVCodecContext *(*Favcodec_alloc_context)(void); AVFrame *(*Favcodec_alloc_frame)(void); int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec); diff -ur opal-3.10.11.org/plugins/video/common/ffmpeg/libavcodec/avcodec.h opal-3.10.11/plugins/video/common/ffmpeg/libavcodec/avcodec.h --- opal-3.10.11.org/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2018-09-29 11:58:31.047147254 +0200 @@ -101,7 +101,7 @@ * 1. no value of a existing codec ID changes (that would break ABI), * 2. it is as close as possible to similar codecs. */ -enum CodecID { +enum AVCodecID { CODEC_ID_NONE, /* video codecs */ @@ -1390,7 +1390,7 @@ char codec_name[32]; enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ - enum CodecID codec_id; /* see CODEC_ID_xxx */ + enum AVCodecID codec_id; /* see CODEC_ID_xxx */ /** * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). @@ -2843,7 +2843,7 @@ */ const char *name; enum AVMediaType type; - enum CodecID id; + enum AVCodecID id; int priv_data_size; int (*init)(AVCodecContext *); int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); @@ -2898,7 +2898,7 @@ * * See CODEC_ID_xxx */ - enum CodecID id; + enum AVCodecID id; /** * Supported pixel format. @@ -3402,10 +3402,10 @@ /** * Find a registered encoder with a matching codec ID. * - * @param id CodecID of the requested encoder + * @param id AVCodecID of the requested encoder * @return An encoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_encoder(enum CodecID id); +AVCodec *avcodec_find_encoder(enum AVCodecID id); /** * Find a registered encoder with the specified name. @@ -3418,10 +3418,10 @@ /** * Find a registered decoder with a matching codec ID. * - * @param id CodecID of the requested decoder + * @param id AVCodecID of the requested decoder * @return A decoder if one was found, NULL otherwise. */ -AVCodec *avcodec_find_decoder(enum CodecID id); +AVCodec *avcodec_find_decoder(enum AVCodecID id); /** * Find a registered decoder with the specified name. @@ -3822,7 +3822,7 @@ * @param[in] codec_id the codec * @return Number of bits per sample or zero if unknown for the given codec. */ -int av_get_bits_per_sample(enum CodecID codec_id); +int av_get_bits_per_sample(enum AVCodecID codec_id); #if FF_API_OLD_SAMPLE_FMT /** diff -ur opal-3.10.11.org/plugins/video/common/ffmpeg.h opal-3.10.11/plugins/video/common/ffmpeg.h --- opal-3.10.11.org/plugins/video/common/ffmpeg.h 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/common/ffmpeg.h 2018-09-29 11:58:52.681123038 +0200 @@ -46,6 +46,7 @@ #include "platform.h" #include "libavcodec/avcodec.h" +#include "libavutil/imgutils.h" // AVPacket was declared in avformat.h before April 2009 #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0) #include "libavformat/avformat.h" diff -ur opal-3.10.11.org/plugins/video/common/mpi.cxx opal-3.10.11/plugins/video/common/mpi.cxx --- opal-3.10.11.org/plugins/video/common/mpi.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/common/mpi.cxx 2018-09-29 12:00:33.957463916 +0200 @@ -132,8 +132,8 @@ // to the desired one or matches it for (i=0; i < MPIs.size(); i++) { // we square the value in order to get absolute distances - distance = ( abs(MPIs[i].width - desiredWidth ) * - abs(MPIs[i].height - desiredHeight) ); + distance = ( abs((int)(MPIs[i].width - desiredWidth )) * + abs((int)(MPIs[i].height - desiredHeight)) ); if (distance < minDistance) { minDistance = distance; diff -ur opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.cxx opal-3.10.11/plugins/video/H.263-1998/h263-1998.cxx --- opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.263-1998/h263-1998.cxx 2018-09-29 11:59:17.348522238 +0200 @@ -48,6 +48,10 @@ #endif #include "h263-1998.h" +extern "C" +{ +#include +} #include #include #include @@ -70,7 +74,7 @@ #define MAX_H263_CUSTOM_SIZES 10 -#define DEFAULT_CUSTOM_MPI "0,0,"STRINGIZE(PLUGINCODEC_MPI_DISABLED) +#define DEFAULT_CUSTOM_MPI "0,0," STRINGIZE(PLUGINCODEC_MPI_DISABLED) static struct StdSizes { enum { @@ -94,7 +98,7 @@ { CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI }, }; -static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P); +static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P); ///////////////////////////////////////////////////////////////////////////// @@ -203,7 +207,7 @@ PTRACE(4, m_prefix, "Encoder closed"); } -bool H263_Base_EncoderContext::Init(CodecID codecId) +bool H263_Base_EncoderContext::Init(AVCodecID codecId) { PTRACE(5, m_prefix, "Opening encoder"); @@ -230,11 +234,10 @@ m_context->opaque = this; - m_context->flags = CODEC_FLAG_EMU_EDGE // don't draw edges - | CODEC_FLAG_TRUNCATED // Possible missing packets + m_context->flags = AV_CODEC_FLAG_TRUNCATED // Possible missing packets ; - m_context->pix_fmt = PIX_FMT_YUV420P; + m_context->pix_fmt = AV_PIX_FMT_YUV420P; m_context->gop_size = H263_KEY_FRAME_INTERVAL; // X-Lite does not like Custom Picture frequency clocks... stick to 29.97Hz @@ -317,9 +320,9 @@ // Level 2+ // works with eyeBeam, signaled via non-standard "D" if (atoi(value) == 1) - m_context->flags |= CODEC_FLAG_H263P_UMV; + av_opt_set_int(m_context->priv_data, "umv", 1, 0); else - m_context->flags &= ~CODEC_FLAG_H263P_UMV; + av_opt_set_int(m_context->priv_data, "umv", 0, 0); return; } @@ -328,9 +331,9 @@ // Annex F: Advanced Prediction Mode // does not work with eyeBeam if (atoi(value) == 1) - m_context->flags |= CODEC_FLAG_OBMC; + av_opt_set_int(m_context->priv_data, "obmc", 1, 0); else - m_context->flags &= ~CODEC_FLAG_OBMC; + av_opt_set_int(m_context->priv_data, "obmc", 0, 0); return; } #endif @@ -340,9 +343,9 @@ // Level 3+ // works with eyeBeam if (atoi(value) == 1) - m_context->flags |= CODEC_FLAG_AC_PRED; + m_context->flags |= AV_CODEC_FLAG_AC_PRED; else - m_context->flags &= ~CODEC_FLAG_AC_PRED; + m_context->flags &= ~AV_CODEC_FLAG_AC_PRED; return; } @@ -350,9 +353,9 @@ // Annex J: Deblocking Filter // works with eyeBeam if (atoi(value) == 1) - m_context->flags |= CODEC_FLAG_LOOP_FILTER; + m_context->flags |= AV_CODEC_FLAG_LOOP_FILTER; else - m_context->flags &= ~CODEC_FLAG_LOOP_FILTER; + m_context->flags &= ~AV_CODEC_FLAG_LOOP_FILTER; return; } @@ -360,9 +363,9 @@ // Annex K: Slice Structure // does not work with eyeBeam if (atoi(value) != 0) - m_context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT; + av_opt_set_int(m_context->priv_data, "structured_slices", 1, 0); else - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); return; } @@ -370,9 +373,9 @@ // Annex S: Alternative INTER VLC mode // does not work with eyeBeam if (atoi(value) == 1) - m_context->flags |= CODEC_FLAG_H263P_AIV; + av_opt_set_int(m_context->priv_data, "aiv", 1, 0); else - m_context->flags &= ~CODEC_FLAG_H263P_AIV; + av_opt_set_int(m_context->priv_data, "aiv", 0, 0); return; } @@ -416,8 +419,8 @@ m_context->qcompress = 0.5; // qscale factor between easy & hard scenes (0.0-1.0) // Lagrange multipliers - this is how the context defaults do it: - m_context->lmin = m_context->qmin * FF_QP2LAMBDA; - m_context->lmax = m_context->qmax * FF_QP2LAMBDA; + av_opt_set_int(m_context->priv_data, "lmin", m_context->qmin * FF_QP2LAMBDA, 0); + av_opt_set_int(m_context->priv_data, "lmax", m_context->qmax * FF_QP2LAMBDA, 0); // YUV420P input m_inputFrame->linesize[0] = m_context->width; @@ -434,9 +437,6 @@ m_inputFrame->data[1] = m_inputFrame->data[0] + planeSize; m_inputFrame->data[2] = m_inputFrame->data[1] + (planeSize / 4); - if (m_context->width > 352) - m_context->flags &= ~CODEC_FLAG_EMU_EDGE; // Totally bizarre! FFMPEG crashes if on for CIF4 - // Dump info PTRACE(5, m_prefix, "Size is " << m_context->width << "x" << m_context->height); PTRACE(5, m_prefix, "GOP is " << m_context->gop_size); @@ -450,16 +450,7 @@ PTRACE(5, m_prefix, "qmax set to " << m_context->qmax); PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size); - #define CODEC_TRACER_FLAG(tracer, flag) \ - PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled")); - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV); - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC); - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED); - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT) - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER); - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV); - - return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0; + return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) == 0; } void H263_Base_EncoderContext::CloseCodec() @@ -521,7 +512,7 @@ // Need to copy to local buffer to guarantee 16 byte alignment memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2); - m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE; + m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE; /* m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE; @@ -592,7 +583,7 @@ bool H263_RFC2190_EncoderContext::Init() { - if (!H263_Base_EncoderContext::Init(CODEC_ID_H263)) + if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263)) return false; #if LIBAVCODEC_RTP_MODE @@ -603,13 +594,13 @@ m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack; m_context->opaque = this; // used to separate out packets from different encode threads - m_context->flags &= ~CODEC_FLAG_H263P_UMV; - m_context->flags &= ~CODEC_FLAG_4MV; + av_opt_set_int(m_context->priv_data, "umv", 0, 0); + m_context->flags &= ~AV_CODEC_FLAG_4MV; #if LIBAVCODEC_RTP_MODE m_context->flags &= ~CODEC_FLAG_H263P_AIC; #endif - m_context->flags &= ~CODEC_FLAG_H263P_AIV; - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT; + av_opt_set_int(m_context->priv_data, "aiv", 0, 0); + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0); return true; } @@ -629,7 +620,7 @@ bool H263_RFC2429_EncoderContext::Init() { - return H263_Base_EncoderContext::Init(CODEC_ID_H263P); + return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P); } @@ -653,7 +644,7 @@ if (!FFMPEGLibraryInstance.Load()) return; - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) { + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) { PTRACE(1, m_prefix, "Codec not found for decoder"); return; } @@ -704,7 +695,7 @@ return 0; } - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0) { + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0) { PTRACE(1, m_prefix, "Failed to open H.263 decoder"); return false; } diff -ur opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.h opal-3.10.11/plugins/video/H.263-1998/h263-1998.h --- opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.h 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.263-1998/h263-1998.h 2018-09-29 11:58:31.047147254 +0200 @@ -115,7 +115,7 @@ virtual ~H263_Base_EncoderContext(); virtual bool Init() = 0; - virtual bool Init(CodecID codecId); + virtual bool Init(AVCodecID codecId); virtual bool SetOptions(const char * const * options); virtual void SetOption(const char * option, const char * value); diff -ur opal-3.10.11.org/plugins/video/H.263-1998/Makefile.in opal-3.10.11/plugins/video/H.263-1998/Makefile.in --- opal-3.10.11.org/plugins/video/H.263-1998/Makefile.in 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.263-1998/Makefile.in 2018-09-29 11:58:31.047147254 +0200 @@ -35,7 +35,7 @@ $(COMMONDIR)/dyna.cxx CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) -LIBS += @DL_LIBS@ +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@ HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@ ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes) diff -ur opal-3.10.11.org/plugins/video/H.263-1998/rfc2190.cxx opal-3.10.11/plugins/video/H.263-1998/rfc2190.cxx --- opal-3.10.11.org/plugins/video/H.263-1998/rfc2190.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.263-1998/rfc2190.cxx 2018-09-29 12:00:01.429831294 +0200 @@ -25,7 +25,7 @@ #include #include -#include +#include const unsigned char PSC[3] = { 0x00, 0x00, 0x80 }; diff -ur opal-3.10.11.org/plugins/video/H.263-1998/rfc2429.cxx opal-3.10.11/plugins/video/H.263-1998/rfc2429.cxx --- opal-3.10.11.org/plugins/video/H.263-1998/rfc2429.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.263-1998/rfc2429.cxx 2018-09-29 11:59:17.348522238 +0200 @@ -286,7 +286,7 @@ unsigned char * RFC2429Frame::GetBuffer() { - memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , FF_INPUT_BUFFER_PADDING_SIZE); + memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , AV_INPUT_BUFFER_PADDING_SIZE); return (m_encodedFrame.ptr); } @@ -340,10 +340,10 @@ unsigned remBytes = packet.GetPayloadSize() - headerPLEN - (headerV ? 3 : 2); - if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - FF_INPUT_BUFFER_PADDING_SIZE)) { + if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - AV_INPUT_BUFFER_PADDING_SIZE)) { PTRACE(2, "H.263-RFC2429", "Trying to add " << remBytes << " bytes to frame at position " << m_encodedFrame.pos + (headerP ? 2 : 0) - << " bytes while maximum frame size is " << m_maxFrameSize << "-" << FF_INPUT_BUFFER_PADDING_SIZE << " bytes"); + << " bytes while maximum frame size is " << m_maxFrameSize << "-" << AV_INPUT_BUFFER_PADDING_SIZE << " bytes"); return false; } diff -ur opal-3.10.11.org/plugins/video/H.264/gpl/h264_helper.cxx opal-3.10.11/plugins/video/H.264/gpl/h264_helper.cxx --- opal-3.10.11.org/plugins/video/H.264/gpl/h264_helper.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.264/gpl/h264_helper.cxx 2018-09-29 11:58:31.047147254 +0200 @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef HAVE_UNISTD_H #include diff -ur opal-3.10.11.org/plugins/video/H.264/h264-x264.cxx opal-3.10.11/plugins/video/H.264/h264-x264.cxx --- opal-3.10.11.org/plugins/video/H.264/h264-x264.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.264/h264-x264.cxx 2018-09-29 11:59:17.351855670 +0200 @@ -40,6 +40,9 @@ #include "plugin-config.h" #endif +#define FF_IDCT_H264 11 +#define CODEC_FLAG2_SKIP_RD 0x00004000 + #include #include "../common/ffmpeg.h" @@ -104,7 +107,7 @@ /////////////////////////////////////////////////////////////////////////////// -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264); +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264); PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF @@ -1064,27 +1067,23 @@ allows you to fail the create operation (return false), which cannot be done in the normal C++ constructor. */ - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL) + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL) return false; if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext()) == NULL) return false; m_context->workaround_bugs = FF_BUG_AUTODETECT; - m_context->error_recognition = FF_ER_AGGRESSIVE; m_context->idct_algo = FF_IDCT_H264; m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; - m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE; - m_context->flags2 = CODEC_FLAG2_BRDO | - CODEC_FLAG2_MEMC_ONLY | - CODEC_FLAG2_DROP_FRAME_TIMECODE | + m_context->flags2 = AV_CODEC_FLAG2_DROP_FRAME_TIMECODE | CODEC_FLAG2_SKIP_RD | - CODEC_FLAG2_CHUNKS; + AV_CODEC_FLAG2_CHUNKS; if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL) return false; - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0) + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0) return false; PTRACE(4, MY_CODEC_LOG, "Opened decoder (SVN $Revision: 28048 $)"); @@ -1181,7 +1180,7 @@ uint8_t * src[3] = { m_picture->data[0], m_picture->data[1], m_picture->data[2] }; uint8_t * dst[3] = { OPAL_VIDEO_FRAME_DATA_PTR(videoHeader), dst[0] + ySize, dst[1] + uvSize }; - size_t dstLineSize[3] = { m_context->width, m_context->width/2, m_context->width/2 }; + size_t dstLineSize[3] = { (size_t)m_context->width, (size_t)m_context->width/2, (size_t)m_context->width/2 }; for (int y = 0; y < m_context->height; ++y) { for (int plane = 0; plane < 3; ++plane) { diff -ur opal-3.10.11.org/plugins/video/H.264/shared/x264wrap.cxx opal-3.10.11/plugins/video/H.264/shared/x264wrap.cxx --- opal-3.10.11.org/plugins/video/H.264/shared/x264wrap.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/H.264/shared/x264wrap.cxx 2018-09-29 11:58:31.047147254 +0200 @@ -33,6 +33,7 @@ #include #include +#include #ifdef HAVE_UNISTD_H #include diff -ur opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/Makefile.in opal-3.10.11/plugins/video/MPEG4-ffmpeg/Makefile.in --- opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/MPEG4-ffmpeg/Makefile.in 2018-09-29 11:58:31.047147254 +0200 @@ -31,7 +31,7 @@ SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR) -LIBS += @DL_LIBS@ +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@ # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include # Also add libavutil, so ffmpeg headers can #include "log.h". diff -ur opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/mpeg4.cxx opal-3.10.11/plugins/video/MPEG4-ffmpeg/mpeg4.cxx --- opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-08-15 01:22:47.000000000 +0200 +++ opal-3.10.11/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2018-09-29 11:59:17.351855670 +0200 @@ -103,6 +103,7 @@ #else /* LIBAVCODEC_HAVE_SOURCE_DIR */ #include "../common/ffmpeg.h" +#include #endif /* LIBAVCODEC_HAVE_SOURCE_DIR */ } @@ -205,7 +206,7 @@ { 0 } }; -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4); +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4); static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen ) @@ -539,7 +540,7 @@ // void MPEG4EncoderContext::SetStaticEncodingParams(){ - m_avcontext->pix_fmt = PIX_FMT_YUV420P; + m_avcontext->pix_fmt = AV_PIX_FMT_YUV420P; m_avcontext->mb_decision = FF_MB_DECISION_SIMPLE; // high quality off m_avcontext->rtp_payload_size = 750; // ffh263 uses 750 m_avcontext->rtp_callback = &MPEG4EncoderContext::RtpCallback; @@ -547,19 +548,19 @@ // Reduce the difference in quantization between frames. m_avcontext->qblur = 0.3f; // default is tex^qComp; 1 is constant bitrate - m_avcontext->rc_eq = (char*) "1"; - //avcontext->rc_eq = "tex^qComp"; + av_opt_set(m_avcontext->priv_data, "rc_eq", (char*) "1", 0); + //av_opt_set(m_avcontext->priv_data, "rc_eq", "tex^qComp", 0); // These ones technically could be dynamic, I think m_avcontext->rc_min_rate = 0; // This is set to 0 in ffmpeg.c, the command-line utility. - m_avcontext->rc_initial_cplx = 0.0f; + av_opt_set_double(m_avcontext->priv_data, "rc_init_cplx", 0.0f, 0); // And this is set to 1. // It seems to affect how aggressively the library will raise and lower // quantization to keep bandwidth constant. Except it's in reference to // the "vbv buffer", not bits per second, so nobody really knows how // it works. - m_avcontext->rc_buffer_aggressivity = 1.0f; + av_opt_set_double(m_avcontext->priv_data, "rc_buf_aggressivity", 1.0f, 0); // Ratecontrol buffer size, in bits. Usually 0.5-1 second worth. // 224 kbyte is what VLC uses, and it seems to fix the quantization pulse (at Level 5) @@ -589,17 +590,16 @@ m_avpicture->quality = m_videoQMin; #ifdef USE_ORIG - m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0); m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors #else m_avcontext->max_b_frames=0; /*don't use b frames*/ - m_avcontext->flags|=CODEC_FLAG_AC_PRED; - m_avcontext->flags|=CODEC_FLAG_H263P_UMV; + m_avcontext->flags|=AV_CODEC_FLAG_AC_PRED; + av_opt_set_int(m_avcontext->priv_data, "umv", 1, 0); /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */ - m_avcontext->flags|=CODEC_FLAG_4MV; - m_avcontext->flags|=CODEC_FLAG_GMC; - m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER; - m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT; + m_avcontext->flags|=AV_CODEC_FLAG_4MV; + m_avcontext->flags|=AV_CODEC_FLAG_LOOP_FILTER; + av_opt_set_int(m_avcontext->priv_data, "structured_slices", 1, 0); #endif m_avcontext->opaque = this; // for use in RTP callback } @@ -636,8 +636,8 @@ m_avcontext->qmax = std::min( m_avcontext->qmax, 31); // Lagrange multipliers - this is how the context defaults do it: - m_avcontext->lmin = m_avcontext->qmin * FF_QP2LAMBDA; - m_avcontext->lmax = m_avcontext->qmax * FF_QP2LAMBDA; + av_opt_set_int(m_avcontext->priv_data, "lmin", m_avcontext->qmin * FF_QP2LAMBDA, 0); + av_opt_set_int(m_avcontext->priv_data, "lmax", m_avcontext->qmax * FF_QP2LAMBDA, 0); // If framesize has changed or is not yet initialized, fix it up if((unsigned)m_avcontext->width != m_frameWidth || (unsigned)m_avcontext->height != m_frameHeight) { @@ -665,7 +665,7 @@ { delete[] m_rawFrameBuffer; } - m_rawFrameBuffer = new BYTE[m_rawFrameLen + FF_INPUT_BUFFER_PADDING_SIZE]; + m_rawFrameBuffer = new BYTE[m_rawFrameLen + AV_INPUT_BUFFER_PADDING_SIZE]; if (m_encFrameBuffer) { @@ -675,7 +675,7 @@ m_encFrameBuffer = new BYTE[m_encFrameLen]; // Clear the back padding - memset(m_rawFrameBuffer + m_rawFrameLen, 0, FF_INPUT_BUFFER_PADDING_SIZE); + memset(m_rawFrameBuffer + m_rawFrameLen, 0, AV_INPUT_BUFFER_PADDING_SIZE); const unsigned fsz = m_frameWidth * m_frameHeight; m_avpicture->data[0] = m_rawFrameBuffer; // luminance m_avpicture->data[1] = m_rawFrameBuffer + fsz; // first chroma channel @@ -703,7 +703,7 @@ return false; } - if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){ + if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){ PTRACE(1, "MPEG4", "Encoder not found"); return false; } @@ -713,13 +713,15 @@ if (PTRACE_CHECK(4)) { m_avcontext->debug |= FF_DEBUG_RC; m_avcontext->debug |= FF_DEBUG_PICT_INFO; - m_avcontext->debug |= FF_DEBUG_MV; +// m_avcontext->debug |= FF_DEBUG_MV; } #endif SetStaticEncodingParams(); SetDynamicEncodingParams(false); // don't force a restart, it's not open - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0) + AVDictionary *opts = NULL; + av_dict_set_int(&opts, "gmc", 1, 0); + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, &opts) < 0) { PTRACE(1, "MPEG4", "Encoder could not be opened"); return false; @@ -804,7 +806,7 @@ // Should the next frame be an I-Frame? if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0)) { - m_avpicture->pict_type = FF_I_TYPE; + m_avpicture->pict_type = AV_PICTURE_TYPE_I; } else // No IFrame requested, let avcodec decide what to do { @@ -1324,8 +1326,8 @@ // void MPEG4DecoderContext::SetStaticDecodingParams() { - m_avcontext->flags |= CODEC_FLAG_4MV; - m_avcontext->flags |= CODEC_FLAG_PART; + m_avcontext->flags |= AV_CODEC_FLAG_4MV; + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0); m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations } @@ -1394,7 +1396,7 @@ bool MPEG4DecoderContext::OpenCodec() { - if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) { + if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) { PTRACE(1, "MPEG4", "Decoder not found for encoder"); return false; } @@ -1415,7 +1417,7 @@ SetStaticDecodingParams(); SetDynamicDecodingParams(false); // don't force a restart, it's not open - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0) { + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, NULL) < 0) { PTRACE(1, "MPEG4", "Decoder failed to open"); return false; } diff -ur opal-3.10.11.org/src/im/msrp.cxx opal-3.10.11/src/im/msrp.cxx --- opal-3.10.11.org/src/im/msrp.cxx 2013-08-15 01:22:57.000000000 +0200 +++ opal-3.10.11/src/im/msrp.cxx 2018-09-29 11:58:07.796456792 +0200 @@ -835,7 +835,8 @@ flush(); { - PStringStream str; str << ::setfill('\r') << mime.PrintContents(str); + PStringStream str; str << ::setfill('\r'); + mime.PrintContents(str); PTRACE(4, "Sending MSRP REPORT\n" << "MSRP " << chunkId << " " << MSRPCommands[REPORT] << CRLF << "To-Path: " << toUrl << CRLF << "From-Path: "<< fromUrl << CRLF diff -ur opal-3.10.11.org/src/sip/sipep.cxx opal-3.10.11/src/sip/sipep.cxx --- opal-3.10.11.org/src/sip/sipep.cxx 2013-08-15 01:22:51.000000000 +0200 +++ opal-3.10.11/src/sip/sipep.cxx 2018-09-29 11:58:07.796456792 +0200 @@ -471,7 +471,7 @@ if (!AddConnection(connection)) return false; - if (remoteParty.Find(";OPAL-"OPAL_SIP_REFERRED_CONNECTION) == P_MAX_INDEX) + if (remoteParty.Find(";OPAL-" OPAL_SIP_REFERRED_CONNECTION) == P_MAX_INDEX) otherConnection->Release(OpalConnection::EndedByCallForwarded); else otherConnection->SetPhase(OpalConnection::ForwardingPhase);