/src/vlc/modules/demux/mkv/chapters.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /***************************************************************************** |
2 | | * chapters.hpp : 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 | | /* chapter_item, chapter_edition, and chapter_translation classes */ |
25 | | |
26 | | #ifndef VLC_MKV_CHAPTERS_HPP_ |
27 | | #define VLC_MKV_CHAPTERS_HPP_ |
28 | | |
29 | | #include "mkv.hpp" |
30 | | |
31 | | #include <optional> |
32 | | |
33 | | namespace mkv { |
34 | | |
35 | | class chapter_translation_c |
36 | | { |
37 | | public: |
38 | | chapter_translation_c() |
39 | | :p_translated(NULL) |
40 | 0 | {} |
41 | | |
42 | | ~chapter_translation_c() |
43 | 0 | { |
44 | 0 | delete p_translated; |
45 | 0 | } |
46 | | |
47 | | KaxChapterTranslateID *p_translated; |
48 | | unsigned int codec_id; |
49 | | std::vector<uint64_t> editions; |
50 | | }; |
51 | | |
52 | | class chapter_item_c |
53 | | { |
54 | | public: |
55 | | chapter_item_c() |
56 | 0 | {} |
57 | | |
58 | | virtual ~chapter_item_c(); |
59 | | void Append( const chapter_item_c & edition ); |
60 | | chapter_item_c * FindChapter( chapter_uid i_find_uid ); |
61 | | virtual chapter_item_c *BrowseCodecPrivate( chapter_codec_id codec_id, |
62 | | chapter_cmd_match match ); |
63 | | std::string GetCodecName( bool f_for_title = false ) const; |
64 | | bool ParentOf( const chapter_item_c & item ) const; |
65 | | int16_t GetTitleNumber( ) const; |
66 | | |
67 | | vlc_tick_t i_start_time = 0; |
68 | | std::optional<vlc_tick_t> i_end_time; |
69 | | std::vector<chapter_item_c*> sub_chapters; |
70 | | KaxChapterSegmentUID *p_segment_uid = nullptr; |
71 | | KaxChapterSegmentEditionUID *p_segment_edition_uid = nullptr; |
72 | | chapter_uid i_uid = 0; |
73 | | bool b_display_seekpoint = true; |
74 | | bool b_user_display = true; |
75 | | std::string str_name; |
76 | | chapter_item_c *p_parent = nullptr; |
77 | | bool b_is_leaving = false; |
78 | | |
79 | | std::vector<chapter_codec_cmds_c*> codecs; |
80 | | |
81 | | bool Enter( bool b_do_subchapters ); |
82 | | bool Leave( bool b_do_subchapters ); |
83 | | bool EnterAndLeave( chapter_item_c *p_leaving_chapter, bool b_enter = true ); |
84 | | |
85 | | protected: |
86 | | bool EnterLeaveHelper_ (bool, bool(chapter_codec_cmds_c::*)(), bool(chapter_item_c::*)(bool)); |
87 | | }; |
88 | | |
89 | | class chapter_edition_c : public chapter_item_c |
90 | | { |
91 | | public: |
92 | 0 | chapter_edition_c(): b_ordered(false), b_default(false), b_hidden(false) |
93 | 0 | {} |
94 | | |
95 | | std::string GetMainName() const; |
96 | | bool b_ordered; |
97 | | bool b_default; |
98 | | bool b_hidden; |
99 | | }; |
100 | | |
101 | | } // namespace |
102 | | |
103 | | #endif |