summaryrefslogtreecommitdiff
path: root/libavformat/au.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-10 10:18:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-10 10:18:35 +0100
commit70a65ecabff00a8330a56ceb51b15d10cb5b5389 (patch)
tree5d50bdef5dee2f182203f0b4d05e5dad013d37a1 /libavformat/au.c
parentf023003ce610a8fd6377cf4a8e98002ac3117ef4 (diff)
parent9a7b56883d1333cdfcdf0fa7584a333841b86114 (diff)
Merge commit '9a7b56883d1333cdfcdf0fa7584a333841b86114'
* commit '9a7b56883d1333cdfcdf0fa7584a333841b86114': au: set bit rate au: validate bits-per-sample separately from codec tag rtpdec_vp8: Mark broken packets with AV_PKT_FLAG_CORRUPT Conflicts: libavformat/au.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/au.c')
-rw-r--r--libavformat/au.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/au.c b/libavformat/au.c
index 2e54a185ff..6d1d9abc52 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -66,10 +66,11 @@ static int au_probe(AVProbeData *p)
/* au input */
static int au_read_header(AVFormatContext *s)
{
- int size, bps, data_size = 0;
+ int size, data_size = 0;
unsigned int tag;
AVIOContext *pb = s->pb;
unsigned int id, channels, rate;
+ int bps;
enum AVCodecID codec;
AVStream *st;
@@ -91,7 +92,13 @@ static int au_read_header(AVFormatContext *s)
codec = ff_codec_get_id(codec_au_tags, id);
- if (!(bps = av_get_bits_per_sample(codec))) {
+ if (codec == AV_CODEC_ID_NONE) {
+ av_log_ask_for_sample(s, "unknown or unsupported codec tag: %d\n", id);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ bps = av_get_bits_per_sample(codec);
+ if (!bps) {
av_log_ask_for_sample(s, "could not determine bits per sample\n");
return AVERROR_PATCHWELCOME;
}
@@ -115,6 +122,7 @@ static int au_read_header(AVFormatContext *s)
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
+ st->codec->bit_rate = channels * rate * bps;
st->codec->block_align = FFMAX(bps * st->codec->channels / 8, 1);
if (data_size != AU_UNKNOWN_SIZE)
st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * (int64_t)bps);