Commit 81d3b677 authored by Will07c5's avatar Will07c5

Added bd_get_playlist_info for getting information about a specific playlist.

parent e97319e0
......@@ -869,29 +869,14 @@ static void _copy_streams(BLURAY_STREAM_INFO *streams, MPLS_STREAM *si, int coun
}
}
BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx)
BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx, uint32_t playlist)
{
NAV_TITLE *title;
BLURAY_TITLE_INFO *title_info;
unsigned int ii;
if (bd->title_list == NULL) {
DEBUG(DBG_BLURAY, "Title list not yet read! (%p)\n", bd);
return NULL;
}
if (bd->title_list->count <= title_idx) {
DEBUG(DBG_BLURAY, "Invalid title index %d! (%p)\n", title_idx, bd);
return NULL;
}
title = nav_title_open(bd->device_path, bd->title_list->title_info[title_idx].name);
if (title == NULL) {
DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
bd->title_list->title_info[title_idx].name, bd);
return NULL;
}
title_info = calloc(1, sizeof(BLURAY_TITLE_INFO));
title_info->idx = title_idx;
title_info->playlist = bd->title_list->title_info[title_idx].mpls_id;
title_info->playlist = playlist;
title_info->duration = (uint64_t)title->duration * 2;
title_info->angle_count = title->angle_count;
title_info->chapter_count = title->chap_list.count;
......@@ -926,6 +911,52 @@ BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx)
_copy_streams(ci->sec_video_streams, pi->stn.secondary_video, ci->sec_video_stream_count);
_copy_streams(ci->sec_audio_streams, pi->stn.secondary_audio, ci->sec_audio_stream_count);
}
return title_info;
}
BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx)
{
NAV_TITLE *title;
BLURAY_TITLE_INFO *title_info;
if (bd->title_list == NULL) {
DEBUG(DBG_BLURAY, "Title list not yet read! (%p)\n", bd);
return NULL;
}
if (bd->title_list->count <= title_idx) {
DEBUG(DBG_BLURAY, "Invalid title index %d! (%p)\n", title_idx, bd);
return NULL;
}
title = nav_title_open(bd->device_path, bd->title_list->title_info[title_idx].name);
if (title == NULL) {
DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
bd->title_list->title_info[title_idx].name, bd);
return NULL;
}
title_info = _fill_title_info(title, title_idx, bd->title_list->title_info[title_idx].mpls_id);
nav_title_close(title);
return title_info;
}
BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist)
{
char *f_name = str_printf("%05d.mpls", playlist);
NAV_TITLE *title;
BLURAY_TITLE_INFO *title_info;
title = nav_title_open(bd->device_path, f_name);
if (title == NULL) {
DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
f_name, bd);
return NULL;
}
// the title number doesn't matter in this case
title_info = _fill_title_info(title, 0, playlist);
nav_title_close(title);
return title_info;
}
......
......@@ -102,6 +102,16 @@ uint32_t bd_get_titles(BLURAY *bd, uint8_t flags);
*/
BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx);
/**
*
* Get information about a playlist
*
* @param bd BLURAY object
* @param playlist playlist number
* @return allocated BLURAY_TITLE_INFO object, NULL on error
*/
BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist);
/**
*
* Free BLURAY_TITLE_INFO object
......
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