mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit '936f0d98f864f9f6bb4f9e5458b78537e146bacd'
* commit '936f0d98f864f9f6bb4f9e5458b78537e146bacd': lavc: Move rtp_payload_size to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
commit
899e19f177
|
@ -2653,12 +2653,16 @@ typedef struct AVCodecContext {
|
||||||
void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
|
void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FF_API_PRIVATE_OPT
|
||||||
|
/** @deprecated use encoder private options instead */
|
||||||
|
attribute_deprecated
|
||||||
int rtp_payload_size; /* The size of the RTP payload: the coder will */
|
int rtp_payload_size; /* The size of the RTP payload: the coder will */
|
||||||
/* do its best to deliver a chunk with size */
|
/* do its best to deliver a chunk with size */
|
||||||
/* below rtp_payload_size, the chunk will start */
|
/* below rtp_payload_size, the chunk will start */
|
||||||
/* with a start code on some codecs like H.263. */
|
/* with a start code on some codecs like H.263. */
|
||||||
/* This doesn't take account of any particular */
|
/* This doesn't take account of any particular */
|
||||||
/* headers inside the transmitted RTP payload. */
|
/* headers inside the transmitted RTP payload. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FF_API_STAT_BITS
|
#if FF_API_STAT_BITS
|
||||||
/* statistics, used for 2-pass encoding */
|
/* statistics, used for 2-pass encoding */
|
||||||
|
|
|
@ -203,16 +203,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
param.uiMaxNalSize = s->max_nal_size;
|
param.uiMaxNalSize = s->max_nal_size;
|
||||||
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = s->max_nal_size;
|
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = s->max_nal_size;
|
||||||
} else {
|
} else {
|
||||||
if (avctx->rtp_payload_size) {
|
av_log(avctx, AV_LOG_ERROR, "Invalid -max_nal_size, "
|
||||||
av_log(avctx,AV_LOG_DEBUG,"Using RTP Payload size for uiMaxNalSize");
|
"specify a valid max_nal_size to use -slice_mode dyn\n");
|
||||||
param.uiMaxNalSize = avctx->rtp_payload_size;
|
|
||||||
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = avctx->rtp_payload_size;
|
|
||||||
} else {
|
|
||||||
av_log(avctx,AV_LOG_ERROR,"Invalid -max_nal_size, specify a valid max_nal_size to use -slice_mode dyn\n");
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((*s->encoder)->InitializeExt(s->encoder, ¶m) != cmResultSuccess) {
|
if ((*s->encoder)->InitializeExt(s->encoder, ¶m) != cmResultSuccess) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
|
av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
|
||||||
|
|
|
@ -675,16 +675,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
if (x4->slice_max_size >= 0)
|
if (x4->slice_max_size >= 0)
|
||||||
x4->params.i_slice_max_size = x4->slice_max_size;
|
x4->params.i_slice_max_size = x4->slice_max_size;
|
||||||
else {
|
|
||||||
/*
|
|
||||||
* Allow x264 to be instructed through AVCodecContext about the maximum
|
|
||||||
* size of the RTP payload. For example, this enables the production of
|
|
||||||
* payload suitable for the H.264 RTP packetization-mode 0 i.e. single
|
|
||||||
* NAL unit per RTP packet.
|
|
||||||
*/
|
|
||||||
if (avctx->rtp_payload_size)
|
|
||||||
x4->params.i_slice_max_size = avctx->rtp_payload_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x4->fastfirstpass)
|
if (x4->fastfirstpass)
|
||||||
x264_param_apply_fastfirstpass(&x4->params);
|
x264_param_apply_fastfirstpass(&x4->params);
|
||||||
|
|
|
@ -481,6 +481,7 @@ typedef struct MpegEncContext {
|
||||||
|
|
||||||
/* RTP specific */
|
/* RTP specific */
|
||||||
int rtp_mode;
|
int rtp_mode;
|
||||||
|
int rtp_payload_size;
|
||||||
|
|
||||||
char *tc_opt_str; ///< timecode option string
|
char *tc_opt_str; ///< timecode option string
|
||||||
AVTimecode tc; ///< timecode context
|
AVTimecode tc; ///< timecode context
|
||||||
|
@ -646,6 +647,7 @@ FF_MPV_OPT_CMP_FUNC, \
|
||||||
{"sc_threshold", "Scene change threshold", FF_MPV_OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
|
{"sc_threshold", "Scene change threshold", FF_MPV_OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
|
||||||
{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
|
{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
|
||||||
{"mpeg_quant", "Use MPEG quantizers instead of H.263", FF_MPV_OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS }, \
|
{"mpeg_quant", "Use MPEG quantizers instead of H.263", FF_MPV_OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS }, \
|
||||||
|
{"ps", "RTP payload size in bytes", FF_MPV_OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
|
||||||
|
|
||||||
extern const AVOption ff_mpv_generic_options[];
|
extern const AVOption ff_mpv_generic_options[];
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,14 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8);
|
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->bit_rate = avctx->bit_rate;
|
||||||
s->width = avctx->width;
|
s->width = avctx->width;
|
||||||
s->height = avctx->height;
|
s->height = avctx->height;
|
||||||
|
@ -369,7 +377,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||||
s->codec_id = avctx->codec->id;
|
s->codec_id = avctx->codec->id;
|
||||||
s->strict_std_compliance = avctx->strict_std_compliance;
|
s->strict_std_compliance = avctx->strict_std_compliance;
|
||||||
s->quarter_sample = (avctx->flags & AV_CODEC_FLAG_QPEL) != 0;
|
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;
|
s->intra_dc_precision = avctx->intra_dc_precision;
|
||||||
|
|
||||||
// workaround some differences between how applications specify dc precision
|
// workaround some differences between how applications specify dc precision
|
||||||
|
@ -3023,7 +3031,9 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
||||||
|
|
||||||
current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
|
current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
|
||||||
|
|
||||||
is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0;
|
is_gob_start = s->rtp_payload_size &&
|
||||||
|
current_packet_size >= s->rtp_payload_size &&
|
||||||
|
mb_y + mb_x > 0;
|
||||||
|
|
||||||
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
|
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ static const AVOption avcodec_options[] = {
|
||||||
#endif
|
#endif
|
||||||
#if FF_API_PRIVATE_OPT
|
#if FF_API_PRIVATE_OPT
|
||||||
{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
|
{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
|
||||||
#endif
|
|
||||||
{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
|
{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
|
||||||
|
#endif
|
||||||
#if FF_API_STAT_BITS
|
#if FF_API_STAT_BITS
|
||||||
{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||||
{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||||
|
|
Loading…
Reference in New Issue