#include <byteswap.h>#include <dirent.h>#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <unistd.h>#include "ifo.h"#include "mpeg3private.h"#include "mpeg3protos.h"

Go to the source code of this file.
Data Structures | |
| struct | mpeg3ifo_cell_t |
| struct | mpeg3ifo_celltable_t |
| struct | cell_addr_hdr_t |
| struct | audio_hdr_t |
| struct | pgci_sub_t |
Defines | |
| #define | CADDR_HDR_LEN 8 |
| #define | AUDIO_HDR_LEN 4 |
| #define | PGCI_SUB_LEN 8 |
| #define | PGCI_COLOR_LEN 4 |
| #define | OFF_PTT get4bytes (ifo->data[ID_MAT] + 0xC8) |
| #define | OFF_TITLE_PGCI get4bytes (ifo->data[ID_MAT] + 0xCC) |
| #define | OFF_MENU_PGCI get4bytes (ifo->data[ID_MAT] + 0xD0) |
| #define | OFF_TMT get4bytes (ifo->data[ID_MAT] + 0xD4) |
| #define | OFF_MENU_CELL_ADDR get4bytes (ifo->data[ID_MAT] + 0xD8) |
| #define | OFF_MENU_VOBU_ADDR_MAP get4bytes (ifo->data[ID_MAT] + 0xDC) |
| #define | OFF_TITLE_CELL_ADDR get4bytes (ifo->data[ID_MAT] + 0xE0) |
| #define | OFF_TITLE_VOBU_ADDR_MAP get4bytes (ifo->data[ID_MAT] + 0xE4) |
| #define | OFF_VMG_TSP get4bytes (ifo->data[ID_MAT] + 0xC4) |
| #define | OFF_VMG_MENU_PGCI get4bytes (ifo->data[ID_MAT] + 0xC8) |
| #define | OFF_VMG_TMT get4bytes (ifo->data[ID_MAT] + 0xD0) |
| #define | TEST_START 0x1000000 |
| #define | TEST_LEN 0x1000000 |
Functions | |
| static u_int | get4bytes (u_char *buf) |
| static u_int | get2bytes (u_char *buf) |
| static int | ifo_read (int fd, long pos, long count, unsigned char *data) |
| static int | ifo_vts (ifo_t *ifo) |
| static int | ifo_vmg (ifo_t *ifo) |
| static int | ifo_table (ifo_t *ifo, int64_t offset, unsigned long tbl_id) |
| static ifo_t * | ifo_open (int fd, long pos) |
| static int | ifo_close (ifo_t *ifo) |
| static int | ifo_audio (char *_hdr, char **ptr) |
| static int | pgci (ifo_hdr_t *hdr, int title, char **ptr) |
| static int | program_map (mpeg3_t *file, char *pgc, unsigned char **ptr) |
| static u_int | get_cellplayinfo (u_char *pgc, u_char **ptr) |
| static void | get_ifo_playlist (mpeg3_t *file, mpeg3_demuxer_t *demuxer) |
| static void | get_ifo_header (mpeg3_demuxer_t *demuxer, ifo_t *ifo) |
| static mpeg3ifo_cell_t * | append_cell (mpeg3ifo_celltable_t *table) |
| static void | delete_celltable (mpeg3ifo_celltable_t *table) |
| static void | cellplayinfo (mpeg3_t *file, ifo_t *ifo, mpeg3ifo_celltable_t *cells) |
| static void | celladdresses (ifo_t *ifo, mpeg3ifo_celltable_t *cell_addresses) |
| static void | finaltable (mpeg3ifo_celltable_t *final_cells, mpeg3ifo_celltable_t *cells, mpeg3ifo_celltable_t *cell_addresses) |
| int | mpeg3_read_ifo (mpeg3_t *file, int read_cells) |
| #define AUDIO_HDR_LEN 4 |
| #define CADDR_HDR_LEN 8 |
| #define OFF_MENU_CELL_ADDR get4bytes (ifo->data[ID_MAT] + 0xD8) |
| #define OFF_MENU_PGCI get4bytes (ifo->data[ID_MAT] + 0xD0) |
| #define OFF_MENU_VOBU_ADDR_MAP get4bytes (ifo->data[ID_MAT] + 0xDC) |
| #define OFF_PTT get4bytes (ifo->data[ID_MAT] + 0xC8) |
| #define OFF_TITLE_CELL_ADDR get4bytes (ifo->data[ID_MAT] + 0xE0) |
| #define OFF_TITLE_PGCI get4bytes (ifo->data[ID_MAT] + 0xCC) |
| #define OFF_TITLE_VOBU_ADDR_MAP get4bytes (ifo->data[ID_MAT] + 0xE4) |
| #define OFF_TMT get4bytes (ifo->data[ID_MAT] + 0xD4) |
| #define OFF_VMG_MENU_PGCI get4bytes (ifo->data[ID_MAT] + 0xC8) |
| #define OFF_VMG_TMT get4bytes (ifo->data[ID_MAT] + 0xD0) |
| #define OFF_VMG_TSP get4bytes (ifo->data[ID_MAT] + 0xC4) |
| #define PGCI_COLOR_LEN 4 |
| #define PGCI_SUB_LEN 8 |
Definition at line 56 of file mpeg3ifo.c.
| #define TEST_LEN 0x1000000 |
Referenced by get_ifo_header().
| #define TEST_START 0x1000000 |
Referenced by get_ifo_header().
| static mpeg3ifo_cell_t* append_cell | ( | mpeg3ifo_celltable_t * | table | ) | [static] |
Definition at line 477 of file mpeg3ifo.c.
References mpeg3ifo_celltable_t::cells, mpeg3ifo_celltable_t::cells_allocated, memcpy, and mpeg3ifo_celltable_t::total_cells.
Referenced by celladdresses(), and cellplayinfo().
| static void celladdresses | ( | ifo_t * | ifo, | |
| mpeg3ifo_celltable_t * | cell_addresses | |||
| ) | [static] |
Definition at line 572 of file mpeg3ifo.c.
References append_cell(), bswap_16(), bswap_32(), CADDR_HDR_LEN, ifo_cell_addr_t::cell_id, mpeg3ifo_cell_t::cell_id, mpeg3ifo_celltable_t::cells, ifo_t::data, ifo_cell_addr_t::end, mpeg3ifo_cell_t::end_byte, ID_TITLE_CELL_ADDR, ifo_cell_addr_t::start, mpeg3ifo_cell_t::start_byte, ifo_cell_addr_t::vob_id, and mpeg3ifo_cell_t::vob_id.
Referenced by mpeg3_read_ifo().

