changeset 1152:c7cf3d1f9bd7 libavformat

simplify and write correct values conforming to specs
author bcoudurier
date Thu, 06 Jul 2006 14:38:50 +0000
parents bf808f3f7f46
children 6cb1c11cc363
files movenc.c
diffstat 1 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/movenc.c	Thu Jul 06 12:27:43 2006 +0000
+++ b/movenc.c	Thu Jul 06 14:38:50 2006 +0000
@@ -200,29 +200,17 @@
     return updateSize (pb, pos);
 }
 
-static int mov_write_damr_tag(ByteIOContext *pb)
+static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track)
 {
     put_be32(pb, 0x11); /* size */
-    put_tag(pb, "damr");
+    if (track->mode == MODE_MOV) put_tag(pb, "samr");
+    else                         put_tag(pb, "damr");
     put_tag(pb, "FFMP");
-    put_byte(pb, 0);
-
-    //put_be16(pb, 0x80); /* Mode set (all modes for AMR_NB) */
-    //put_be16(pb, 0xa); /* Mode change period (no restriction) */
-    put_be16(pb, 0x81ff); /* Mode set (all modes for AMR_NB) */
-    put_be16(pb, 1); /* Mode change period (no restriction) */
-    return 0x11;
-}
-
-static int mov_write_samr_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0x11); /* size */
-    put_tag(pb, "samr");
-    put_tag(pb, "FFMP");
-    put_byte(pb, 1);
+    put_byte(pb, 0); /* decoder version */
 
     put_be16(pb, 0x80); /* Mode set (all modes for AMR_NB) */
-    put_be16(pb, 0x5); /* Mode change period (no restriction) */
+    put_byte(pb, 0x00); /* Mode change period (no restriction) */
+    put_byte(pb, 0x01); /* Frames per sample */
     return 0x11;
 }
 
@@ -322,7 +310,7 @@
                track->enc->codec_id == CODEC_ID_PCM_S32LE) {
         mov_write_enda_tag(pb);
     } else if (track->enc->codec_id == CODEC_ID_AMR_NB) {
-        mov_write_samr_tag(pb);
+        mov_write_amr_tag(pb, track);
     }
 
     put_be32(pb, 8);     /* size */
@@ -404,7 +392,7 @@
     else if(track->enc->codec_id == CODEC_ID_AAC)
         mov_write_esds_tag(pb, track);
     else if(track->enc->codec_id == CODEC_ID_AMR_NB)
-        mov_write_damr_tag(pb);
+        mov_write_amr_tag(pb, track);
 
     return updateSize (pb, pos);
 }