MP4TrunAtom::MP4TrunAtom() : MP4Atom("trun") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sampleCount")); }
MP4UrnAtom::MP4UrnAtom(MP4File &file) : MP4Atom(file, "urn ") { AddVersionAndFlags(); AddProperty(new MP4StringProperty(*this, "name")); AddProperty(new MP4StringProperty(*this, "location")); }
MP4TfhdAtom::MP4TfhdAtom(MP4File &file) : MP4Atom(file, "tfhd") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property(*this, "trackId")); }
MP4IKMSAtom::MP4IKMSAtom() : MP4Atom("iKMS") { AddVersionAndFlags(); /* 0, 1 */ MP4StringProperty* pProp = new MP4StringProperty("kms_URI"); AddProperty(pProp); /* 2 */ }
MP4TfhdAtom::MP4TfhdAtom() : MP4Atom("tfhd") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("trackId")); }
// MP4ChplAtom is for Nero chapter list atom which is a child of udta MP4ChplAtom::MP4ChplAtom () : MP4Atom("chpl") { // it is not completely clear if version, flags, reserved and chaptercount // have the right sizes but // one thing is clear: chaptercount is not only 8-bit it is at least 16-bit // add the version AddVersionAndFlags(); // add reserved bytes AddReserved("reserved", 1); // define the chaptercount MP4Integer32Property * counter = new MP4Integer32Property("chaptercount"); AddProperty(counter); // define the chapterlist MP4TableProperty * list = new MP4TableProperty("chapters", counter); // the start time as 100 nanoseconds units list->AddProperty(new MP4Integer64Property("starttime")); // the chapter name as UTF-8 list->AddProperty(new MP4StringProperty("title", true)); // add the chapterslist AddProperty(list); }
MP4Meta1Atom::MP4Meta1Atom(const char *name) : MP4Atom(name) { AddVersionAndFlags(); /* 0, 1 */ AddProperty(new MP4BytesProperty("metadata")); /* 2 */ }
MP4StscAtom::MP4StscAtom() : MP4Atom("stsc") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer32Property("firstChunk")); pTable->AddProperty( new MP4Integer32Property("samplesPerChunk")); pTable->AddProperty( new MP4Integer32Property("sampleDescriptionIndex")); // As an optimization we add an implicit property to this table, // "firstSample" that corresponds to the first sample of the firstChunk MP4Integer32Property* pSample = new MP4Integer32Property("firstSample"); pSample->SetImplicit(); pTable->AddProperty(pSample); }
MP4MetaAtom::MP4MetaAtom() : MP4Atom("meta") { AddVersionAndFlags(); /* 0, 1 */ ExpectChildAtom("hdlr", Required, OnlyOne); ExpectChildAtom("ilst", Required, OnlyOne); }
MP4NameAtom::MP4NameAtom() : MP4Atom("name") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( new MP4BytesProperty("metadata")); /* 2 */ }
MP4DataAtom::MP4DataAtom() : MP4Atom("data") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved2", 4); /* 2 */ AddProperty( new MP4BytesProperty("metadata")); /* 3 */ }
MP4HdlrAtom::MP4HdlrAtom() : MP4Atom("hdlr") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved1", 4); /* 2 */ MP4StringProperty* pProp = new MP4StringProperty("handlerType"); pProp->SetFixedLength(4); AddProperty(pProp); /* 3 */ AddReserved("reserved2", 12); /* 4 */ AddProperty( /* 5 */ new MP4StringProperty("name")); }
MP4ElstAtom::MP4ElstAtom() : MP4Atom("elst") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); }
/*! \brief Constructor. */ MP4OhdrAtom::MP4OhdrAtom(): MP4Atom("ohdr") { AddVersionAndFlags(); AddProperty(new MP4Integer8Property("EncryptionMethod")); AddProperty(new MP4Integer8Property("EncryptionPadding")); AddProperty(new MP4Integer64Property("PlaintextLength")); AddProperty(new MP4Integer16Property("ContentIDLength")); AddProperty(new MP4Integer16Property("RightsIssuerURLLength")); AddProperty(new MP4Integer16Property("TextualHeadersLength")); AddProperty(new OhdrMP4StringProperty("ContentID")); AddProperty(new OhdrMP4StringProperty("RightsIssuerURL")); AddProperty(new MP4BytesProperty("TextualHeaders")); }
MP4GminAtom::MP4GminAtom() : MP4Atom("gmin") { AddVersionAndFlags(); /* 0, 1 */ AddProperty(new MP4Integer16Property("graphicsMode")); /* 2 */ AddProperty(new MP4Integer16Property("opColorRed")); /* 3 */ AddProperty(new MP4Integer16Property("opColorGreen")); /* 4 */ AddProperty(new MP4Integer16Property("opColorBlue")); /* 5 */ AddProperty(new MP4Integer16Property("balance")); /* 6 */ AddReserved("reserved", 2); /* 7 */ }
MP4DrefAtom::MP4DrefAtom() : MP4Atom("dref") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetReadOnly(); AddProperty(pCount); ExpectChildAtom("url ", Optional, Many); ExpectChildAtom("urn ", Optional, Many); ExpectChildAtom("alis", Optional, Many); }
MP4Stz2Atom::MP4Stz2Atom() : MP4Atom("stz2") { AddVersionAndFlags(); /* 0, 1 */ AddReserved("reserved", 3); /* 2 */ AddProperty( /* 3 */ new MP4Integer8Property("fieldSize")); MP4Integer32Property* pCount = new MP4Integer32Property("sampleCount"); AddProperty(pCount); /* 4 */ }
MP4StdpAtom::MP4StdpAtom() : MP4Atom("stdp") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetImplicit(); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer16Property("priority")); }
MP4CttsAtom::MP4CttsAtom() : MP4Atom("ctts") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer32Property("sampleCount")); pTable->AddProperty( new MP4Integer32Property("sampleOffset")); }
MP4StszAtom::MP4StszAtom() : MP4Atom("stsz") { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sampleSize")); MP4Integer32Property* pCount = new MP4Integer32Property("sampleCount"); AddProperty(pCount); /* 3 */ MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); /* 4 */ pTable->AddProperty( /* 4/0 */ new MP4Integer32Property("entrySize")); }
MP4StsdAtom::MP4StsdAtom() : MP4Atom("stsd") { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); pCount->SetReadOnly(); AddProperty(pCount); ExpectChildAtom("mp4a", Optional, Many); ExpectChildAtom("enca", Optional, Many); ExpectChildAtom("mp4s", Optional, Many); ExpectChildAtom("mp4v", Optional, Many); ExpectChildAtom("encv", Optional, Many); ExpectChildAtom("rtp ", Optional, Many); ExpectChildAtom("samr", Optional, Many); // For AMR-NB ExpectChildAtom("sawb", Optional, Many); // For AMR-WB ExpectChildAtom("s263", Optional, Many); // For H.263 ExpectChildAtom("avc1", Optional, Many); ExpectChildAtom("alac", Optional, Many); }
MP4VmhdAtom::MP4VmhdAtom() : MP4Atom("vmhd") { AddVersionAndFlags(); AddReserved("reserved", 8); }
MP4TkhdAtom::MP4TkhdAtom(MP4File &file) : MP4Atom(file, "tkhd") { AddVersionAndFlags(); }
MP4NmhdAtom::MP4NmhdAtom(MP4File &file) : MP4Atom(file, "nmhd") { AddVersionAndFlags(); }
MP4TkhdAtom::MP4TkhdAtom() : MP4Atom("tkhd") { AddVersionAndFlags(); }
MP4StandardAtom::MP4StandardAtom (const char *type) : MP4Atom(type) { /* * This is a big if else loop. Make sure that you don't break it * when adding new atoms, or you will set the unknown type flag * * Try to keep it in alphabetical order - it should only be called * 1 time per atom, so it's not that urgent. */ /* * b??? */ if (ATOMID(type) == ATOMID("bitr")) { AddProperty( /* 0 */ new MP4Integer32Property("avgBitrate")); AddProperty( /* 1 */ new MP4Integer32Property("maxBitrate")); } else if (ATOMID(type) == ATOMID("btrt")) { AddProperty( new MP4Integer32Property("bufferSizeDB")); /* 0 */ AddProperty( new MP4Integer32Property("avgBitrate")); /* 1 */ AddProperty( new MP4Integer32Property("maxBitrate")); /* 2 */ /* * c??? */ } else if (ATOMID(type) == ATOMID("co64")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty( new MP4Integer64Property("chunkOffset")); } else if (ATOMID(type) == ATOMID("cpil")) { ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */ ExpectChildAtom("data", Required, Many); } else if (ATOMID(type) == ATOMID("cprt")) { AddVersionAndFlags(); AddProperty( new MP4Integer16Property("language")); AddProperty( new MP4StringProperty("notice")); } else if (ATOMID(type) == ATOMID("ctts")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleCount")); pTable->AddProperty(new MP4Integer32Property("sampleOffset")); /* * d??? */ } else if (ATOMID(type) == ATOMID("dinf")) { ExpectChildAtom("dref", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("dimm")) { AddProperty( // bytes of immediate data new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */ ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("dmax")) { AddProperty( // max packet duration new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("dmed")) { AddProperty( // bytes sent from media data new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("drep")) { AddProperty( // bytes of repeated data new MP4Integer64Property("bytes")); /* * e??? */ } else if (ATOMID(type) == ATOMID("edts")) { ExpectChildAtom("elst", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("esds")) { AddVersionAndFlags(); AddProperty( new MP4DescriptorProperty(NULL, MP4ESDescrTag, 0, Required, OnlyOne)); /* * f??? */ } else if (ATOMID(type) == ATOMID("frma")) { AddProperty( /* 0 */ new MP4Integer32Property("data-format")); /* * g??? */ } else if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes ExpectChildAtom("data", Optional, OnlyOne); /* * h??? */ } else if (ATOMID(type) == ATOMID("hmhd")) { AddVersionAndFlags(); AddProperty(new MP4Integer16Property("maxPduSize")); AddProperty(new MP4Integer16Property("avgPduSize")); AddProperty(new MP4Integer32Property("maxBitRate")); AddProperty(new MP4Integer32Property("avgBitRate")); AddProperty(new MP4Integer32Property("slidingAvgBitRate")); /* * i??? */ } else if (ATOMID(type) == ATOMID("iKMS")) { AddVersionAndFlags(); /* 0, 1 */ MP4StringProperty* pProp = new MP4StringProperty("kms_URI"); AddProperty(pProp); /* 2 */ } else if (ATOMID(type) == ATOMID("iSFM")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4BitfieldProperty("selective-encryption", 1)); AddProperty( /* 3 */ new MP4BitfieldProperty("reserved", 7)); AddProperty( /* 4 */ new MP4Integer8Property("key-indicator-length")); AddProperty( /* 5 */ new MP4Integer8Property("IV-length")); } else if (ATOMID(type) == ATOMID("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 */ } else if (ATOMID(type) == ATOMID("imif")) { AddVersionAndFlags(); AddProperty(new MP4DescriptorProperty("ipmp_desc", MP4IPMPDescrTag, MP4IPMPDescrTag, Required, Many)); } else if (ATOMID(type) == ATOMID("iods")) { AddVersionAndFlags(); AddProperty( new MP4DescriptorProperty(NULL, MP4FileIODescrTag, MP4FileODescrTag, Required, OnlyOne)); /* * m??? */ } else if (ATOMID(type) == ATOMID("maxr")) { AddProperty(new MP4Integer32Property("granularity")); AddProperty(new MP4Integer32Property("bytes")); } else if (ATOMID(type) == ATOMID("mdia")) { ExpectChildAtom("mdhd", Required, OnlyOne); ExpectChildAtom("hdlr", Required, OnlyOne); ExpectChildAtom("minf", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("meta")) { // iTunes AddVersionAndFlags(); /* 0, 1 */ ExpectChildAtom("hdlr", Required, OnlyOne); ExpectChildAtom("ilst", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("mfhd")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("sequenceNumber")); } else if (ATOMID(type) == ATOMID("minf")) { ExpectChildAtom("vmhd", Optional, OnlyOne); ExpectChildAtom("smhd", Optional, OnlyOne); ExpectChildAtom("hmhd", Optional, OnlyOne); ExpectChildAtom("nmhd", Optional, OnlyOne); ExpectChildAtom("dinf", Required, OnlyOne); ExpectChildAtom("stbl", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("moof")) { ExpectChildAtom("mfhd", Required, OnlyOne); ExpectChildAtom("traf", Optional, Many); } else if (ATOMID(type) == ATOMID("moov")) { ExpectChildAtom("mvhd", Required, OnlyOne); ExpectChildAtom("iods", Optional, OnlyOne); ExpectChildAtom("trak", Required, Many); ExpectChildAtom("udta", Optional, Many); ExpectChildAtom("mvex", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("mvex")) { ExpectChildAtom("trex", Required, Many); /* * n??? */ } else if (ATOMID(type) == ATOMID("nmhd")) { AddVersionAndFlags(); } else if (ATOMID(type) == ATOMID("nump")) { AddProperty( // packets sent new MP4Integer64Property("packets")); /* * o??? */ } else if (ATOMID(type) == ATOMID("odkm")) { AddVersionAndFlags(); ExpectChildAtom("ohdr", Required, OnlyOne); /* * p??? */ } else if (ATOMID(type) == ATOMID("payt")) { AddProperty(new MP4Integer32Property("payloadNumber")); AddProperty(new MP4StringProperty("rtpMap", Counted)); } else if (ATOMID(type) == ATOMID("pmax")) { AddProperty( // max packet size new MP4Integer32Property("bytes")); /* * s??? */ } else if (ATOMID(type) == ATOMID("schi")) { // not sure if this is child atoms or table of boxes // get clarification on spec 9.1.2.5 ExpectChildAtom("odkm", Optional, OnlyOne); ExpectChildAtom("iKMS", Optional, OnlyOne); ExpectChildAtom("iSFM", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("schm")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("scheme_type")); AddProperty( /* 3 */ new MP4Integer32Property("scheme_version")); // browser URI if flags set, TODO } else if (ATOMID(type) == ATOMID("sinf")) { ExpectChildAtom("frma", Required, OnlyOne); ExpectChildAtom("imif", Optional, OnlyOne); ExpectChildAtom("schm", Optional, OnlyOne); ExpectChildAtom("schi", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("smhd")) { AddVersionAndFlags(); AddReserved("reserved", 4); } else if (ATOMID(type) == ATOMID("snro")) { AddProperty(new MP4Integer32Property("offset")); } else if (ATOMID(type) == ATOMID("stco")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("chunkOffset")); } else if (ATOMID(type) == ATOMID("stsh")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("shadowedSampleNumber")); pTable->AddProperty(new MP4Integer32Property("syncSampleNumber")); } else if (ATOMID(type) == ATOMID("stss")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleNumber")); } else if (ATOMID(type) == ATOMID("stts")) { AddVersionAndFlags(); MP4Integer32Property* pCount = new MP4Integer32Property("entryCount"); AddProperty(pCount); MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); AddProperty(pTable); pTable->AddProperty(new MP4Integer32Property("sampleCount")); pTable->AddProperty(new MP4Integer32Property("sampleDelta")); /* * t??? */ } else if (ATOMID(type) == ATOMID("tims")) { AddProperty( new MP4Integer32Property("timeScale")); } else if (ATOMID(type) == ATOMID("tmin")) { AddProperty( // min relative xmit time new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("tmax")) { AddProperty( // max relative xmit time new MP4Integer32Property("milliSecs")); } else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("traf")) { ExpectChildAtom("tfhd", Required, OnlyOne); ExpectChildAtom("trun", Optional, Many); } else if (ATOMID(type) == ATOMID("trak")) { ExpectChildAtom("tkhd", Required, OnlyOne); ExpectChildAtom("tref", Optional, OnlyOne); ExpectChildAtom("edts", Optional, OnlyOne); ExpectChildAtom("mdia", Required, OnlyOne); ExpectChildAtom("udta", Optional, Many); } else if (ATOMID(type) == ATOMID("tref")) { ExpectChildAtom("dpnd", Optional, OnlyOne); ExpectChildAtom("hint", Optional, OnlyOne); ExpectChildAtom("ipir", Optional, OnlyOne); ExpectChildAtom("mpod", Optional, OnlyOne); ExpectChildAtom("sync", Optional, OnlyOne); } else if (ATOMID(type) == ATOMID("trex")) { AddVersionAndFlags(); /* 0, 1 */ AddProperty( /* 2 */ new MP4Integer32Property("trackId")); AddProperty( /* 3 */ new MP4Integer32Property("defaultSampleDesriptionIndex")); AddProperty( /* 4 */ new MP4Integer32Property("defaultSampleDuration")); AddProperty( /* 5 */ new MP4Integer32Property("defaultSampleSize")); AddProperty( /* 6 */ new MP4Integer32Property("defaultSampleFlags")); } else if (ATOMID(type) == ATOMID("trkn")) { // iTunes ExpectChildAtom("data", Required, OnlyOne); } else if (ATOMID(type) == ATOMID("trpy") || ATOMID(type) == ATOMID("tpyl")) { AddProperty( // bytes sent including RTP headers new MP4Integer64Property("bytes")); } else if (ATOMID(type) == ATOMID("tsro")) { AddProperty( new MP4Integer32Property("offset")); } else if (ATOMID(type) == ATOMID("wave")) { ExpectChildAtom("esds", Required, OnlyOne); /* * copyright??? */ } else if (ATOMID(type) == ATOMID(art) || ATOMID(type) == ATOMID(wrt) || ATOMID(type) == ATOMID(alb) || ATOMID(type) == ATOMID(day) || ATOMID(type) == ATOMID(too) || ATOMID(type) == ATOMID(gen) || ATOMID(type) == ATOMID(grp)) { /* Apple iTunes */ ExpectChildAtom("data", Required, OnlyOne); /* * ---- */ } else if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */ ExpectChildAtom("mean", Required, OnlyOne); ExpectChildAtom("name", Required, OnlyOne); ExpectChildAtom("data", Required, OnlyOne); } else { /* * default - unknown type */ SetUnknownType(true); } }
MP4MdhdAtom::MP4MdhdAtom() : MP4Atom("mdhd") { AddVersionAndFlags(); }