/src/vlc/modules/demux/mkv/chapter_command.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /***************************************************************************** |
2 | | * chapter_command.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 | | #ifndef VLC_MKV_CHAPTER_COMMAND_HPP_ |
25 | | #define VLC_MKV_CHAPTER_COMMAND_HPP_ |
26 | | |
27 | | #include "mkv.hpp" |
28 | | |
29 | | #include <memory> |
30 | | |
31 | | struct vlc_spu_highlight_t; |
32 | | |
33 | | namespace mkv { |
34 | | |
35 | | class virtual_chapter_c; |
36 | | class virtual_segment_c; |
37 | | |
38 | | class chapter_codec_vm |
39 | | { |
40 | | public: |
41 | | virtual virtual_segment_c *GetCurrentVSegment() = 0; |
42 | | virtual virtual_chapter_c *FindVChapter( chapter_uid i_find_uid, virtual_segment_c * & p_vsegment_found ) = 0; |
43 | | virtual void JumpTo( virtual_segment_c &, virtual_chapter_c & ) = 0; |
44 | | |
45 | | virtual virtual_chapter_c *BrowseCodecPrivate( enum chapter_codec_id, |
46 | | chapter_cmd_match match, |
47 | | virtual_segment_c * & p_vsegment_found ) = 0; |
48 | | virtual void SetHighlight( vlc_spu_highlight_t & ) = 0; |
49 | | }; |
50 | | |
51 | | enum NavivationKey { |
52 | | LEFT, RIGHT, UP, DOWN, OK, MENU, POPUP |
53 | | }; |
54 | | |
55 | | class chapter_codec_cmds_c |
56 | | { |
57 | | public: |
58 | | chapter_codec_cmds_c( struct vlc_logger *log, chapter_codec_vm & vm_, enum chapter_codec_id codec_id) |
59 | 0 | :i_codec_id( codec_id ) |
60 | 0 | ,l( log ) |
61 | 0 | ,vm( vm_ ) |
62 | 0 | {} |
63 | | |
64 | 0 | virtual ~chapter_codec_cmds_c() = default; |
65 | | |
66 | | void SetPrivate( const KaxChapterProcessPrivate & private_data ) |
67 | 0 | { |
68 | 0 | p_private_data = std::make_unique<KaxChapterProcessPrivate>(private_data); |
69 | 0 | } |
70 | | |
71 | | void AddCommand( const KaxChapterProcessCommand & command ); |
72 | | |
73 | | /// \return whether the codec has seeked in the files or not |
74 | 0 | virtual bool Enter() { return false; } |
75 | 0 | virtual bool Leave() { return false; } |
76 | 0 | virtual std::string GetCodecName( bool ) const { return ""; } |
77 | 0 | virtual int16_t GetTitleNumber() const { return -1; } |
78 | | |
79 | | const enum chapter_codec_id i_codec_id; |
80 | | |
81 | | std::unique_ptr<KaxChapterProcessPrivate> p_private_data; |
82 | | |
83 | | protected: |
84 | | using ChapterProcess = std::vector<KaxChapterProcessData>; |
85 | | ChapterProcess enter_cmds; |
86 | | ChapterProcess during_cmds; |
87 | | ChapterProcess leave_cmds; |
88 | | |
89 | | struct vlc_logger *l; |
90 | | chapter_codec_vm & vm; |
91 | | }; |
92 | | } // namespace |
93 | | |
94 | | #endif |