summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-09-04 21:04:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-09-04 21:04:25 +0000
commit302c389e4f825395e2580d6303ad26eb6ac0dffa (patch)
treef6571c74c0c9afae5a4eb5f3f8e643d014928576 /libavformat/mov.c
parent3723f01c141b5ef95c06a1721ac861564db2140f (diff)
sample_rate value is not always correct (is there anything in quicktime which is?) so try to guess it from time_scale
Originally committed as revision 4558 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 72f3ee392a..e050dddc5f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -781,7 +781,7 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
- //MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;
+ MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;
int entries, frames_per_sample;
uint32_t format;
uint8_t codec_name[32];
@@ -1071,6 +1071,9 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
st->codec->bits_per_sample = get_be16(pb); /* bits per sample */
get_be32(pb);
st->codec->sample_rate = get_be16(pb); /* sample rate, not always correct */
+ if(st->codec->sample_rate == 1) //nonsese rate? -> ignore
+ st->codec->sample_rate= 0;
+
get_be16(pb);
c->mp4=1;
@@ -1196,6 +1199,10 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
}
}
}
+
+ if(st->codec->codec_type==CODEC_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) {
+ st->codec->sample_rate= sc->time_scale;
+ }
return 0;
}