| static void cellplayinfo | ( | mpeg3_t * | file, | |
| ifo_t * | ifo, | |||
| mpeg3ifo_celltable_t * | cells | |||
| ) | [static] |
Definition at line 504 of file mpeg3ifo.c.
References append_cell(), bswap_16(), bswap_32(), mpeg3ifo_cell_t::cell_type, mpeg3ifo_celltable_t::cells, ifo_pgci_cell_addr_t::chain_info, ifo_t::data, mpeg3ifo_cell_t::end_byte, get_cellplayinfo(), ID_TITLE_PGCI, ifo_hdr_t::num, pgci(), PGCI_CELL_ADDR_LEN, program_map(), mpeg3ifo_cell_t::start_byte, mpeg3ifo_celltable_t::total_cells, ifo_pgci_cell_addr_t::vobu_last_end, and ifo_pgci_cell_addr_t::vobu_start.
Referenced by mpeg3_read_ifo().

| static void delete_celltable | ( | mpeg3ifo_celltable_t * | table | ) | [static] |
Definition at line 498 of file mpeg3ifo.c.
References mpeg3ifo_celltable_t::cells.
Referenced by mpeg3_read_ifo().
| static void finaltable | ( | mpeg3ifo_celltable_t * | final_cells, | |
| mpeg3ifo_celltable_t * | cells, | |||
| mpeg3ifo_celltable_t * | cell_addresses | |||
| ) | [static] |
Definition at line 624 of file mpeg3ifo.c.
References mpeg3ifo_cell_t::cell_id, mpeg3ifo_celltable_t::cells, mpeg3ifo_celltable_t::cells_allocated, mpeg3ifo_cell_t::end_byte, input, output, mpeg3ifo_cell_t::program, mpeg3ifo_cell_t::start_byte, mpeg3ifo_celltable_t::total_cells, and mpeg3ifo_cell_t::vob_id.
Referenced by mpeg3_read_ifo().
| static u_int get2bytes | ( | u_char * | buf | ) | [static] |
Definition at line 66 of file mpeg3ifo.c.
References bswap_16().
Referenced by get_cellplayinfo(), and program_map().

