[FFmpeg-cvslog] au: reuse the result of the previous call to av_get_bits_per_sample()
Stefano Sabatini
git at videolan.org
Thu Jul 21 13:11:10 CEST 2011
ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Mon Jul 18 14:02:07 2011 +0200| [daa62372293a265d8885be94ffd3f243ed1adb91] | committer: Stefano Sabatini
au: reuse the result of the previous call to av_get_bits_per_sample()
Avoid an unnecessary call to the function, slighlty more
robust/readable.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=daa62372293a265d8885be94ffd3f243ed1adb91
---
libavformat/au.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/au.c b/libavformat/au.c
index 5934428..870f46f 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -120,7 +120,7 @@ static int au_probe(AVProbeData *p)
static int au_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- int size, data_size = 0;
+ int size, bps, data_size = 0;
unsigned int tag;
AVIOContext *pb = s->pb;
unsigned int id, channels, rate;
@@ -145,7 +145,7 @@ static int au_read_header(AVFormatContext *s,
codec = ff_codec_get_id(codec_au_tags, id);
- if (!av_get_bits_per_sample(codec)) {
+ if (!(bps = av_get_bits_per_sample(codec))) {
av_log_ask_for_sample(s, "could not determine bits per sample\n");
return AVERROR_INVALIDDATA;
}
@@ -164,7 +164,7 @@ static int au_read_header(AVFormatContext *s,
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
- st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * av_get_bits_per_sample(codec));
+ st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * bps);
av_set_pts_info(st, 64, 1, rate);
return 0;
}
More information about the ffmpeg-cvslog
mailing list