Mercurial > libavformat.hg
changeset 5540:7828124f41d6 libavformat
use codec rc_max_rate if set and warn if bit rate is not set
author | bcoudurier |
---|---|
date | Wed, 13 Jan 2010 22:23:29 +0000 |
parents | 445ebebedeaf |
children | 79e17d3fdc9e |
files | mpegtsenc.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegtsenc.c Wed Jan 13 22:21:45 2010 +0000 +++ b/mpegtsenc.c Wed Jan 13 22:23:29 2010 +0000 @@ -425,7 +425,16 @@ if (st->codec->codec_type == CODEC_TYPE_VIDEO && service->pcr_pid == 0x1fff) service->pcr_pid = ts_st->pid; - total_bit_rate += st->codec->bit_rate; + if (st->codec->rc_max_rate) + total_bit_rate += st->codec->rc_max_rate; + else { + if (!st->codec->bit_rate) { + av_log(s, AV_LOG_WARNING, + "stream %d, bit rate is not set, this will cause problems\n", + st->index); + } + total_bit_rate += st->codec->bit_rate; + } /* PES header size */ if (st->codec->codec_type == CODEC_TYPE_VIDEO || st->codec->codec_type == CODEC_TYPE_SUBTITLE) {