| static u_int get4bytes | ( | u_char * | buf | ) | [static] |
Definition at line 61 of file mpeg3ifo.c.
References bswap_32().
Referenced by ifo_open(), and ifo_table().

| static u_int get_cellplayinfo | ( | u_char * | pgc, | |
| u_char ** | ptr | |||
| ) | [static] |
Definition at line 319 of file mpeg3ifo.c.
References get2bytes(), and PGCI_COLOR_LEN.
Referenced by cellplayinfo().

| static void get_ifo_header | ( | mpeg3_demuxer_t * | demuxer, | |
| ifo_t * | ifo | |||
| ) | [static] |
Definition at line 421 of file mpeg3ifo.c.
References mpeg3_demuxer_t::astream_table, ifo_t::data, ID_MAT, ifo_audio(), IFO_OFFSET_AUDIO, ifo_vmg(), ifo_vts(), MPEG3_MAX_STREAMS, mpeg3_read_next_packet(), mpeg3demux_eof(), mpeg3demux_open_title(), mpeg3demux_seek_byte(), mpeg3demux_tell_byte(), TEST_LEN, TEST_START, and mpeg3_demuxer_t::vstream_table.
Referenced by mpeg3_read_ifo().

| static void get_ifo_playlist | ( | mpeg3_t * | file, | |
| mpeg3_demuxer_t * | demuxer | |||
| ) | [static] |
Definition at line 342 of file mpeg3ifo.c.
References complete_path(), mpeg3_title_t::end_byte, mpeg3_title_t::fs, mpeg3_t::fs, mpeg3_new_cell(), mpeg3_new_title(), MPEG3_STRLEN, mpeg3io_complete_path(), mpeg3io_get_directory(), mpeg3io_get_filename(), mpeg3io_joinpath(), mpeg3io_path_total_bytes(), mpeg3_fs_t::path, mpeg3_title_t::start_byte, strrchr, mpeg3_demuxer_t::titles, mpeg3_title_t::total_bytes, and mpeg3_demuxer_t::total_titles.
Referenced by mpeg3_read_ifo().

| static int ifo_audio | ( | char * | _hdr, | |
| char ** | ptr | |||
| ) | [static] |
Definition at line 230 of file mpeg3ifo.c.
References AUDIO_HDR_LEN, bswap_16(), and audio_hdr_t::num.
Referenced by get_ifo_header().

