1 /*
2     $Id$
3 
4     Copyright (C) 2000, 2005 Herbert Valerio Riedel <hvr@gnu.org>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20 
21 #ifndef __VCD_OBJ_H__
22 #define __VCD_OBJ_H__
23 
24 #include <cdio/iso9660.h>
25 #include <libvcd/files.h>
26 
27 /* Private headers */
28 #include "data_structures.h"
29 #include "directory.h"
30 #include "image_sink.h"
31 #include "mpeg_stream.h"
32 #include "salloc.h"
33 #include "vcd.h"
34 
35 typedef struct {
36   double time;
37   struct aps_data aps;
38   char *id;
39 } entry_t;
40 
41 typedef struct {
42   double time;
43   char *id;
44 } pause_t;
45 
46 typedef struct {
47   VcdMpegSource_t *source;
48   char *id;
49   const struct vcd_mpeg_stream_info *info;
50 
51   CdioList_t *pause_list; /* pause_t */
52 
53   char *default_entry_id;
54   CdioList_t *entry_list; /* entry_t */
55 
56   /* pbc ref check */
57   bool referenced;
58 
59   /* computed on sector allocation */
60   unsigned relative_start_extent; /* relative to iso data end */
61 } mpeg_sequence_t;
62 
63 /* work in progress -- fixme rename all occurences */
64 #define mpeg_track_t mpeg_sequence_t
65 #define mpeg_track_list mpeg_sequence_list
66 
67 typedef struct {
68   VcdMpegSource_t *source;
69   char *id;
70   const struct vcd_mpeg_stream_info *info;
71 
72   CdioList_t *pause_list; /* pause_t */
73 
74   /* pbc ref check */
75   bool referenced;
76 
77   /* computed through info */
78   unsigned segment_count;
79 
80   /* computed on sector allocation */
81   unsigned start_extent;
82 } mpeg_segment_t;
83 
84 
85 typedef struct {
86   char *iso_pathname;
87   VcdDataSource_t *file;
88   bool raw_flag;
89 
90   uint32_t size;
91   uint32_t start_extent;
92   uint32_t sectors;
93 } custom_file_t;
94 
95 struct _VcdObj {
96   vcd_type_t type;
97 
98   /* VCD 3.0 chinese SVCD compat flags */
99   bool svcd_vcd3_mpegav;
100   bool svcd_vcd3_entrysvd;
101   bool svcd_vcd3_tracksvd;
102   bool svcd_vcd3_spiconsv;
103 
104   bool update_scan_offsets;
105   bool relaxed_aps;
106 
107   unsigned leadout_pregap;
108   unsigned track_pregap;
109   unsigned track_front_margin;
110   unsigned track_rear_margin;
111 
112   /* output */
113   VcdImageSink_t *image_sink;
114 
115   /* ... */
116   unsigned iso_size;
117   char *iso_volume_label;
118   char *iso_publisher_id;
119   char *iso_application_id;
120   char *iso_preparer_id;
121 
122   char *info_album_id;
123   unsigned info_volume_count;
124   unsigned info_volume_number;
125   unsigned info_restriction;
126   bool info_use_seq2;
127   bool info_use_lid2;
128 
129   /* input */
130   unsigned mpeg_segment_start_extent;
131   CdioList_t *mpeg_segment_list; /* mpeg_segment_t */
132 
133   CdioList_t *mpeg_sequence_list; /* mpeg_sequence_t */
134 
135   unsigned relative_end_extent; /* last mpeg sequence track end extent */
136 
137   /* PBC */
138   CdioList_t *pbc_list; /* pbc_t */
139   unsigned psd_size;
140   unsigned psdx_size;
141 
142   /* custom files */
143   unsigned ext_file_start_extent;
144   unsigned custom_file_start_extent;
145   CdioList_t *custom_file_list; /* custom_file_t */
146   CdioList_t *custom_dir_list; /* char */
147 
148   /* dictionary */
149   CdioList_t *buffer_dict_list;
150 
151   /* aggregates */
152   VcdSalloc *iso_bitmap;
153 
154   VcdDirectory_t *dir;
155 
156   /* state info */
157   bool in_output;
158 
159   unsigned sectors_written;
160   unsigned in_track;
161 
162   long last_cb_call;
163 
164   progress_callback_t progress_callback;
165   void *callback_user_data;
166 };
167 
168 /* private functions */
169 
170 mpeg_sequence_t *
171 _vcd_obj_get_sequence_by_id (VcdObj_t *obj, const char sequence_id[]);
172 
173 mpeg_sequence_t *
174 _vcd_obj_get_sequence_by_entry_id (VcdObj_t *obj, const char entry_id[]);
175 
176 mpeg_segment_t *
177 _vcd_obj_get_segment_by_id (VcdObj_t *obj, const char segment_id[]);
178 
179 enum vcd_capability_t {
180   _CAP_VALID,
181   _CAP_MPEG1,
182   _CAP_MPEG2,
183   _CAP_PBC,
184   _CAP_PBC_X,
185   _CAP_TRACK_MARGINS,
186   _CAP_4C_SVCD,
187   _CAP_PAL_BITS
188 };
189 
190 bool
191 _vcd_obj_has_cap_p (const VcdObj_t *obj, enum vcd_capability_t capability);
192 
193 #endif /* __VCD_OBJ_H__ */
194 
195 
196 /*
197  * Local variables:
198  *  c-file-style: "gnu"
199  *  tab-width: 8
200  *  indent-tabs-mode: nil
201  * End:
202  */
203