From c9dc42ff1814dc7867c610576f8f7e6f2e89a2bf Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 12 Sep 2018 14:00:59 +0200 Subject: [PATCH] Fixed support for gstreamer matroska streams --- lib/ebml.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ebml.cpp b/lib/ebml.cpp index c865f841..0670b6f1 100644 --- a/lib/ebml.cpp +++ b/lib/ebml.cpp @@ -509,7 +509,12 @@ namespace EBML{ return val; } - std::string Element::getValString() const{return std::string(getPayload(), getPayloadLen());} + std::string Element::getValString() const{ + uint64_t strLen = getPayloadLen(); + const char * strPtr = getPayload(); + while (strLen && strPtr[strLen-1] == 0){--strLen;} + return std::string(strPtr, strLen); + } uint64_t Block::getTrackNum() const{return UniInt::readInt(getPayload());}