From: Derek Buitenhuis Date: Sun, 31 Jan 2016 13:19:50 +0000 (+0000) Subject: Merge commit '936f0d98f864f9f6bb4f9e5458b78537e146bacd' X-Git-Tag: n3.1-dev~230 X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/899e19f1776c607c126b291a7e0a614782f18f42 Merge commit '936f0d98f864f9f6bb4f9e5458b78537e146bacd' * commit '936f0d98f864f9f6bb4f9e5458b78537e146bacd': lavc: Move rtp_payload_size to codec private options Merged-by: Derek Buitenhuis --- 899e19f1776c607c126b291a7e0a614782f18f42 diff --cc libavcodec/mpegvideo.h index 62cedf0,ea8da57..5836afd --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@@ -481,13 -465,9 +481,14 @@@ typedef struct MpegEncContext /* RTP specific */ int rtp_mode; + int rtp_payload_size; + char *tc_opt_str; ///< timecode option string + AVTimecode tc; ///< timecode context + uint8_t *ptr_lastgob; + int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped + int pack_pblocks; //xvmc needs to keep blocks without gaps. int16_t (*pblocks[12])[64]; int16_t (*block)[64]; ///< points to one of the following blocks diff --cc libavcodec/mpegvideo_enc.c index dd3b4c6,fbbbb00..fde3fd8 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@@ -347,7 -294,13 +347,15 @@@ av_cold int ff_mpv_encode_init(AVCodecC break; } + avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8); ++ + #if FF_API_PRIVATE_OPT + FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->rtp_payload_size) + s->rtp_payload_size = avctx->rtp_payload_size; + FF_ENABLE_DEPRECATION_WARNINGS + #endif + s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; @@@ -369,26 -320,8 +377,26 @@@ s->codec_id = avctx->codec->id; s->strict_std_compliance = avctx->strict_std_compliance; s->quarter_sample = (avctx->flags & AV_CODEC_FLAG_QPEL) != 0; - s->rtp_mode = !!avctx->rtp_payload_size; + s->rtp_mode = !!s->rtp_payload_size; s->intra_dc_precision = avctx->intra_dc_precision; + + // workaround some differences between how applications specify dc precision + if (s->intra_dc_precision < 0) { + s->intra_dc_precision += 8; + } else if (s->intra_dc_precision >= 8) + s->intra_dc_precision -= 8; + + if (s->intra_dc_precision < 0) { + av_log(avctx, AV_LOG_ERROR, + "intra dc precision must be positive, note some applications use" + " 0 and some 8 as base meaning 8bit, the value must not be smaller than that\n"); + return AVERROR(EINVAL); + } + + if (s->intra_dc_precision > (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 3 : 0)) { + av_log(avctx, AV_LOG_ERROR, "intra dc precision too large\n"); + return AVERROR(EINVAL); + } s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) {