Mercurial > audlegacy
changeset 201:f2dc045d2327 trunk
[svn] libmp4v2 goes back to the future
line wrap: on
line diff
--- a/Plugins/Input/aac/libmp4v2/INTERNALS Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/INTERNALS Thu Nov 17 14:01:18 2005 -0800 @@ -50,12 +50,17 @@ any combination of properties, other atoms, or descriptors. The mp4atom files contain the base class for all the atoms, and provide -generic functions that cover most cases. However, each atom has it's own -subclass contained in file atom_<name>.cpp, where <name> is the four -letter name of the atom defined in the MP4 specification. Typically this -atom file just specifies the properties of the atom or the possible child -atoms in the case of a container atom. In more specialized cases the atom -specific file provides routines to initialize, read, or write the atom. +generic functions that cover most cases. Most atoms are covered in +atom_standard.cpp. Atoms that have a special read, generation or +write needs are contained in their subclass contained in file atom_<name>.cpp, + where <name> is the four letter name of the atom defined in the MP4 +specification. + +Atoms that only specifies the properties of the atom or the possible child +atoms in the case of a container atom are located in atom_standard.cpp. + +In more specialized cases the atom specific file provides routines to +initialize, read, or write the atom. Properties are the atomic pieces of information. The basic types of properties are integers, floats, strings, and byte arrays. For integers @@ -103,6 +108,15 @@ Note that internally when performance matters the code looks up a property by name once, and then stores the returned pointer to the property class. +To add an atom, first you should see if an existing atom exists that +can be used. If not, you need to decide if special read/write or +generate properties need to be established; for example a property in the atom +changes other properties (adds, or subtracts). If there are no +special cases, add the atom properties to atom_standard.cpp. If there +are special properties, add a new file, add a new class to atoms.h, and +add the class to MP4Atom::CreateAtom in mp4atom.cpp. + + Generic Tracks ==============
--- a/Plugins/Input/aac/libmp4v2/Makefile.am Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/Makefile.am Thu Nov 17 14:01:18 2005 -0800 @@ -1,6 +1,6 @@ INCLUDES = -I../include -I. -noinst_LTLIBRARIES = libmp4v2.la +lib_LTLIBRARIES = libmp4v2.la include_HEADERS = mp4.h @@ -9,87 +9,42 @@ atom_amr.cpp \ atom_avc1.cpp \ atom_avcC.cpp \ - atom_bitr.cpp \ - atom_btrt.cpp \ - atom_co64.cpp \ - atom_cprt.cpp \ - atom_ctts.cpp \ atom_d263.cpp \ atom_damr.cpp \ - atom_dimm.cpp \ - atom_dinf.cpp \ - atom_dmax.cpp \ - atom_dmed.cpp \ atom_dref.cpp \ - atom_drep.cpp \ - atom_edts.cpp \ atom_elst.cpp \ atom_enca.cpp \ atom_encv.cpp \ - atom_esds.cpp \ atom_free.cpp \ - atom_frma.cpp \ atom_ftyp.cpp \ atom_hdlr.cpp \ atom_hinf.cpp \ - atom_hmhd.cpp \ atom_hnti.cpp \ - atom_iods.cpp \ - atom_iKMS.cpp \ - atom_iSFM.cpp \ - atom_maxr.cpp \ + atom_href.cpp \ atom_mdat.cpp \ atom_mdhd.cpp \ - atom_mdia.cpp \ atom_meta.cpp \ - atom_mfhd.cpp \ - atom_minf.cpp \ - atom_moof.cpp \ - atom_moov.cpp \ atom_mp4a.cpp \ atom_mp4s.cpp \ atom_mp4v.cpp \ - atom_mvex.cpp \ atom_mvhd.cpp \ - atom_nmhd.cpp \ - atom_nump.cpp \ - atom_payt.cpp \ - atom_pmax.cpp \ atom_root.cpp \ atom_rtp.cpp \ atom_s263.cpp \ - atom_schi.cpp \ - atom_schm.cpp \ atom_sdp.cpp \ atoms.h \ - atom_sinf.cpp \ - atom_smhd.cpp \ atom_smi.cpp \ - atom_snro.cpp \ atom_sound.cpp \ + atom_standard.cpp \ atom_stbl.cpp \ - atom_stco.cpp \ atom_stdp.cpp \ atom_stsc.cpp \ atom_stsd.cpp \ - atom_stsh.cpp \ - atom_stss.cpp \ atom_stsz.cpp \ - atom_stts.cpp \ atom_tfhd.cpp \ - atom_tims.cpp \ atom_tkhd.cpp \ - atom_tmax.cpp \ - atom_tmin.cpp \ - atom_tpyl.cpp \ - atom_traf.cpp \ - atom_trak.cpp \ - atom_tref.cpp \ atom_treftype.cpp \ - atom_trex.cpp \ - atom_trpy.cpp \ atom_trun.cpp \ - atom_tsro.cpp \ atom_udta.cpp \ atom_url.cpp \ atom_urn.cpp \
--- a/Plugins/Input/aac/libmp4v2/README Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/README Thu Nov 17 14:01:18 2005 -0800 @@ -17,14 +17,12 @@ The test and util subdirectories contain some simple programs that use this library. +Once make install is run, to use this library, you should: To use this library in your application, it should be sufficient to: -1) add mpeg4ip/include and mpeg4ip/lib/mp4v2 to your INCLUDE path, - e.g. gcc -Impeg4ip/include -Impeg4ip/lib/mp4v2 ... +1) add the installed library to your final link: + e.g. gcc ... -o foo foo.cpp -lmp4v2 -2) add mpeg4ip/lib/mp4v2/libmp4v2.la (or /usr/local/lib/libmp4v2.la) - e.g. gcc ... -o foo foo.cpp mpeg4ip/lib/mp4v2/libmp4v2.a - -3) include mp4.h into your code, +2) include mp4.h into your code, e.g. #include <mp4.h>
--- a/Plugins/Input/aac/libmp4v2/atom_free.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/atom_free.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -37,7 +37,13 @@ bool use64 = (GetSize() > (0xFFFFFFFF - 8)); BeginWrite(use64); +#if 1 + for (uint64_t ix = 0; ix < GetSize(); ix++) { + m_pFile->WriteUInt8(0); + } +#else m_pFile->SetPosition(m_pFile->GetPosition() + GetSize()); +#endif FinishWrite(use64); }
--- a/Plugins/Input/aac/libmp4v2/atom_meta.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/atom_meta.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -23,15 +23,6 @@ #include "mp4common.h" -MP4MetaAtom::MP4MetaAtom() - : MP4Atom("meta") -{ - AddVersionAndFlags(); /* 0, 1 */ - - ExpectChildAtom("hdlr", Required, OnlyOne); - ExpectChildAtom("ilst", Required, OnlyOne); -} - MP4MeanAtom::MP4MeanAtom() : MP4Atom("mean") { @@ -84,114 +75,3 @@ MP4Atom::Read(); } -MP4IlstAtom::MP4IlstAtom() - : MP4Atom("ilst") -{ - ExpectChildAtom("\251nam", Optional, OnlyOne); /* name */ - ExpectChildAtom("\251ART", Optional, OnlyOne); /* artist */ - ExpectChildAtom("\251wrt", Optional, OnlyOne); /* writer */ - ExpectChildAtom("\251alb", Optional, OnlyOne); /* album */ - ExpectChildAtom("\251day", Optional, OnlyOne); /* date */ - ExpectChildAtom("\251too", Optional, OnlyOne); /* tool */ - ExpectChildAtom("\251cmt", Optional, OnlyOne); /* comment */ - ExpectChildAtom("\251gen", Optional, OnlyOne); /* custom genre */ - ExpectChildAtom("trkn", Optional, OnlyOne); /* tracknumber */ - ExpectChildAtom("disk", Optional, OnlyOne); /* disknumber */ - ExpectChildAtom("gnre", Optional, OnlyOne); /* genre (ID3v1 index + 1) */ - ExpectChildAtom("cpil", Optional, OnlyOne); /* compilation */ - ExpectChildAtom("tmpo", Optional, OnlyOne); /* BPM */ - ExpectChildAtom("covr", Optional, OnlyOne); /* cover art */ - ExpectChildAtom("----", Optional, Many); /* ---- free form */ -} - -MP4DashAtom::MP4DashAtom() - : MP4Atom("----") -{ - ExpectChildAtom("mean", Required, OnlyOne); - ExpectChildAtom("name", Required, OnlyOne); - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4NamAtom::MP4NamAtom() - : MP4Atom("\251nam") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4ArtAtom::MP4ArtAtom() - : MP4Atom("\251ART") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4WrtAtom::MP4WrtAtom() - : MP4Atom("\251wrt") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4AlbAtom::MP4AlbAtom() - : MP4Atom("\251alb") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4CmtAtom::MP4CmtAtom() - : MP4Atom("\251cmt") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4TrknAtom::MP4TrknAtom() - : MP4Atom("trkn") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4DiskAtom::MP4DiskAtom() - : MP4Atom("disk") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4DayAtom::MP4DayAtom() - : MP4Atom("\251day") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4GenAtom::MP4GenAtom() - : MP4Atom("\251gen") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4TooAtom::MP4TooAtom() - : MP4Atom("\251too") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4GnreAtom::MP4GnreAtom() - : MP4Atom("gnre") -{ - ExpectChildAtom("data", Optional, OnlyOne); -} - -MP4CpilAtom::MP4CpilAtom() - : MP4Atom("cpil") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4TmpoAtom::MP4TmpoAtom() - : MP4Atom("tmpo") -{ - ExpectChildAtom("data", Required, OnlyOne); -} - -MP4CovrAtom::MP4CovrAtom() - : MP4Atom("covr") -{ - ExpectChildAtom("data", Required, OnlyOne); -}
--- a/Plugins/Input/aac/libmp4v2/atoms.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/atoms.h Thu Nov 17 14:01:18 2005 -0800 @@ -13,7 +13,7 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. @@ -24,6 +24,7 @@ * Contributor(s): * Dave Mackie dmackie@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com + * Bill May wmay@cisco.com */ #ifndef __MP4_ATOMS_INCLUDED__ @@ -51,56 +52,13 @@ void WriteAtomType(const char* type, bool onlyOne); }; -class MP4FtypAtom : public MP4Atom { -public: - MP4FtypAtom(); - void Generate(); - void Read(); -}; - -class MP4MdatAtom : public MP4Atom { -public: - MP4MdatAtom(); - void Read(); - void Write(); -}; - -class MP4MoovAtom : public MP4Atom { -public: - MP4MoovAtom(); -}; - -class MP4MvhdAtom : public MP4Atom { -public: - MP4MvhdAtom(); - void Generate(); - void Read(); -protected: - void AddProperties(u_int8_t version); -}; - -class MP4IodsAtom : public MP4Atom { -public: - MP4IodsAtom(); -}; - -class MP4TrakAtom : public MP4Atom { -public: - MP4TrakAtom(); -}; - -class MP4TkhdAtom : public MP4Atom { -public: - MP4TkhdAtom(); - void Generate(); - void Read(); -protected: - void AddProperties(u_int8_t version); -}; - -class MP4TrefAtom : public MP4Atom { -public: - MP4TrefAtom(); +/*********************************************************************** + * Common atom classes - standard for anything that just contains atoms + * and non-maleable properties, treftype and url + ***********************************************************************/ +class MP4StandardAtom : public MP4Atom { + public: + MP4StandardAtom(const char *name); }; class MP4TrefTypeAtom : public MP4Atom { @@ -109,63 +67,6 @@ void Read(); }; -class MP4MdiaAtom : public MP4Atom { -public: - MP4MdiaAtom(); -}; - -class MP4MdhdAtom : public MP4Atom { -public: - MP4MdhdAtom(); - void Generate(); - void Read(); -protected: - void AddProperties(u_int8_t version); -}; - -class MP4HdlrAtom : public MP4Atom { -public: - MP4HdlrAtom(); - void Read(); -}; - -class MP4MinfAtom : public MP4Atom { -public: - MP4MinfAtom(); -}; - -class MP4VmhdAtom : public MP4Atom { -public: - MP4VmhdAtom(); - void Generate(); -}; - -class MP4SmhdAtom : public MP4Atom { -public: - MP4SmhdAtom(); -}; - -class MP4HmhdAtom : public MP4Atom { -public: - MP4HmhdAtom(); -}; - -class MP4NmhdAtom : public MP4Atom { -public: - MP4NmhdAtom(); -}; - -class MP4DinfAtom : public MP4Atom { -public: - MP4DinfAtom(); -}; - -class MP4DrefAtom : public MP4Atom { -public: - MP4DrefAtom(); - void Read(); -}; - class MP4UrlAtom : public MP4Atom { public: MP4UrlAtom(const char *type="url "); @@ -173,22 +74,70 @@ void Write(); }; -class MP4UrnAtom : public MP4Atom { -public: - MP4UrnAtom(); - void Read(); +/*********************************************************************** + * Sound and Video atoms - use the generic atoms when possible + * (MP4SoundAtom and MP4VideoAtom) + ***********************************************************************/ +class MP4SoundAtom : public MP4Atom { + public: + MP4SoundAtom(const char *atomid); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4VideoAtom : public MP4Atom { + public: + MP4VideoAtom(const char *atomid); + void Generate(); +}; + +class MP4AmrAtom : public MP4Atom { + public: + MP4AmrAtom(const char *type); + void Generate(); }; -class MP4StblAtom : public MP4Atom { -public: - MP4StblAtom(); - void Generate(); +// H.264 atoms + +class MP4Avc1Atom : public MP4Atom { + public: + MP4Avc1Atom(); + void Generate(); +}; + +class MP4AvcCAtom : public MP4Atom { + public: + MP4AvcCAtom(); + void Generate(); }; -class MP4StsdAtom : public MP4Atom { + + +class MP4D263Atom : public MP4Atom { + public: + MP4D263Atom(); + void Generate(); + void Write(); +}; + +class MP4DamrAtom : public MP4Atom { + public: + MP4DamrAtom(); + void Generate(); +}; + +class MP4EncaAtom : public MP4Atom { public: - MP4StsdAtom(); - void Read(); + MP4EncaAtom(); + void Generate(); +}; + +class MP4EncvAtom : public MP4Atom { +public: + MP4EncvAtom(); + void Generate(); }; class MP4Mp4aAtom : public MP4Atom { @@ -209,65 +158,31 @@ void Generate(); }; -class MP4EsdsAtom : public MP4Atom { -public: - MP4EsdsAtom(); -}; -class MP4SttsAtom : public MP4Atom { -public: - MP4SttsAtom(); +class MP4S263Atom : public MP4Atom { + public: + MP4S263Atom(); + void Generate(); }; + + + +/************************************************************************ + * Specialized Atoms + ************************************************************************/ -class MP4CttsAtom : public MP4Atom { +class MP4DataAtom : public MP4Atom { public: - MP4CttsAtom(); -}; - -class MP4StszAtom : public MP4Atom { -public: - MP4StszAtom(); - void Read(); - void Write(); -}; - -class MP4StscAtom : public MP4Atom { -public: - MP4StscAtom(); - void Read(); + MP4DataAtom(); + void Read(); }; -class MP4StcoAtom : public MP4Atom { -public: - MP4StcoAtom(); -}; - -class MP4Co64Atom : public MP4Atom { -public: - MP4Co64Atom(); -}; - -class MP4StssAtom : public MP4Atom { +class MP4DrefAtom : public MP4Atom { public: - MP4StssAtom(); -}; - -class MP4StshAtom : public MP4Atom { -public: - MP4StshAtom(); -}; - -class MP4StdpAtom : public MP4Atom { -public: - MP4StdpAtom(); + MP4DrefAtom(); void Read(); }; -class MP4EdtsAtom : public MP4Atom { -public: - MP4EdtsAtom(); -}; - class MP4ElstAtom : public MP4Atom { public: MP4ElstAtom(); @@ -277,15 +192,30 @@ void AddProperties(u_int8_t version); }; -class MP4UdtaAtom : public MP4Atom { +class MP4FreeAtom : public MP4Atom { public: - MP4UdtaAtom(); + MP4FreeAtom(); + void Read(); + void Write(); +}; + +class MP4FtypAtom : public MP4Atom { +public: + MP4FtypAtom(); + void Generate(); void Read(); }; -class MP4CprtAtom : public MP4Atom { +class MP4HdlrAtom : public MP4Atom { public: - MP4CprtAtom(); + MP4HdlrAtom(); + void Read(); +}; + +class MP4HinfAtom : public MP4Atom { +public: + MP4HinfAtom(); + void Generate(); }; class MP4HntiAtom : public MP4Atom { @@ -294,6 +224,45 @@ void Read(); }; + +class MP4MdatAtom : public MP4Atom { +public: + MP4MdatAtom(); + void Read(); + void Write(); +}; + +class MP4MdhdAtom : public MP4Atom { +public: + MP4MdhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4MeanAtom : public MP4Atom { +public: + MP4MeanAtom(); + void Read(); +}; + + +class MP4MvhdAtom : public MP4Atom { +public: + MP4MvhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4NameAtom : public MP4Atom { +public: + MP4NameAtom(); + void Read(); +}; + class MP4RtpAtom : public MP4Atom { public: MP4RtpAtom(); @@ -314,21 +283,6 @@ void WriteHntiType(); }; -class MP4TimsAtom : public MP4Atom { -public: - MP4TimsAtom(); -}; - -class MP4TsroAtom : public MP4Atom { -public: - MP4TsroAtom(); -}; - -class MP4SnroAtom : public MP4Atom { -public: - MP4SnroAtom(); -}; - class MP4SdpAtom : public MP4Atom { public: MP4SdpAtom(); @@ -336,95 +290,41 @@ void Write(); }; -class MP4HinfAtom : public MP4Atom { +class MP4SmiAtom : public MP4Atom { + public: + MP4SmiAtom(void); + void Read(); +}; + +class MP4StblAtom : public MP4Atom { public: - MP4HinfAtom(); + MP4StblAtom(); void Generate(); }; -class MP4TrpyAtom : public MP4Atom { -public: - MP4TrpyAtom(); -}; - -class MP4NumpAtom : public MP4Atom { +class MP4StdpAtom : public MP4Atom { public: - MP4NumpAtom(); -}; - -class MP4TpylAtom : public MP4Atom { -public: - MP4TpylAtom(); + MP4StdpAtom(); + void Read(); }; -class MP4MaxrAtom : public MP4Atom { -public: - MP4MaxrAtom(); -}; - -class MP4DmedAtom : public MP4Atom { -public: - MP4DmedAtom(); -}; - -class MP4DimmAtom : public MP4Atom { +class MP4StscAtom : public MP4Atom { public: - MP4DimmAtom(); -}; - -class MP4DrepAtom : public MP4Atom { -public: - MP4DrepAtom(); -}; - -class MP4TminAtom : public MP4Atom { -public: - MP4TminAtom(); + MP4StscAtom(); + void Read(); }; -class MP4TmaxAtom : public MP4Atom { -public: - MP4TmaxAtom(); -}; - -class MP4PmaxAtom : public MP4Atom { +class MP4StsdAtom : public MP4Atom { public: - MP4PmaxAtom(); -}; - -class MP4DmaxAtom : public MP4Atom { -public: - MP4DmaxAtom(); -}; - -class MP4PaytAtom : public MP4Atom { -public: - MP4PaytAtom(); + MP4StsdAtom(); + void Read(); }; -class MP4MvexAtom : public MP4Atom { -public: - MP4MvexAtom(); -}; - -class MP4TrexAtom : public MP4Atom { -public: - MP4TrexAtom(); -}; - -class MP4MoofAtom : public MP4Atom { +class MP4StszAtom : public MP4Atom { public: - MP4MoofAtom(); -}; - -class MP4MfhdAtom : public MP4Atom { -public: - MP4MfhdAtom(); -}; - -class MP4TrafAtom : public MP4Atom { -public: - MP4TrafAtom(); + MP4StszAtom(); + void Read(); + void Write(); }; class MP4TfhdAtom : public MP4Atom { @@ -435,6 +335,14 @@ void AddProperties(u_int32_t flags); }; +class MP4TkhdAtom : public MP4Atom { +public: + MP4TkhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; class MP4TrunAtom : public MP4Atom { public: MP4TrunAtom(); @@ -443,226 +351,27 @@ void AddProperties(u_int32_t flags); }; -class MP4FreeAtom : public MP4Atom { -public: - MP4FreeAtom(); - void Read(); - void Write(); -}; - -class MP4EncaAtom : public MP4Atom { -public: - MP4EncaAtom(); - void Generate(); -}; - -class MP4EncvAtom : public MP4Atom { -public: - MP4EncvAtom(); - void Generate(); -}; - -class MP4FrmaAtom : public MP4Atom { -public: - MP4FrmaAtom(); -}; - -class MP4IKMSAtom : public MP4Atom { -public: - MP4IKMSAtom(); -}; - -class MP4ISFMAtom : public MP4Atom { -public: - MP4ISFMAtom(); -}; - -class MP4SchiAtom : public MP4Atom { -public: - MP4SchiAtom(); -}; - -class MP4SchmAtom : public MP4Atom { -public: - MP4SchmAtom(); -}; - -class MP4SinfAtom : public MP4Atom { -public: - MP4SinfAtom(); -}; - -/* iTunes META data atoms */ -class MP4MetaAtom : public MP4Atom { +class MP4UdtaAtom : public MP4Atom { public: - MP4MetaAtom(); -}; - -class MP4NameAtom : public MP4Atom { -public: - MP4NameAtom(); - void Read(); -}; - -class MP4MeanAtom : public MP4Atom { -public: - MP4MeanAtom(); - void Read(); -}; - -class MP4DataAtom : public MP4Atom { -public: - MP4DataAtom(); - void Read(); -}; - -class MP4IlstAtom : public MP4Atom { -public: - MP4IlstAtom(); -}; - -class MP4DashAtom : public MP4Atom { -public: - MP4DashAtom(); -}; - -class MP4NamAtom : public MP4Atom { -public: - MP4NamAtom(); -}; - -class MP4ArtAtom : public MP4Atom { -public: - MP4ArtAtom(); -}; - -class MP4WrtAtom : public MP4Atom { -public: - MP4WrtAtom(); -}; - -class MP4AlbAtom : public MP4Atom { -public: - MP4AlbAtom(); -}; - -class MP4TrknAtom : public MP4Atom { -public: - MP4TrknAtom(); + MP4UdtaAtom(); + void Read(); }; -class MP4DayAtom : public MP4Atom { -public: - MP4DayAtom(); -}; - -class MP4GenAtom : public MP4Atom { -public: - MP4GenAtom(); -}; - -class MP4TooAtom : public MP4Atom { -public: - MP4TooAtom(); -}; - -class MP4GnreAtom : public MP4Atom { -public: - MP4GnreAtom(); -}; - -class MP4CpilAtom : public MP4Atom { +class MP4UrnAtom : public MP4Atom { public: - MP4CpilAtom(); + MP4UrnAtom(); + void Read(); }; - -class MP4TmpoAtom : public MP4Atom { -public: - MP4TmpoAtom(); -}; - -class MP4CmtAtom : public MP4Atom { +class MP4VmhdAtom : public MP4Atom { public: - MP4CmtAtom(); -}; - -class MP4CovrAtom : public MP4Atom { - public: - MP4CovrAtom(); -}; - -class MP4DiskAtom : public MP4Atom { -public: - MP4DiskAtom(); + MP4VmhdAtom(); + void Generate(); }; -class MP4BitrAtom : public MP4Atom { - public: - MP4BitrAtom(); -}; - -class MP4D263Atom : public MP4Atom { +class MP4HrefAtom : public MP4Atom { public: - MP4D263Atom(); - void Generate(); - void Write(); -}; - -class MP4DamrAtom : public MP4Atom { - public: - MP4DamrAtom(); - void Generate(); -}; - -class MP4S263Atom : public MP4Atom { - public: - MP4S263Atom(); - void Generate(); -}; - -class MP4AmrAtom : public MP4Atom { - public: - MP4AmrAtom(const char *type); - void Generate(); -}; - -// H.264 atoms - -class MP4Avc1Atom : public MP4Atom { - public: - MP4Avc1Atom(); - void Generate(); + MP4HrefAtom(); + void Generate(void); }; -class MP4AvcCAtom : public MP4Atom { - public: - MP4AvcCAtom(); - void Generate(); -}; - -class MP4BtrtAtom : public MP4Atom { - public: - MP4BtrtAtom(); -}; - -class MP4SoundAtom : public MP4Atom { - public: - MP4SoundAtom(const char *atomid); - void Generate(); - void Read(); -protected: - void AddProperties(u_int8_t version); -}; - -class MP4VideoAtom : public MP4Atom { - public: - MP4VideoAtom(const char *atomid); - void Generate(); -}; - -class MP4SmiAtom : public MP4Atom { - public: - MP4SmiAtom(void); - void Read(); -}; #endif /* __MP4_ATOMS_INCLUDED__ */
--- a/Plugins/Input/aac/libmp4v2/isma.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/isma.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -59,25 +59,31 @@ catch (MP4Error* e) { delete e; } - const char *audio_media_data_name, *video_media_data_name; + if (audioTrackId == MP4_INVALID_TRACK_ID && + videoTrackId == MP4_INVALID_TRACK_ID) return; - audio_media_data_name = MP4GetTrackMediaDataName(this, audioTrackId); - if (!(ATOMID(audio_media_data_name) == ATOMID("mp4a") || - ATOMID(audio_media_data_name) == ATOMID("enca"))) { - VERBOSE_ERROR(m_verbosity, - printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", audio_media_data_name); - ); - return; + const char *audio_media_data_name, *video_media_data_name; + if (audioTrackId != MP4_INVALID_TRACK_ID) { + audio_media_data_name = MP4GetTrackMediaDataName(this, audioTrackId); + if (!(ATOMID(audio_media_data_name) == ATOMID("mp4a") || + ATOMID(audio_media_data_name) == ATOMID("enca"))) { + VERBOSE_ERROR(m_verbosity, + printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", audio_media_data_name); + ); + return; + } } // // Note - might have to check for avc1 here... - video_media_data_name = MP4GetTrackMediaDataName(this, videoTrackId); - if (!(ATOMID(video_media_data_name) == ATOMID("mp4v") || - ATOMID(video_media_data_name) == ATOMID("encv"))) { - VERBOSE_ERROR(m_verbosity, - printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", video_media_data_name); - ); - return; + if (videoTrackId != MP4_INVALID_TRACK_ID) { + video_media_data_name = MP4GetTrackMediaDataName(this, videoTrackId); + if (!(ATOMID(video_media_data_name) == ATOMID("mp4v") || + ATOMID(video_media_data_name) == ATOMID("encv"))) { + VERBOSE_ERROR(m_verbosity, + printf("MakeIsmaCompliant:can't make ISMA compliant when file contains an %s track\n", video_media_data_name); + ); + return; + } } m_useIsma = true; @@ -513,7 +519,7 @@ delete pVideoEsdProperty; VERBOSE_ISMA(GetVerbosity(), - printf("OD data = "U64" bytes\n", numBytes); MP4HexDump(pBytes, numBytes)); + printf("OD data = %llu bytes\n", numBytes); MP4HexDump(pBytes, numBytes)); char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); @@ -776,7 +782,7 @@ CreateIsmaODUpdateCommandForStream( pAudioEsd, pVideoEsd, ppBytes, pNumBytes); VERBOSE_ISMA(GetVerbosity(), - printf("After CreateImsaODUpdateCommandForStream len "U64" =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes)); + printf("After CreateImsaODUpdateCommandForStream len %llu =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes)); // return SL config values to 2 (file) // return ESID values to 0 if (pAudioSLConfigPredef) {
--- a/Plugins/Input/aac/libmp4v2/libmp4v260.dsp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/libmp4v260.dsp Thu Nov 17 14:01:18 2005 -0800 @@ -90,6 +90,10 @@ # End Source File # Begin Source File +SOURCE=.\atom_amr.cpp +# End Source File +# Begin Source File + SOURCE=.\atom_avc1.cpp # End Source File # Begin Source File @@ -98,26 +102,6 @@ # End Source File # Begin Source File -SOURCE=.\atom_bitr.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_btrt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_co64.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_cprt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_ctts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_d263.cpp # End Source File # Begin Source File @@ -126,34 +110,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_dimm.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dinf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dmax.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dmed.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_dref.cpp # End Source File # Begin Source File -SOURCE=.\atom_drep.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_edts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_elst.cpp # End Source File # Begin Source File @@ -166,18 +126,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_esds.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_free.cpp # End Source File # Begin Source File -SOURCE=.\atom_frma.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_ftyp.cpp # End Source File # Begin Source File @@ -190,27 +142,11 @@ # End Source File # Begin Source File -SOURCE=.\atom_hmhd.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_hnti.cpp # End Source File # Begin Source File -SOURCE=.\atom_iKMS.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_iods.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_iSFM.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_maxr.cpp +SOURCE=.\atom_href.cpp # End Source File # Begin Source File @@ -222,30 +158,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_mdia.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_meta.cpp # End Source File # Begin Source File -SOURCE=.\atom_mfhd.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_minf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_moof.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_moov.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_mp4a.cpp # End Source File # Begin Source File @@ -258,30 +174,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_mvex.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_mvhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_nmhd.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_nump.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_payt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_pmax.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_root.cpp # End Source File # Begin Source File @@ -294,27 +190,19 @@ # End Source File # Begin Source File -SOURCE=.\atom_schi.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_schm.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_sdp.cpp # End Source File # Begin Source File -SOURCE=.\atom_sinf.cpp +SOURCE=.\atom_smi.cpp # End Source File # Begin Source File -SOURCE=.\atom_smhd.cpp +SOURCE=.\atom_sound.cpp # End Source File # Begin Source File -SOURCE=.\atom_snro.cpp +SOURCE=.\atom_standard.cpp # End Source File # Begin Source File @@ -322,10 +210,6 @@ # End Source File # Begin Source File -SOURCE=.\atom_stco.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_stdp.cpp # End Source File # Begin Source File @@ -338,78 +222,26 @@ # End Source File # Begin Source File -SOURCE=.\atom_stsh.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_stss.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_stsz.cpp # End Source File # Begin Source File -SOURCE=.\atom_stts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_tfhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_tims.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_tkhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_tmax.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tmin.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tpyl.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_traf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_trak.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tref.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_treftype.cpp # End Source File # Begin Source File -SOURCE=.\atom_trex.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_trpy.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_trun.cpp # End Source File # Begin Source File -SOURCE=.\atom_tsro.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_udta.cpp # End Source File # Begin Source File @@ -422,6 +254,10 @@ # End Source File # Begin Source File +SOURCE=.\atom_video.cpp +# End Source File +# Begin Source File + SOURCE=.\atom_vmhd.cpp # End Source File # Begin Source File @@ -561,21 +397,5 @@ SOURCE=.\rtphint.h # End Source File # End Group -# Begin Source File - -SOURCE=.\atom_amr.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_smi.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_sound.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_video.cpp -# End Source File # End Target # End Project
--- a/Plugins/Input/aac/libmp4v2/libmp4v2_st60.dsp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/libmp4v2_st60.dsp Thu Nov 17 14:01:18 2005 -0800 @@ -101,26 +101,6 @@ # End Source File # Begin Source File -SOURCE=.\atom_bitr.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_btrt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_co64.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_cprt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_ctts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_d263.cpp # End Source File # Begin Source File @@ -129,39 +109,19 @@ # End Source File # Begin Source File -SOURCE=.\atom_dimm.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dinf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dmax.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_dmed.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_dref.cpp # End Source File # Begin Source File -SOURCE=.\atom_drep.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_edts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_elst.cpp # End Source File # Begin Source File -SOURCE=.\atom_esds.cpp +SOURCE=.\atom_enca.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_encv.cpp # End Source File # Begin Source File @@ -181,19 +141,11 @@ # End Source File # Begin Source File -SOURCE=.\atom_hmhd.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_hnti.cpp # End Source File # Begin Source File -SOURCE=.\atom_iods.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_maxr.cpp +SOURCE=.\atom_href.cpp # End Source File # Begin Source File @@ -205,30 +157,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_mdia.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_meta.cpp # End Source File # Begin Source File -SOURCE=.\atom_mfhd.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_minf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_moof.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_moov.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_mp4a.cpp # End Source File # Begin Source File @@ -241,30 +173,10 @@ # End Source File # Begin Source File -SOURCE=.\atom_mvex.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_mvhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_nmhd.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_nump.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_payt.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_pmax.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_root.cpp # End Source File # Begin Source File @@ -281,11 +193,15 @@ # End Source File # Begin Source File -SOURCE=.\atom_smhd.cpp +SOURCE=.\atom_smi.cpp # End Source File # Begin Source File -SOURCE=.\atom_snro.cpp +SOURCE=.\atom_sound.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_standard.cpp # End Source File # Begin Source File @@ -293,10 +209,6 @@ # End Source File # Begin Source File -SOURCE=.\atom_stco.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_stdp.cpp # End Source File # Begin Source File @@ -309,78 +221,26 @@ # End Source File # Begin Source File -SOURCE=.\atom_stsh.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_stss.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_stsz.cpp # End Source File # Begin Source File -SOURCE=.\atom_stts.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_tfhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_tims.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_tkhd.cpp # End Source File # Begin Source File -SOURCE=.\atom_tmax.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tmin.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tpyl.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_traf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_trak.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_tref.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_treftype.cpp # End Source File # Begin Source File -SOURCE=.\atom_trex.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_trpy.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_trun.cpp # End Source File # Begin Source File -SOURCE=.\atom_tsro.cpp -# End Source File -# Begin Source File - SOURCE=.\atom_udta.cpp # End Source File # Begin Source File @@ -433,6 +293,10 @@ # End Source File # Begin Source File +SOURCE=.\mp4info.cpp +# End Source File +# Begin Source File + SOURCE=.\mp4meta.cpp # End Source File # Begin Source File @@ -532,49 +396,5 @@ SOURCE=.\rtphint.h # End Source File # End Group -# Begin Source File - -SOURCE=.\atom_enca.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_encv.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_frma.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_iKMS.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_iSFM.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_schi.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_schm.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_sinf.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_smi.cpp -# End Source File -# Begin Source File - -SOURCE=.\atom_sound.cpp -# End Source File -# Begin Source File - -SOURCE=.\mp4info.cpp -# End Source File # End Target # End Project
--- a/Plugins/Input/aac/libmp4v2/mp4.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -13,7 +13,7 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. @@ -25,6 +25,7 @@ * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com + * Bill May wmay@cisco.com */ /* @@ -60,13 +61,20 @@ extern "C" MP4FileHandle MP4Create (const char* fileName, u_int32_t verbosity, - u_int32_t flags, - int add_ftyp, - int add_iods, - char* majorBrand, - u_int32_t minorVersion, - char** supportedBrands, - u_int32_t supportedBrandsCount) + u_int32_t flags) +{ + return MP4CreateEx(fileName, verbosity, flags); +} + +extern "C" MP4FileHandle MP4CreateEx (const char* fileName, + u_int32_t verbosity, + u_int32_t flags, + int add_ftyp, + int add_iods, + char* majorBrand, + u_int32_t minorVersion, + char** supportedBrands, + u_int32_t supportedBrandsCount) { MP4File* pFile = NULL; try { @@ -695,6 +703,24 @@ return 0; } +extern "C" MP4TrackId MP4AddHrefTrack (MP4FileHandle hFile, + uint32_t timeScale, + MP4Duration sampleDuration) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + MP4File *pFile = (MP4File *)hFile; + + return pFile->AddHrefTrack(timeScale, + sampleDuration); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} extern "C" MP4TrackId MP4AddVideoTrack( MP4FileHandle hFile, @@ -780,7 +806,7 @@ extern "C" bool MP4AddH264SequenceParameterSet (MP4FileHandle hFile, MP4TrackId trackId, - uint8_t *pSequence, + const uint8_t *pSequence, uint16_t sequenceLen) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { @@ -800,8 +826,8 @@ } extern "C" bool MP4AddH264PictureParameterSet (MP4FileHandle hFile, MP4TrackId trackId, - uint8_t *pPict, - uint16_t pictLen) + const uint8_t *pPict, + uint16_t pictLen) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { @@ -1562,7 +1588,7 @@ MP4_MSECS_TIME_SCALE); MP4Track *pTrack = pFile->GetTrack(trackId); uint64_t bytes = pTrack->GetTotalOfSampleSizes(); - bytes *= TO_U64(8 * 1000); + bytes *= (u_int64_t) (8 * 1000); bytes /= msDuration; return (uint32_t)bytes; } @@ -1737,7 +1763,7 @@ return 0; } -extern "C" float MP4GetTrackVideoFrameRate( +extern "C" double MP4GetTrackVideoFrameRate( MP4FileHandle hFile, MP4TrackId trackId) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { @@ -3313,6 +3339,20 @@ return false; } +extern "C" bool MP4DeleteMetadataName(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataName(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value) { @@ -3343,6 +3383,20 @@ return false; } +extern "C" bool MP4DeleteMetadataWriter(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataWriter(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value) { @@ -3373,6 +3427,20 @@ return false; } +extern "C" bool MP4DeleteMetadataAlbum(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataAlbum(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value) { @@ -3403,6 +3471,20 @@ return false; } +extern "C" bool MP4DeleteMetadataArtist(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataArtist(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value) { @@ -3433,6 +3515,20 @@ return false; } +extern "C" bool MP4DeleteMetadataTool(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataTool(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value) { @@ -3463,6 +3559,20 @@ return false; } +extern "C" bool MP4DeleteMetadataComment(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataComment(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value) { @@ -3493,6 +3603,20 @@ return false; } +extern "C" bool MP4DeleteMetadataYear(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataYear(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataTrack(MP4FileHandle hFile, u_int16_t track, u_int16_t totalTracks) { @@ -3523,6 +3647,20 @@ return false; } +extern "C" bool MP4DeleteMetadataTrack(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataTrack(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataDisk(MP4FileHandle hFile, u_int16_t disk, u_int16_t totalDisks) { @@ -3553,6 +3691,20 @@ return false; } +extern "C" bool MP4DeleteMetadataDisk(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataDisk(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { @@ -3581,6 +3733,62 @@ return false; } +extern "C" bool MP4DeleteMetadataGenre(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataGenre(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataGrouping(grouping); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataGrouping(grouping); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4DeleteMetadataGrouping(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataGrouping(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { @@ -3609,6 +3817,20 @@ return false; } +extern "C" bool MP4DeleteMetadataTempo(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataTempo(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl) { if (MP4_IS_VALID_FILE_HANDLE(hFile)) { @@ -3637,6 +3859,20 @@ return false; } +extern "C" bool MP4DeleteMetadataCompilation(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataCompilation(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataCoverArt(MP4FileHandle hFile, u_int8_t *coverArt, u_int32_t size) { @@ -3667,6 +3903,20 @@ return false; } +extern "C" bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataCoverArt(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + extern "C" bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, u_int8_t* pValue, u_int32_t valueSize) { @@ -3696,3 +3946,18 @@ } return false; } + +extern "C" bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->DeleteMetadataFreeForm(name); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} +
--- a/Plugins/Input/aac/libmp4v2/mp4.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4.h Thu Nov 17 14:01:18 2005 -0800 @@ -13,7 +13,7 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. @@ -25,6 +25,7 @@ * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com + * Bill May wmay@cisco.com */ #ifndef __MP4_INCLUDED__ @@ -98,6 +99,7 @@ #define MP4_AUDIO_TRACK_TYPE "soun" #define MP4_VIDEO_TRACK_TYPE "vide" #define MP4_HINT_TRACK_TYPE "hint" +#define MP4_CNTL_TRACK_TYPE "cntl" /* * This second set of track types should be created * via MP4AddSystemsTrack(type) @@ -114,6 +116,9 @@ #define MP4_IS_AUDIO_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_AUDIO_TRACK_TYPE)) +#define MP4_IS_CNTL_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_CNTL_TRACK_TYPE)) + #define MP4_IS_OD_TRACK_TYPE(type) \ (!strcasecmp(type, MP4_OD_TRACK_TYPE)) @@ -175,7 +180,7 @@ #define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \ (((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \ - && (mpeg4Type) <= MP4_MPEG4_AAC_LTP_AUDIO_TYPE) \ + && (mpeg4Type) <= MP4_MPEG4_AAC_HE_AUDIO_TYPE) \ || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \ || (mpeg4Type) == 17) @@ -287,6 +292,10 @@ MP4FileHandle MP4Create( const char* fileName, u_int32_t verbosity DEFAULT(0), + u_int32_t flags DEFAULT(0)); +MP4FileHandle MP4CreateEx( + const char *fileName, + u_int32_t verbosity DEFAULT(0), u_int32_t flags DEFAULT(0), int add_ftyp DEFAULT(1), int add_iods DEFAULT(1), @@ -459,6 +468,10 @@ void MP4SetAmrModeSet(MP4FileHandle hFile, MP4TrackId trakId, uint16_t modeSet); uint16_t MP4GetAmrModeSet(MP4FileHandle hFile, MP4TrackId trackId); +MP4TrackId MP4AddHrefTrack(MP4FileHandle hFile, + uint32_t timeScale, + MP4Duration sampleDuration); + MP4TrackId MP4AddVideoTrack( MP4FileHandle hFile, u_int32_t timeScale, @@ -488,12 +501,12 @@ uint8_t sampleLenFieldSizeMinusOne); bool MP4AddH264SequenceParameterSet(MP4FileHandle hFile, MP4TrackId trackId, - uint8_t *pSequence, + const uint8_t *pSequence, uint16_t sequenceLen); bool MP4AddH264PictureParameterSet(MP4FileHandle hFile, MP4TrackId trackId, - uint8_t *pPict, - uint16_t pictLen); + const uint8_t *pPict, + uint16_t pictLen); void MP4SetH263Vendor( MP4FileHandle hFile, MP4TrackId trackId, @@ -659,7 +672,7 @@ MP4FileHandle hFile, MP4TrackId trackId); -float MP4GetTrackVideoFrameRate( +double MP4GetTrackVideoFrameRate( MP4FileHandle hFile, MP4TrackId trackId); @@ -1077,40 +1090,57 @@ u_int8_t** ppValue, u_int32_t* pValueSize); bool MP4SetMetadataName(MP4FileHandle hFile, const char* value); bool MP4GetMetadataName(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataName(MP4FileHandle hFile); bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value); bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataArtist(MP4FileHandle hFile); bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value); bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataWriter(MP4FileHandle hFile); bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value); bool MP4GetMetadataComment(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataComment(MP4FileHandle hFile); bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value); bool MP4GetMetadataTool(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataTool(MP4FileHandle hFile); bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value); bool MP4GetMetadataYear(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataYear(MP4FileHandle hFile); bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value); bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value); +bool MP4DeleteMetadataAlbum(MP4FileHandle hFile); bool MP4SetMetadataTrack(MP4FileHandle hFile, u_int16_t track, u_int16_t totalTracks); bool MP4GetMetadataTrack(MP4FileHandle hFile, u_int16_t* track, u_int16_t* totalTracks); +bool MP4DeleteMetadataTrack(MP4FileHandle hFile); bool MP4SetMetadataDisk(MP4FileHandle hFile, u_int16_t disk, u_int16_t totalDisks); bool MP4GetMetadataDisk(MP4FileHandle hFile, u_int16_t* disk, u_int16_t* totalDisks); +bool MP4DeleteMetadataDisk(MP4FileHandle hFile); bool MP4SetMetadataGenre(MP4FileHandle hFile, const char *genre); bool MP4GetMetadataGenre(MP4FileHandle hFile, char **genre); +bool MP4DeleteMetadataGenre(MP4FileHandle hFile); +bool MP4SetMetadataGrouping(MP4FileHandle hFile, const char *grouping); +bool MP4GetMetadataGrouping(MP4FileHandle hFile, char **grouping); +bool MP4DeleteMetadataGrouping(MP4FileHandle hFile); bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo); bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo); +bool MP4DeleteMetadataTempo(MP4FileHandle hFile); bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl); bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl); +bool MP4DeleteMetadataCompilation(MP4FileHandle hFile); bool MP4SetMetadataCoverArt(MP4FileHandle hFile, u_int8_t *coverArt, u_int32_t size); bool MP4GetMetadataCoverArt(MP4FileHandle hFile, u_int8_t **coverArt, u_int32_t* size); +bool MP4DeleteMetadataCoverArt(MP4FileHandle hFile); bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, u_int8_t* pValue, u_int32_t valueSize); bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name, u_int8_t** pValue, u_int32_t* valueSize); +bool MP4DeleteMetadataFreeForm(MP4FileHandle hFile, char *name); /* time conversion utilties */
--- a/Plugins/Input/aac/libmp4v2/mp4atom.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4atom.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -84,57 +84,21 @@ pAtom = new MP4SoundAtom("alaw"); } break; - case 'b': - if (ATOMID(type) == ATOMID("bitr")) { - pAtom = new MP4BitrAtom(); - } else if (ATOMID(type) == ATOMID("btrt")) { - pAtom = new MP4BtrtAtom(); - } - break; - case 'c': - if (ATOMID(type) == ATOMID("ctts")) { - pAtom = new MP4CttsAtom(); - } else if (ATOMID(type) == ATOMID("co64")) { - pAtom = new MP4Co64Atom(); - } else if (ATOMID(type) == ATOMID("cprt")) { - pAtom = new MP4CprtAtom(); - } else if (ATOMID(type) == ATOMID("cpil")) { /* Apple iTunes */ - pAtom = new MP4CpilAtom(); - } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */ - pAtom = new MP4CovrAtom(); - } - break; case 'd': if (ATOMID(type) == ATOMID("d263")) { pAtom = new MP4D263Atom(); } else if (ATOMID(type) == ATOMID("damr")) { pAtom = new MP4DamrAtom(); - } else if (ATOMID(type) == ATOMID("dinf")) { - pAtom = new MP4DinfAtom(); } else if (ATOMID(type) == ATOMID("dref")) { pAtom = new MP4DrefAtom(); } else if (ATOMID(type) == ATOMID("dpnd")) { pAtom = new MP4TrefTypeAtom(type); - } else if (ATOMID(type) == ATOMID("dmed")) { - pAtom = new MP4DmedAtom(); - } else if (ATOMID(type) == ATOMID("dimm")) { - pAtom = new MP4DimmAtom(); - } else if (ATOMID(type) == ATOMID("drep")) { - pAtom = new MP4DrepAtom(); - } else if (ATOMID(type) == ATOMID("dmax")) { - pAtom = new MP4DmaxAtom(); } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ pAtom = new MP4DataAtom(); - } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */ - pAtom = new MP4DiskAtom(); } break; case 'e': - if (ATOMID(type) == ATOMID("esds")) { - pAtom = new MP4EsdsAtom(); - } else if (ATOMID(type) == ATOMID("edts")) { - pAtom = new MP4EdtsAtom(); - } else if (ATOMID(type) == ATOMID("elst")) { + if (ATOMID(type) == ATOMID("elst")) { pAtom = new MP4ElstAtom(); } else if (ATOMID(type) == ATOMID("enca")) { pAtom = new MP4EncaAtom(); @@ -145,22 +109,13 @@ case 'f': if (ATOMID(type) == ATOMID("free")) { pAtom = new MP4FreeAtom(); - } else if (ATOMID(type) == ATOMID("frma")) { - pAtom = new MP4FrmaAtom(); } else if (ATOMID(type) == ATOMID("ftyp")) { pAtom = new MP4FtypAtom(); } break; - case 'g': - if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes - pAtom = new MP4GnreAtom(); - } - break; case 'h': if (ATOMID(type) == ATOMID("hdlr")) { pAtom = new MP4HdlrAtom(); - } else if (ATOMID(type) == ATOMID("hmhd")) { - pAtom = new MP4HmhdAtom(); } else if (ATOMID(type) == ATOMID("hint")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("hnti")) { @@ -169,19 +124,13 @@ pAtom = new MP4HinfAtom(); } else if (ATOMID(type) == ATOMID("h263")) { pAtom = new MP4VideoAtom("h263"); + } else if (ATOMID(type) == ATOMID("href")) { + pAtom = new MP4HrefAtom(); } break; case 'i': - if (ATOMID(type) == ATOMID("iKMS")) { - pAtom = new MP4IKMSAtom(); - } else if (ATOMID(type) == ATOMID("iSFM")) { - pAtom = new MP4ISFMAtom(); - } else if (ATOMID(type) == ATOMID("iods")) { - pAtom = new MP4IodsAtom(); - } else if (ATOMID(type) == ATOMID("ipir")) { + if (ATOMID(type) == ATOMID("ipir")) { pAtom = new MP4TrefTypeAtom(type); - } else if (ATOMID(type) == ATOMID("ilst")) { - pAtom = new MP4IlstAtom(); } else if (ATOMID(type) == ATOMID("ima4")) { pAtom = new MP4SoundAtom("ima4"); } @@ -192,18 +141,12 @@ } break; case 'm': - if (ATOMID(type) == ATOMID("mdia")) { - pAtom = new MP4MdiaAtom(); - } else if (ATOMID(type) == ATOMID("minf")) { - pAtom = new MP4MinfAtom(); - } else if (ATOMID(type) == ATOMID("mdhd")) { + if (ATOMID(type) == ATOMID("mdhd")) { pAtom = new MP4MdhdAtom(); + } else if (ATOMID(type) == ATOMID("mvhd")) { + pAtom = new MP4MvhdAtom(); } else if (ATOMID(type) == ATOMID("mdat")) { pAtom = new MP4MdatAtom(); - } else if (ATOMID(type) == ATOMID("moov")) { - pAtom = new MP4MoovAtom(); - } else if (ATOMID(type) == ATOMID("mvhd")) { - pAtom = new MP4MvhdAtom(); } else if (ATOMID(type) == ATOMID("mpod")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("mp4a")) { @@ -212,36 +155,15 @@ pAtom = new MP4Mp4sAtom(); } else if (ATOMID(type) == ATOMID("mp4v")) { pAtom = new MP4Mp4vAtom(); - } else if (ATOMID(type) == ATOMID("moof")) { - pAtom = new MP4MoofAtom(); - } else if (ATOMID(type) == ATOMID("mfhd")) { - pAtom = new MP4MfhdAtom(); - } else if (ATOMID(type) == ATOMID("mvex")) { - pAtom = new MP4MvexAtom(); - } else if (ATOMID(type) == ATOMID("maxr")) { - pAtom = new MP4MaxrAtom(); - } else if (ATOMID(type) == ATOMID("meta")) { // iTunes - pAtom = new MP4MetaAtom(); } else if (ATOMID(type) == ATOMID("mean")) { // iTunes pAtom = new MP4MeanAtom(); } break; case 'n': - if (ATOMID(type) == ATOMID("nmhd")) { - pAtom = new MP4NmhdAtom(); - } else if (ATOMID(type) == ATOMID("nump")) { - pAtom = new MP4NumpAtom(); - } else if (ATOMID(type) == ATOMID("name")) { // iTunes + if (ATOMID(type) == ATOMID("name")) { // iTunes pAtom = new MP4NameAtom(); } break; - case 'p': - if (ATOMID(type) == ATOMID("pmax")) { - pAtom = new MP4PmaxAtom(); - } else if (ATOMID(type) == ATOMID("payt")) { - pAtom = new MP4PaytAtom(); - } - break; case 'r': if (ATOMID(type) == ATOMID("rtp ")) { pAtom = new MP4RtpAtom(); @@ -256,36 +178,18 @@ pAtom = new MP4AmrAtom("samr"); } else if (ATOMID(type) == ATOMID("sawb")) { pAtom = new MP4AmrAtom("sawb"); - } else if (ATOMID(type) == ATOMID("schi")) { - pAtom = new MP4SchiAtom(); - } else if (ATOMID(type) == ATOMID("schm")) { - pAtom = new MP4SchmAtom(); - } else if (ATOMID(type) == ATOMID("sinf")) { - pAtom = new MP4SinfAtom(); } else if (ATOMID(type) == ATOMID("stbl")) { pAtom = new MP4StblAtom(); } else if (ATOMID(type) == ATOMID("stsd")) { pAtom = new MP4StsdAtom(); - } else if (ATOMID(type) == ATOMID("stts")) { - pAtom = new MP4SttsAtom(); } else if (ATOMID(type) == ATOMID("stsz")) { pAtom = new MP4StszAtom(); } else if (ATOMID(type) == ATOMID("stsc")) { pAtom = new MP4StscAtom(); - } else if (ATOMID(type) == ATOMID("stco")) { - pAtom = new MP4StcoAtom(); - } else if (ATOMID(type) == ATOMID("stss")) { - pAtom = new MP4StssAtom(); - } else if (ATOMID(type) == ATOMID("stsh")) { - pAtom = new MP4StshAtom(); } else if (ATOMID(type) == ATOMID("stdp")) { pAtom = new MP4StdpAtom(); - } else if (ATOMID(type) == ATOMID("smhd")) { - pAtom = new MP4SmhdAtom(); } else if (ATOMID(type) == ATOMID("sdp ")) { pAtom = new MP4SdpAtom(); - } else if (ATOMID(type) == ATOMID("snro")) { - pAtom = new MP4SnroAtom(); } else if (ATOMID(type) == ATOMID("sync")) { pAtom = new MP4TrefTypeAtom(type); } else if (ATOMID(type) == ATOMID("skip")) { @@ -296,36 +200,12 @@ } break; case 't': - if (ATOMID(type) == ATOMID("trak")) { - pAtom = new MP4TrakAtom(); - } else if (ATOMID(type) == ATOMID("tkhd")) { + if (ATOMID(type) == ATOMID("tkhd")) { pAtom = new MP4TkhdAtom(); - } else if (ATOMID(type) == ATOMID("tref")) { - pAtom = new MP4TrefAtom(); - } else if (ATOMID(type) == ATOMID("traf")) { - pAtom = new MP4TrafAtom(); } else if (ATOMID(type) == ATOMID("tfhd")) { pAtom = new MP4TfhdAtom(); - } else if (ATOMID(type) == ATOMID("trex")) { - pAtom = new MP4TrexAtom(); } else if (ATOMID(type) == ATOMID("trun")) { pAtom = new MP4TrunAtom(); - } else if (ATOMID(type) == ATOMID("tmin")) { - pAtom = new MP4TminAtom(); - } else if (ATOMID(type) == ATOMID("tmax")) { - pAtom = new MP4TmaxAtom(); - } else if (ATOMID(type) == ATOMID("trpy")) { - pAtom = new MP4TrpyAtom(); - } else if (ATOMID(type) == ATOMID("tpyl")) { - pAtom = new MP4TpylAtom(); - } else if (ATOMID(type) == ATOMID("tims")) { - pAtom = new MP4TimsAtom(); - } else if (ATOMID(type) == ATOMID("tsro")) { - pAtom = new MP4TsroAtom(); - } else if (ATOMID(type) == ATOMID("trkn")) { // iTunes - pAtom = new MP4TrknAtom(); - } else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes - pAtom = new MP4TmpoAtom(); } else if (ATOMID(type) == ATOMID("twos")) { pAtom = new MP4SoundAtom("twos"); } @@ -358,44 +238,12 @@ pAtom = new MP4SmiAtom(); } break; - case 0251: { // copyright symbol -static const char name[5]={0251,'n', 'a', 'm', '\0'}; -static const char art[5]={0251,'A', 'R', 'T', '\0'}; -static const char wrt[5]={0251,'w', 'r', 't', '\0'}; -static const char alb[5]={0251,'a', 'l', 'b', '\0'}; -static const char day[5]={0251,'d', 'a', 'y', '\0'}; -static const char too[5]={0251,'t', 'o', 'o', '\0'}; -static const char cmt[5]={0251,'c', 'm', 't', '\0'}; -static const char gen[5]={0251,'g', 'e', 'n', '\0'}; - if (ATOMID(type) == ATOMID(name)) { - pAtom = new MP4NamAtom(); - } else if (ATOMID(type) == ATOMID(art)) { /* Apple iTunes */ - pAtom = new MP4ArtAtom(); - } else if (ATOMID(type) == ATOMID(wrt)) { /* Apple iTunes */ - pAtom = new MP4WrtAtom(); - } else if (ATOMID(type) == ATOMID(alb)) { /* Apple iTunes */ - pAtom = new MP4AlbAtom(); - } else if (ATOMID(type) == ATOMID(day)) { /* Apple iTunes */ - pAtom = new MP4DayAtom(); - } else if (ATOMID(type) == ATOMID(too)) { /* Apple iTunes */ - pAtom = new MP4TooAtom(); - } else if (ATOMID(type) == ATOMID(cmt)) { /* Apple iTunes */ - pAtom = new MP4CmtAtom(); - } else if (ATOMID(type) == ATOMID(gen)) { /* Apple iTunes */ - pAtom = new MP4GenAtom(); - } - break; - } - case '-': - if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */ - pAtom = new MP4DashAtom(); - } } } if (pAtom == NULL) { - pAtom = new MP4Atom(type); - pAtom->SetUnknownType(true); + pAtom = new MP4StandardAtom(type); + // unknown type is set by StandardAtom type } ASSERT(pAtom); @@ -439,7 +287,7 @@ u_int64_t pos = pFile->GetPosition(); VERBOSE_READ(pFile->GetVerbosity(), - printf("ReadAtom: pos = 0x"X64"\n", pos)); + printf("ReadAtom: pos = 0x%llx\n", pos)); u_int64_t dataSize = pFile->ReadUInt32(); @@ -467,15 +315,17 @@ dataSize -= hdrSize; VERBOSE_READ(pFile->GetVerbosity(), - printf("ReadAtom: type = %s data-size = "U64" (0x"X64")\n", - type, dataSize, dataSize)); + printf("ReadAtom: type = \"%s\" data-size = %llu (0x%llx) hdr %u\n", + type, dataSize, dataSize, hdrSize)); if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { VERBOSE_ERROR(pFile->GetVerbosity(), - printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of %s \"%s\"\n", - pParentAtom->GetType(), type)); + printf("ReadAtom: invalid atom size, extends outside parent atom - skipping to end of \"%s\" \"%s\" %llu vs %llu\n", + pParentAtom->GetType(), type, + pos + hdrSize + dataSize, + pParentAtom->GetEnd())); VERBOSE_READ(pFile->GetVerbosity(), - printf("parent %s ("U64") pos "U64" hdr %d data "U64" sum "U64"\n", + printf("parent %s (%llu) pos %llu hdr %d data %llu sum %llu\n", pParentAtom->GetType(), pParentAtom->GetEnd(), pos, @@ -542,7 +392,7 @@ if (ATOMID(m_type) != 0 && m_size > 1000000) { VERBOSE_READ(GetVerbosity(), - printf("Warning: %s atom size "U64" is suspect\n", + printf("Warning: %s atom size %llu is suspect\n", m_type, m_size)); } @@ -560,7 +410,7 @@ { if (m_pFile->GetPosition() != m_end) { VERBOSE_READ(m_pFile->GetVerbosity(), - printf("Skip: "U64" bytes\n", m_end - m_pFile->GetPosition())); + printf("Skip: %llu bytes\n", m_end - m_pFile->GetPosition())); } m_pFile->SetPosition(m_end); } @@ -696,7 +546,7 @@ if (m_pFile->GetPosition() > m_end) { VERBOSE_READ(GetVerbosity(), - printf("ReadProperties: insufficient data for property: %s pos 0x"X64" atom end 0x"X64"\n", + printf("ReadProperties: insufficient data for property: %s pos 0x%llx atom end 0x%llx\n", m_pProperties[i]->GetName(), m_pFile->GetPosition(), m_end)); @@ -738,7 +588,7 @@ } // otherwise, output a warning, but don't care VERBOSE_WARNING(GetVerbosity(), - printf("Error: In %s atom, extra "D64" bytes at end of atom\n", + printf("Error: In %s atom, extra %lld bytes at end of atom\n", m_type, (m_end - position))); for (uint64_t ix = 0; ix < m_end - position; ix++) { m_pFile->ReadUInt8(); @@ -850,6 +700,10 @@ { m_end = m_pFile->GetPosition(); m_size = (m_end - m_start); + VERBOSE_WRITE(GetVerbosity(), + printf("end: type %s %llu %llu size %llu\n", m_type, + m_start, m_end, + m_size)); //use64 = m_pFile->Use64Bits(); if (use64) { m_pFile->SetPosition(m_start + 8);
--- a/Plugins/Input/aac/libmp4v2/mp4atom.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4atom.h Thu Nov 17 14:01:18 2005 -0800 @@ -96,7 +96,7 @@ }; void SetType(const char* type) { if (type && *type != '\0') { - ASSERT(strlen(type) == 4); + // not needed ASSERT(strlen(type) == 4); memcpy(m_type, type, 4); m_type[4] = '\0'; } else {
--- a/Plugins/Input/aac/libmp4v2/mp4descriptor.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4descriptor.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -81,7 +81,7 @@ void MP4Descriptor::ReadHeader(MP4File* pFile) { VERBOSE_READ(pFile->GetVerbosity(), - printf("ReadDescriptor: pos = 0x"X64"\n", + printf("ReadDescriptor: pos = 0x%llx\n", pFile->GetPosition())); // read tag and length
--- a/Plugins/Input/aac/libmp4v2/mp4file.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4file.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -13,7 +13,7 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. @@ -25,6 +25,7 @@ * Dave Mackie dmackie@cisco.com * Alix Marchandise-Franquet alix@cisco.com * Ximpo Group Ltd. mp4v2@ximpo.com + * Bill May wmay@cisco.com */ #include "mp4common.h" @@ -61,6 +62,11 @@ MP4File::~MP4File() { MP4Free(m_fileName); + if (m_pFile != NULL) { + // not closed ? + fclose(m_pFile); + m_pFile = NULL; + } delete m_pRootAtom; for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { delete m_pTracks[i]; @@ -1425,7 +1431,40 @@ return trackId; } - +MP4TrackId MP4File::AddCntlTrackDefault (uint32_t timeScale, + MP4Duration sampleDuration, + const char *type) +{ + MP4TrackId trackId = AddTrack(MP4_CNTL_TRACK_TYPE, timeScale); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0); + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), type); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the mp4v atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsz.sampleSize", sampleDuration); + + m_pTracks[FindTrackIndex(trackId)]-> + SetFixedSampleDuration(sampleDuration); + + return trackId; +} + +MP4TrackId MP4File::AddHrefTrack (uint32_t timeScale, + MP4Duration sampleDuration) +{ + MP4TrackId trackId = AddCntlTrackDefault(timeScale, sampleDuration, "href"); + + return trackId; +} + MP4TrackId MP4File::AddVideoTrackDefault( u_int32_t timeScale, MP4Duration sampleDuration, @@ -1628,7 +1667,7 @@ } bool MP4File::AddH264SequenceParameterSet (MP4TrackId trackId, - uint8_t *pSequence, + const uint8_t *pSequence, uint16_t sequenceLen) { MP4Atom *avcCAtom = @@ -1670,8 +1709,8 @@ return true; } bool MP4File::AddH264PictureParameterSet (MP4TrackId trackId, - uint8_t *pPict, - uint16_t pictLen) + const uint8_t *pPict, + uint16_t pictLen) { MP4Atom *avcCAtom = FindAtom(MakeTrackName(trackId, @@ -2326,7 +2365,7 @@ return m_pTracks[FindTrackIndex(trackId)]->GetFixedSampleDuration(); } -float MP4File::GetTrackVideoFrameRate(MP4TrackId trackId) +double MP4File::GetTrackVideoFrameRate(MP4TrackId trackId) { MP4SampleId numSamples = GetTrackNumberOfSamples(trackId); @@ -2339,7 +2378,7 @@ return 0.0; } - return ((double)numSamples / UINT64_TO_DOUBLE(msDuration)) * MP4_MSECS_TIME_SCALE; + return ((double)numSamples / (double) msDuration) * MP4_MSECS_TIME_SCALE; } int MP4File::GetTrackAudioChannels (MP4TrackId trackId)
--- a/Plugins/Input/aac/libmp4v2/mp4file.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4file.h Thu Nov 17 14:01:18 2005 -0800 @@ -13,7 +13,7 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001 - 2005. All Rights Reserved. * * 3GPP features implementation is based on 3GPP's TS26.234-v5.60, * and was contributed by Ximpo Group Ltd. @@ -234,6 +234,9 @@ u_int8_t framesPerSample, bool isAmrWB); + MP4TrackId AddHrefTrack(uint32_t timeScale, + MP4Duration sampleDuration); + MP4TrackId AddMP4VideoTrack( u_int32_t timeScale, MP4Duration sampleDuration, @@ -254,6 +257,7 @@ bool selective_enc, char *kms_uri); + void SetH263Vendor( MP4TrackId trackId, u_int32_t vendor); @@ -286,10 +290,10 @@ uint8_t AVCLevelIndication, uint8_t sampleLenFieldSizeMinusOne); bool AddH264SequenceParameterSet(MP4TrackId trackId, - uint8_t *pSequence, + const uint8_t *pSequence, uint16_t sequenceLen); bool AddH264PictureParameterSet(MP4TrackId trackId, - uint8_t *pPicture, + const uint8_t *pPicture, uint16_t pictureLen); MP4TrackId AddHintTrack(MP4TrackId refTrackId); @@ -310,7 +314,7 @@ MP4Duration GetTrackFixedSampleDuration(MP4TrackId trackId); - float GetTrackVideoFrameRate(MP4TrackId trackId); + double GetTrackVideoFrameRate(MP4TrackId trackId); int GetTrackAudioChannels(MP4TrackId trackId); void GetTrackESConfiguration(MP4TrackId trackId, @@ -535,7 +539,12 @@ MP4Duration* pDuration = NULL); /* iTunes metadata handling */ + protected: bool CreateMetadataAtom(const char* name); + bool DeleteMetadataAtom(const char* name); + bool GetMetadataString(const char *atom, char **value); + bool SetMetadataString(const char *atom, const char *value); + public: bool MetadataDelete(void); /* set metadata */ @@ -549,6 +558,7 @@ bool SetMetadataTrack(u_int16_t track, u_int16_t totalTracks); bool SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks); bool SetMetadataGenre(const char *value); + bool SetMetadataGrouping(const char *value); bool SetMetadataTempo(u_int16_t tempo); bool SetMetadataCompilation(u_int8_t compilation); bool SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size); @@ -571,12 +581,31 @@ bool GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks); bool GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks); bool GetMetadataGenre(char **value); + bool GetMetadataGrouping(char **value); bool GetMetadataTempo(u_int16_t* tempo); bool GetMetadataCompilation(u_int8_t* compilation); bool GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t* size); bool GetMetadataFreeForm(char *name, u_int8_t** pValue, u_int32_t* valueSize); + + /* delete metadata */ + bool DeleteMetadataName(); + bool DeleteMetadataWriter(); + bool DeleteMetadataAlbum(); + bool DeleteMetadataArtist(); + bool DeleteMetadataTool(); + bool DeleteMetadataComment(); + bool DeleteMetadataYear(); + bool DeleteMetadataTrack(); + bool DeleteMetadataDisk(); + bool DeleteMetadataGenre(); + bool DeleteMetadataGrouping(); + bool DeleteMetadataTempo(); + bool DeleteMetadataCompilation(); + bool DeleteMetadataCoverArt(); + bool DeleteMetadataFreeForm(char *name); + /* end of MP4 API */ /* "protected" interface to be used only by friends in library */ @@ -699,6 +728,10 @@ u_int16_t width, u_int16_t height, const char *videoType); + MP4TrackId AddCntlTrackDefault( + u_int32_t timeScale, + MP4Duration sampleDuration, + const char *videoType); void AddTrackToIod(MP4TrackId trackId); void RemoveTrackFromIod(MP4TrackId trackId, bool shallHaveIods = true);
--- a/Plugins/Input/aac/libmp4v2/mp4info.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4info.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -158,7 +158,7 @@ MP4GetTrackDuration(mp4File, trackId); double msDuration = - UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, + (double) (MP4ConvertFromTrackDuration(mp4File, trackId, trackDuration, MP4_MSECS_TIME_SCALE)); u_int32_t avgBitRate = @@ -302,14 +302,46 @@ const char *media_data_name; uint8_t type = 0; + media_data_name = MP4GetTrackMediaDataName(mp4File, trackId); - + char typebuffer[80]; if (media_data_name == NULL) { typeName = "Unknown - no media data name"; foundTypeName = true; } else if (strcasecmp(media_data_name, "avc1") == 0) { // avc - typeName = "H.264"; + uint8_t profile, level; + char profileb[20], levelb[20]; + if (MP4GetTrackH264ProfileLevel(mp4File, trackId, &profile, &level)) { + if (profile == 66) { + strcpy(profileb, "Baseline"); + } else if (profile == 77) { + strcpy(profileb, "Main"); + } else if (profile == 88) { + strcpy(profileb, "Extended"); + } else { + sprintf(profileb, "Unknown Profile %x", profile); + } + switch (level) { + case 10: case 20: case 30: case 40: case 50: + sprintf(levelb, "%u", level / 10); + break; + case 11: case 12: case 13: + case 21: case 22: + case 31: case 32: + case 41: case 42: + case 51: + sprintf(levelb, "%u.%u", level / 10, level % 10); + break; + default: + sprintf(levelb, "unknown level %x", level); + break; + } + sprintf(typebuffer, "H264 %s@%s", profileb, levelb); + typeName = typebuffer; + } else { + typeName = "H.264 - profile/level error"; + } foundTypeName = true; } else if (strcasecmp(media_data_name, "s263") == 0) { // 3gp h.263 @@ -345,7 +377,7 @@ MP4GetTrackDuration(mp4File, trackId); double msDuration = - UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, + (double) (MP4ConvertFromTrackDuration(mp4File, trackId, trackDuration, MP4_MSECS_TIME_SCALE)); u_int32_t avgBitRate = @@ -357,14 +389,14 @@ u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId); - float fps = MP4GetTrackVideoFrameRate(mp4File, trackId); + double fps = MP4GetTrackVideoFrameRate(mp4File, trackId); char *sInfo = (char*)MP4Malloc(256); // type duration avgBitrate frameSize frameRate if (foundTypeName) { sprintf(sInfo, - "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %.2f fps\n", + "%u\tvideo\t%s%s, %.3f secs, %u kbps, %ux%u @ %f fps\n", trackId, MP4IsIsmaCrypMediaTrack(mp4File, trackId) ? "encv - " : "", typeName, @@ -376,7 +408,7 @@ ); } else { sprintf(sInfo, - "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %.2f fps\n", + "%u\tvideo\t%s(%u), %.3f secs, %u kbps, %ux%u @ %f fps\n", trackId, typeName, type, @@ -390,7 +422,38 @@ return sInfo; } +static char* PrintCntlInfo( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + const char *media_data_name = MP4GetTrackMediaDataName(mp4File, trackId); + const char *typeName = "Unknown"; + if (media_data_name == NULL) { + typeName = "Unknown - no media data name"; + } else if (strcasecmp(media_data_name, "href") == 0) { + typeName = "ISMA Href"; + } else { + typeName = media_data_name; + } + + MP4Duration trackDuration = + MP4GetTrackDuration(mp4File, trackId); + + double msDuration = + (double) (MP4ConvertFromTrackDuration(mp4File, trackId, + trackDuration, MP4_MSECS_TIME_SCALE)); + char *sInfo = (char *)MP4Malloc(256); + + snprintf(sInfo, 256, + "%u\tcontrol\t%s, %.3f secs\n", + trackId, + typeName, + msDuration / 1000.0); + return sInfo; +} + + static char* PrintHintInfo( MP4FileHandle mp4File, MP4TrackId trackId) @@ -429,6 +492,8 @@ trackInfo = PrintVideoInfo(mp4File, trackId); } else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) { trackInfo = PrintHintInfo(mp4File, trackId); + } else if (strcmp(trackType, MP4_CNTL_TRACK_TYPE) == 0) { + trackInfo = PrintCntlInfo(mp4File, trackId); } else { trackInfo = (char*)MP4Malloc(256); if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) {
--- a/Plugins/Input/aac/libmp4v2/mp4meta.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4meta.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -35,6 +35,7 @@ - ©too : Tool(s) used to create the file (string) - ©cmt : Comment (string) - ©gen : Custom genre (string) + - ©grp : Grouping (string) - trkn : Tracknumber (8 byte string) 16 bit: empty 16 bit: tracknumber @@ -135,122 +136,64 @@ return true; } -bool MP4File::SetMetadataName(const char* value) +bool MP4File::DeleteMetadataAtom(const char* name) { - const char *s = "moov.udta.meta.ilst.\251nam.data"; - MP4BytesProperty *pMetadataProperty = NULL; MP4Atom *pMetaAtom = NULL; - + char s[256]; + + sprintf(s, "moov.udta.meta.ilst.%s", name); pMetaAtom = m_pRootAtom->FindAtom(s); - if (!pMetaAtom) + /* if it exists, delete it */ + if (pMetaAtom) { - if (!CreateMetadataAtom("\251nam")) - return false; + MP4Atom *pParent = pMetaAtom->GetParentAtom(); + + pParent->DeleteChildAtom(pMetaAtom); - pMetaAtom = m_pRootAtom->FindAtom(s); + delete pMetaAtom; + + return true; } - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; + return false; } -bool MP4File::GetMetadataName(char** value) +bool MP4File::SetMetadataString (const char *atom, const char *value) +{ + char atomstring[40]; + MP4Atom *pMetaAtom; + MP4BytesProperty *pMetadataProperty = NULL; + sprintf(atomstring, "moov.udta.meta.ilst.%s.data", atom); + + pMetaAtom = m_pRootAtom->FindAtom(atomstring); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom(atom)) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(atomstring); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataString (const char *atom, char **value) { unsigned char *val = NULL; u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251nam.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); - - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } -} - -bool MP4File::SetMetadataWriter(const char* value) -{ - const char *s = "moov.udta.meta.ilst.\251wrt.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251wrt")) - return false; - - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; -} + char atomstring[60]; + sprintf(atomstring, "moov.udta.meta.ilst.%s.data.metadata", atom); -bool MP4File::GetMetadataWriter(char** value) -{ - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251wrt.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); - - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } -} + *value = NULL; -bool MP4File::SetMetadataAlbum(const char* value) -{ - const char *s = "moov.udta.meta.ilst.\251alb.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251alb")) - return false; - - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; -} - -bool MP4File::GetMetadataAlbum(char** value) -{ - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251alb.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); + GetBytesProperty(atomstring, (u_int8_t**)&val, &valSize); if (valSize > 0) { @@ -258,185 +201,115 @@ memset(*value, 0, (valSize+1)*sizeof(unsigned char)); memcpy(*value, val, valSize*sizeof(unsigned char)); return true; - } else { - *value = NULL; - return false; - } + } + return false; +} + +bool MP4File::SetMetadataName(const char* value) +{ + return SetMetadataString("\251nam", value); +} + +bool MP4File::GetMetadataName(char** value) +{ + return GetMetadataString("\251nam", value); +} + +bool MP4File::DeleteMetadataName() +{ + return DeleteMetadataAtom("\251nam"); +} + +bool MP4File::SetMetadataWriter(const char* value) +{ + return SetMetadataString("\251wrt", value); +} + +bool MP4File::GetMetadataWriter(char** value) +{ + return GetMetadataString("\251wrt", value); +} + +bool MP4File::DeleteMetadataWriter() +{ + return DeleteMetadataAtom("\251wrt"); +} + +bool MP4File::SetMetadataAlbum(const char* value) +{ + return SetMetadataString("\251alb", value); +} + +bool MP4File::GetMetadataAlbum(char** value) +{ + return GetMetadataString("\251alb", value); +} + +bool MP4File::DeleteMetadataAlbum() +{ + return DeleteMetadataAtom("\251alb"); } bool MP4File::SetMetadataArtist(const char* value) { - const char *s = "moov.udta.meta.ilst.\251ART.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251ART")) - return false; - - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; + return SetMetadataString("\251ART", value); } bool MP4File::GetMetadataArtist(char** value) { - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251ART.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); + return GetMetadataString("\251ART", value); +} - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } +bool MP4File::DeleteMetadataArtist() +{ + return DeleteMetadataAtom("\251ART"); } bool MP4File::SetMetadataTool(const char* value) { - const char *s = "moov.udta.meta.ilst.\251too.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251too")) - return false; - - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; + return SetMetadataString("\251too", value); } bool MP4File::GetMetadataTool(char** value) { - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251too.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); + return GetMetadataString("\251too", value); +} - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } +bool MP4File::DeleteMetadataTool() +{ + return DeleteMetadataAtom("\251too"); } bool MP4File::SetMetadataComment(const char* value) { - const char *s = "moov.udta.meta.ilst.\251cmt.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251cmt")) - return false; - - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); - - return true; + return SetMetadataString("\251cmt", value); } bool MP4File::GetMetadataComment(char** value) { - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251cmt.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); + return GetMetadataString("\251cmt", value); +} - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } +bool MP4File::DeleteMetadataComment() +{ + return DeleteMetadataAtom("\251cmt"); } bool MP4File::SetMetadataYear(const char* value) { - const char *s = "moov.udta.meta.ilst.\251day.data"; - MP4BytesProperty *pMetadataProperty = NULL; - MP4Atom *pMetaAtom = NULL; - - pMetaAtom = m_pRootAtom->FindAtom(s); - - if (!pMetaAtom) - { - if (!CreateMetadataAtom("\251day")) - return false; + if (strlen(value) != 4) return false; - pMetaAtom = m_pRootAtom->FindAtom(s); - } - - pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); - ASSERT(pMetadataProperty); - - if (strlen(value) < 4) - return false; - - pMetadataProperty->SetValue((u_int8_t*)value, 4); - - return true; + return SetMetadataString("\251day", value); } bool MP4File::GetMetadataYear(char** value) { - unsigned char *val = NULL; - u_int32_t valSize = 0; - const char *s = "moov.udta.meta.ilst.\251day.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); + return GetMetadataString("\251day", value); +} - if (valSize > 0) - { - *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); - memset(*value, 0, (valSize+1)*sizeof(unsigned char)); - memcpy(*value, val, valSize*sizeof(unsigned char)); - return true; - } else { - *value = NULL; - return false; - } +bool MP4File::DeleteMetadataYear() +{ + return DeleteMetadataAtom("\251day"); } bool MP4File::SetMetadataTrack(u_int16_t track, u_int16_t totalTracks) @@ -475,11 +348,12 @@ unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.trkn.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); *track = 0; *totalTracks = 0; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + if (valSize != 8) return false; @@ -491,6 +365,11 @@ return true; } +bool MP4File::DeleteMetadataTrack() +{ + return DeleteMetadataAtom("trkn"); +} + bool MP4File::SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks) { unsigned char t[9]; @@ -527,11 +406,12 @@ unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.disk.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); *disk = 0; *totalDisks = 0; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + if (valSize != 8) return false; @@ -543,6 +423,11 @@ return true; } +bool MP4File::DeleteMetadataDisk() +{ + return DeleteMetadataAtom("disk"); +} + static const char* ID3v1GenreList[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", @@ -609,11 +494,13 @@ genreIndex = StringToGenre(value); + const char *s = "moov.udta.meta.ilst.gnre.data"; + const char *sroot = "moov.udta.meta.ilst.gnre"; + const char *s2 = "moov.udta.meta.ilst.\251gen.data"; + const char *s2root = "moov.udta.meta.ilst.\251gen"; if (genreIndex != 0) { - const char *s = "moov.udta.meta.ilst.gnre.data"; - pMetaAtom = m_pRootAtom->FindAtom(s); - + pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) { if (!CreateMetadataAtom("gnre")) @@ -630,10 +517,20 @@ ASSERT(pMetadataProperty); pMetadataProperty->SetValue((u_int8_t*)t, 2); + + // remove other style of genre atom, if this one is added + pMetaAtom = m_pRootAtom->FindAtom(s2root); + if (pMetaAtom != NULL) { + MP4Atom *pParent = pMetaAtom->GetParentAtom(); + pParent->DeleteChildAtom(pMetaAtom); + delete pMetaAtom; + } + + + (void)DeleteMetadataAtom( "\251gen" ); return true; } else { - const char *s2 = "moov.udta.meta.ilst.\251gen.data"; pMetaAtom = m_pRootAtom->FindAtom(s2); if (!pMetaAtom) @@ -649,6 +546,13 @@ pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + // remove other gnre atom if this one is entered + pMetaAtom = m_pRootAtom->FindAtom(sroot); + if (pMetaAtom != NULL) { + MP4Atom *pParent = pMetaAtom->GetParentAtom(); + pParent->DeleteChildAtom(pMetaAtom); + delete pMetaAtom; + } return true; } @@ -663,6 +567,8 @@ const char *t = "moov.udta.meta.ilst.gnre"; const char *s = "moov.udta.meta.ilst.gnre.data.metadata"; + *value = NULL; + MP4Atom *gnre = FindAtom(t); if (gnre) @@ -677,6 +583,8 @@ GenreToString(value, genreIndex); + (void)DeleteMetadataAtom( "gnre" ); + return true; } else { const char *s2 = "moov.udta.meta.ilst.\251gen.data.metadata"; @@ -693,7 +601,6 @@ memcpy(*value, val, valSize*sizeof(unsigned char)); return true; } else { - *value = NULL; return false; } } @@ -701,6 +608,28 @@ return false; } +bool MP4File::DeleteMetadataGenre() +{ + bool val1 = DeleteMetadataAtom("\251gen"); + bool val2 = DeleteMetadataAtom("gnre"); + return val1 || val2; +} + +bool MP4File::SetMetadataGrouping(const char* value) +{ + return SetMetadataString("\251grp", value); +} + +bool MP4File::GetMetadataGrouping(char** value) +{ + return GetMetadataString("\251grp", value); +} + +bool MP4File::DeleteMetadataGrouping() +{ + return DeleteMetadataAtom("\251grp"); +} + bool MP4File::SetMetadataTempo(u_int16_t tempo) { unsigned char t[3]; @@ -735,10 +664,11 @@ unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.tmpo.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); *tempo = 0; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + if (valSize != 2) return false; @@ -748,6 +678,11 @@ return true; } +bool MP4File::DeleteMetadataTempo() +{ + return DeleteMetadataAtom("tmpo"); +} + bool MP4File::SetMetadataCompilation(u_int8_t compilation) { const char *s = "moov.udta.meta.ilst.cpil.data"; @@ -778,10 +713,11 @@ unsigned char *val = NULL; u_int32_t valSize = 0; const char *s = "moov.udta.meta.ilst.cpil.data.metadata"; - GetBytesProperty(s, (u_int8_t**)&val, &valSize); *compilation = 0; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + if (valSize != 1) return false; @@ -790,6 +726,11 @@ return true; } +bool MP4File::DeleteMetadataCompilation() +{ + return DeleteMetadataAtom("cpil"); +} + bool MP4File::SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size) { const char *s = "moov.udta.meta.ilst.covr.data"; @@ -817,6 +758,10 @@ bool MP4File::GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t *size) { const char *s = "moov.udta.meta.ilst.covr.data.metadata"; + + *coverArt = NULL; + *size = 0; + GetBytesProperty(s, coverArt, size); if (size == 0) @@ -825,6 +770,11 @@ return true; } +bool MP4File::DeleteMetadataCoverArt() +{ + return DeleteMetadataAtom("covr"); +} + bool MP4File::SetMetadataFreeForm(char *name, u_int8_t* pValue, u_int32_t valueSize) { MP4Atom *pMetaAtom = NULL; @@ -928,6 +878,9 @@ char s[256]; int i = 0; + *ppValue = NULL; + *pValueSize = 0; + while (1) { MP4BytesProperty *pMetadataProperty; @@ -963,6 +916,45 @@ } } +bool MP4File::DeleteMetadataFreeForm(char *name) +{ + char s[256]; + int i = 0; + + while (1) + { + MP4BytesProperty *pMetadataProperty; + + sprintf(s, "moov.udta.meta.ilst.----[%u].name", i); + + MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); + + if (!pTagAtom) + return false; + + pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty); + if (pMetadataProperty) + { + u_int8_t* pV; + u_int32_t VSize = 0; + + pMetadataProperty->GetValue(&pV, &VSize); + + if (VSize != 0) + { + if (memcmp(pV, name, VSize) == 0) + { + sprintf(s, "----[%u]", i); + + return DeleteMetadataAtom(s); + } + } + } + + i++; + } +} + bool MP4File::MetadataDelete() { MP4Atom *pMetaAtom = NULL;
--- a/Plugins/Input/aac/libmp4v2/mp4property.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4property.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -215,11 +215,11 @@ } Indent(pFile, indent); if (index != 0) - fprintf(pFile, "%s[%u] = "U64" (0x%016"X64F")\n", + fprintf(pFile, "%s[%u] = %llu (0x%016llxf)\n", m_name, index, m_values[index], m_values[index]); else fprintf(pFile, - "%s = "U64" (0x%016"X64F")\n", + "%s = %llu (0x%016llxf)\n", m_name, m_values[index], m_values[index]); fflush(pFile); } @@ -256,11 +256,11 @@ } if (index != 0) fprintf(pFile, - "%s[%u] = "U64" (0x%0*"X64F") <%u bits>\n", + "%s[%u] = %llu (0x%0*llxf) <%u bits>\n", m_name, index, m_values[index], (int)hexWidth, m_values[index], m_numBits); else fprintf(pFile, - "%s = "U64" (0x%0*"X64F") <%u bits>\n", + "%s = %llu (0x%0*llxf) <%u bits>\n", m_name, m_values[index], (int)hexWidth, m_values[index], m_numBits); fflush(pFile); }
--- a/Plugins/Input/aac/libmp4v2/mp4property.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4property.h Thu Nov 17 14:01:18 2005 -0800 @@ -301,7 +301,7 @@ void SetValue(const char* value, u_int32_t index = 0); - void AddValue(char* value) { + void AddValue(const char* value) { u_int32_t count = GetCount(); SetCount(count + 1); SetValue(value, count); @@ -387,7 +387,7 @@ void SetValue(const u_int8_t* pValue, u_int32_t valueSize, u_int32_t index = 0); - void AddValue(u_int8_t* pValue, u_int32_t valueSize) { + void AddValue(const u_int8_t* pValue, u_int32_t valueSize) { u_int32_t count = GetCount(); SetCount(count + 1); SetValue(pValue, valueSize, count);
--- a/Plugins/Input/aac/libmp4v2/mp4track.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4track.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -613,14 +613,13 @@ return 0; } - u_int64_t durationSecs = - MP4ConvertTime(GetDuration(), GetTimeScale(), MP4_SECS_TIME_SCALE); - - if (GetDuration() % GetTimeScale() != 0) { - durationSecs++; - } - - return (GetTotalOfSampleSizes() * 8) / durationSecs; + double calc = (double) (GetTotalOfSampleSizes()); + // this is a bit better - we use the whole duration + calc *= 8.0; + calc *= GetTimeScale(); + calc /= (double) (GetDuration()); + // we might want to think about rounding to the next 100 or 1000 + return (uint32_t) ceil(calc); } u_int32_t MP4Track::GetMaxBitrate() @@ -629,32 +628,48 @@ MP4SampleId numSamples = GetNumberOfSamples(); u_int32_t maxBytesPerSec = 0; u_int32_t bytesThisSec = 0; - MP4Timestamp thisSec = 0; + MP4Timestamp thisSecStart = 0; + MP4Timestamp lastSampleTime = 0; + uint32_t lastSampleSize = 0; + MP4SampleId thisSecStartSid = 1; for (MP4SampleId sid = 1; sid <= numSamples; sid++) { - u_int32_t sampleSize; - MP4Timestamp sampleTime; - - sampleSize = GetSampleSize(sid); - - GetSampleTimes(sid, &sampleTime, NULL); + uint32_t sampleSize; + MP4Timestamp sampleTime; - // sample counts for current second - if (sampleTime < thisSec + timeScale) { - bytesThisSec += sampleSize; - } else { // sample is in a future second - if (bytesThisSec > maxBytesPerSec) { - maxBytesPerSec = bytesThisSec; - } + sampleSize = GetSampleSize(sid); + GetSampleTimes(sid, &sampleTime, NULL); + + if (sampleTime < thisSecStart + timeScale) { + bytesThisSec += sampleSize; + lastSampleSize = sampleSize; + lastSampleTime = sampleTime; + } else { + // we've already written the last sample and sampleSize. + // this means that we've probably overflowed the last second + // calculate the time we've overflowed + MP4Duration overflow_dur = + (thisSecStart + timeScale) - lastSampleTime; + // calculate the duration of the last sample + MP4Duration lastSampleDur = sampleTime - lastSampleTime; + uint32_t overflow_bytes; + // now, calculate the number of bytes we overflowed. Round up. + overflow_bytes = + ((lastSampleSize * overflow_dur) + (lastSampleDur - 1)) / lastSampleDur; - thisSec = sampleTime - (sampleTime % timeScale); - bytesThisSec = sampleSize; - } - } + if (bytesThisSec - overflow_bytes > maxBytesPerSec) { + maxBytesPerSec = bytesThisSec - overflow_bytes; + } - // last second (or partial second) - if (bytesThisSec > maxBytesPerSec) { - maxBytesPerSec = bytesThisSec; + // now adjust the values for this sample. Remove the bytes + // from the first sample in this time frame + lastSampleTime = sampleTime; + lastSampleSize = sampleSize; + bytesThisSec += sampleSize; + bytesThisSec -= GetSampleSize(thisSecStartSid); + thisSecStartSid++; + GetSampleTimes(thisSecStartSid, &thisSecStart, NULL); + } } return maxBytesPerSec * 8;
--- a/Plugins/Input/aac/libmp4v2/mp4util.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4util.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -13,10 +13,11 @@ * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * Copyright (C) Cisco Systems Inc. 2001-2005. All Rights Reserved. * * Contributor(s): * Dave Mackie dmackie@cisco.com + * Bill May wmay@cisco.com */ #include "mp4common.h" @@ -334,6 +335,9 @@ || !strcasecmp(type, "od")) { return MP4_OD_TRACK_TYPE; } + if (strcasecmp(type, "cntl") == 0) { + return MP4_CNTL_TRACK_TYPE; + } VERBOSE_WARNING(verbosity, printf("Attempt to normalize %s did not match\n", type));
--- a/Plugins/Input/aac/libmp4v2/mp4util.h Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/mp4util.h Thu Nov 17 14:01:18 2005 -0800 @@ -207,12 +207,24 @@ } inline u_int32_t STRTOINT32(const char* s) { +#ifdef WORDS_BIGENDIAN + return (*(u_int32_t *)s); +#else + return htonl(*(uint32_t *)s); +#endif +#if 0 return (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; +#endif } inline void INT32TOSTR(u_int32_t i, char* s) { +#ifdef WORDS_BIGENDIAN + *(uint32_t *)s = i; + s[4] = 0; +#else s[0] = ((i >> 24) & 0xFF); s[1] = ((i >> 16) & 0xFF); s[2] = ((i >> 8) & 0xFF); s[3] = (i & 0xFF); s[4] = 0; +#endif } inline MP4Timestamp MP4GetAbsTimestamp() {
--- a/Plugins/Input/aac/libmp4v2/rtphint.cpp Thu Nov 17 12:21:04 2005 -0800 +++ b/Plugins/Input/aac/libmp4v2/rtphint.cpp Thu Nov 17 14:01:18 2005 -0800 @@ -415,6 +415,8 @@ sdpMediaType = "audio"; } else if (!strcmp(m_pRefTrack->GetType(), MP4_VIDEO_TRACK_TYPE)) { sdpMediaType = "video"; + } else if (!strcmp(m_pRefTrack->GetType(), MP4_CNTL_TRACK_TYPE)) { + sdpMediaType = "control"; } else { sdpMediaType = "application"; }