[MPlayer-dev-eng] [PATCH] Support for MPEG2 video in MP4 files
Moritz Bunkus
moritz at bunkus.org
Thu Nov 11 22:33:43 CET 2004
Hey,
MP4 files usually contain MPEG4 video and AAC audio, but other types are
possible, too. The distinction is NOT made with the FourCC (which is
always 'mp4a' and 'mp4v') but with the 'object type identifier' in the
elementary stream descriptor.
Mplayer supports MP3 with one particular OTI (object type identifier),
but not MPEG2 video so far. This patch add this and introduces some
#defines for a couple of OTI (see
http://gpac.sourceforge.net/tutorial/mediatypes.htm).
I can provide a sample that needs at least the last hunk of this patch.
If noone objects I'll apply this on Monday.
Mosu
--
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
-------------- next part --------------
Index: libmpdemux/parse_mp4.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/parse_mp4.h,v
retrieving revision 1.2
diff -u -u -r1.2 parse_mp4.h
--- libmpdemux/parse_mp4.h 24 Mar 2002 06:10:13 -0000 1.2
+++ libmpdemux/parse_mp4.h 11 Nov 2004 21:30:51 -0000
@@ -30,6 +30,26 @@
#define MP4ExtDescrTagsStart 0x80
#define MP4ExtDescrTagsEnd 0xFE
+/* object type identifiers in the ESDS */
+/* See http://gpac.sourceforge.net/tutorial/mediatypes.htm */
+#define MP4OTI_MPEG4Systems1 0x01
+#define MP4OTI_MPEG4Systems2 0x02
+#define MP4OTI_MPEG4Visual 0x20
+#define MP4OTI_MPEG4Audio 0x40
+#define MP4OTI_MPEG2VisualSimple 0x60
+#define MP4OTI_MPEG2VisualMain 0x61
+#define MP4OTI_MPEG2VisualSNR 0x62
+#define MP4OTI_MPEG2VisualSpatial 0x63
+#define MP4OTI_MPEG2VisualHigh 0x64
+#define MP4OTI_MPEG2Visual422 0x65
+#define MP4OTI_MPEG2AudioMain 0x66
+#define MP4OTI_MPEG2AudioLowComplexity 0x67
+#define MP4OTI_MPEG2AudioScaleableSamplingRate 0x68
+#define MP4OTI_MPEG2AudioPart3 0x69
+#define MP4OTI_MPEG1Visual 0x6A
+#define MP4OTI_MPEG1Audio 0x6B
+#define MP4OTI_JPEG 0x6C
+
/* I define uint24 here for better understanding */
#ifndef uint24_t
#define uint24_t uint32_t
Index: libmpdemux/demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.108
diff -u -u -r1.108 demux_mov.c
--- libmpdemux/demux_mov.c 13 Sep 2004 21:21:47 -0000 1.108
+++ libmpdemux/demux_mov.c 11 Nov 2004 21:30:52 -0000
@@ -946,7 +946,7 @@
sh->i_bps = esds.avgBitrate/8;
// printf("######## audio format = %d ########\n",esds.objectTypeId);
- if(esds.objectTypeId==107)
+ if(esds.objectTypeId==MP4OTI_MPEG1Audio || esds.objectTypeId==MP4OTI_MPEG2AudioPart3)
sh->format=0x55; // .mp3
// dump away the codec specific configuration for the AAC decoder
@@ -1103,6 +1103,11 @@
esds_t esds;
if(!mp4_parse_esds(trak->stdata+pos+8, atom_len-8, &esds)) {
+ if(esds.objectTypeId==MP4OTI_MPEG2VisualSimple || esds.objectTypeId==MP4OTI_MPEG2VisualMain ||
+ esds.objectTypeId==MP4OTI_MPEG2VisualSNR || esds.objectTypeId==MP4OTI_MPEG2VisualSpatial ||
+ esds.objectTypeId==MP4OTI_MPEG2VisualHigh || esds.objectTypeId==MP4OTI_MPEG2Visual422)
+ sh->format=mmioFOURCC('m', 'p', 'g', '2');
+
// dump away the codec specific configuration for the AAC decoder
trak->stream_header_len = esds.decoderConfigLen;
trak->stream_header = (unsigned char *)malloc(trak->stream_header_len);
More information about the MPlayer-dev-eng
mailing list