changeset 3619:bd4b7c8fec83 libavformat

move version specific parsing code before codec specific code, will be needed
author bcoudurier
date Sat, 02 Aug 2008 03:35:43 +0000
parents e77025bff589
children a52f6dd66490
files mov.c
diffstat 1 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mov.c	Fri Aug 01 23:12:10 2008 +0000
+++ b/mov.c	Sat Aug 02 03:35:43 2008 +0000
@@ -848,6 +848,26 @@
 
             st->codec->sample_rate = ((get_be32(pb) >> 16));
 
+            //Read QT version 1 fields. In version 0 these do not exist.
+            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);
+            if(!c->isom) {
+                if(version==1) {
+                    sc->samples_per_frame = get_be32(pb);
+                    get_be32(pb); /* bytes per packet */
+                    sc->bytes_per_frame = get_be32(pb);
+                    get_be32(pb); /* bytes per sample */
+                } else if(version==2) {
+                    get_be32(pb); /* sizeof struct only */
+                    st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
+                    st->codec->channels = get_be32(pb);
+                    get_be32(pb); /* always 0x7F000000 */
+                    get_be32(pb); /* bits per channel if sound is uncompressed */
+                    get_be32(pb); /* lcpm format specific flag */
+                    get_be32(pb); /* bytes per audio packet if constant */
+                    get_be32(pb); /* lpcm frames per audio packet if constant */
+                }
+            }
+
             switch (st->codec->codec_id) {
             case CODEC_ID_PCM_S8:
             case CODEC_ID_PCM_U8:
@@ -882,26 +902,6 @@
                 break;
             }
 
-            //Read QT version 1 fields. In version 0 these do not exist.
-            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);
-            if(!c->isom) {
-                if(version==1) {
-                    sc->samples_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per packet */
-                    sc->bytes_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per sample */
-                } else if(version==2) {
-                    get_be32(pb); /* sizeof struct only */
-                    st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
-                    st->codec->channels = get_be32(pb);
-                    get_be32(pb); /* always 0x7F000000 */
-                    get_be32(pb); /* bits per channel if sound is uncompressed */
-                    get_be32(pb); /* lcpm format specific flag */
-                    get_be32(pb); /* bytes per audio packet if constant */
-                    get_be32(pb); /* lpcm frames per audio packet if constant */
-                }
-            }
-
             bits_per_sample = av_get_bits_per_sample(st->codec->codec_id);
             if (bits_per_sample) {
                 st->codec->bits_per_sample = bits_per_sample;