summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2006-07-06 14:38:50 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2006-07-06 14:38:50 +0000
commitb7d9da100d3006674d07e06ad21aa6c9586e0e9b (patch)
tree045bfead4fff0f31a33e2e6b121f4a844411122c /libavformat/movenc.c
parent62a05b5b009ae49a220e739102b440fc13cb9418 (diff)
simplify and write correct values conforming to specs
Originally committed as revision 5640 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 77b74b57a6..be0bfe4431 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -200,29 +200,17 @@ static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack* track)
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 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack* track)
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 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
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);
}