Fixed EBML input cutting off zero bytes in places where it's not appropriate
This commit is contained in:
		
							parent
							
								
									a53fd5fa63
								
							
						
					
					
						commit
						ab39cca5f4
					
				
					 3 changed files with 15 additions and 8 deletions
				
			
		|  | @ -516,6 +516,12 @@ namespace EBML{ | ||||||
|     return std::string(strPtr, strLen); |     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());} |   uint64_t Block::getTrackNum() const{return UniInt::readInt(getPayload());} | ||||||
| 
 | 
 | ||||||
|   int16_t Block::getTimecode() const{ |   int16_t Block::getTimecode() const{ | ||||||
|  |  | ||||||
|  | @ -97,6 +97,7 @@ namespace EBML{ | ||||||
|     int64_t getValInt() const; |     int64_t getValInt() const; | ||||||
|     double getValFloat() const; |     double getValFloat() const; | ||||||
|     std::string getValString() const; |     std::string getValString() const; | ||||||
|  |     std::string getValStringUntrimmed() const; | ||||||
|     const Element findChild(uint32_t id) const; |     const Element findChild(uint32_t id) const; | ||||||
| 
 | 
 | ||||||
|   private: |   private: | ||||||
|  |  | ||||||
|  | @ -191,13 +191,13 @@ namespace Mist{ | ||||||
|           trueCodec = "H264"; |           trueCodec = "H264"; | ||||||
|           trueType = "video"; |           trueType = "video"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "V_MPEGH/ISO/HEVC"){ |         if (codec == "V_MPEGH/ISO/HEVC"){ | ||||||
|           trueCodec = "HEVC"; |           trueCodec = "HEVC"; | ||||||
|           trueType = "video"; |           trueType = "video"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "V_AV1"){ |         if (codec == "V_AV1"){ | ||||||
|           trueCodec = "AV1"; |           trueCodec = "AV1"; | ||||||
|  | @ -215,25 +215,25 @@ namespace Mist{ | ||||||
|           trueCodec = "opus"; |           trueCodec = "opus"; | ||||||
|           trueType = "audio"; |           trueType = "audio"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "A_VORBIS"){ |         if (codec == "A_VORBIS"){ | ||||||
|           trueCodec = "vorbis"; |           trueCodec = "vorbis"; | ||||||
|           trueType = "audio"; |           trueType = "audio"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "V_THEORA"){ |         if (codec == "V_THEORA"){ | ||||||
|           trueCodec = "theora"; |           trueCodec = "theora"; | ||||||
|           trueType = "video"; |           trueType = "video"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "A_AAC"){ |         if (codec == "A_AAC"){ | ||||||
|           trueCodec = "AAC"; |           trueCodec = "AAC"; | ||||||
|           trueType = "audio"; |           trueType = "audio"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "A_PCM/INT/BIG"){ |         if (codec == "A_PCM/INT/BIG"){ | ||||||
|           trueCodec = "PCM"; |           trueCodec = "PCM"; | ||||||
|  | @ -275,12 +275,12 @@ namespace Mist{ | ||||||
|           trueCodec = "subtitle"; |           trueCodec = "subtitle"; | ||||||
|           trueType = "meta"; |           trueType = "meta"; | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){init = tmpElem.getValString();} |           if (tmpElem){init = tmpElem.getValStringUntrimmed();} | ||||||
|         } |         } | ||||||
|         if (codec == "A_MS/ACM"){ |         if (codec == "A_MS/ACM"){ | ||||||
|           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); |           tmpElem = E.findChild(EBML::EID_CODECPRIVATE); | ||||||
|           if (tmpElem){ |           if (tmpElem){ | ||||||
|             std::string WAVEFORMATEX = tmpElem.getValString(); |             std::string WAVEFORMATEX = tmpElem.getValStringUntrimmed(); | ||||||
|             unsigned int formatTag = Bit::btohs_le(WAVEFORMATEX.data()); |             unsigned int formatTag = Bit::btohs_le(WAVEFORMATEX.data()); | ||||||
|             switch (formatTag){ |             switch (formatTag){ | ||||||
|               case 3: |               case 3: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma