mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca'
* commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca': mpegenc: use the CPB props side data Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
commit
079b5d4ef8
|
@ -338,6 +338,8 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
||||||
lpcm_id = LPCM_ID;
|
lpcm_id = LPCM_ID;
|
||||||
|
|
||||||
for (i = 0; i < ctx->nb_streams; i++) {
|
for (i = 0; i < ctx->nb_streams; i++) {
|
||||||
|
AVCPBProperties *props;
|
||||||
|
|
||||||
st = ctx->streams[i];
|
st = ctx->streams[i];
|
||||||
stream = av_mallocz(sizeof(StreamInfo));
|
stream = av_mallocz(sizeof(StreamInfo));
|
||||||
if (!stream)
|
if (!stream)
|
||||||
|
@ -389,8 +391,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
||||||
stream->id = h264_id++;
|
stream->id = h264_id++;
|
||||||
else
|
else
|
||||||
stream->id = mpv_id++;
|
stream->id = mpv_id++;
|
||||||
if (st->codec->rc_buffer_size)
|
|
||||||
stream->max_buffer_size = 6 * 1024 + st->codec->rc_buffer_size / 8;
|
props = (AVCPBProperties*)av_stream_get_side_data(st, AV_PKT_DATA_CPB_PROPERTIES, NULL);
|
||||||
|
if (props && props->buffer_size)
|
||||||
|
stream->max_buffer_size = 6 * 1024 + props->buffer_size / 8;
|
||||||
else {
|
else {
|
||||||
av_log(ctx, AV_LOG_WARNING,
|
av_log(ctx, AV_LOG_WARNING,
|
||||||
"VBV buffer size not set, using default size of 130KB\n"
|
"VBV buffer size not set, using default size of 130KB\n"
|
||||||
|
@ -422,13 +426,14 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
||||||
audio_bitrate = 0;
|
audio_bitrate = 0;
|
||||||
video_bitrate = 0;
|
video_bitrate = 0;
|
||||||
for (i = 0; i < ctx->nb_streams; i++) {
|
for (i = 0; i < ctx->nb_streams; i++) {
|
||||||
|
AVCPBProperties *props;
|
||||||
int codec_rate;
|
int codec_rate;
|
||||||
st = ctx->streams[i];
|
st = ctx->streams[i];
|
||||||
stream = (StreamInfo *)st->priv_data;
|
stream = (StreamInfo *)st->priv_data;
|
||||||
|
|
||||||
if (st->codec->rc_max_rate ||
|
props = (AVCPBProperties*)av_stream_get_side_data(st, AV_PKT_DATA_CPB_PROPERTIES, NULL);
|
||||||
st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
if (props)
|
||||||
codec_rate = st->codec->rc_max_rate;
|
codec_rate = props->max_bitrate;
|
||||||
else
|
else
|
||||||
codec_rate = st->codec->bit_rate;
|
codec_rate = st->codec->bit_rate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue