[vlc-devel] [RFC, PATCH 6/6] demux/mkv: Use `StringDispatcher` in `matroska_segment_c::TrackInit`

Filip Roséen filip at videolabs.io
Thu Mar 3 13:54:06 CET 2016


After a conversation with JB it seems like some of the older cases that used
`strncmp` are somewhat wrong, which effectively means that the patch in which
this email is a reply to should replace S_CASE_GLOB with a fixed S_CASE in these
cases.

S_CASE_GLOB was introduced in the cases where the old code used `strncmp` to
only match a substring of the codec specified.

See the below:

    index 30696a5..6efb252 100644
    --- a/modules/demux/mkv/matroska_segment_parse.cpp
    +++ b/modules/demux/mkv/matroska_segment_parse.cpp
    @@ -1251,7 +1251,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
                 vars.p_fmt->i_codec = VLC_CODEC_MPGV;
                 fill_extra_data( vars.p_tk, 0 );
             }
    -        S_CASE_GLOB("V_THEORA*") {
    +        S_CASE("V_THEORA") {
                 vars.p_fmt->i_codec = VLC_CODEC_THEORA;
                 vars.p_tk->b_pts_only = true;
                 fill_extra_data( vars.p_tk, 0 );
    @@ -1277,14 +1277,14 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
             S_CASE("V_REAL/RV20") { v_real_helper (VLC_CODEC_RV20, vars ); }
             S_CASE("V_REAL/RV30") { v_real_helper (VLC_CODEC_RV30, vars ); }
             S_CASE("V_REAL/RV40") { v_real_helper (VLC_CODEC_RV40, vars ); }
    -        S_CASE_GLOB("V_DIRAC*")     {
    +        S_CASE("V_DIRAC")     {
                 vars.p_fmt->i_codec = VLC_CODEC_DIRAC;
             }
    -        S_CASE_GLOB("V_VP8*") {
    +        S_CASE("V_VP8") {
                 vars.p_fmt->i_codec = VLC_CODEC_VP8;
                 vars.p_tk->b_pts_only = true;
             }
    -        S_CASE_GLOB("V_VP9*") {
    +        S_CASE("V_VP9") {
                 vars.p_fmt->i_codec = VLC_CODEC_VP9;
                 vars.p_fmt->b_packetized = false;
                 vars.p_tk->b_pts_only = true;
    @@ -1435,7 +1435,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
                 vars.p_fmt->i_codec = VLC_CODEC_VORBIS;
                 fill_extra_data( vars.p_tk, 0 );
             }
    -        S_CASE_GLOB("A_OPUS*") {
    +        S_CASE("A_OPUS") {
                 vars.p_fmt->i_codec = VLC_CODEC_OPUS;
                 if( !vars.p_tk->fmt.audio.i_rate )
                 {
    @@ -1626,13 +1626,13 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
     
                 A_REAL__helper (vars, VLC_CODEC_RA_288);
             }
    -        S_CASE_GLOB("A_QUICKTIME/QDM2*") {
    +        S_CASE("A_QUICKTIME/QDM2") {
                 vars.p_fmt->i_cat   = AUDIO_ES;
                 vars.p_fmt->i_codec = VLC_CODEC_QDM2;
     
                 fill_extra_data( vars.p_tk, 0 );
             }
    -        S_CASE_GLOB("A_QUICKTIME/QDMC*") {
    +        S_CASE("A_QUICKTIME/QDMC") {
                 vars.p_fmt->i_cat   = AUDIO_ES;
                 vars.p_fmt->i_codec = VLC_FOURCC('Q','D','M','C');


The S_DIRAC case needs a bit more investigation, we might actually want that one
to be able to match "S_DIRAC*" -- but JB knows far more than I do on the
subject.

------------------------------------------------------------------------------

On 16/03/03 13:30, Filip Roséen wrote:

> This patch is far too big to be easily reviewed, so if it seems like a good fix
> it will have to be split up into a lot of smaller patches (so that one can
> prove that the functionality remains the same).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160303/0a766347/attachment.html>


More information about the vlc-devel mailing list