[vlc-devel] [PATCH] demux: mkv: parse language codes with embedded country codes
Shaleen
shaleen.jain95 at gmail.com
Thu Apr 27 12:51:12 CEST 2017
fixes bug: https://trac.videolan.org/vlc/ticket/11813
mkv spec: https://www.matroska.org/technical/specs/index.html#languages
---
modules/demux/mkv/matroska_segment_parse.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp
b/modules/demux/mkv/matroska_segment_parse.cpp
index f4d73613c9..206a1630a6 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -379,9 +379,11 @@ void matroska_segment_c::ParseTrackEntry(
KaxTrackEntry *m )
}
E_CASE( KaxTrackLanguage, lang )
{
- free( vars.tk->fmt.psz_language );
- vars.tk->fmt.psz_language = strdup( std::string( lang ).c_str() );
- debug( vars, "Track Language=`%s'", vars.tk->fmt.psz_language );
+ std::string const& slang ( lang );
+ free(vars.tk->fmt.psz_language);
+ vars.tk->fmt.psz_language = strndup( slang.c_str (),
+ slang.find_first_of( '-' ) );
+ debug(vars, "Track Language=`%s'", vars.tk->fmt.psz_language );
}
E_CASE( KaxCodecID, codecid )
{
--
2.12.2
Hello Filip
Sorry for a late response, I am not so familiar with mailing lists
and had missed some of the responses to my patch coupled
with my exams coming up in between.
What I had inferred from your first message and erred was your suggestion
about using a function at all and made clear by your next message about
using C++ Utility/Library classes.
I have taken your advice and moved to a complete C++ implementation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170427/ca5827af/attachment.html>
More information about the vlc-devel
mailing list