| static int ifo_close | ( | ifo_t * | ifo | ) | [static] |
Definition at line 213 of file mpeg3ifo.c.
References ifo_t::data, ID_MAT, ID_MENU_CELL_ADDR, ID_MENU_PGCI, ID_MENU_VOBU_ADDR_MAP, ID_PTT, ID_TITLE_CELL_ADDR, ID_TITLE_PGCI, ID_TITLE_VOBU_ADDR_MAP, and ID_TMT.
Referenced by mpeg3_read_ifo().
| static ifo_t* ifo_open | ( | int | fd, | |
| long | pos | |||
| ) | [static] |
Definition at line 162 of file mpeg3ifo.c.
References ifo_t::data, DVD_VIDEO_LB_LEN, ifo_t::fd, get4bytes(), ID_MAT, ID_MENU_CELL_ADDR, ID_MENU_PGCI, ID_MENU_VOBU_ADDR_MAP, ID_PTT, ID_TITLE_CELL_ADDR, ID_TITLE_PGCI, ID_TITLE_VOBU_ADDR_MAP, ID_TMT, ID_TSP, ifo_read(), ifo_table(), ifo_vmg(), ifo_vts(), NULL, ifo_t::num_menu_vobs, OFF_MENU_CELL_ADDR, OFF_MENU_PGCI, OFF_MENU_VOBU_ADDR_MAP, OFF_PTT, OFF_TITLE_CELL_ADDR, OFF_TITLE_PGCI, OFF_TITLE_VOBU_ADDR_MAP, OFF_TMT, OFF_VMG_MENU_PGCI, OFF_VMG_TMT, OFF_VMG_TSP, ifo_t::pos, and ifo_t::vob_start.
Referenced by mpeg3_read_ifo().

| static int ifo_read | ( | int | fd, | |
| long | pos, | |||
| long | count, | |||
| unsigned char * | data | |||
| ) | [static] |
| static int ifo_table | ( | ifo_t * | ifo, | |
| int64_t | offset, | |||
| unsigned long | tbl_id | |||
| ) | [static] |
Definition at line 113 of file mpeg3ifo.c.
References bswap_32(), ifo_t::data, DVD_VIDEO_LB_LEN, ifo_t::fd, get4bytes(), ID_MENU_VOBU_ADDR_MAP, ID_TITLE_VOBU_ADDR_MAP, ID_TMT, ifo_read(), ifo_hdr_t::len, and ifo_t::pos.
Referenced by ifo_open().

| static int ifo_vmg | ( | ifo_t * | ifo | ) | [static] |
Definition at line 105 of file mpeg3ifo.c.
References ifo_t::data, and ID_MAT.
Referenced by get_ifo_header(), and ifo_open().
| static int ifo_vts | ( | ifo_t * | ifo | ) | [static] |
Definition at line 96 of file mpeg3ifo.c.
References ifo_t::data, and ID_MAT.
Referenced by get_ifo_header(), and ifo_open().
| int mpeg3_read_ifo | ( | mpeg3_t * | file, | |
| int | read_cells | |||
| ) |
Definition at line 705 of file mpeg3ifo.c.
References mpeg3_title_t::cell_table, mpeg3_title_t::cell_table_size, celladdresses(), cellplayinfo(), mpeg3ifo_celltable_t::cells, delete_celltable(), mpeg3_t::demuxer, mpeg3ifo_cell_t::end_byte, finaltable(), fprintf, mpeg3_t::fs, get_ifo_header(), get_ifo_playlist(), ifo_close(), ifo_open(), mpeg3_new_cell(), mpeg3io_get_fd, mpeg3ifo_cell_t::program, mpeg3_demuxer_t::read_all, mpeg3ifo_cell_t::start_byte, mpeg3_demuxer_t::titles, mpeg3_title_t::total_bytes, mpeg3ifo_celltable_t::total_cells, and mpeg3_demuxer_t::total_titles.
Referenced by mpeg3_get_file_type().

| static int pgci | ( | ifo_hdr_t * | hdr, | |
| int | title, | |||
| char ** | ptr | |||
| ) | [static] |
Definition at line 242 of file mpeg3ifo.c.
References bswap_32(), IFO_HDR_LEN, ifo_hdr_t::num, and pgci_sub_t::start.
Referenced by cellplayinfo().

| static int program_map | ( | mpeg3_t * | file, | |
| char * | pgc, | |||
| unsigned char ** | ptr | |||
| ) | [static] |
Definition at line 261 of file mpeg3ifo.c.
References b, CLAMP, get2bytes(), mpeg3_t::have_palette, mpeg3_t::palette, and r.
Referenced by cellplayinfo().

1.5.5