diff mov.c @ 258:59c2e84817a1 libavformat

AMR-WB support by (Johannes Carlsson <joca at rixmail dot se>)
author michaelni
date Sun, 28 Sep 2003 20:34:11 +0000
parents efb35207fb1b
children 8bb470d85249
line wrap: on
line diff
--- a/mov.c	Fri Sep 26 00:10:21 2003 +0000
+++ b/mov.c	Sun Sep 28 20:34:11 2003 +0000
@@ -121,6 +121,7 @@
     { CODEC_ID_AAC, MKTAG('m', 'p', '4', 'a') }, /* MPEG 4 AAC or audio ? */
     /* The standard for mpeg4 audio is still not normalised AFAIK anyway */
     { CODEC_ID_AMR_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
+    { CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 3gp */
     { CODEC_ID_NONE, 0 },
 };
 
@@ -850,10 +851,10 @@
 #endif
 	} else {
             st->codec.codec_id = codec_get_id(mov_audio_tags, format);
-	    if(st->codec.codec_id==CODEC_ID_AMR_NB) //from TS26.244
+	    if(st->codec.codec_id==CODEC_ID_AMR_NB || st->codec.codec_id==CODEC_ID_AMR_WB) //from TS26.244
 	    {
 #ifdef DEBUG
-               printf("AMR-NB audio identified!!\n");
+               printf("AMR-NB or AMR-WB audio identified!!\n");
 #endif
                get_be32(pb);get_be32(pb); //Reserved_8
                get_be16(pb);//Reserved_2
@@ -863,41 +864,26 @@
                get_be16(pb);//Reserved_2
 
                 //AMRSpecificBox.(10 bytes)
-                
-#ifdef DEBUG
-               int damr_size=
-#endif
+               
                get_be32(pb); //size
-#ifdef DEBUG
-               int damr_type=
-#endif
                get_be32(pb); //type=='damr'
-#ifdef DEBUG
-               int damr_vendor=
-#endif
                get_be32(pb); //vendor
                get_byte(pb); //decoder version
                get_be16(pb); //mode_set
                get_byte(pb); //mode_change_period
                get_byte(pb); //frames_per_sample
 
-#ifdef DEBUG
-               printf("Audio: damr_type=%c%c%c%c damr_size=%d damr_vendor=%c%c%c%c\n",
-                       (damr_type >> 24) & 0xff,
-                       (damr_type >> 16) & 0xff,
-                       (damr_type >> 8) & 0xff,
-                       (damr_type >> 0) & 0xff,
-		       damr_size, 
-                       (damr_vendor >> 24) & 0xff,
-                       (damr_vendor >> 16) & 0xff,
-                       (damr_vendor >> 8) & 0xff,
-                       (damr_vendor >> 0) & 0xff
-		       );
-#endif
-
                st->duration = AV_NOPTS_VALUE;//Not possible to get from this info, must count number of AMR frames
-               st->codec.sample_rate=8000;
-               st->codec.channels=1;
+               if(st->codec.codec_id==CODEC_ID_AMR_NB)
+               {
+                   st->codec.sample_rate=8000;
+                   st->codec.channels=1;
+               }
+               else //AMR-WB
+               {
+                   st->codec.sample_rate=16000;
+                   st->codec.channels=1;
+               }
                st->codec.bits_per_sample=16;
                st->codec.bit_rate=0; /*It is not possible to tell this before we have 
                                        an audio frame and even then every frame can be different*/