Commit 9ee86de0 authored by hpi1's avatar hpi1

int -> unsigned for array indexes

compress structs
parent c3fd1e2d
......@@ -33,9 +33,9 @@
#include <stdlib.h>
#include <string.h>
static int _filter_dup(MPLS_PL *pl_list[], int count, MPLS_PL *pl)
static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
{
int ii, jj;
unsigned ii, jj;
for (ii = 0; ii < count; ii++) {
if (pl->list_count != pl_list[ii]->list_count) {
......@@ -61,10 +61,10 @@ static int _filter_dup(MPLS_PL *pl_list[], int count, MPLS_PL *pl)
return 1;
}
static int
static unsigned int
_find_repeats(MPLS_PL *pl, const char *m2ts)
{
int ii, count = 0;
unsigned ii, count = 0;
for (ii = 0; ii < pl->list_count; ii++) {
MPLS_PI *pi;
......@@ -79,9 +79,9 @@ _find_repeats(MPLS_PL *pl, const char *m2ts)
}
static int
_filter_repeats(MPLS_PL *pl, int repeats)
_filter_repeats(MPLS_PL *pl, unsigned repeats)
{
int ii;
unsigned ii;
for (ii = 0; ii < pl->list_count; ii++) {
MPLS_PI *pi;
......@@ -98,7 +98,7 @@ _filter_repeats(MPLS_PL *pl, int repeats)
static uint32_t
_pl_duration(MPLS_PL *pl)
{
int ii;
unsigned ii;
uint32_t duration = 0;
MPLS_PI *pi;
......@@ -211,7 +211,7 @@ char* nav_find_main_title(const char *root)
MPLS_PL **pl_list = NULL;
MPLS_PL **tmp = NULL;
MPLS_PL *pl = NULL;
int count, ii, jj, pl_list_size = 0;
unsigned count, ii, jj, pl_list_size = 0;
int res;
char longest[11];
......@@ -308,7 +308,7 @@ _extrapolate_title(NAV_TITLE *title)
{
uint64_t duration = 0;
uint64_t pkt = 0;
int ii, jj;
unsigned ii, jj;
MPLS_PL *pl = title->pl;
MPLS_PI *pi;
MPLS_PLM *plm;
......@@ -364,7 +364,7 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
{
NAV_TITLE *title = NULL;
char *path;
int ii, chapters = 0;
unsigned ii, chapters = 0;
uint32_t pos = 0;
uint32_t time = 0;
......@@ -455,7 +455,7 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
void nav_title_close(NAV_TITLE *title)
{
int ii;
unsigned ii;
for (ii = 0; ii < title->pl->list_count; ii++) {
clpi_free(title->clip_list.clip[ii].cl);
......@@ -470,7 +470,7 @@ void nav_title_close(NAV_TITLE *title)
// Search for random access point closest to the requested packet
// Packets are 192 byte TS packets
NAV_CLIP* nav_chapter_search(NAV_TITLE *title, int chapter, uint32_t *clip_pkt, uint32_t *out_pkt)
NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt)
{
NAV_CLIP *clip;
......@@ -488,7 +488,7 @@ NAV_CLIP* nav_chapter_search(NAV_TITLE *title, int chapter, uint32_t *clip_pkt,
// Search for random access point closest to the requested packet
// Packets are 192 byte TS packets
NAV_CLIP* nav_mark_search(NAV_TITLE *title, int mark, uint32_t *clip_pkt, uint32_t *out_pkt)
NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt)
{
NAV_CLIP *clip;
......@@ -512,7 +512,7 @@ NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
{
uint32_t pos, len;
NAV_CLIP *clip;
int ii;
unsigned ii;
pos = 0;
for (ii = 0; ii < title->pl->list_count; ii++) {
......@@ -566,7 +566,7 @@ NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, u
uint32_t pos, len;
MPLS_PI *pi;
NAV_CLIP *clip;
int ii;
unsigned ii;
pos = 0;
for (ii = 0; ii < title->pl->list_count; ii++) {
......@@ -620,7 +620,7 @@ NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip)
return &title->clip_list.clip[clip->ref + 1];
}
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, int angle)
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
{
char *path;
int ii;
......@@ -630,7 +630,7 @@ NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, int angle)
if (title == NULL) {
return clip;
}
if (angle < 0 || angle > 8) {
if (angle > 8) {
// invalid angle
return clip;
}
......
......@@ -38,7 +38,7 @@ struct nav_mark_s
{
int number;
int mark_type;
int clip_ref;
unsigned clip_ref;
uint32_t clip_pkt;
uint32_t clip_time;
......@@ -54,7 +54,7 @@ struct nav_mark_s
typedef struct nav_mark_list_s NAV_MARK_LIST;
struct nav_mark_list_s
{
int count;
unsigned count;
NAV_MARK *mark;
};
......@@ -63,7 +63,7 @@ struct nav_clip_s
{
char name[11];
uint32_t clip_id;
int ref;
unsigned ref;
uint32_t pos;
uint32_t start_pkt;
uint32_t end_pkt;
......@@ -88,7 +88,7 @@ struct nav_clip_s
typedef struct nav_clip_list_s NAV_CLIP_LIST;
struct nav_clip_list_s
{
int count;
unsigned count;
NAV_CLIP *clip;
};
......@@ -113,13 +113,13 @@ struct nav_title_info_s
char name[11];
uint32_t mpls_id;
uint32_t duration;
int ref;
unsigned ref;
};
typedef struct nav_title_list_s NAV_TITLE_LIST;
struct nav_title_list_s
{
unsigned int count;
unsigned int count;
NAV_TITLE_INFO *title_info;
};
......@@ -130,10 +130,10 @@ NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip);
NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt, uint32_t *out_pkt, uint32_t *out_time);
NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
NAV_CLIP* nav_chapter_search(NAV_TITLE *title, int chapter, uint32_t *clip_pkt, uint32_t *out_pkt);
NAV_CLIP* nav_mark_search(NAV_TITLE *title, int mark, uint32_t *clip_pkt, uint32_t *out_pkt);
NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt);
NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt);
uint32_t nav_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time);
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, int angle);
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle);
NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags);
void nav_free_title_list(NAV_TITLE_LIST *title_list);
......
......@@ -441,7 +441,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
return bd->s_pos;
}
int64_t bd_seek_chapter(BLURAY *bd, int chapter)
int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter)
{
uint32_t clip_pkt, out_pkt;
NAV_CLIP *clip;
......@@ -457,17 +457,20 @@ int64_t bd_seek_chapter(BLURAY *bd, int chapter)
return bd->s_pos;
}
int64_t bd_chapter_pos(BLURAY *bd, int chapter)
int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter)
{
uint32_t clip_pkt, out_pkt;
NAV_CLIP *clip;
// Find the closest access unit to the requested position
clip = nav_chapter_search(bd->title, chapter, &clip_pkt, &out_pkt);
return (int64_t)out_pkt * 192;
if (chapter < bd->title->chap_list.count) {
// Find the closest access unit to the requested position
nav_chapter_search(bd->title, chapter, &clip_pkt, &out_pkt);
return (int64_t)out_pkt * 192;
}
return -1;
}
int64_t bd_seek_mark(BLURAY *bd, int mark)
int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
{
uint32_t clip_pkt, out_pkt;
NAV_CLIP *clip;
......@@ -666,7 +669,7 @@ int bd_select_title(BLURAY *bd, uint32_t title_idx)
return _open_playlist(bd, f_name);
}
int bd_select_angle(BLURAY *bd, int angle)
int bd_select_angle(BLURAY *bd, unsigned angle)
{
if (bd->title == NULL) {
DEBUG(DBG_BLURAY, "Title not yet selected! (%p)\n", bd);
......@@ -676,7 +679,7 @@ int bd_select_angle(BLURAY *bd, int angle)
return 1;
}
void bd_seamless_angle_change(BLURAY *bd, int angle)
void bd_seamless_angle_change(BLURAY *bd, unsigned angle)
{
uint32_t clip_pkt;
......
......@@ -64,8 +64,8 @@ struct bluray {
int seamless_angle_change;
uint32_t angle_change_pkt;
uint32_t angle_change_time;
int request_angle;
int angle;
unsigned request_angle;
unsigned angle;
enum { title_undef = 0, title_hdmv, title_bdj } title_type;
struct indx_root_s *index;
......@@ -82,12 +82,12 @@ typedef struct bd_stream_info {
} BLURAY_STREAM_INFO;
typedef struct bd_clip {
uint32_t video_stream_count;
uint32_t audio_stream_count;
uint32_t pg_stream_count;
uint32_t ig_stream_count;
uint32_t sec_audio_stream_count;
uint32_t sec_video_stream_count;
uint8_t video_stream_count;
uint8_t audio_stream_count;
uint8_t pg_stream_count;
uint8_t ig_stream_count;
uint8_t sec_audio_stream_count;
uint8_t sec_video_stream_count;
BLURAY_STREAM_INFO *video_streams;
BLURAY_STREAM_INFO *audio_streams;
BLURAY_STREAM_INFO *pg_streams;
......@@ -107,7 +107,7 @@ typedef struct bd_title_info {
uint32_t idx;
uint64_t duration;
uint32_t clip_count;
uint32_t angle_count;
uint8_t angle_count;
uint32_t chapter_count;
BLURAY_CLIP_INFO *clips;
BLURAY_TITLE_CHAPTER *chapters;
......@@ -123,13 +123,13 @@ void bd_close(BLURAY *bd); // Free libb
int64_t bd_seek(BLURAY *bd, uint64_t pos); // Seek to pos in currently selected title file
int64_t bd_seek_time(BLURAY *bd, uint64_t tick); // Seek to a specific time in 90Khz ticks
int bd_read(BLURAY *bd, unsigned char *buf, int len); // Read from currently selected title file, decrypt if possible
int64_t bd_seek_chapter(BLURAY *bd, int chapter); // Seek to a chapter. First chapter is 0
int64_t bd_chapter_pos(BLURAY *bd, int chapter); // Find the byte position of a chapter
int64_t bd_seek_mark(BLURAY *bd, int mark); // Seek to a playmark. First mark is 0
int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter); // Seek to a chapter. First chapter is 0
int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter); // Find the byte position of a chapter
int64_t bd_seek_mark(BLURAY *bd, unsigned mark); // Seek to a playmark. First mark is 0
int bd_select_playlist(BLURAY *bd, uint32_t playlist);
int bd_select_title(BLURAY *bd, uint32_t title); // Select the title from the list created by bd_get_titles()
int bd_select_angle(BLURAY *bd, int angle); // Set the angle to play
void bd_seamless_angle_change(BLURAY *bd, int angle); // Initiate seamless angle change
int bd_select_angle(BLURAY *bd, unsigned angle); // Set the angle to play
void bd_seamless_angle_change(BLURAY *bd, unsigned angle); // Initiate seamless angle change
uint64_t bd_get_title_size(BLURAY *bd); // Returns file size in bytes of currently selected title, 0 in no title selected
uint64_t bd_tell(BLURAY *bd); // Return current pos
......
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