diff --git a/lib/ebml.cpp b/lib/ebml.cpp index 0670b6f1..45a7abad 100644 --- a/lib/ebml.cpp +++ b/lib/ebml.cpp @@ -516,6 +516,12 @@ namespace EBML{ return std::string(strPtr, strLen); } + std::string Element::getValStringUntrimmed() const{ + uint64_t strLen = getPayloadLen(); + const char * strPtr = getPayload(); + return std::string(strPtr, strLen); + } + uint64_t Block::getTrackNum() const{return UniInt::readInt(getPayload());} int16_t Block::getTimecode() const{ diff --git a/lib/ebml.h b/lib/ebml.h index 972fe071..ff1668b1 100644 --- a/lib/ebml.h +++ b/lib/ebml.h @@ -97,6 +97,7 @@ namespace EBML{ int64_t getValInt() const; double getValFloat() const; std::string getValString() const; + std::string getValStringUntrimmed() const; const Element findChild(uint32_t id) const; private: diff --git a/src/input/input_ebml.cpp b/src/input/input_ebml.cpp index 5b44caf4..2e430074 100644 --- a/src/input/input_ebml.cpp +++ b/src/input/input_ebml.cpp @@ -191,13 +191,13 @@ namespace Mist{ trueCodec = "H264"; trueType = "video"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "V_MPEGH/ISO/HEVC"){ trueCodec = "HEVC"; trueType = "video"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "V_AV1"){ trueCodec = "AV1"; @@ -215,25 +215,25 @@ namespace Mist{ trueCodec = "opus"; trueType = "audio"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "A_VORBIS"){ trueCodec = "vorbis"; trueType = "audio"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "V_THEORA"){ trueCodec = "theora"; trueType = "video"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "A_AAC"){ trueCodec = "AAC"; trueType = "audio"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "A_PCM/INT/BIG"){ trueCodec = "PCM"; @@ -275,12 +275,12 @@ namespace Mist{ trueCodec = "subtitle"; trueType = "meta"; tmpElem = E.findChild(EBML::EID_CODECPRIVATE); - if (tmpElem){init = tmpElem.getValString();} + if (tmpElem){init = tmpElem.getValStringUntrimmed();} } if (codec == "A_MS/ACM"){ tmpElem = E.findChild(EBML::EID_CODECPRIVATE); if (tmpElem){ - std::string WAVEFORMATEX = tmpElem.getValString(); + std::string WAVEFORMATEX = tmpElem.getValStringUntrimmed(); unsigned int formatTag = Bit::btohs_le(WAVEFORMATEX.data()); switch (formatTag){ case 3: