summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demux/demux_lavf.c3
-rw-r--r--player/command.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 9559c73260..0d33219dd9 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -477,7 +477,10 @@ static void handle_stream(demuxer_t *demuxer, int i)
else
sh_video->aspect = codec->width * codec->sample_aspect_ratio.num
/ (float)(codec->height * codec->sample_aspect_ratio.den);
+
sh_video->bitrate = codec->bit_rate;
+ if (sh_video->bitrate == 0)
+ sh_video->bitrate = avfc->bit_rate;
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
if (rot && rot->value) {
diff --git a/player/command.c b/player/command.c
index 35738e1efb..6f1a769a20 100644
--- a/player/command.c
+++ b/player/command.c
@@ -105,7 +105,10 @@ static void mark_seek(struct MPContext *mpctx)
static char *format_bitrate(int rate)
{
- return talloc_asprintf(NULL, "%d kbps", rate / 1000);
+ if (rate < 1024 * 1024)
+ return talloc_asprintf(NULL, "%.3f kbps", rate * 8.0 / 1000.0);
+
+ return talloc_asprintf(NULL, "%.3f mbps", rate * 8.0 / 1000000.0);
}
static char *format_file_size(int64_t size)