1 /*
2   mkvmerge -- utility for splicing together matroska files
3   from component media subtypes
4 
5   Distributed under the GPL v2
6   see the file COPYING for details
7   or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8 
9   definitions and helper functions for Blu-ray index file
10 
11   Written by Moritz Bunkus <moritz@bunkus.org>.
12 */
13 
14 #pragma once
15 
16 #include "common/common_pch.h"
17 
18 namespace mtx::bluray::index {
19 
20 struct first_playback_t {
21   unsigned int object_type{};
22   unsigned int hdmv_title_playback_type{}, mobj_id_ref{};
23   unsigned int bd_j_title_playback_type{};
24   std::string bdjo_file_name;
25 
26   void dump() const;
27 };
28 
29 struct top_menu_t {
30   unsigned int object_type{};
31   unsigned int mobj_id_ref{};
32   std::string bdjo_file_name;
33 
34   void dump() const;
35 };
36 
37 struct title_t {
38   unsigned int object_type{}, access_type{};
39   unsigned int hdmv_title_playback_type{}, mobj_id_ref{};
40   unsigned int bd_j_title_playback_type{};
41   std::string bdjo_file_name;
42 
43   void dump(unsigned int idx) const;
44 };
45 
46 struct index_t {
47   first_playback_t first_playback;
48   top_menu_t top_menu;
49   std::vector<title_t> titles;
50 
51   void dump() const;
52 };
53 
54 class parser_private_c;
55 class parser_c {
56 protected:
57   MTX_DECLARE_PRIVATE(parser_private_c)
58 
59   std::unique_ptr<parser_private_c> const p_ptr;
60 
61   explicit parser_c(parser_private_c &p);
62 
63 public:
64   parser_c(std::string file_name);
65   virtual ~parser_c();
66 
67   virtual bool parse();
68   virtual bool is_ok() const;
69 
70   virtual index_t const &get_index() const;
71 
72   virtual void dump() const;
73 
74 protected:
75   virtual void parse_header();
76   virtual void parse_index();
77   virtual void parse_first_playback();
78   virtual void parse_top_menu();
79   virtual void parse_title();
80 };
81 
82 }                             // namespace mtx::bluray::index
83