mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
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.
This commit is contained in:
parent
633aa01f72
commit
daa6237229
@ -120,7 +120,7 @@ static int au_probe(AVProbeData *p)
|
|||||||
static int au_read_header(AVFormatContext *s,
|
static int au_read_header(AVFormatContext *s,
|
||||||
AVFormatParameters *ap)
|
AVFormatParameters *ap)
|
||||||
{
|
{
|
||||||
int size, data_size = 0;
|
int size, bps, data_size = 0;
|
||||||
unsigned int tag;
|
unsigned int tag;
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
unsigned int id, channels, rate;
|
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);
|
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");
|
av_log_ask_for_sample(s, "could not determine bits per sample\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ static int au_read_header(AVFormatContext *s,
|
|||||||
st->codec->codec_id = codec;
|
st->codec->codec_id = codec;
|
||||||
st->codec->channels = channels;
|
st->codec->channels = channels;
|
||||||
st->codec->sample_rate = rate;
|
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);
|
av_set_pts_info(st, 64, 1, rate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user