1 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
2 --- opal-3.10.11.org/plugins/audio/G.722.2/G7222Codec.cpp 2013-08-15 01:22:45.000000000 +0200
3 +++ opal-3.10.11/plugins/audio/G.722.2/G7222Codec.cpp 2018-09-29 11:58:07.796456792 +0200
5 const UWord16 AMRWB_efficient_ToC_bits = 6;
6 const UWord16 AMRWB_efficient_CMR_bits = 4;
8 -const UWord8 AMRWB_block_size_octet[16]= { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 };
9 +const unsigned AMRWB_block_size_octet[16]= { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 };
11 // RFC 3267 octet-aligned ToC adds 8 bits to each core speech bits frame and 8 per packet for header
12 // RFC 3267 bandwidth-efficient adds 6 bits to each core speech bits frame and 4 per packet for header
14 //PTRACE(2, "Codec\tAMR-WB encoder: Audio data of size " << *fromLen << " did not match expected " << AMRWB_FRAME_SAMPLES * sizeof(short));
17 - if (*toLen < (unsigned) AMRWB_block_size_octet[Context->mode] + 1)
18 + if (*toLen < AMRWB_block_size_octet[Context->mode] + 1)
20 //PTRACE(2,"Codec\tAMR-WB encoder: Output buffer of size " << *toLen << " too short for mode " << mode);
26 - //PTRACE(2, "Codec\tAMR-WB decoder: Packet size " << *fromLen << " did not match expected " << (unsigned)(AMRWB_block_size_octet[FrameType] + 1) << " for frame type " << FrameType);
27 + //PTRACE(2, "Codec\tAMR-WB decoder: Packet size " << *fromLen << " did not match expected " << (AMRWB_block_size_octet[FrameType] + 1) << " for frame type " << FrameType);
31 diff -ur opal-3.10.11.org/plugins/audio/Speex/speexcodec.cxx opal-3.10.11/plugins/audio/Speex/speexcodec.cxx
32 --- opal-3.10.11.org/plugins/audio/Speex/speexcodec.cxx 2013-08-15 01:22:44.000000000 +0200
33 +++ opal-3.10.11/plugins/audio/Speex/speexcodec.cxx 2018-09-29 11:58:07.796456792 +0200
36 ////////////////////////////////////////////////////////////////////////////////////////////////
38 -#define NARROW_BITSPERFRAME_MODE2 (Speex_Bits_Per_Second(2, 8000)/50) // 119 // 5950
39 -#define NARROW_BITSPERFRAME_MODE3 (Speex_Bits_Per_Second(3, 8000)/50) // 160 // 8000
40 -#define NARROW_BITSPERFRAME_MODE4 (Speex_Bits_Per_Second(4, 8000)/50) // 220 // 11000
41 -#define NARROW_BITSPERFRAME_MODE5 (Speex_Bits_Per_Second(5, 8000)/50) // 300 // 15000
42 -#define NARROW_BITSPERFRAME_MODE6 (Speex_Bits_Per_Second(6, 8000)/50) // 364 // 18200
43 -#define NARROW_BITSPERFRAME_MODE7 (Speex_Bits_Per_Second(7, 8000)/50) // 492 // 26400
44 +#define NARROW_BITSPERFRAME_MODE(m) ((unsigned)Speex_Bits_Per_Second(m, 8000)/50)
45 +#define NARROW_BITSPERFRAME_MODE2 NARROW_BITSPERFRAME_MODE(2) // 119 // 5950
46 +#define NARROW_BITSPERFRAME_MODE3 NARROW_BITSPERFRAME_MODE(3) // 160 // 8000
47 +#define NARROW_BITSPERFRAME_MODE4 NARROW_BITSPERFRAME_MODE(4) // 220 // 11000
48 +#define NARROW_BITSPERFRAME_MODE5 NARROW_BITSPERFRAME_MODE(5) // 300 // 15000
49 +#define NARROW_BITSPERFRAME_MODE6 NARROW_BITSPERFRAME_MODE(6) // 364 // 18200
50 +#define NARROW_BITSPERFRAME_MODE7 NARROW_BITSPERFRAME_MODE(7) // 492 // 26400
52 //#define WIDE_BITSPERFRAME_MODE2 ((Speex_Bytes_Per_Frame(2, 16000)/50) // NARROW_BITSPERFRAME_MODE2 + 112) // 11550
53 //#define WIDE_BITSPERFRAME_MODE3 ((Speex_Bytes_Per_Frame(3, 16000)/50) // 17600
54 //#define WIDE_BITSPERFRAME_MODE4 ((Speex_Bytes_Per_Frame(4, 16000)/50) // 28600
55 //#define WIDE_BITSPERFRAME_MODE5 ((Speex_Bytes_Per_Frame(5, 16000)/50) // 28600
56 -#define WIDE_BITSPERFRAME_MODE6 (Speex_Bits_Per_Second(6, 16000)/50) // 20600
57 +#define WIDE_BITSPERFRAME_MODE6 ((unsigned)Speex_Bits_Per_Second(6, 16000)/50) // 20600
59 static struct PluginCodec_Definition ver1SpeexCodecDefn[] = {
61 diff -ur opal-3.10.11.org/plugins/video/common/dyna.cxx opal-3.10.11/plugins/video/common/dyna.cxx
62 --- opal-3.10.11.org/plugins/video/common/dyna.cxx 2013-08-15 01:22:47.000000000 +0200
63 +++ opal-3.10.11/plugins/video/common/dyna.cxx 2018-09-29 11:58:52.681123038 +0200
68 -FFMPEGLibrary::FFMPEGLibrary(CodecID codec)
69 +FFMPEGLibrary::FFMPEGLibrary(AVCodecID codec)
72 - if (m_codec==CODEC_ID_H264)
73 + if (m_codec==AV_CODEC_ID_H264)
74 snprintf( m_codecString, sizeof(m_codecString), "H264");
75 - if (m_codec==CODEC_ID_H263P)
76 + if (m_codec==AV_CODEC_ID_H263P)
77 snprintf( m_codecString, sizeof(m_codecString), "H263+");
78 - if (m_codec==CODEC_ID_MPEG4)
79 + if (m_codec==AV_CODEC_ID_MPEG4)
80 snprintf( m_codecString, sizeof(m_codecString), "MPEG4");
87 -AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum CodecID id)
88 +AVCodec *FFMPEGLibrary::AvcodecFindEncoder(enum AVCodecID id)
90 return Favcodec_find_encoder(id);
93 -AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum CodecID id)
94 +AVCodec *FFMPEGLibrary::AvcodecFindDecoder(enum AVCodecID id)
96 WaitAndSignal m(processLock);
99 return Favcodec_alloc_frame();
102 -int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec)
103 +int FFMPEGLibrary::AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options)
105 WaitAndSignal m(processLock);
107 diff -ur opal-3.10.11.org/plugins/video/common/dyna.h opal-3.10.11/plugins/video/common/dyna.h
108 --- opal-3.10.11.org/plugins/video/common/dyna.h 2013-08-15 01:22:47.000000000 +0200
109 +++ opal-3.10.11/plugins/video/common/dyna.h 2018-09-29 11:58:52.681123038 +0200
114 - FFMPEGLibrary(CodecID codec);
115 + FFMPEGLibrary(AVCodecID codec);
120 - AVCodec *AvcodecFindEncoder(enum CodecID id);
121 - AVCodec *AvcodecFindDecoder(enum CodecID id);
122 + AVCodec *AvcodecFindEncoder(enum AVCodecID id);
123 + AVCodec *AvcodecFindDecoder(enum AVCodecID id);
124 AVCodecContext *AvcodecAllocContext(void);
125 AVFrame *AvcodecAllocFrame(void);
126 - int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec);
127 + int AvcodecOpen(AVCodecContext *ctx, AVCodec *codec, AVDictionary **options);
128 int AvcodecClose(AVCodecContext *ctx);
129 int AvcodecEncodeVideo(AVCodecContext *ctx, BYTE *buf, int buf_size, const AVFrame *pict);
130 int AvcodecDecodeVideo(AVCodecContext *ctx, AVFrame *pict, int *got_picture_ptr, BYTE *buf, int buf_size);
131 @@ -117,15 +117,15 @@
132 DynaLink m_libAvcodec;
133 DynaLink m_libAvutil;
137 char m_codecString[32];
139 void (*Favcodec_init)(void);
140 void (*Fav_init_packet)(AVPacket *pkt);
142 void (*Favcodec_register_all)(void);
143 - AVCodec *(*Favcodec_find_encoder)(enum CodecID id);
144 - AVCodec *(*Favcodec_find_decoder)(enum CodecID id);
145 + AVCodec *(*Favcodec_find_encoder)(enum AVCodecID id);
146 + AVCodec *(*Favcodec_find_decoder)(enum AVCodecID id);
147 AVCodecContext *(*Favcodec_alloc_context)(void);
148 AVFrame *(*Favcodec_alloc_frame)(void);
149 int (*Favcodec_open)(AVCodecContext *ctx, AVCodec *codec);
150 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
151 --- opal-3.10.11.org/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2013-08-15 01:22:47.000000000 +0200
152 +++ opal-3.10.11/plugins/video/common/ffmpeg/libavcodec/avcodec.h 2018-09-29 11:58:31.047147254 +0200
154 * 1. no value of a existing codec ID changes (that would break ABI),
155 * 2. it is as close as possible to similar codecs.
162 @@ -1390,7 +1390,7 @@
165 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
166 - enum CodecID codec_id; /* see CODEC_ID_xxx */
167 + enum AVCodecID codec_id; /* see CODEC_ID_xxx */
170 * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
171 @@ -2843,7 +2843,7 @@
174 enum AVMediaType type;
178 int (*init)(AVCodecContext *);
179 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
180 @@ -2898,7 +2898,7 @@
188 * Supported pixel format.
189 @@ -3402,10 +3402,10 @@
191 * Find a registered encoder with a matching codec ID.
193 - * @param id CodecID of the requested encoder
194 + * @param id AVCodecID of the requested encoder
195 * @return An encoder if one was found, NULL otherwise.
197 -AVCodec *avcodec_find_encoder(enum CodecID id);
198 +AVCodec *avcodec_find_encoder(enum AVCodecID id);
201 * Find a registered encoder with the specified name.
202 @@ -3418,10 +3418,10 @@
204 * Find a registered decoder with a matching codec ID.
206 - * @param id CodecID of the requested decoder
207 + * @param id AVCodecID of the requested decoder
208 * @return A decoder if one was found, NULL otherwise.
210 -AVCodec *avcodec_find_decoder(enum CodecID id);
211 +AVCodec *avcodec_find_decoder(enum AVCodecID id);
214 * Find a registered decoder with the specified name.
215 @@ -3822,7 +3822,7 @@
216 * @param[in] codec_id the codec
217 * @return Number of bits per sample or zero if unknown for the given codec.
219 -int av_get_bits_per_sample(enum CodecID codec_id);
220 +int av_get_bits_per_sample(enum AVCodecID codec_id);
222 #if FF_API_OLD_SAMPLE_FMT
224 diff -ur opal-3.10.11.org/plugins/video/common/ffmpeg.h opal-3.10.11/plugins/video/common/ffmpeg.h
225 --- opal-3.10.11.org/plugins/video/common/ffmpeg.h 2013-08-15 01:22:47.000000000 +0200
226 +++ opal-3.10.11/plugins/video/common/ffmpeg.h 2018-09-29 11:58:52.681123038 +0200
228 #include "platform.h"
230 #include "libavcodec/avcodec.h"
231 +#include "libavutil/imgutils.h"
232 // AVPacket was declared in avformat.h before April 2009
233 #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0)
234 #include "libavformat/avformat.h"
235 diff -ur opal-3.10.11.org/plugins/video/common/mpi.cxx opal-3.10.11/plugins/video/common/mpi.cxx
236 --- opal-3.10.11.org/plugins/video/common/mpi.cxx 2013-08-15 01:22:47.000000000 +0200
237 +++ opal-3.10.11/plugins/video/common/mpi.cxx 2018-09-29 12:00:33.957463916 +0200
239 // to the desired one or matches it
240 for (i=0; i < MPIs.size(); i++) {
241 // we square the value in order to get absolute distances
242 - distance = ( abs(MPIs[i].width - desiredWidth ) *
243 - abs(MPIs[i].height - desiredHeight) );
244 + distance = ( abs((int)(MPIs[i].width - desiredWidth )) *
245 + abs((int)(MPIs[i].height - desiredHeight)) );
247 if (distance < minDistance) {
248 minDistance = distance;
249 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
250 --- opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.cxx 2013-08-15 01:22:47.000000000 +0200
251 +++ opal-3.10.11/plugins/video/H.263-1998/h263-1998.cxx 2018-09-29 11:59:17.348522238 +0200
255 #include "h263-1998.h"
258 +#include <libavutil/opt.h>
266 #define MAX_H263_CUSTOM_SIZES 10
267 -#define DEFAULT_CUSTOM_MPI "0,0,"STRINGIZE(PLUGINCODEC_MPI_DISABLED)
268 +#define DEFAULT_CUSTOM_MPI "0,0," STRINGIZE(PLUGINCODEC_MPI_DISABLED)
270 static struct StdSizes {
273 { CIF16_WIDTH, CIF16_HEIGHT, PLUGINCODEC_CIF16_MPI },
276 -static FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H263P);
277 +static FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H263P);
280 /////////////////////////////////////////////////////////////////////////////
282 PTRACE(4, m_prefix, "Encoder closed");
285 -bool H263_Base_EncoderContext::Init(CodecID codecId)
286 +bool H263_Base_EncoderContext::Init(AVCodecID codecId)
288 PTRACE(5, m_prefix, "Opening encoder");
290 @@ -230,11 +234,10 @@
292 m_context->opaque = this;
294 - m_context->flags = CODEC_FLAG_EMU_EDGE // don't draw edges
295 - | CODEC_FLAG_TRUNCATED // Possible missing packets
296 + m_context->flags = AV_CODEC_FLAG_TRUNCATED // Possible missing packets
299 - m_context->pix_fmt = PIX_FMT_YUV420P;
300 + m_context->pix_fmt = AV_PIX_FMT_YUV420P;
301 m_context->gop_size = H263_KEY_FRAME_INTERVAL;
303 // X-Lite does not like Custom Picture frequency clocks... stick to 29.97Hz
306 // works with eyeBeam, signaled via non-standard "D"
307 if (atoi(value) == 1)
308 - m_context->flags |= CODEC_FLAG_H263P_UMV;
309 + av_opt_set_int(m_context->priv_data, "umv", 1, 0);
311 - m_context->flags &= ~CODEC_FLAG_H263P_UMV;
312 + av_opt_set_int(m_context->priv_data, "umv", 0, 0);
317 // Annex F: Advanced Prediction Mode
318 // does not work with eyeBeam
319 if (atoi(value) == 1)
320 - m_context->flags |= CODEC_FLAG_OBMC;
321 + av_opt_set_int(m_context->priv_data, "obmc", 1, 0);
323 - m_context->flags &= ~CODEC_FLAG_OBMC;
324 + av_opt_set_int(m_context->priv_data, "obmc", 0, 0);
330 // works with eyeBeam
331 if (atoi(value) == 1)
332 - m_context->flags |= CODEC_FLAG_AC_PRED;
333 + m_context->flags |= AV_CODEC_FLAG_AC_PRED;
335 - m_context->flags &= ~CODEC_FLAG_AC_PRED;
336 + m_context->flags &= ~AV_CODEC_FLAG_AC_PRED;
341 // Annex J: Deblocking Filter
342 // works with eyeBeam
343 if (atoi(value) == 1)
344 - m_context->flags |= CODEC_FLAG_LOOP_FILTER;
345 + m_context->flags |= AV_CODEC_FLAG_LOOP_FILTER;
347 - m_context->flags &= ~CODEC_FLAG_LOOP_FILTER;
348 + m_context->flags &= ~AV_CODEC_FLAG_LOOP_FILTER;
353 // Annex K: Slice Structure
354 // does not work with eyeBeam
355 if (atoi(value) != 0)
356 - m_context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
357 + av_opt_set_int(m_context->priv_data, "structured_slices", 1, 0);
359 - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
360 + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0);
365 // Annex S: Alternative INTER VLC mode
366 // does not work with eyeBeam
367 if (atoi(value) == 1)
368 - m_context->flags |= CODEC_FLAG_H263P_AIV;
369 + av_opt_set_int(m_context->priv_data, "aiv", 1, 0);
371 - m_context->flags &= ~CODEC_FLAG_H263P_AIV;
372 + av_opt_set_int(m_context->priv_data, "aiv", 0, 0);
377 m_context->qcompress = 0.5; // qscale factor between easy & hard scenes (0.0-1.0)
379 // Lagrange multipliers - this is how the context defaults do it:
380 - m_context->lmin = m_context->qmin * FF_QP2LAMBDA;
381 - m_context->lmax = m_context->qmax * FF_QP2LAMBDA;
382 + av_opt_set_int(m_context->priv_data, "lmin", m_context->qmin * FF_QP2LAMBDA, 0);
383 + av_opt_set_int(m_context->priv_data, "lmax", m_context->qmax * FF_QP2LAMBDA, 0);
386 m_inputFrame->linesize[0] = m_context->width;
388 m_inputFrame->data[1] = m_inputFrame->data[0] + planeSize;
389 m_inputFrame->data[2] = m_inputFrame->data[1] + (planeSize / 4);
391 - if (m_context->width > 352)
392 - m_context->flags &= ~CODEC_FLAG_EMU_EDGE; // Totally bizarre! FFMPEG crashes if on for CIF4
395 PTRACE(5, m_prefix, "Size is " << m_context->width << "x" << m_context->height);
396 PTRACE(5, m_prefix, "GOP is " << m_context->gop_size);
398 PTRACE(5, m_prefix, "qmax set to " << m_context->qmax);
399 PTRACE(5, m_prefix, "payload size set to " << m_context->rtp_payload_size);
401 - #define CODEC_TRACER_FLAG(tracer, flag) \
402 - PTRACE(4, m_prefix, #flag " is " << ((m_context->flags & flag) ? "enabled" : "disabled"));
403 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_UMV);
404 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_OBMC);
405 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_AC_PRED);
406 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_SLICE_STRUCT)
407 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_LOOP_FILTER);
408 - CODEC_TRACER_FLAG(tracer, CODEC_FLAG_H263P_AIV);
410 - return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) == 0;
411 + return FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) == 0;
414 void H263_Base_EncoderContext::CloseCodec()
417 // Need to copy to local buffer to guarantee 16 byte alignment
418 memcpy(m_inputFrame->data[0], OPAL_VIDEO_FRAME_DATA_PTR(header), header->width*header->height*3/2);
419 - m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? FF_I_TYPE : AV_PICTURE_TYPE_NONE;
420 + m_inputFrame->pict_type = (flags & PluginCodec_CoderForceIFrame) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE;
423 m_inputFrame->pts = (int64_t)srcRTP.GetTimestamp()*m_context->time_base.den/m_context->time_base.num/VIDEO_CLOCKRATE;
426 bool H263_RFC2190_EncoderContext::Init()
428 - if (!H263_Base_EncoderContext::Init(CODEC_ID_H263))
429 + if (!H263_Base_EncoderContext::Init(AV_CODEC_ID_H263))
432 #if LIBAVCODEC_RTP_MODE
433 @@ -603,13 +594,13 @@
434 m_context->rtp_callback = &H263_RFC2190_EncoderContext::RTPCallBack;
435 m_context->opaque = this; // used to separate out packets from different encode threads
437 - m_context->flags &= ~CODEC_FLAG_H263P_UMV;
438 - m_context->flags &= ~CODEC_FLAG_4MV;
439 + av_opt_set_int(m_context->priv_data, "umv", 0, 0);
440 + m_context->flags &= ~AV_CODEC_FLAG_4MV;
441 #if LIBAVCODEC_RTP_MODE
442 m_context->flags &= ~CODEC_FLAG_H263P_AIC;
444 - m_context->flags &= ~CODEC_FLAG_H263P_AIV;
445 - m_context->flags &= ~CODEC_FLAG_H263P_SLICE_STRUCT;
446 + av_opt_set_int(m_context->priv_data, "aiv", 0, 0);
447 + av_opt_set_int(m_context->priv_data, "structured_slices", 0, 0);
453 bool H263_RFC2429_EncoderContext::Init()
455 - return H263_Base_EncoderContext::Init(CODEC_ID_H263P);
456 + return H263_Base_EncoderContext::Init(AV_CODEC_ID_H263P);
461 if (!FFMPEGLibraryInstance.Load())
464 - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H263)) == NULL) {
465 + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H263)) == NULL) {
466 PTRACE(1, m_prefix, "Codec not found for decoder");
473 - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0) {
474 + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0) {
475 PTRACE(1, m_prefix, "Failed to open H.263 decoder");
478 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
479 --- opal-3.10.11.org/plugins/video/H.263-1998/h263-1998.h 2013-08-15 01:22:47.000000000 +0200
480 +++ opal-3.10.11/plugins/video/H.263-1998/h263-1998.h 2018-09-29 11:58:31.047147254 +0200
482 virtual ~H263_Base_EncoderContext();
484 virtual bool Init() = 0;
485 - virtual bool Init(CodecID codecId);
486 + virtual bool Init(AVCodecID codecId);
488 virtual bool SetOptions(const char * const * options);
489 virtual void SetOption(const char * option, const char * value);
490 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
491 --- opal-3.10.11.org/plugins/video/H.263-1998/Makefile.in 2013-08-15 01:22:47.000000000 +0200
492 +++ opal-3.10.11/plugins/video/H.263-1998/Makefile.in 2018-09-29 11:58:31.047147254 +0200
494 $(COMMONDIR)/dyna.cxx
496 CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
498 +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@
500 HAVE_LIBAVCODEC_RTP_MODE=@HAVE_LIBAVCODEC_RTP_MODE@
501 ifeq ($(HAVE_LIBAVCODEC_RTP_MODE),yes)
502 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
503 --- opal-3.10.11.org/plugins/video/H.263-1998/rfc2190.cxx 2013-08-15 01:22:47.000000000 +0200
504 +++ opal-3.10.11/plugins/video/H.263-1998/rfc2190.cxx 2018-09-29 12:00:01.429831294 +0200
513 const unsigned char PSC[3] = { 0x00, 0x00, 0x80 };
514 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
515 --- opal-3.10.11.org/plugins/video/H.263-1998/rfc2429.cxx 2013-08-15 01:22:47.000000000 +0200
516 +++ opal-3.10.11/plugins/video/H.263-1998/rfc2429.cxx 2018-09-29 11:59:17.348522238 +0200
519 unsigned char * RFC2429Frame::GetBuffer()
521 - memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , FF_INPUT_BUFFER_PADDING_SIZE);
522 + memset (m_encodedFrame.ptr + m_encodedFrame.pos,0 , AV_INPUT_BUFFER_PADDING_SIZE);
523 return (m_encodedFrame.ptr);
526 @@ -340,10 +340,10 @@
528 unsigned remBytes = packet.GetPayloadSize() - headerPLEN - (headerV ? 3 : 2);
530 - if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - FF_INPUT_BUFFER_PADDING_SIZE)) {
531 + if ((m_encodedFrame.pos + (headerP ? 2 : 0) + remBytes) > (m_maxFrameSize - AV_INPUT_BUFFER_PADDING_SIZE)) {
532 PTRACE(2, "H.263-RFC2429", "Trying to add " << remBytes
533 << " bytes to frame at position " << m_encodedFrame.pos + (headerP ? 2 : 0)
534 - << " bytes while maximum frame size is " << m_maxFrameSize << "-" << FF_INPUT_BUFFER_PADDING_SIZE << " bytes");
535 + << " bytes while maximum frame size is " << m_maxFrameSize << "-" << AV_INPUT_BUFFER_PADDING_SIZE << " bytes");
539 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
540 --- opal-3.10.11.org/plugins/video/H.264/gpl/h264_helper.cxx 2013-08-15 01:22:47.000000000 +0200
541 +++ opal-3.10.11/plugins/video/H.264/gpl/h264_helper.cxx 2018-09-29 11:58:31.047147254 +0200
545 #include <sys/stat.h>
550 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
551 --- opal-3.10.11.org/plugins/video/H.264/h264-x264.cxx 2013-08-15 01:22:47.000000000 +0200
552 +++ opal-3.10.11/plugins/video/H.264/h264-x264.cxx 2018-09-29 11:59:17.351855670 +0200
554 #include "plugin-config.h"
557 +#define FF_IDCT_H264 11
558 +#define CODEC_FLAG2_SKIP_RD 0x00004000
560 #include <codec/opalplugin.hpp>
562 #include "../common/ffmpeg.h"
565 ///////////////////////////////////////////////////////////////////////////////
567 -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_H264);
568 +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_H264);
570 PLUGINCODEC_CONTROL_LOG_FUNCTION_DEF
572 @@ -1064,27 +1067,23 @@
573 allows you to fail the create operation (return false), which cannot
574 be done in the normal C++ constructor. */
576 - if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_H264)) == NULL)
577 + if ((m_codec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_H264)) == NULL)
580 if ((m_context = FFMPEGLibraryInstance.AvcodecAllocContext()) == NULL)
583 m_context->workaround_bugs = FF_BUG_AUTODETECT;
584 - m_context->error_recognition = FF_ER_AGGRESSIVE;
585 m_context->idct_algo = FF_IDCT_H264;
586 m_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
587 - m_context->flags = CODEC_FLAG_INPUT_PRESERVED | CODEC_FLAG_EMU_EDGE;
588 - m_context->flags2 = CODEC_FLAG2_BRDO |
589 - CODEC_FLAG2_MEMC_ONLY |
590 - CODEC_FLAG2_DROP_FRAME_TIMECODE |
591 + m_context->flags2 = AV_CODEC_FLAG2_DROP_FRAME_TIMECODE |
592 CODEC_FLAG2_SKIP_RD |
593 - CODEC_FLAG2_CHUNKS;
594 + AV_CODEC_FLAG2_CHUNKS;
596 if ((m_picture = FFMPEGLibraryInstance.AvcodecAllocFrame()) == NULL)
599 - if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec) < 0)
600 + if (FFMPEGLibraryInstance.AvcodecOpen(m_context, m_codec, NULL) < 0)
603 PTRACE(4, MY_CODEC_LOG, "Opened decoder (SVN $Revision: 28048 $)");
604 @@ -1181,7 +1180,7 @@
606 uint8_t * src[3] = { m_picture->data[0], m_picture->data[1], m_picture->data[2] };
607 uint8_t * dst[3] = { OPAL_VIDEO_FRAME_DATA_PTR(videoHeader), dst[0] + ySize, dst[1] + uvSize };
608 - size_t dstLineSize[3] = { m_context->width, m_context->width/2, m_context->width/2 };
609 + size_t dstLineSize[3] = { (size_t)m_context->width, (size_t)m_context->width/2, (size_t)m_context->width/2 };
611 for (int y = 0; y < m_context->height; ++y) {
612 for (int plane = 0; plane < 3; ++plane) {
613 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
614 --- opal-3.10.11.org/plugins/video/H.264/shared/x264wrap.cxx 2013-08-15 01:22:47.000000000 +0200
615 +++ opal-3.10.11/plugins/video/H.264/shared/x264wrap.cxx 2018-09-29 11:58:31.047147254 +0200
618 #include <codec/opalplugin.hpp>
624 diff -ur opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/Makefile.in opal-3.10.11/plugins/video/MPEG4-ffmpeg/Makefile.in
625 --- opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/Makefile.in 2013-08-15 01:22:47.000000000 +0200
626 +++ opal-3.10.11/plugins/video/MPEG4-ffmpeg/Makefile.in 2018-09-29 11:58:31.047147254 +0200
628 SRCS := mpeg4.cxx $(COMMONDIR)/dyna.cxx
630 CFLAGS += @LIBAVCODEC_CFLAGS@ -I$(COMMONDIR)
632 +LIBS += @DL_LIBS@ @LIBAVUTIL_LIBS@
634 # Add LIBAVCODEC_SOURCE_DIR to the include path so we can #include <libavcodec/...h>
635 # Also add libavutil, so ffmpeg headers can #include "log.h".
636 diff -ur opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/mpeg4.cxx opal-3.10.11/plugins/video/MPEG4-ffmpeg/mpeg4.cxx
637 --- opal-3.10.11.org/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2013-08-15 01:22:47.000000000 +0200
638 +++ opal-3.10.11/plugins/video/MPEG4-ffmpeg/mpeg4.cxx 2018-09-29 11:59:17.351855670 +0200
641 #else /* LIBAVCODEC_HAVE_SOURCE_DIR */
642 #include "../common/ffmpeg.h"
643 +#include <libavutil/opt.h>
644 #endif /* LIBAVCODEC_HAVE_SOURCE_DIR */
651 -FFMPEGLibrary FFMPEGLibraryInstance(CODEC_ID_MPEG4);
652 +FFMPEGLibrary FFMPEGLibraryInstance(AV_CODEC_ID_MPEG4);
655 static bool mpeg4IsIframe (BYTE * frameBuffer, unsigned int frameLen )
659 void MPEG4EncoderContext::SetStaticEncodingParams(){
660 - m_avcontext->pix_fmt = PIX_FMT_YUV420P;
661 + m_avcontext->pix_fmt = AV_PIX_FMT_YUV420P;
662 m_avcontext->mb_decision = FF_MB_DECISION_SIMPLE; // high quality off
663 m_avcontext->rtp_payload_size = 750; // ffh263 uses 750
664 m_avcontext->rtp_callback = &MPEG4EncoderContext::RtpCallback;
665 @@ -547,19 +548,19 @@
666 // Reduce the difference in quantization between frames.
667 m_avcontext->qblur = 0.3f;
668 // default is tex^qComp; 1 is constant bitrate
669 - m_avcontext->rc_eq = (char*) "1";
670 - //avcontext->rc_eq = "tex^qComp";
671 + av_opt_set(m_avcontext->priv_data, "rc_eq", (char*) "1", 0);
672 + //av_opt_set(m_avcontext->priv_data, "rc_eq", "tex^qComp", 0);
673 // These ones technically could be dynamic, I think
674 m_avcontext->rc_min_rate = 0;
675 // This is set to 0 in ffmpeg.c, the command-line utility.
676 - m_avcontext->rc_initial_cplx = 0.0f;
677 + av_opt_set_double(m_avcontext->priv_data, "rc_init_cplx", 0.0f, 0);
679 // And this is set to 1.
680 // It seems to affect how aggressively the library will raise and lower
681 // quantization to keep bandwidth constant. Except it's in reference to
682 // the "vbv buffer", not bits per second, so nobody really knows how
684 - m_avcontext->rc_buffer_aggressivity = 1.0f;
685 + av_opt_set_double(m_avcontext->priv_data, "rc_buf_aggressivity", 1.0f, 0);
687 // Ratecontrol buffer size, in bits. Usually 0.5-1 second worth.
688 // 224 kbyte is what VLC uses, and it seems to fix the quantization pulse (at Level 5)
689 @@ -589,17 +590,16 @@
690 m_avpicture->quality = m_videoQMin;
693 - m_avcontext->flags |= CODEC_FLAG_PART; // data partitioning
694 + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0);
695 m_avcontext->flags |= CODEC_FLAG_4MV; // 4 motion vectors
697 m_avcontext->max_b_frames=0; /*don't use b frames*/
698 - m_avcontext->flags|=CODEC_FLAG_AC_PRED;
699 - m_avcontext->flags|=CODEC_FLAG_H263P_UMV;
700 + m_avcontext->flags|=AV_CODEC_FLAG_AC_PRED;
701 + av_opt_set_int(m_avcontext->priv_data, "umv", 1, 0);
702 /*c->flags|=CODEC_FLAG_QPEL;*/ /*don't enable this one: this forces profile_level to advanced simple profile */
703 - m_avcontext->flags|=CODEC_FLAG_4MV;
704 - m_avcontext->flags|=CODEC_FLAG_GMC;
705 - m_avcontext->flags|=CODEC_FLAG_LOOP_FILTER;
706 - m_avcontext->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
707 + m_avcontext->flags|=AV_CODEC_FLAG_4MV;
708 + m_avcontext->flags|=AV_CODEC_FLAG_LOOP_FILTER;
709 + av_opt_set_int(m_avcontext->priv_data, "structured_slices", 1, 0);
711 m_avcontext->opaque = this; // for use in RTP callback
714 m_avcontext->qmax = std::min( m_avcontext->qmax, 31);
716 // Lagrange multipliers - this is how the context defaults do it:
717 - m_avcontext->lmin = m_avcontext->qmin * FF_QP2LAMBDA;
718 - m_avcontext->lmax = m_avcontext->qmax * FF_QP2LAMBDA;
719 + av_opt_set_int(m_avcontext->priv_data, "lmin", m_avcontext->qmin * FF_QP2LAMBDA, 0);
720 + av_opt_set_int(m_avcontext->priv_data, "lmax", m_avcontext->qmax * FF_QP2LAMBDA, 0);
722 // If framesize has changed or is not yet initialized, fix it up
723 if((unsigned)m_avcontext->width != m_frameWidth || (unsigned)m_avcontext->height != m_frameHeight) {
726 delete[] m_rawFrameBuffer;
728 - m_rawFrameBuffer = new BYTE[m_rawFrameLen + FF_INPUT_BUFFER_PADDING_SIZE];
729 + m_rawFrameBuffer = new BYTE[m_rawFrameLen + AV_INPUT_BUFFER_PADDING_SIZE];
731 if (m_encFrameBuffer)
734 m_encFrameBuffer = new BYTE[m_encFrameLen];
736 // Clear the back padding
737 - memset(m_rawFrameBuffer + m_rawFrameLen, 0, FF_INPUT_BUFFER_PADDING_SIZE);
738 + memset(m_rawFrameBuffer + m_rawFrameLen, 0, AV_INPUT_BUFFER_PADDING_SIZE);
739 const unsigned fsz = m_frameWidth * m_frameHeight;
740 m_avpicture->data[0] = m_rawFrameBuffer; // luminance
741 m_avpicture->data[1] = m_rawFrameBuffer + fsz; // first chroma channel
746 - if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(CODEC_ID_MPEG4)) == NULL){
747 + if((m_avcodec = FFMPEGLibraryInstance.AvcodecFindEncoder(AV_CODEC_ID_MPEG4)) == NULL){
748 PTRACE(1, "MPEG4", "Encoder not found");
751 @@ -713,13 +713,15 @@
752 if (PTRACE_CHECK(4)) {
753 m_avcontext->debug |= FF_DEBUG_RC;
754 m_avcontext->debug |= FF_DEBUG_PICT_INFO;
755 - m_avcontext->debug |= FF_DEBUG_MV;
756 +// m_avcontext->debug |= FF_DEBUG_MV;
760 SetStaticEncodingParams();
761 SetDynamicEncodingParams(false); // don't force a restart, it's not open
762 - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0)
763 + AVDictionary *opts = NULL;
764 + av_dict_set_int(&opts, "gmc", 1, 0);
765 + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, &opts) < 0)
767 PTRACE(1, "MPEG4", "Encoder could not be opened");
770 // Should the next frame be an I-Frame?
771 if ((flags & PluginCodec_CoderForceIFrame) || (m_frameNum == 0))
773 - m_avpicture->pict_type = FF_I_TYPE;
774 + m_avpicture->pict_type = AV_PICTURE_TYPE_I;
776 else // No IFrame requested, let avcodec decide what to do
778 @@ -1324,8 +1326,8 @@
781 void MPEG4DecoderContext::SetStaticDecodingParams() {
782 - m_avcontext->flags |= CODEC_FLAG_4MV;
783 - m_avcontext->flags |= CODEC_FLAG_PART;
784 + m_avcontext->flags |= AV_CODEC_FLAG_4MV;
785 + av_opt_set_int(m_avcontext->priv_data, "data_partitionin", 1, 0);
786 m_avcontext->workaround_bugs = 0; // no workaround for buggy implementations
789 @@ -1394,7 +1396,7 @@
791 bool MPEG4DecoderContext::OpenCodec()
793 - if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(CODEC_ID_MPEG4)) == NULL) {
794 + if ((m_avcodec = FFMPEGLibraryInstance.AvcodecFindDecoder(AV_CODEC_ID_MPEG4)) == NULL) {
795 PTRACE(1, "MPEG4", "Decoder not found for encoder");
798 @@ -1415,7 +1417,7 @@
800 SetStaticDecodingParams();
801 SetDynamicDecodingParams(false); // don't force a restart, it's not open
802 - if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec) < 0) {
803 + if (FFMPEGLibraryInstance.AvcodecOpen(m_avcontext, m_avcodec, NULL) < 0) {
804 PTRACE(1, "MPEG4", "Decoder failed to open");
807 diff -ur opal-3.10.11.org/src/im/msrp.cxx opal-3.10.11/src/im/msrp.cxx
808 --- opal-3.10.11.org/src/im/msrp.cxx 2013-08-15 01:22:57.000000000 +0200
809 +++ opal-3.10.11/src/im/msrp.cxx 2018-09-29 11:58:07.796456792 +0200
814 - PStringStream str; str << ::setfill('\r') << mime.PrintContents(str);
815 + PStringStream str; str << ::setfill('\r');
816 + mime.PrintContents(str);
817 PTRACE(4, "Sending MSRP REPORT\n" << "MSRP " << chunkId << " " << MSRPCommands[REPORT] << CRLF
818 << "To-Path: " << toUrl << CRLF
819 << "From-Path: "<< fromUrl << CRLF
820 diff -ur opal-3.10.11.org/src/sip/sipep.cxx opal-3.10.11/src/sip/sipep.cxx
821 --- opal-3.10.11.org/src/sip/sipep.cxx 2013-08-15 01:22:51.000000000 +0200
822 +++ opal-3.10.11/src/sip/sipep.cxx 2018-09-29 11:58:07.796456792 +0200
824 if (!AddConnection(connection))
827 - if (remoteParty.Find(";OPAL-"OPAL_SIP_REFERRED_CONNECTION) == P_MAX_INDEX)
828 + if (remoteParty.Find(";OPAL-" OPAL_SIP_REFERRED_CONNECTION) == P_MAX_INDEX)
829 otherConnection->Release(OpalConnection::EndedByCallForwarded);
831 otherConnection->SetPhase(OpalConnection::ForwardingPhase);