diff --git a/libmpeg3/ifo.h b/libmpeg3/ifo.h index 415fd8f..7267aeb 100644 --- a/libmpeg3/ifo.h +++ b/libmpeg3/ifo.h @@ -1,6 +1,8 @@ #ifndef __IFO_H__ #define __IFO_H__ +typedef off_t __off64_t; + #ifndef DVD_VIDEO_LB_LEN #define DVD_VIDEO_LB_LEN 2048 #endif diff --git a/libmpeg3/libmpeg3.c b/libmpeg3/libmpeg3.c index 697e590..444ee7d 100644 --- a/libmpeg3/libmpeg3.c +++ b/libmpeg3/libmpeg3.c @@ -6,6 +6,7 @@ #include #include #include +#include int mpeg3_major() diff --git a/libmpeg3/mpeg3ifo.c b/libmpeg3/mpeg3ifo.c index f0dd85e..8f5d3e0 100644 --- a/libmpeg3/mpeg3ifo.c +++ b/libmpeg3/mpeg3ifo.c @@ -1,9 +1,9 @@ -#include #include #include #include #include #include +#include #include #include "ifo.h" @@ -60,12 +60,12 @@ typedef struct { static u_int get4bytes(u_char *buf) { - return bswap_32 (*((u_int32_t *)buf)); + return bswap32 (*((u_int32_t *)buf)); } static u_int get2bytes(u_char *buf) { - return bswap_16 (*((u_int16_t *)buf)); + return bswap16 (*((u_int16_t *)buf)); } static int ifo_read(int fd, long pos, long count, unsigned char *data) @@ -137,7 +137,7 @@ static int ifo_table(ifo_t *ifo, int64_t offset, unsigned long tbl_id) default: { ifo_hdr_t *hdr = (ifo_hdr_t *)data; - len = bswap_32(hdr->len) + 1; + len = bswap32(hdr->len) + 1; } } @@ -154,7 +154,7 @@ static int ifo_table(ifo_t *ifo, int64_t offset, unsigned long tbl_id) if(tbl_id == ID_TMT) for (i = 0; i < len; i++) - ptr[i] = bswap_32(ptr[i]); + ptr[i] = bswap32(ptr[i]); return 0; } @@ -235,7 +235,7 @@ static int ifo_audio(char *_hdr, char **ptr) *ptr = _hdr + AUDIO_HDR_LEN; - return bswap_16(hdr->num); + return bswap16(hdr->num); } @@ -253,7 +253,7 @@ static int pgci(ifo_hdr_t *hdr, int title, char **ptr) pgci_sub = (pgci_sub_t *)*ptr + title; - *ptr = (char *)hdr + bswap_32(pgci_sub->start); + *ptr = (char *)hdr + bswap32(pgci_sub->start); return 0; } @@ -506,7 +506,7 @@ static void cellplayinfo(mpeg3_t *file, ifo_t *ifo, mpeg3ifo_celltable_t *cells) int i, j; char *cell_hdr, *cell_hdr_start, *cell_info; ifo_hdr_t *hdr = (ifo_hdr_t*)ifo->data[ID_TITLE_PGCI]; - int program_chains = bswap_16(hdr->num); + int program_chains = bswap16(hdr->num); long total_cells; //printf("cellplayinfo\n"); @@ -545,8 +545,8 @@ static void cellplayinfo(mpeg3_t *file, ifo_t *ifo, mpeg3ifo_celltable_t *cells) for(i = 0; i < total_cells; i++) { ifo_pgci_cell_addr_t *cell_addr = (ifo_pgci_cell_addr_t *)cell_info; - int64_t start_byte = bswap_32(cell_addr->vobu_start); - int64_t end_byte = bswap_32(cell_addr->vobu_last_end); + int64_t start_byte = bswap32(cell_addr->vobu_start); + int64_t end_byte = bswap32(cell_addr->vobu_last_end); int cell_type = cell_addr->chain_info; if(!cells->total_cells && start_byte > 0) @@ -579,15 +579,15 @@ static void celladdresses(ifo_t *ifo, mpeg3ifo_celltable_t *cell_addresses) int done = 0; //printf("celladdresses\n"); - if(total_addresses = bswap_32(cell_addr_hdr->len) / sizeof(ifo_cell_addr_t)) + if(total_addresses = bswap32(cell_addr_hdr->len) / sizeof(ifo_cell_addr_t)) { for(i = 0; i < total_addresses; i++) { mpeg3ifo_cell_t *cell; cell = append_cell(cell_addresses); - cell->start_byte = (int64_t)bswap_32(cell_addr->start); - cell->end_byte = (int64_t)bswap_32(cell_addr->end); - cell->vob_id = bswap_16(cell_addr->vob_id); + cell->start_byte = (int64_t)bswap32(cell_addr->start); + cell->end_byte = (int64_t)bswap32(cell_addr->end); + cell->vob_id = bswap16(cell_addr->vob_id); cell->cell_id = cell_addr->cell_id; cell_addr++; } diff --git a/libmpeg3/mpeg3io.c b/libmpeg3/mpeg3io.c index c8e77bc..7016562 100644 --- a/libmpeg3/mpeg3io.c +++ b/libmpeg3/mpeg3io.c @@ -1,12 +1,14 @@ #include "mpeg3private.h" #include "mpeg3protos.h" -#include +#include #include #include #include #include +#define stat64 stat + mpeg3_fs_t* mpeg3_new_fs(char *path) { mpeg3_fs_t *fs = calloc(1, sizeof(mpeg3_fs_t)); @@ -61,7 +63,7 @@ int mpeg3io_open_file(mpeg3_fs_t *fs) mpeg3_get_keys(fs->css, fs->path); //printf("mpeg3io_open_file 1 %s\n", fs->path); - if(!(fs->fd = fopen64(fs->path, "rb"))) + if(!(fs->fd = fopen(fs->path, "rb"))) { if (fs->path) fprintf(stderr,"[mpeg3io_open_file] Error opening file '%s': ",fs->path); perror(""); @@ -162,7 +164,7 @@ void mpeg3io_read_buffer(mpeg3_fs_t *fs) - fseeko64(fs->fd, new_buffer_position, SEEK_SET); + fseeko(fs->fd, new_buffer_position, SEEK_SET); fread(fs->buffer, 1, remainder_start, fs->fd); @@ -177,7 +179,7 @@ void mpeg3io_read_buffer(mpeg3_fs_t *fs) fs->buffer_position = fs->current_byte; fs->buffer_offset = 0; - result = fseeko64(fs->fd, fs->buffer_position, SEEK_SET); + result = fseeko(fs->fd, fs->buffer_position, SEEK_SET); //printf("mpeg3io_read_buffer 2 %llx %llx\n", fs->buffer_position, ftell(fs->fd)); fs->buffer_size = fread(fs->buffer, 1, MPEG3_IO_SIZE, fs->fd); @@ -216,6 +218,8 @@ void mpeg3io_complete_path(char *complete_path, char *path) int mpeg3io_device(char *path, char *device) { + return 1; +#if 0 struct stat64 file_st, device_st; struct mntent *mnt; FILE *fp; @@ -239,6 +243,7 @@ int mpeg3io_device(char *path, char *device) endmntent(fp); return 0; +#endif } void mpeg3io_get_directory(char *directory, char *path) diff --git a/libmpeg3/mpeg3title.c b/libmpeg3/mpeg3title.c index db08830..572b976 100644 --- a/libmpeg3/mpeg3title.c +++ b/libmpeg3/mpeg3title.c @@ -5,6 +5,7 @@ #include #include +#include mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path) { diff --git a/libmpeg3/mpeg3toc.c b/libmpeg3/mpeg3toc.c index 50b201c..9e316d7 100644 --- a/libmpeg3/mpeg3toc.c +++ b/libmpeg3/mpeg3toc.c @@ -10,6 +10,7 @@ #include #include #include +#include diff --git a/libmpeg3/mpeg3tocutil.c b/libmpeg3/mpeg3tocutil.c index 5c245c9..6aded61 100644 --- a/libmpeg3/mpeg3tocutil.c +++ b/libmpeg3/mpeg3tocutil.c @@ -6,8 +6,9 @@ #include #include #include +#include - +#define stat64 stat #define PUT_INT32(x) \ { \