1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-19 13:21:13 +00:00

vd_lavc: set video bitrate if available

Set the bitrate of dec_video if it is available in avcodec.
This commit is contained in:
Marcoen Hirschberg 2014-05-27 16:45:19 +02:00 committed by wm4
parent 1fa48a2452
commit ecea66e8dc

View File

@ -281,6 +281,10 @@ static int init(struct dec_video *vd, const char *decoder)
return 0;
}
}
if (ctx->avctx->bit_rate != 0)
vd->bitrate = ctx->avctx->bit_rate;
return 1;
}
@ -321,6 +325,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
ctx->hwdec_fmt = 0;
ctx->avctx = avcodec_alloc_context3(lavc_codec);
AVCodecContext *avctx = ctx->avctx;
avctx->bit_rate = 0;
avctx->opaque = vd;
avctx->codec_type = AVMEDIA_TYPE_VIDEO;
avctx->codec_id = lavc_codec->id;