00001 #ifndef __IFO_H__
00002 #define __IFO_H__
00003
00004 #ifndef DVD_VIDEO_LB_LEN
00005 #define DVD_VIDEO_LB_LEN 2048
00006 #endif
00007
00008 #define OFFSET_IFO 0x0000
00009 #define OFFSET_VTS 0x0000
00010 #define OFFSET_LEN 0x00C0
00011 #define IFO_OFFSET_TAT 0x00C0
00012 #define OFFSET_VTSI_MAT 0x0080
00013 #define IFO_OFFSET_VIDEO 0x0100
00014 #define IFO_OFFSET_AUDIO 0x0200
00015 #define IFO_OFFSET_SUBPIC 0x0250
00016
00017
00018
00019
00024 typedef struct {
00025 #if BYTE_ORDER == BIG_ENDIAN
00026 u_char compression : 2;
00027 u_char system : 2;
00028 u_char ratio : 2;
00029 u_char perm_displ : 2;
00030
00031 u_char line21_1 : 1;
00032 u_char line21_2 : 1;
00033 u_char source_res : 2;
00034 u_char letterboxed : 1;
00035 u_char mode : 1;
00036 #else
00037 u_char perm_displ : 2;
00038 u_char ratio : 2;
00039 u_char system : 2;
00040 u_char compression : 2;
00041
00042 u_char mode : 1;
00043 u_char letterboxed : 1;
00044 u_char source_res : 2;
00045 u_char line21_2 : 1;
00046 u_char line21_1 : 1;
00047 #endif
00048 } ifo_video_info_t;
00049
00054 typedef struct {
00055 #if MPEG3_LITTLE_ENDIAN
00056 u_char num_channels : 3;
00057 u_char sample_freq : 2;
00058 u_char quantization : 2;
00059 u_char appl_mode2 : 1;
00060
00061 u_char appl_mode1 : 1;
00062 u_char type : 2;
00063 u_char multichannel_extension: 1;
00064 u_char coding_mode : 2;
00065 #else
00066 u_char appl_mode2 : 1;
00067 u_char quantization : 2;
00068 u_char sample_freq : 2;
00069 u_char num_channels : 3;
00070
00071 u_char coding_mode : 2;
00072 u_char multichannel_extension: 1;
00073 u_char type : 2;
00074 u_char appl_mode1 : 1;
00075 #endif
00076 u_short lang_code : 16;
00077 u_int foo : 8;
00078 u_int caption : 8;
00079 u_int bar : 8;
00080 } ifo_audio_t;
00081
00082 #define IFO_AUDIO_LEN 7
00083
00088 typedef struct {
00089 u_short prefix : 16;
00090 u_short lang_code : 16;
00091 u_char foo : 8;
00092 u_char caption : 8;
00093 } ifo_spu_t;
00094
00095
00100 #if 0
00101 typedef struct {
00102 u_char tu : 16;
00103 u_int : 16;
00104 } ifo_tmt_hdr_t;
00105 #endif
00106
00107 typedef struct {
00108 u_int : 24;
00109 u_char tu : 8;
00110 } ifoq_tmt_hdr_t;
00111
00112
00113 #define IFOQ_TMT_HDR_LEN 1
00114
00115
00120 typedef struct {
00121 u_short vob_id : 16;
00122 u_char cell_id : 8;
00123 u_char : 8;
00124 u_int start : 32;
00125 u_int end : 32;
00126 } ifo_cell_addr_t;
00127
00128
00129 typedef struct {
00130 u_short vob_id : 16;
00131 u_short cell_id : 16;
00132 } ifo_pgc_cell_pos_t;
00133
00138 typedef struct {
00139 u_short pgc;
00140 u_short pg;
00141 u_long start;
00142 u_long end;
00143 } ifo_ptt_data_t;
00144
00145 typedef struct {
00146 u_int num;
00147 ifo_ptt_data_t *data;
00148 } ifo_ptt_sub_t;
00149
00150 typedef struct {
00151 u_int num;
00152 ifo_ptt_sub_t *title;
00153 } ifo_ptt_t;
00154
00155 typedef struct {
00156 u_char chain_info : 8;
00157 u_char foo : 8;
00158 u_char still_time : 8;
00159 u_char cell_cmd : 8;
00160
00161 u_int len_time : 32;
00162 u_int vobu_start : 32;
00163 u_int ilvu_end : 32;
00164 u_int vobu_last_start : 32;
00165 u_int vobu_last_end : 32;
00166 } ifo_pgci_cell_addr_t;
00167
00168 #define PGCI_CELL_ADDR_LEN 24
00169
00170 #define ID_NUM_MENU_VOBS 0
00171 #define ID_NUM_TITLE_VOBS 1
00172
00173 #define ID_MAT 0
00174 #define ID_PTT 1
00175 #define ID_TSP 1
00176 #define ID_TITLE_PGCI 2
00177 #define ID_MENU_PGCI 3
00178 #define ID_TMT 4
00179 #define ID_MENU_CELL_ADDR 5
00180 #define ID_MENU_VOBU_ADDR_MAP 6
00181 #define ID_TITLE_CELL_ADDR 7
00182 #define ID_TITLE_VOBU_ADDR_MAP 8
00183
00184
00189 typedef struct {
00190 u_int num_menu_vobs;
00191 u_int vob_start;
00192
00193 u_char *data[10];
00194
00195 int fd;
00196 __off64_t pos;
00197 } ifo_t;
00198
00199
00204 #define IFO_HDR_LEN 8
00205 #define IFOQ_HDR_LEN 2
00206
00207 typedef struct {
00208 u_short num : 16;
00209 u_short : 16;
00210 u_int len : 32;
00211 } ifo_hdr_t;
00212
00213 typedef struct {
00214 u_short : 16;
00215 u_short num : 16;
00216 u_int len : 32;
00217 } ifoq_hdr_t;
00218
00219
00224 ifo_t *ifoOpen (int fd, __off64_t pos);
00225 int ifoClose (ifo_t *ifo);
00226
00227 u_int ifoGetVOBStart (ifo_t *ifo);
00228 int ifoGetNumberOfTitles (ifo_t *ifo);
00229 int ifoGetNumberOfParts (ifo_t *ifo);
00230
00231 int ifoGetVMGPTT (ifo_hdr_t *hdr, char **ptr);
00232 int ifoGetPGCI (ifo_hdr_t *hdr, int title, char **ptr);
00233 int ifoGetCLUT (char *pgc, char **ptr);
00234 u_int ifoGetCellPlayInfo (u_char *pgc, u_char **ptr);
00235 u_int ifoGetCellPos (u_char *pgc, u_char **ptr);
00236 int ifoGetProgramMap (char *pgc, char **ptr);
00237 int ifoGetCellAddr (char *cell_addr, char **ptr);
00238 int ifoGetCellAddrNum (char *hdr);
00239
00240 int ifoGetAudio (char *hdr, char **ptr);
00241 int ifoGetSPU (char *hdr, char **ptr);
00242
00243 ifo_ptt_t *ifo_get_ptt (ifo_t *ifo);
00244 int ifo_get_num_title_pgci (ifo_t *ifo);
00245 u_char *ifo_get_ptr_title_pgci (ifo_t *ifo, int index);
00246
00247 char *ifoDecodeLang (u_short descr);
00248
00249 int ifoIsVTS (ifo_t *ifo);
00250 int ifoIsVMG (ifo_t *ifo);
00251
00252 void ifoPrintVideo (u_char *ptr);
00253
00254 void ifoPrintCellPlayInfo (u_char *ptr, u_int num);
00255 void ifoPrintCellInfo (u_char *ptr, u_int num);
00256 void ifoPrintCellPos (u_char *ptr, u_int num);
00257 void ifoPrintCLUT (u_char *ptr);
00258 void ifoPrintProgramMap (u_char *ptr, u_int num);
00259
00260 #ifdef PARSER
00261 void ifoPrintAudio (ifo_audio_t *ptr, u_int num);
00262 void ifoPrintSPU (ifo_spu_t *ptr, u_int num);
00263 void ifoPrintTMT (ifo_t *ifo);
00264
00265 void ifoPrintVMOP (u_char *opcode);
00266
00267 void ifoPrint_ptt (ifo_ptt_t *ptt);
00268 void ifoPrint_vts_vobu_addr_map (ifo_t *ifo);
00269 void ifoPrint_vtsm_vobu_addr_map (ifo_t *ifo);
00270 void ifoPrint_vts_cell_addr (ifo_t *ifo);
00271 void ifoPrint_vtsm_cell_addr (ifo_t *ifo);
00272 void ifoPrint_title_pgci (ifo_t *ifo);
00273 void ifoPrint_pgc_cmd (u_char *pgc_ptr);
00274 void ifoPrintTSP (u_char *toast);
00275 void ifoPrint_pgc (u_char *ptr);
00276 #endif
00277 #endif
00278