X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fau.c;h=4afee85a948e3a1787efd42457e05395a8724bd4;hb=dfb0b9370d3621ab1f603e7bb8e142b1f6996562;hp=520824fc123ac11b31a1800da29e711fda3042cb;hpb=b4ca32414ea28ad29b4bd387c298f5a676dace2a;p=ffmpeg diff --git a/libavformat/au.c b/libavformat/au.c index 520824fc123..4afee85a948 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -57,7 +57,7 @@ static const AVCodecTag codec_au_tags[] = { #if CONFIG_AU_DEMUXER -static int au_probe(AVProbeData *p) +static int au_probe(const AVProbeData *p) { if (p->buf[0] == '.' && p->buf[1] == 's' && p->buf[2] == 'n' && p->buf[3] == 'd') @@ -140,7 +140,7 @@ static int au_read_header(AVFormatContext *s) unsigned int tag; AVIOContext *pb = s->pb; unsigned int id, channels, rate; - int bps; + int bps, ba = 0; enum AVCodecID codec; AVStream *st; @@ -178,6 +178,7 @@ static int au_read_header(AVFormatContext *s) } else { const uint8_t bpcss[] = {4, 0, 3, 5}; av_assert0(id >= 23 && id < 23 + 4); + ba = bpcss[id - 23]; bps = bpcss[id - 23]; } } else if (!bps) { @@ -205,7 +206,7 @@ static int au_read_header(AVFormatContext *s) st->codecpar->sample_rate = rate; st->codecpar->bits_per_coded_sample = bps; st->codecpar->bit_rate = channels * rate * bps; - st->codecpar->block_align = FFMAX(bps * st->codecpar->channels / 8, 1); + st->codecpar->block_align = ba ? ba : FFMAX(bps * st->codecpar->channels / 8, 1); if (data_size != AU_UNKNOWN_SIZE) st->duration = (((int64_t)data_size)<<3) / (st->codecpar->channels * (int64_t)bps); @@ -310,7 +311,6 @@ static int au_write_header(AVFormatContext *s) } else { avio_wb64(pb, 0); /* annotation field */ } - avio_flush(pb); return 0; } @@ -326,7 +326,6 @@ static int au_write_trailer(AVFormatContext *s) avio_seek(pb, 8, SEEK_SET); avio_wb32(pb, (uint32_t)(file_size - au->header_size)); avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } return 0;