Mercurial > libdvdnav.hg
comparison dvdread/ifo_read.c @ 348:5300b5982b85 src
video_attr_t is now defined and read correctly, rather than relying on conditional bitfields
author | nicodvb |
---|---|
date | Fri, 02 May 2008 08:27:21 +0000 |
parents | e14f453bb208 |
children | 8a711d89e294 |
comparison
equal
deleted
inserted
replaced
347:a5319a5c34f4 | 348:5300b5982b85 |
---|---|
28 #include "bswap.h" | 28 #include "bswap.h" |
29 #include "ifo_types.h" | 29 #include "ifo_types.h" |
30 #include "ifo_read.h" | 30 #include "ifo_read.h" |
31 #include "dvd_reader.h" | 31 #include "dvd_reader.h" |
32 #include "dvdread_internal.h" | 32 #include "dvdread_internal.h" |
33 #include "bitreader.h" | |
33 | 34 |
34 #ifndef DVD_BLOCK_LEN | 35 #ifndef DVD_BLOCK_LEN |
35 #define DVD_BLOCK_LEN 2048 | 36 #define DVD_BLOCK_LEN 2048 |
36 #endif | 37 #endif |
37 | 38 |
91 | 92 |
92 static inline int DVDFileSeek_( dvd_file_t *dvd_file, uint32_t offset ) { | 93 static inline int DVDFileSeek_( dvd_file_t *dvd_file, uint32_t offset ) { |
93 return (DVDFileSeek(dvd_file, (int)offset) == (int)offset); | 94 return (DVDFileSeek(dvd_file, (int)offset) == (int)offset); |
94 } | 95 } |
95 | 96 |
97 static void read_video_attr(video_attr_t *va) { | |
98 getbits_state_t state; | |
99 uint8_t buf[sizeof(video_attr_t)]; | |
100 | |
101 memcpy(buf, va, sizeof(video_attr_t)); | |
102 if (!dvdread_getbits_init(&state, buf)) abort(); | |
103 va->mpeg_version = dvdread_getbits(&state, 2); | |
104 va->video_format = dvdread_getbits(&state, 2); | |
105 va->display_aspect_ratio = dvdread_getbits(&state, 2); | |
106 va->permitted_df = dvdread_getbits(&state, 2); | |
107 va->line21_cc_1 = dvdread_getbits(&state, 1); | |
108 va->line21_cc_2 = dvdread_getbits(&state, 1); | |
109 va->unknown1 = dvdread_getbits(&state, 1); | |
110 va->bit_rate = dvdread_getbits(&state, 1); | |
111 va->picture_size = dvdread_getbits(&state, 2); | |
112 va->letterboxed = dvdread_getbits(&state, 1); | |
113 va->film_mode = dvdread_getbits(&state, 1); | |
114 } | |
96 | 115 |
97 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { | 116 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { |
98 ifo_handle_t *ifofile; | 117 ifo_handle_t *ifofile; |
99 | 118 |
100 ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | 119 ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); |
316 B2N_32(vmgi_mat->txtdt_mgi); | 335 B2N_32(vmgi_mat->txtdt_mgi); |
317 B2N_32(vmgi_mat->vmgm_c_adt); | 336 B2N_32(vmgi_mat->vmgm_c_adt); |
318 B2N_32(vmgi_mat->vmgm_vobu_admap); | 337 B2N_32(vmgi_mat->vmgm_vobu_admap); |
319 B2N_16(vmgi_mat->vmgm_audio_attr.lang_code); | 338 B2N_16(vmgi_mat->vmgm_audio_attr.lang_code); |
320 B2N_16(vmgi_mat->vmgm_subp_attr.lang_code); | 339 B2N_16(vmgi_mat->vmgm_subp_attr.lang_code); |
340 read_video_attr(&vmgi_mat->vmgm_video_attr); | |
321 | 341 |
322 | 342 |
323 CHECK_ZERO(vmgi_mat->zero_1); | 343 CHECK_ZERO(vmgi_mat->zero_1); |
324 CHECK_ZERO(vmgi_mat->zero_2); | 344 CHECK_ZERO(vmgi_mat->zero_2); |
325 CHECK_ZERO(vmgi_mat->zero_3); | 345 CHECK_ZERO(vmgi_mat->zero_3); |
388 free(ifofile->vtsi_mat); | 408 free(ifofile->vtsi_mat); |
389 ifofile->vtsi_mat = 0; | 409 ifofile->vtsi_mat = 0; |
390 return 0; | 410 return 0; |
391 } | 411 } |
392 | 412 |
413 read_video_attr(&vtsi_mat->vtsm_video_attr); | |
414 read_video_attr(&vtsi_mat->vts_video_attr); | |
393 B2N_32(vtsi_mat->vts_last_sector); | 415 B2N_32(vtsi_mat->vts_last_sector); |
394 B2N_32(vtsi_mat->vtsi_last_sector); | 416 B2N_32(vtsi_mat->vtsi_last_sector); |
395 B2N_32(vtsi_mat->vts_category); | 417 B2N_32(vtsi_mat->vts_category); |
396 B2N_32(vtsi_mat->vtsi_last_byte); | 418 B2N_32(vtsi_mat->vtsi_last_byte); |
397 B2N_32(vtsi_mat->vtsm_vobs); | 419 B2N_32(vtsi_mat->vtsm_vobs); |
1839 return 0; | 1861 return 0; |
1840 | 1862 |
1841 if(!(DVDReadBytes(ifofile->file, vts_attributes, sizeof(vts_attributes_t)))) | 1863 if(!(DVDReadBytes(ifofile->file, vts_attributes, sizeof(vts_attributes_t)))) |
1842 return 0; | 1864 return 0; |
1843 | 1865 |
1866 read_video_attr(&vts_attributes->vtsm_vobs_attr); | |
1867 read_video_attr(&vts_attributes->vtstt_vobs_video_attr); | |
1844 B2N_32(vts_attributes->last_byte); | 1868 B2N_32(vts_attributes->last_byte); |
1845 B2N_32(vts_attributes->vts_cat); | 1869 B2N_32(vts_attributes->vts_cat); |
1846 B2N_16(vts_attributes->vtsm_audio_attr.lang_code); | 1870 B2N_16(vts_attributes->vtsm_audio_attr.lang_code); |
1847 B2N_16(vts_attributes->vtsm_subp_attr.lang_code); | 1871 B2N_16(vts_attributes->vtsm_subp_attr.lang_code); |
1848 for(i = 0; i < 8; i++) | 1872 for(i = 0; i < 8; i++) |