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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Apr 27 16:03:32 CEST 2017


On Thu, Apr 27, 2017, at 03:19 PM, Shaleen wrote:
> 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 );

While this is valid C++, I'd suggest you remove the '&' since you're
constructing a new value, not a reference to an existing one.

> +            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
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

LGTM otherwise, thanks!

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list