/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 | | namespace mkv { |
29 | | |
30 | | void chapter_codec_cmds_c::AddCommand( const KaxChapterProcessCommand & command ) |
31 | 25 | { |
32 | 25 | auto data = FindChild<KaxChapterProcessData>(command); |
33 | 25 | if (unlikely(!data)) |
34 | 3 | { |
35 | 3 | vlc_debug( l, "missing ChapProcessData" ); |
36 | 3 | return; |
37 | 3 | } |
38 | | |
39 | 22 | auto codec_time = FindChild<KaxChapterProcessTime>(command); |
40 | 22 | if( unlikely(!codec_time) ) |
41 | 0 | { |
42 | 0 | vlc_debug( l, "missing ChapProcessTime" ); |
43 | 0 | return; |
44 | 0 | } |
45 | 22 | if( static_cast<unsigned>(*codec_time) >= 3 ) |
46 | 0 | { |
47 | 0 | vlc_debug( l, "unknown ChapProcessTime %d", static_cast<unsigned>(*codec_time) ); |
48 | 0 | return; |
49 | 0 | } |
50 | | |
51 | 22 | switch (static_cast<unsigned>(*codec_time)) |
52 | 22 | { |
53 | 0 | case MATROSKA_CHAPPROCESSTIME_DURING: during_cmds.push_back( *data ); break; |
54 | 22 | case MATROSKA_CHAPPROCESSTIME_BEFORE: enter_cmds.push_back( *data ); break; |
55 | 0 | case MATROSKA_CHAPPROCESSTIME_AFTER: leave_cmds.push_back( *data ); break; |
56 | 0 | default: vlc_assert_unreachable(); |
57 | 22 | } |
58 | 22 | } |
59 | | |
60 | | } // namespace |