Commit daad3523 authored by John Stebbins's avatar John Stebbins

Add public accessors for current title, chapter, and angle

parent a0ecbfed
......@@ -486,6 +486,31 @@ NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_
return clip;
}
uint32_t nav_chapter_get_current(NAV_CLIP *clip, uint32_t pkt)
{
NAV_MARK * mark;
NAV_TITLE *title = clip->title;
uint32_t ii;
// Clip can be null if we haven't started the first clip yet
if (clip == NULL) {
return 0;
}
for (ii = 0; ii < title->chap_list.count; ii++) {
mark = &title->chap_list.mark[ii];
if (mark->clip_ref == clip->ref && mark->clip_pkt <= pkt) {
if ( ii == title->chap_list.count - 1 ) {
return ii;
}
mark = &title->chap_list.mark[ii+1];
if (mark->clip_ref != clip->ref || mark->clip_pkt > pkt) {
return ii;
}
}
}
return 0;
}
// Search for random access point closest to the requested packet
// Packets are 192 byte TS packets
NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt)
......
......@@ -131,6 +131,7 @@ NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
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, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt);
uint32_t nav_chapter_get_current(NAV_CLIP *clip, uint32_t 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, unsigned angle);
......
......@@ -72,6 +72,7 @@ struct bluray {
/* current playlist */
NAV_TITLE *title;
uint32_t title_idx;
uint64_t s_size;
uint64_t s_pos;
......@@ -527,6 +528,11 @@ int64_t bd_chapter_pos(BLURAY *bd, unsigned chapter)
return -1;
}
uint32_t bd_get_current_chapter(BLURAY *bd)
{
return nav_chapter_get_current(bd->clip, bd->clip_pos / 192);
}
int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
{
uint32_t clip_pkt, out_pkt;
......@@ -718,11 +724,17 @@ int bd_select_title(BLURAY *bd, uint32_t title_idx)
return 0;
}
bd->title_idx = title_idx;
f_name = bd->title_list->title_info[title_idx].name;
return _open_playlist(bd, f_name);
}
uint32_t bd_get_current_title(BLURAY *bd)
{
return bd->title_idx;
}
int bd_select_angle(BLURAY *bd, unsigned angle)
{
if (bd->title == NULL) {
......@@ -733,6 +745,12 @@ int bd_select_angle(BLURAY *bd, unsigned angle)
return 1;
}
unsigned bd_get_current_angle(BLURAY *bd)
{
return bd->title->angle;
}
void bd_seamless_angle_change(BLURAY *bd, unsigned angle)
{
uint32_t clip_pkt;
......
......@@ -83,12 +83,15 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick); // Seek to a specific time in 9
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, 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
uint32_t bd_get_current_chapter(BLURAY *bd); // Get the current 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, 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
uint32_t bd_get_current_title(BLURAY *bd); // Returns the current title index
unsigned bd_get_current_angle(BLURAY *bd); // Returns the current angle
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