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

Steve Lhomme robux4 at gmail.com
Thu Apr 27 14:47:35 CEST 2017


On Thu, Apr 27, 2017 at 12:51 PM, Shaleen <shaleen.jain95 at gmail.com> 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 | 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 );

nitpicking: this line only has a spacing changed. The change is not
necessary and break the rest of the coding style.

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


More information about the vlc-devel mailing list