1 /* dvd.h
2 
3    Copyright (c) 2003-2021 HandBrake Team
4    This file is part of the HandBrake source code
5    Homepage: <http://handbrake.fr/>.
6    It may be used under the terms of the GNU General Public License v2.
7    For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
8  */
9 
10 #ifndef HANDBRAKE_DVD_H
11 #define HANDBRAKE_DVD_H
12 
13 #include "dvdnav/dvdnav.h"
14 #include "dvdread/ifo_read.h"
15 #include "dvdread/nav_read.h"
16 
17 #define HB_VOBSUB_STYLE_4_3        0
18 #define HB_VOBSUB_STYLE_WIDE       1
19 #define HB_VOBSUB_STYLE_LETTERBOX  2
20 #define HB_VOBSUB_STYLE_PANSCAN    3
21 
22 struct hb_dvd_chapter_s
23 {
24     int     index;
25     int64_t duration;
26     int     pgn;
27     int     pgcn;
28     int     block_start;
29     int     block_end;
30 };
31 
32 struct hb_dvdread_s
33 {
34     char         * path;
35 
36     dvd_reader_t * reader;
37     ifo_handle_t * vmg;
38 
39     int            vts;
40     int            ttn;
41     ifo_handle_t * ifo;
42     dvd_file_t   * file;
43 
44     pgc_t        * pgc;
45     int            cell_start;
46     int            cell_end;
47     int            title_start;
48     int            title_end;
49     int            title_block_count;
50     int            cell_cur;
51     int            cell_next;
52     int            cell_overlap;
53     int            block;
54     int            pack_len;
55     int            next_vobu;
56     int            in_cell;
57     int            in_sync;
58     uint16_t       cur_vob_id;
59     uint8_t        cur_cell_id;
60     hb_handle_t  * h;
61     int            chapter;
62 };
63 
64 struct hb_dvdnav_s
65 {
66     char         * path;
67 
68     dvdnav_t     * dvdnav;
69     dvd_reader_t * reader;
70     ifo_handle_t * vmg;
71     int            title;
72     int            title_block_count;
73     int            chapter;
74     int            cell;
75     int            stopped;
76     hb_handle_t  * h;
77 
78     ifo_handle_t * ifo;
79     int            vts;
80     int            pgcn;
81     int            pgn;
82     int64_t        duration;
83     hb_list_t    * list_dvd_chapter;
84 };
85 
86 typedef struct hb_dvd_chapter_s hb_dvd_chapter_t;
87 typedef struct hb_dvdnav_s hb_dvdnav_t;
88 typedef struct hb_dvdread_s hb_dvdread_t;
89 
90 union hb_dvd_s
91 {
92     hb_dvdread_t dvdread;
93     hb_dvdnav_t  dvdnav;
94 };
95 
96 
97 struct hb_dvd_func_s
98 {
99     hb_dvd_t *    (* init)        ( hb_handle_t *, const char * );
100     void          (* close)       ( hb_dvd_t ** );
101     char        * (* name)        ( char * );
102     int           (* title_count) ( hb_dvd_t * );
103     hb_title_t  * (* title_scan)  ( hb_dvd_t *, int, uint64_t );
104     int           (* start)       ( hb_dvd_t *, hb_title_t *, int );
105     void          (* stop)        ( hb_dvd_t * );
106     int           (* seek)        ( hb_dvd_t *, float );
107     hb_buffer_t * (* read)        ( hb_dvd_t * );
108     int           (* chapter)     ( hb_dvd_t * );
109     int           (* angle_count) ( hb_dvd_t * );
110     void          (* set_angle)   ( hb_dvd_t *, int );
111     int           (* main_feature)( hb_dvd_t *, hb_list_t * );
112 };
113 typedef struct hb_dvd_func_s hb_dvd_func_t;
114 
115 hb_dvd_func_t * hb_dvdnav_methods( void );
116 hb_dvd_func_t * hb_dvdread_methods( void );
117 
118 #endif // HANDBRAKE_DVD_H
119