📄 ifo_types.h
字号:
#ifndef IFO_TYPES_H_INCLUDED
#define IFO_TYPES_H_INCLUDED
/*
* Copyright (C) 2000, 2001 Bj鰎n Englund <d4bjorn@dtek.chalmers.se>,
* H錵an Hjort <d95hjort@dtek.chalmers.se>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inttypes.h"
#include "dvd_reader.h"
#undef ATTRIBUTE_PACKED
#undef PRAGMA_PACK_BEGIN
#undef PRAGMA_PACK_END
#if defined(__GNUC__)
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define ATTRIBUTE_PACKED __attribute__ ((packed))
#define PRAGMA_PACK 0
#endif
#endif
#if !defined(ATTRIBUTE_PACKED)
#define ATTRIBUTE_PACKED
#define PRAGMA_PACK 1
#endif
#if PRAGMA_PACK
#pragma pack(1)
#endif
/**
* Common
*
* The following structures are used in both the VMGI and VTSI.
*/
/**
* DVD Time Information.
*/
typedef struct {
uint8_t hour;
uint8_t minute;
uint8_t second;
uint8_t frame_u; /* The two high bits are the frame rate. */
} ATTRIBUTE_PACKED dvd_time_t;
/**
* Type to store per-command data.
*/
typedef struct {
uint8_t bytes[8];
} ATTRIBUTE_PACKED vm_cmd_t;
#define COMMAND_DATA_SIZE 8
/**
* Video Attributes.
*/
typedef struct {
#ifdef WORDS_BIGENDIAN
unsigned int mpeg_version : 2;
unsigned int video_format : 2;
unsigned int display_aspect_ratio : 2;
unsigned int permitted_df : 2;
unsigned int line21_cc_1 : 1;
unsigned int line21_cc_2 : 1;
unsigned int unknown1 : 1;
unsigned int bit_rate : 1;
unsigned int picture_size : 2;
unsigned int letterboxed : 1;
unsigned int film_mode : 1;
#elif defined( WIN32 )
unsigned char permitted_df : 2;
unsigned char display_aspect_ratio : 2;
unsigned char video_format : 2;
unsigned char mpeg_version : 2;
unsigned char film_mode : 1;
unsigned char letterboxed : 1;
unsigned char picture_size : 2;
unsigned char bit_rate : 1;
unsigned char unknown1 : 1;
unsigned char line21_cc_2 : 1;
unsigned char line21_cc_1 : 1;
#else
unsigned int permitted_df : 2;
unsigned int display_aspect_ratio : 2;
unsigned int video_format : 2;
unsigned int mpeg_version : 2;
unsigned int film_mode : 1;
unsigned int letterboxed : 1;
unsigned int picture_size : 2;
unsigned int bit_rate : 1;
unsigned int unknown1 : 1;
unsigned int line21_cc_2 : 1;
unsigned int line21_cc_1 : 1;
#endif
} ATTRIBUTE_PACKED video_attr_t;
/**
* Audio Attributes.
*/
typedef struct ATTRIBUTE_PACKED {
#ifdef WORDS_BIGENDIAN
unsigned int unknown4 : 1;
unsigned int channel_assignment : 3;
unsigned int version : 2;
unsigned int mc_intro : 1; /* probably 0: true, 1:false */
unsigned int mode : 1; /* Karaoke mode 0: solo 1: duet */
#else
unsigned char mode : 1;
unsigned char mc_intro : 1;
unsigned char version : 2;
unsigned char channel_assignment : 3;
unsigned char unknown4 : 1;
#endif
} KARAOKE;
typedef struct ATTRIBUTE_PACKED {
#ifdef WORDS_BIGENDIAN
unsigned int unknown5 : 4;
unsigned int dolby_encoded : 1; /* suitable for surround decoding */
unsigned int unknown6 : 3;
#else
unsigned char unknown6 : 3;
unsigned char dolby_encoded : 1;
unsigned char unknown5 : 4;
#endif
} SURROUND;
typedef struct {
#ifdef WORDS_BIGENDIAN
unsigned int audio_format : 3;
unsigned int multichannel_extension : 1;
unsigned int lang_type : 2;
unsigned int application_mode : 2;
unsigned int quantization : 2;
unsigned int sample_frequency : 2;
unsigned int unknown1 : 1;
unsigned int channels : 3;
#else
unsigned char application_mode : 2;
unsigned char lang_type : 2;
unsigned char multichannel_extension : 1;
unsigned char audio_format : 3;
unsigned char channels : 3;
unsigned char unknown1 : 1;
unsigned char sample_frequency : 2;
unsigned char quantization : 2;
#endif
uint16_t lang_code;
uint8_t lang_extension;
uint8_t code_extension;
uint8_t unknown3;
union app_info{
KARAOKE karaoke;
SURROUND surround;
} app_info;
} ATTRIBUTE_PACKED audio_attr_t;
/**
* MultiChannel Extension
*/
typedef struct {
#ifdef WORDS_BIGENDIAN
unsigned int zero1 : 7;
unsigned int ach0_gme : 1;
unsigned int zero2 : 7;
unsigned int ach1_gme : 1;
unsigned int zero3 : 4;
unsigned int ach2_gv1e : 1;
unsigned int ach2_gv2e : 1;
unsigned int ach2_gm1e : 1;
unsigned int ach2_gm2e : 1;
unsigned int zero4 : 4;
unsigned int ach3_gv1e : 1;
unsigned int ach3_gv2e : 1;
unsigned int ach3_gmAe : 1;
unsigned int ach3_se2e : 1;
unsigned int zero5 : 4;
unsigned int ach4_gv1e : 1;
unsigned int ach4_gv2e : 1;
unsigned int ach4_gmBe : 1;
unsigned int ach4_seBe : 1;
#else
unsigned char ach0_gme : 1;
unsigned char zero1 : 7;
unsigned char ach1_gme : 1;
unsigned char zero2 : 7;
unsigned char ach2_gm2e : 1;
unsigned char ach2_gm1e : 1;
unsigned char ach2_gv2e : 1;
unsigned char ach2_gv1e : 1;
unsigned char zero3 : 4;
unsigned char ach3_se2e : 1;
unsigned char ach3_gmAe : 1;
unsigned char ach3_gv2e : 1;
unsigned char ach3_gv1e : 1;
unsigned char zero4 : 4;
unsigned char ach4_seBe : 1;
unsigned char ach4_gmBe : 1;
unsigned char ach4_gv2e : 1;
unsigned char ach4_gv1e : 1;
unsigned char zero5 : 4;
#endif
uint8_t zero6[19];
} ATTRIBUTE_PACKED multichannel_ext_t;
/**
* Subpicture Attributes.
*/
typedef struct {
/*
* type: 0 not specified
* 1 language
* 2 other
* coding mode: 0 run length
* 1 extended
* 2 other
* language: indicates language if type == 1
* lang extension: if type == 1 contains the lang extension
*/
#ifdef WORDS_BIGENDIAN
unsigned int code_mode : 3;
unsigned int zero1 : 3;
unsigned int type : 2;
#else
unsigned char type : 2;
unsigned char zero1 : 3;
unsigned char code_mode : 3;
#endif
uint8_t zero2;
uint16_t lang_code;
uint8_t lang_extension;
uint8_t code_extension;
} ATTRIBUTE_PACKED subp_attr_t;
/**
* PGC Command Table.
*/
typedef struct {
uint16_t nr_of_pre;
uint16_t nr_of_post;
uint16_t nr_of_cell;
uint16_t zero_1;
vm_cmd_t *pre_cmds;
vm_cmd_t *post_cmds;
vm_cmd_t *cell_cmds;
} ATTRIBUTE_PACKED pgc_command_tbl_t;
#define PGC_COMMAND_TBL_SIZE 8
/**
* PGC Program Map
*/
typedef uint8_t pgc_program_map_t;
/**
* Cell Playback Information.
*/
typedef struct {
#ifdef WORDS_BIGENDIAN
unsigned int block_mode : 2;
unsigned int block_type : 2;
unsigned int seamless_play : 1;
unsigned int interleaved : 1;
unsigned int stc_discontinuity: 1;
unsigned int seamless_angle : 1;
unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
unsigned int restricted : 1; /**< ?? drop out of fastforward? */
unsigned int unknown2 : 6;
#else
unsigned char seamless_angle : 1;
unsigned char stc_discontinuity: 1;
unsigned char interleaved : 1;
unsigned char seamless_play : 1;
unsigned char block_type : 2;
unsigned char block_mode : 2;
unsigned char unknown2 : 6;
unsigned char restricted : 1;
unsigned char playback_mode : 1;
#endif
uint8_t still_time;
uint8_t cell_cmd_nr;
dvd_time_t playback_time;
uint32_t first_sector;
uint32_t first_ilvu_end_sector;
uint32_t last_vobu_start_sector;
uint32_t last_sector;
} ATTRIBUTE_PACKED cell_playback_t;
#define BLOCK_TYPE_NONE 0x0
#define BLOCK_TYPE_ANGLE_BLOCK 0x1
#define BLOCK_MODE_NOT_IN_BLOCK 0x0
#define BLOCK_MODE_FIRST_CELL 0x1
#define BLOCK_MODE_IN_BLOCK 0x2
#define BLOCK_MODE_LAST_CELL 0x3
/**
* Cell Position Information.
*/
typedef struct {
uint16_t vob_id_nr;
uint8_t zero_1;
uint8_t cell_nr;
} ATTRIBUTE_PACKED cell_position_t;
/**
* User Operations.
*/
typedef struct {
#ifdef WORDS_BIGENDIAN
unsigned int zero : 7; /* 25-31 */
unsigned int video_pres_mode_change : 1; /* 24 */
unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
unsigned int angle_change : 1;
unsigned int subpic_stream_change : 1;
unsigned int audio_stream_change : 1;
unsigned int pause_on : 1;
unsigned int still_off : 1;
unsigned int button_select_or_activate : 1;
unsigned int resume : 1; /* 16 */
unsigned int chapter_menu_call : 1; /* 15 */
unsigned int angle_menu_call : 1;
unsigned int audio_menu_call : 1;
unsigned int subpic_menu_call : 1;
unsigned int root_menu_call : 1;
unsigned int title_menu_call : 1;
unsigned int backward_scan : 1;
unsigned int forward_scan : 1; /* 8 */
unsigned int next_pg_search : 1; /* 7 */
unsigned int prev_or_top_pg_search : 1;
unsigned int time_or_chapter_search : 1;
unsigned int go_up : 1;
unsigned int stop : 1;
unsigned int title_play : 1;
unsigned int chapter_search_or_play : 1;
unsigned int title_or_time_play : 1; /* 0 */
#else
unsigned char video_pres_mode_change : 1; /* 24 */
unsigned char zero : 7; /* 25-31 */
unsigned char resume : 1; /* 16 */
unsigned char button_select_or_activate : 1;
unsigned char still_off : 1;
unsigned char pause_on : 1;
unsigned char audio_stream_change : 1;
unsigned char subpic_stream_change : 1;
unsigned char angle_change : 1;
unsigned char karaoke_audio_pres_mode_change : 1; /* 23 */
unsigned char forward_scan : 1; /* 8 */
unsigned char backward_scan : 1;
unsigned char title_menu_call : 1;
unsigned char root_menu_call : 1;
unsigned char subpic_menu_call : 1;
unsigned char audio_menu_call : 1;
unsigned char angle_menu_call : 1;
unsigned char chapter_menu_call : 1; /* 15 */
unsigned char title_or_time_play : 1; /* 0 */
unsigned char chapter_search_or_play : 1;
unsigned char title_play : 1;
unsigned char stop : 1;
unsigned char go_up : 1;
unsigned char time_or_chapter_search : 1;
unsigned char prev_or_top_pg_search : 1;
unsigned char next_pg_search : 1; /* 7 */
#endif
} ATTRIBUTE_PACKED user_ops_t;
/**
* Program Chain Information.
*/
typedef struct {
uint16_t zero_1;
uint8_t nr_of_programs;
uint8_t nr_of_cells;
dvd_time_t playback_time;
user_ops_t prohibited_ops;
uint16_t audio_control[8]; /* New type? */
uint32_t subp_control[32]; /* New type? */
uint16_t next_pgc_nr;
uint16_t prev_pgc_nr;
uint16_t goup_pgc_nr;
uint8_t still_time;
uint8_t pg_playback_mode;
uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */
uint16_t command_tbl_offset;
uint16_t program_map_offset;
uint16_t cell_playback_offset;
uint16_t cell_position_offset;
pgc_command_tbl_t *command_tbl;
pgc_program_map_t *program_map;
cell_playback_t *cell_playback;
cell_position_t *cell_position;
} ATTRIBUTE_PACKED pgc_t;
#define PGC_SIZE 236
/**
* Program Chain Information Search Pointer.
*/
typedef struct {
uint8_t entry_id;
#ifdef WORDS_BIGENDIAN
unsigned int block_mode : 2;
unsigned int block_type : 2;
unsigned int unknown1 : 4;
#else
unsigned char unknown1 : 4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -