summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjraivio@cc.hut.fi <tjraivio@cc.hut.fi>2005-02-16 23:14:38 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-02-16 23:14:38 +0000
commit8536ab896443f75291252f47a590d05b901fb983 (patch)
treeab2c004da859c9934f4566c97d7842e5a532998b
parent0078e9b9c5ea90ce51bc4a0c1eaff32167256d4d (diff)
quick patch for adding 3g2 support to ffmpeg (muxer and demuxer). No movie fragment support yet patch by (tjraivio cc.hut fi)
Originally committed as revision 3959 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/movenc.c23
2 files changed, 23 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 62286930b3..1378b97ec5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2239,7 +2239,7 @@ static int mov_read_close(AVFormatContext *s)
}
static AVInputFormat mov_iformat = {
- "mov,mp4,m4a,3gp",
+ "mov,mp4,m4a,3gp,3g2",
"QuickTime/MPEG4 format",
sizeof(MOVContext),
mov_probe,
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 39069b3dc5..85965786f9 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -32,6 +32,7 @@
#define MODE_3GP 2
#define MODE_PSP 3 // example working PSP command line:
// ffmpeg -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
+#define MODE_3G2 4
typedef struct MOVIentry {
unsigned int flags, pos, size;
@@ -1210,6 +1211,8 @@ int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
if ( mov->mode == MODE_3GP )
put_tag(pb, "3gp4");
+ else if ( mov->mode == MODE_3G2 )
+ put_tag(pb, "3g2a");
else if ( mov->mode == MODE_PSP )
put_tag(pb, "MSNV");
else
@@ -1219,6 +1222,8 @@ int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
if ( mov->mode == MODE_3GP )
put_tag(pb, "3gp4");
+ else if ( mov->mode == MODE_3G2 )
+ put_tag(pb, "3g2a");
else if ( mov->mode == MODE_PSP )
put_tag(pb, "MSNV");
else
@@ -1311,10 +1316,12 @@ static int mov_write_header(AVFormatContext *s)
if (s->oformat != NULL) {
if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP;
+ else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2;
else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
- if ( mov->mode == MODE_3GP || mov->mode == MODE_MP4 || mov->mode == MODE_PSP )
+ if ( mov->mode == MODE_3GP || mov->mode == MODE_3G2 ||
+ mov->mode == MODE_MP4 || mov->mode == MODE_PSP )
mov_write_ftyp_tag(pb,s);
if ( mov->mode == MODE_PSP ) {
if ( s->nb_streams != 2 ) {
@@ -1509,11 +1516,25 @@ static AVOutputFormat psp_oformat = {
mov_write_trailer,
};
+static AVOutputFormat _3g2_oformat = {
+ "3g2",
+ "3gp2 format",
+ NULL,
+ "3g2",
+ sizeof(MOVContext),
+ CODEC_ID_AMR_NB,
+ CODEC_ID_H263,
+ mov_write_header,
+ mov_write_packet,
+ mov_write_trailer,
+};
+
int movenc_init(void)
{
av_register_output_format(&mov_oformat);
av_register_output_format(&_3gp_oformat);
av_register_output_format(&mp4_oformat);
av_register_output_format(&psp_oformat);
+ av_register_output_format(&_3g2_oformat);
return 0;
}