[vlc-devel] [PATCH] demux: mkv: parse language codes with embedded country codes

Shaleen shaleen.jain95 at gmail.com
Thu Apr 27 15:16:01 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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp
b/modules/demux/mkv/matroska_segment_parse.cpp
index a4138d1d06..3303b6a041 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -379,8 +379,10 @@ 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() );
+            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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170427/9b391457/attachment.html>


More information about the vlc-devel mailing list