| 1 | /* |
| 2 | * Copyright (C) 2000, 2001, 2002 Björn Englund <[email protected]>, |
| 3 | * Håkan Hjort <[email protected]> |
| 4 | * |
| 5 | * This file is part of libdvdread. |
| 6 | * |
| 7 | * libdvdread is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * libdvdread is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with libdvdread; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef LIBDVDREAD_IFO_READ_H |
| 23 | #define LIBDVDREAD_IFO_READ_H |
| 24 | |
| 25 | #include <dvdread/ifo_types.h> |
| 26 | #include <dvdread/attributes.h> |
| 27 | #include <dvdread/dvd_reader.h> |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | /** |
| 34 | * handle = ifoOpen(dvd, title); |
| 35 | * |
| 36 | * Opens an IFO and reads in all the data for the IFO file corresponding to the |
| 37 | * given title. If title 0 is given, the video manager IFO file is read. |
| 38 | * Returns a handle to a completely parsed structure. |
| 39 | */ |
| 40 | DVDREAD_API ifo_handle_t *ifoOpen(dvd_reader_t *, int ); |
| 41 | |
| 42 | /** |
| 43 | * handle = ifoOpenVMGI(dvd); |
| 44 | * |
| 45 | * Opens an IFO and reads in _only_ the vmgi_mat data. This call can be used |
| 46 | * together with the calls below to read in each segment of the IFO file on |
| 47 | * demand. If the dvd_reader opened an DVD-Audio Disc, this will open the AMGI |
| 48 | * if the dvd_reader opened a DVD-VR disc, this will open the RTAV_VMGI |
| 49 | */ |
| 50 | DVDREAD_API ifo_handle_t *ifoOpenVMGI(dvd_reader_t *); |
| 51 | |
| 52 | /** |
| 53 | * handle = ifoOpenVTSI(dvd, title); |
| 54 | * |
| 55 | * Opens an IFO and reads in _only_ the vtsi_mat data. This call can be used |
| 56 | * together with the calls below to read in each segment of the IFO file on |
| 57 | * demand. If the dvd_reader opened an DVD-Audio Disc, this will open the ATSI |
| 58 | */ |
| 59 | DVDREAD_API ifo_handle_t *ifoOpenVTSI(dvd_reader_t *, int); |
| 60 | |
| 61 | /** |
| 62 | * ifoClose(ifofile); |
| 63 | * Cleans up the IFO information. This will free all data allocated for the |
| 64 | * substructures. |
| 65 | */ |
| 66 | DVDREAD_API void ifoClose(ifo_handle_t *); |
| 67 | |
| 68 | /** |
| 69 | * The following functions are for reading only part of the VMGI/VTSI files. |
| 70 | * Returns 1 if the data was successfully read and 0 on error. |
| 71 | */ |
| 72 | |
| 73 | /** |
| 74 | * okay = ifoRead_PLT_MAIT(ifofile); |
| 75 | * |
| 76 | * Read in the Parental Management Information table, filling the |
| 77 | * ifofile->ptl_mait structure and its substructures. This data is only |
| 78 | * located in the video manager information file. This fills the |
| 79 | * ifofile->ptl_mait structure and all its substructures. |
| 80 | */ |
| 81 | DVDREAD_API int ifoRead_PTL_MAIT(ifo_handle_t *); |
| 82 | |
| 83 | /** |
| 84 | * okay = ifoRead_VTS_ATRT(ifofile); |
| 85 | * |
| 86 | * Read in the attribute table for the main menu vob, filling the |
| 87 | * ifofile->vts_atrt structure and its substructures. Only located in the |
| 88 | * video manager information file. This fills in the ifofile->vts_atrt |
| 89 | * structure and all its substructures. |
| 90 | */ |
| 91 | DVDREAD_API int ifoRead_VTS_ATRT(ifo_handle_t *); |
| 92 | |
| 93 | /** |
| 94 | * okay = ifoRead_TT_SRPT(ifofile); |
| 95 | * |
| 96 | * Reads the title info for the main menu, filling the ifofile->tt_srpt |
| 97 | * structure and its substructures. This data is only located in the video |
| 98 | * manager information file. This structure is mandatory in the IFO file. |
| 99 | */ |
| 100 | DVDREAD_API int ifoRead_TT_SRPT(ifo_handle_t *); |
| 101 | |
| 102 | /** |
| 103 | * okay = ifoRead_VTS_PTT_SRPT(ifofile); |
| 104 | * |
| 105 | * Reads in the part of title search pointer table, filling the |
| 106 | * ifofile->vts_ptt_srpt structure and its substructures. This data is only |
| 107 | * located in the video title set information file. This structure is |
| 108 | * mandatory, and must be included in the VTSI file. |
| 109 | */ |
| 110 | DVDREAD_API int ifoRead_VTS_PTT_SRPT(ifo_handle_t *); |
| 111 | |
| 112 | /** |
| 113 | * okay = ifoRead_FP_PGC(ifofile); |
| 114 | * |
| 115 | * Reads in the first play program chain data, filling the |
| 116 | * ifofile->first_play_pgc structure. This data is only located in the video |
| 117 | * manager information file (VMGI). This structure is optional. |
| 118 | */ |
| 119 | DVDREAD_API int ifoRead_FP_PGC(ifo_handle_t *); |
| 120 | |
| 121 | /** |
| 122 | * okay = ifoRead_PGCIT(ifofile); |
| 123 | * |
| 124 | * Reads in the program chain information table for the video title set. Fills |
| 125 | * in the ifofile->vts_pgcit structure and its substructures, which includes |
| 126 | * the data for each program chain in the set. This data is only located in |
| 127 | * the video title set information file. This structure is mandatory, and must |
| 128 | * be included in the VTSI file. |
| 129 | */ |
| 130 | DVDREAD_API int ifoRead_PGCIT(ifo_handle_t *); |
| 131 | |
| 132 | /** |
| 133 | * okay = ifoRead_PGCI_UT(ifofile); |
| 134 | * |
| 135 | * Reads in the menu PGCI unit table for the menu VOB. For the video manager, |
| 136 | * this corresponds to the VIDEO_TS.VOB file, and for each title set, this |
| 137 | * corresponds to the VTS_XX_0.VOB file. This data is located in both the |
| 138 | * video manager and video title set information files. For VMGI files, this |
| 139 | * fills the ifofile->vmgi_pgci_ut structure and all its substructures. For |
| 140 | * VTSI files, this fills the ifofile->vtsm_pgci_ut structure. |
| 141 | */ |
| 142 | DVDREAD_API int ifoRead_PGCI_UT(ifo_handle_t *); |
| 143 | |
| 144 | /** |
| 145 | * okay = ifoRead_VTS_TMAPT(ifofile); |
| 146 | * |
| 147 | * Reads in the VTS Time Map Table, this data is only located in the video |
| 148 | * title set information file. This fills the ifofile->vts_tmapt structure |
| 149 | * and all its substructures. When present enables VOBU level time-based |
| 150 | * seeking for One_Sequential_PGC_Titles. |
| 151 | */ |
| 152 | DVDREAD_API int ifoRead_VTS_TMAPT(ifo_handle_t *); |
| 153 | |
| 154 | /** |
| 155 | * okay = ifoRead_C_ADT(ifofile); |
| 156 | * |
| 157 | * Reads in the cell address table for the menu VOB. For the video manager, |
| 158 | * this corresponds to the VIDEO_TS.VOB file, and for each title set, this |
| 159 | * corresponds to the VTS_XX_0.VOB file. This data is located in both the |
| 160 | * video manager and video title set information files. For VMGI files, this |
| 161 | * fills the ifofile->vmgm_c_adt structure and all its substructures. For VTSI |
| 162 | * files, this fills the ifofile->vtsm_c_adt structure. |
| 163 | */ |
| 164 | DVDREAD_API int ifoRead_C_ADT(ifo_handle_t *); |
| 165 | |
| 166 | /** |
| 167 | * okay = ifoRead_TITLE_C_ADT(ifofile); |
| 168 | * |
| 169 | * Reads in the cell address table for the video title set corresponding to |
| 170 | * this IFO file. This data is only located in the video title set information |
| 171 | * file. This structure is mandatory, and must be included in the VTSI file. |
| 172 | * This call fills the ifofile->vts_c_adt structure and its substructures. |
| 173 | */ |
| 174 | DVDREAD_API int ifoRead_TITLE_C_ADT(ifo_handle_t *); |
| 175 | |
| 176 | /** |
| 177 | * okay = ifoRead_VOBU_ADMAP(ifofile); |
| 178 | * |
| 179 | * Reads in the VOBU address map for the menu VOB. For the video manager, this |
| 180 | * corresponds to the VIDEO_TS.VOB file, and for each title set, this |
| 181 | * corresponds to the VTS_XX_0.VOB file. This data is located in both the |
| 182 | * video manager and video title set information files. For VMGI files, this |
| 183 | * fills the ifofile->vmgm_vobu_admap structure and all its substructures. For |
| 184 | * VTSI files, this fills the ifofile->vtsm_vobu_admap structure. |
| 185 | */ |
| 186 | DVDREAD_API int ifoRead_VOBU_ADMAP(ifo_handle_t *); |
| 187 | |
| 188 | /** |
| 189 | * okay = ifoRead_TITLE_VOBU_ADMAP(ifofile); |
| 190 | * |
| 191 | * Reads in the VOBU address map for the associated video title set. This data |
| 192 | * is only located in the video title set information file. This structure is |
| 193 | * mandatory, and must be included in the VTSI file. Fills the |
| 194 | * ifofile->vts_vobu_admap structure and its substructures. |
| 195 | */ |
| 196 | DVDREAD_API int ifoRead_TITLE_VOBU_ADMAP(ifo_handle_t *); |
| 197 | |
| 198 | /** |
| 199 | * okay = ifoRead_TXTDT_MGI(ifofile); |
| 200 | * |
| 201 | * Reads in the text data strings for the DVD. Fills the ifofile->txtdt_mgi |
| 202 | * structure and all its substructures. This data is only located in the video |
| 203 | * manager information file. This structure is mandatory, and must be included |
| 204 | * in the VMGI file. |
| 205 | */ |
| 206 | DVDREAD_API int ifoRead_TXTDT_MGI(ifo_handle_t *); |
| 207 | |
| 208 | /** |
| 209 | * okay = ifoRead_TT(ifofile); |
| 210 | * |
| 211 | * Reads the Title Track Table in ATS IFO's. |
| 212 | * This structure. This structure is mandatory, and must be included |
| 213 | * in the AMGI file. |
| 214 | */ |
| 215 | DVDREAD_API int ifoRead_TT(ifo_handle_t *); |
| 216 | |
| 217 | /** |
| 218 | * okay = ifoRead_TIF(ifofile); |
| 219 | * |
| 220 | * Reads either table in AUDIO_TS.IFO based on the sector offset given, |
| 221 | * either 1,2. The first table being one with video titles, the second one |
| 222 | * without. This structure. This structure is mandatory, and must be included |
| 223 | * in the AMGI file. |
| 224 | */ |
| 225 | DVDREAD_API int ifoRead_TIF(ifo_handle_t *, int); |
| 226 | |
| 227 | /** |
| 228 | * handle = ifoOpen_SAMG(ifofile); |
| 229 | * |
| 230 | * the SAMG menu contains all the information for all the ATS and AMG |
| 231 | * But only for audio titles, and without any menu information |
| 232 | * is loaded in ifoOpen as a part of the audio manager |
| 233 | * Can be for simple audio playback |
| 234 | * |
| 235 | */ |
| 236 | DVDREAD_API ifo_handle_t *ifoOpenSAMG(dvd_reader_t *ctx); |
| 237 | |
| 238 | /** |
| 239 | * handle = ifoOpenASVS(ifofile); |
| 240 | * |
| 241 | * the ASVS ifo contains the sector addresses of each still frame |
| 242 | * in Audio_sv.vob, to access audio_sv.vob load menu > 0 in dvdopenvob |
| 243 | * is loaded in ifoOpen as a part of the audio manager |
| 244 | * |
| 245 | */ |
| 246 | DVDREAD_API ifo_handle_t *ifoOpenASVS(dvd_reader_t *ctx); |
| 247 | |
| 248 | /** |
| 249 | * okay = ifoRead_PGCI(ifofile); |
| 250 | * |
| 251 | * Reads the Program Chain Information Table (pgci). |
| 252 | * This structure contains the technical definitions for the recordings, including |
| 253 | * video attributes (aspect ratio, resolution), audio stream counts, and formats. |
| 254 | * Use this data to configure the decoder element (ES format) before playback starts. |
| 255 | */ |
| 256 | DVDREAD_API int ifoRead_PGCI(ifo_handle_t *ifofile); |
| 257 | |
| 258 | /** |
| 259 | * okay = ifoRead_PGC_GI(ifofile); |
| 260 | * |
| 261 | * Reads the Program Chain General Information (pgc_gi). |
| 262 | * This is the master database of all physical video clips ("Programs") on the disc. |
| 263 | * It provides the raw byte offsets, durations, and timestamps (PGTM) for every |
| 264 | * recording. This is required to locate content sectors and to generate "Title 0" |
| 265 | * (the raw/original timeline). |
| 266 | */ |
| 267 | DVDREAD_API int ifoRead_PGC_GI(ifo_handle_t *ifofile); |
| 268 | |
| 269 | /** |
| 270 | * okay = ifoRead_UD_PGCIT(ifofile); |
| 271 | * |
| 272 | * Reads the Program Set General Information (ud_pgcit). |
| 273 | * This defines the user-created "Titles" (Playlists) and their text labels. |
| 274 | * It maps logical groupings of content to the physical programs found in pgc_gi. |
| 275 | * Use this to build the main navigation menu and "Next/Prev" chapter logic |
| 276 | * intended by the user. |
| 277 | */ |
| 278 | DVDREAD_API int ifoRead_UD_PGCIT(ifo_handle_t *ifofile); |
| 279 | |
| 280 | /** |
| 281 | * The following functions are used for freeing parsed sections of the |
| 282 | * ifo_handle_t structure and the allocated substructures. The free calls |
| 283 | * below are safe: they will not mind if you attempt to free part of an IFO |
| 284 | * file which was not read in or which does not exist. |
| 285 | */ |
| 286 | DVDREAD_API void ifoFree_PTL_MAIT(ifo_handle_t *); |
| 287 | DVDREAD_API void ifoFree_VTS_ATRT(ifo_handle_t *); |
| 288 | DVDREAD_API void ifoFree_TT_SRPT(ifo_handle_t *); |
| 289 | DVDREAD_API void ifoFree_VTS_PTT_SRPT(ifo_handle_t *); |
| 290 | DVDREAD_API void ifoFree_FP_PGC(ifo_handle_t *); |
| 291 | DVDREAD_API void ifoFree_PGCIT(ifo_handle_t *); |
| 292 | DVDREAD_API void ifoFree_PGCI_UT(ifo_handle_t *); |
| 293 | DVDREAD_API void ifoFree_VTS_TMAPT(ifo_handle_t *); |
| 294 | DVDREAD_API void ifoFree_C_ADT(ifo_handle_t *); |
| 295 | DVDREAD_API void ifoFree_TITLE_C_ADT(ifo_handle_t *); |
| 296 | DVDREAD_API void ifoFree_VOBU_ADMAP(ifo_handle_t *); |
| 297 | DVDREAD_API void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *); |
| 298 | DVDREAD_API void ifoFree_TXTDT_MGI(ifo_handle_t *); |
| 299 | DVDREAD_API void ifoFree_TT(ifo_handle_t *); |
| 300 | DVDREAD_API void ifoFree_PGC_GI(ifo_handle_t *); |
| 301 | |
| 302 | #ifdef __cplusplus |
| 303 | }; |
| 304 | #endif |
| 305 | #endif /* LIBDVDREAD_IFO_READ_H */ |