[Ffmpeg-cvslog] CVS: ffmpeg/libavformat mov.c,1.90,1.91

Michael Niedermayer CVS michael
Sun Sep 4 23:04:27 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv14700

Modified Files:
	mov.c 
Log Message:
sample_rate value is not always correct (is there anything in quicktime which is?) so try to guess it from time_scale


Index: mov.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/mov.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- mov.c	19 Jul 2005 14:41:08 -0000	1.90
+++ mov.c	4 Sep 2005 21:04:25 -0000	1.91
@@ -781,7 +781,7 @@
 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 @@
                 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 @@
             }
         }
     }
+    
+    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;
 }





More information about the ffmpeg-cvslog mailing list