From 6e58b20cced05c303f1b35d5baa5f79b8ad612f5 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Mon, 26 May 2014 20:16:40 +0200 Subject: audio: change values from bytes-per-second to bits-per-second The i_bps members of the sh_audio and dev_video structs are mostly used for displaying the average audio and video bitrates. Keeping them in bits-per-second avoids truncating them to bytes-per-second and changing them back lateron. --- demux/demux_lavf.c | 4 ++-- demux/demux_raw.c | 2 +- demux/stheader.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'demux') diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 2b43f4f27f..75e6cb41f0 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -433,7 +433,7 @@ static void handle_stream(demuxer_t *demuxer, int i) if (codec->channel_layout) mp_chmap_from_lavc(&sh_audio->channels, codec->channel_layout); sh_audio->samplerate = codec->sample_rate; - sh_audio->i_bps = codec->bit_rate / 8; + sh_audio->i_bps = codec->bit_rate; export_replaygain(demuxer, st); @@ -477,7 +477,7 @@ 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->i_bps = codec->bit_rate / 8; + sh_video->i_bps = codec->bit_rate; AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0); if (rot && rot->value) { diff --git a/demux/demux_raw.c b/demux/demux_raw.c index 3c605e3f96..ceb5d7bf30 100644 --- a/demux/demux_raw.c +++ b/demux/demux_raw.c @@ -179,7 +179,7 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check) sh_video->fps = fps; sh_video->disp_w = width; sh_video->disp_h = height; - sh_video->i_bps = fps * imgsize; + sh_video->i_bps = fps * imgsize * 8; struct priv *p = talloc_ptrtype(demuxer, p); demuxer->priv = p; diff --git a/demux/stheader.h b/demux/stheader.h index 99dc35832a..c8a72795b0 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -67,7 +67,7 @@ struct sh_stream { typedef struct sh_audio { int samplerate; struct mp_chmap channels; - int i_bps; // == bitrate (compressed bytes/sec) + int i_bps; // == bitrate (compressed bits/sec) // win32-compatible codec parameters: MP_WAVEFORMATEX *wf; // note codec extradata may be either under "wf" or "codecdata" @@ -79,7 +79,7 @@ typedef struct sh_video { bool avi_dts; // use DTS timing; first frame and DTS is 0 float fps; // frames per second (set only if constant fps) float aspect; // aspect ratio stored in the file (for prescaling) - int i_bps; // == bitrate (compressed bytes/sec) + int i_bps; // == bitrate (compressed bits/sec) int disp_w, disp_h; // display size int rotate; // intended display rotation, in degrees, [0, 359] MP_BITMAPINFOHEADER *bih; -- cgit v1.2.3