]> git.sesse.net Git - vlc/blob - modules/demux/mkv/chapters.hpp
LGPL
[vlc] / modules / demux / mkv / chapters.hpp
1 /*****************************************************************************
2  * chapters.hpp : matroska demuxer
3  *****************************************************************************
4  * Copyright (C) 2003-2004 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *          Steve Lhomme <steve.lhomme@free.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /* chapter_item, chapter_edition, and chapter_translation classes */
26
27 #ifndef _CHAPTER_H_
28 #define _CHAPTER_H_
29
30 #include "mkv.hpp"
31
32 class chapter_translation_c
33 {
34 public:
35     chapter_translation_c()
36         :p_translated(NULL)
37     {}
38
39     ~chapter_translation_c()
40     {
41         delete p_translated;
42     }
43
44     KaxChapterTranslateID  *p_translated;
45     unsigned int           codec_id;
46     std::vector<uint64_t>  editions;
47 };
48
49 class chapter_codec_cmds_c;
50 class chapter_item_c
51 {
52 public:
53     chapter_item_c()
54     :i_start_time(0)
55     ,i_end_time(-1)
56     ,p_segment_uid(NULL)
57     ,p_segment_edition_uid(NULL)
58     ,b_display_seekpoint(true)
59     ,b_user_display(false)
60     ,p_parent(NULL)
61     ,b_is_leaving(false)
62     {}
63
64     virtual ~chapter_item_c();
65     void Append( const chapter_item_c & edition );
66     chapter_item_c * FindChapter( int64_t i_find_uid );
67     virtual chapter_item_c *BrowseCodecPrivate( unsigned int codec_id,
68                                     bool (*match)(const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ),
69                                     const void *p_cookie,
70                                     size_t i_cookie_size );
71     std::string                 GetCodecName( bool f_for_title = false ) const;
72     bool                        ParentOf( const chapter_item_c & item ) const;
73     int16                       GetTitleNumber( ) const;
74
75     int64_t                     i_start_time, i_end_time;
76     std::vector<chapter_item_c*> sub_chapters;
77     KaxChapterSegmentUID        *p_segment_uid;
78     KaxChapterSegmentEditionUID *p_segment_edition_uid;
79     int64_t                     i_uid;
80     bool                        b_display_seekpoint;
81     bool                        b_user_display;
82     std::string                 psz_name;
83     chapter_item_c              *p_parent;
84     bool                        b_is_leaving;
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_item, bool b_enter = true );
91 };
92
93 class chapter_edition_c : public chapter_item_c
94 {
95 public:
96     chapter_edition_c(): b_ordered(false), b_default(false), b_hidden(false)
97     {}
98
99     std::string GetMainName() const;
100     bool                        b_ordered;
101     bool                        b_default;
102     /* TODO handle hidden chapters */
103     bool                        b_hidden;
104 };
105
106 #endif