diff --git a/lib/mp4.cpp b/lib/mp4.cpp index a95eab7e..b32efba2 100644 --- a/lib/mp4.cpp +++ b/lib/mp4.cpp @@ -250,6 +250,15 @@ namespace MP4 { case 0x61766331: return ((AVC1*)this)->toPrettyString(indent); break; + case 0x65647473: + return ((EDTS*)this)->toPrettyString(indent); + break; + case 0x73747373: + return ((STSS*)this)->toPrettyString(indent); + break; + case 0x75647461: + return ((UDTA*)this)->toPrettyString(indent); + break; case 0x75756964: return ((UUID*)this)->toPrettyString(indent); break; @@ -4014,6 +4023,59 @@ namespace MP4 { return r.str(); } + EDTS::EDTS(){ + memcpy(data + 4, "edts", 4); + } + + std::string EDTS::toPrettyString(uint32_t indent){ + return toPrettyContainerString(indent, std::string("[edts] Edit Box")); + } + + UDTA::UDTA(){ + memcpy(data + 4, "udta", 4); + } + + std::string UDTA::toPrettyString(uint32_t indent){ + return toPrettyContainerString(indent, std::string("[udta] User Data Box")); + } + + STSS::STSS(){ + memcpy(data + 4, "stss", 4); + } + + void STSS::setEntryCount(uint32_t newVal){ + setInt32(newVal, 4); + } + + uint32_t STSS::getEntryCount(){ + getInt32(4); + } + + void STSS::setSampleNumber(uint32 newVal, uint32_t index){ + if (index+1 > getEntryCount()){ + setEntryCount(index); + } + setInt32(newVal, 8 + (index * 4)); + } + + uint32_t STSS::getSampleNumber(uint32_t index){ + if (index >= getEntryCount()){ + return 0; + } + return getInt32(8 + (index * 4)); + } + + std::string STSS::toPrettyString(uint32_t indent){ + std::stringstream r; + r << std::string(indent, ' ') << "[stss] Sync Sample Box (" << boxedSize() << ")" << std::endl; + r << fullBox::toPrettyString(indent); + r << std::string(indent + 1, ' ') << "EntryCount: " << getEntryCount() << std::endl; + for (int i = 0; i < getEntryCount(); i++){ + r << std::string(indent + 1, ' ') << "SampleNumber[" << i <<"] : " << getSampleNumber(i) << std::endl; + } + return r.str(); + } + static char c2hex(int c){ if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; diff --git a/lib/mp4.h b/lib/mp4.h index cbecd429..094f6d15 100644 --- a/lib/mp4.h +++ b/lib/mp4.h @@ -786,6 +786,28 @@ namespace MP4 { std::string toPrettyString(uint32_t indent = 0); }; + class EDTS: public containerBox{ + public: + EDTS(); + std::string toPrettyString(uint32_t indent = 0); + }; + + class UDTA: public containerBox{ + public: + UDTA(); + std::string toPrettyString(uint32_t indent = 0); + }; + + class STSS: public fullBox{ + public: + STSS(); + void setEntryCount(uint32_t newVal); + uint32_t getEntryCount(); + void setSampleNumber(uint32 newVal, uint32_t index); + uint32_t getSampleNumber(uint32_t index); + std::string toPrettyString(uint32_t indent = 0); + }; + class UUID: public Box{ public: UUID();