Coverage Report

Created: 2026-01-10 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vlc/modules/demux/mkv/chapter_command.cpp
Line
Count
Source
1
/*****************************************************************************
2
 * chapter_command.cpp : matroska demuxer
3
 *****************************************************************************
4
 * Copyright (C) 2003-2004 VLC authors and VideoLAN
5
 *
6
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7
 *          Steve Lhomme <steve.lhomme@free.fr>
8
 *
9
 * This program is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU Lesser General Public License as published by
11
 * the Free Software Foundation; either version 2.1 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with this program; if not, write to the Free Software Foundation,
21
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
 *****************************************************************************/
23
24
#include "chapter_command.hpp"
25
26
#include <vlc_arrays.h>
27
28
#if LIBMATROSKA_VERSION < 0x010700
29
typedef enum {
30
  MATROSKA_CHAPPROCESSTIME_DURING           = 0,
31
  MATROSKA_CHAPPROCESSTIME_BEFORE           = 1,
32
  MATROSKA_CHAPPROCESSTIME_AFTER            = 2,
33
} MatroskaChapterProcessTime;
34
#endif
35
36
namespace mkv {
37
38
void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command )
39
171
{
40
171
    auto data = FindChild<KaxChapterProcessData>(command);
41
171
    if (unlikely(!data))
42
6
    {
43
6
        vlc_debug( l, "missing ChapProcessData" );
44
6
        return;
45
6
    }
46
47
165
    auto codec_time = FindChild<KaxChapterProcessTime>(command);
48
165
    if( unlikely(!codec_time) )
49
6
    {
50
6
        vlc_debug( l, "missing ChapProcessTime" );
51
6
        return;
52
6
    }
53
159
    if( static_cast<unsigned>(*codec_time) >= 3 )
54
1
    {
55
1
        vlc_debug( l, "unknown ChapProcessTime %d", static_cast<unsigned>(*codec_time) );
56
1
        return;
57
1
    }
58
59
158
    switch (static_cast<unsigned>(*codec_time))
60
158
    {
61
3
        case MATROSKA_CHAPPROCESSTIME_DURING: during_cmds.push_back( *data ); break;
62
154
        case MATROSKA_CHAPPROCESSTIME_BEFORE: enter_cmds.push_back( *data );  break;
63
1
        case MATROSKA_CHAPPROCESSTIME_AFTER:  leave_cmds.push_back( *data );  break;
64
0
        default: vlc_assert_unreachable();
65
158
    }
66
158
}
67
68
} // namespace