Commit d4ea66aa authored by hpi1's avatar hpi1

Hide implementation details:

- moved struct bluray to bluray.c
- removed unused fields
- re-ordered and grouped fields, added some comments
parent 9ee86de0
......@@ -46,17 +46,75 @@
#include <inttypes.h>
#include <string.h>
/*
* Navigation mode event queue
*/
typedef int (*fptr_int)();
typedef int32_t (*fptr_int32)();
typedef void* (*fptr_p_void)();
#define MAX_EVENTS 31 /* 2^n - 1 */
struct bd_event_queue_s {
typedef struct bd_event_queue_s {
unsigned in; /* next free slot */
unsigned out; /* next event */
BD_EVENT ev[MAX_EVENTS];
} BD_EVENT_QUEUE;
typedef enum {
title_undef = 0,
title_hdmv,
title_bdj,
} BD_TITLE_TYPE;
struct bluray {
/* current disc */
char *device_path;
INDX_ROOT *index;
NAV_TITLE_LIST *title_list;
/* current playlist */
NAV_TITLE *title;
uint64_t s_size;
uint64_t s_pos;
/* current clip */
NAV_CLIP *clip;
FILE_H *fp;
uint64_t clip_size;
uint64_t clip_block_pos;
uint64_t clip_pos;
/* current aligned unit */
uint8_t int_buf[6144];
uint16_t int_buf_off;
/* seamless angle change request */
int seamless_angle_change;
uint32_t angle_change_pkt;
uint32_t angle_change_time;
unsigned request_angle;
/* aacs */
void *h_libaacs; // library handle
void *aacs;
fptr_int libaacs_decrypt_unit;
/* BD+ */
void *h_libbdplus; // library handle
void *bdplus;
fptr_int32 bdplus_seek;
fptr_int32 bdplus_fixup;
/* player state */
BD_REGISTERS *regs; // player registers
BD_EVENT_QUEUE *event_queue; // navigation mode event queue
BD_TITLE_TYPE title_type; // type of current title (in navigation mode)
void *bdjava;
};
/*
* Navigation mode event queue
*/
static void _init_event_queue(BLURAY *bd)
{
if (!bd->event_queue) {
......@@ -426,7 +484,6 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
if (bd->seamless_angle_change) {
bd->clip = nav_set_angle(bd->title, bd->clip, bd->request_angle);
bd->angle = bd->request_angle;
bd->seamless_angle_change = 0;
}
if (tick < bd->title->duration) {
......@@ -493,7 +550,6 @@ int64_t bd_seek(BLURAY *bd, uint64_t pos)
if (bd->seamless_angle_change) {
bd->clip = nav_set_angle(bd->title, bd->clip, bd->request_angle);
bd->angle = bd->request_angle;
bd->seamless_angle_change = 0;
}
if (pos < bd->s_size) {
......@@ -549,7 +605,6 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
bd->clip = nav_set_angle(bd->title, bd->clip, bd->request_angle);
_clip_seek_time(bd, bd->angle_change_time);
}
bd->angle = bd->request_angle;
bd->seamless_angle_change = 0;
} else {
uint64_t angle_pos;
......@@ -622,7 +677,6 @@ static int _open_playlist(BLURAY *bd, const char *f_name)
return 0;
}
bd->angle = 0;
bd->seamless_angle_change = 0;
bd->s_pos = 0;
bd->s_size = (uint64_t)bd->title->packets * 192;
......
......@@ -29,49 +29,7 @@
#define TITLES_FILTER_DUP_CLIP 0x02
#define TITLES_RELEVANT (TITLES_FILTER_DUP_TITLE | TITLES_FILTER_DUP_CLIP)
/* Forward declaration of internal objects */
struct file;
struct nav_title_list_s;
struct nav_title_s;
struct nav_clip_s;
struct indx_root_s;
struct bd_registers_s;
struct bd_event_queue_s;
typedef int (*fptr_int)();
typedef int32_t (*fptr_int32)();
typedef void* (*fptr_p_void)();
typedef struct bluray BLURAY;
struct bluray {
char *device_path;
struct nav_title_list_s *title_list;
struct nav_title_s *title;
uint64_t s_size;
uint64_t s_pos;
struct nav_clip_s *clip;
struct file *fp;
uint64_t clip_size;
uint64_t clip_block_pos;
uint64_t clip_pos;
void *aacs, *bdplus, *bdjava;
fptr_int32 bdplus_seek; // frequently called
fptr_int32 bdplus_fixup; // frequently called
void *h_libaacs, *h_libbdplus, *h_libbdnav;
fptr_int libaacs_decrypt_unit;
uint8_t int_buf[6144];
uint16_t int_buf_off;
int seamless_angle_change;
uint32_t angle_change_pkt;
uint32_t angle_change_time;
unsigned request_angle;
unsigned angle;
enum { title_undef = 0, title_hdmv, title_bdj } title_type;
struct indx_root_s *index;
struct bd_registers_s *regs;
struct bd_event_queue_s *event_queue;
};
typedef struct bd_stream_info {
uint8_t coding_type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment