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