Commit 17896a40 authored by hpi1's avatar hpi1

Added min_title_length parameter to bd_get_titles()

parent 80779fae
......@@ -1088,7 +1088,7 @@ static int bluray_plugin_open (input_plugin_t *this_gen)
/* load title list */
this->num_title_idx = bd_get_titles(this->bdh, TITLES_RELEVANT);
this->num_title_idx = bd_get_titles(this->bdh, TITLES_RELEVANT, 180);
LOGMSG("%d titles\n", this->num_title_idx);
if (this->num_title_idx < 1)
......
......@@ -141,7 +141,7 @@ main(int argc, char *argv[])
return 1;
}
title_count = bd_get_titles(bd, TITLES_RELEVANT);
title_count = bd_get_titles(bd, TITLES_RELEVANT, 0);
if (title_count <= 0) {
fprintf(stderr, "No titles found: %s\n", bdpath);
return 1;
......
......@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
BD_DEBUG(DBG_BLURAY,"\nListing titles:\n");
count = bd_get_titles(bd, TITLES_RELEVANT);
count = bd_get_titles(bd, TITLES_RELEVANT, 0);
for (ii = 0; ii < count; ii++)
{
BLURAY_TITLE_INFO* ti;
......
......@@ -81,15 +81,11 @@ int main(int argc, char *argv[])
}
bd = bd_open(bd_dir, NULL);
count = bd_get_titles(bd, TITLES_RELEVANT);
count = bd_get_titles(bd, TITLES_RELEVANT, seconds);
for (ii = 0; ii < count; ii++)
{
BLURAY_TITLE_INFO* ti;
ti = bd_get_title_info(bd, ii, 0);
if (ti->duration / 90000 < seconds)
{
continue;
}
printf(
"index: %d duration: %02"PRIu64":%02"PRIu64":%02"PRIu64" chapters: %d angles: %u clips %u\n",
ii + 1,
......
......@@ -111,7 +111,7 @@ _pl_duration(MPLS_PL *pl)
return duration;
}
NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags)
NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags, uint32_t min_title_length)
{
BD_DIR_H *dir;
BD_DIRENT ent;
......@@ -171,6 +171,11 @@ NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags)
mpls_free(pl);
continue;
}
if (min_title_length > 0 &&
_pl_duration(pl) < min_title_length*45000) {
mpls_free(pl);
continue;
}
if (ii >= title_info_alloc) {
NAV_TITLE_INFO *tmp = NULL;
title_info_alloc += 100;
......
......@@ -150,7 +150,7 @@ BD_PRIVATE NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *
BD_PRIVATE uint32_t nav_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time);
BD_PRIVATE NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle);
BD_PRIVATE NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags);
BD_PRIVATE NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags, uint32_t min_title_length);
BD_PRIVATE void nav_free_title_list(NAV_TITLE_LIST *title_list);
#endif // _NAVIGATION_H_
......@@ -1455,7 +1455,7 @@ void bd_seamless_angle_change(BLURAY *bd, unsigned angle)
* title lists
*/
uint32_t bd_get_titles(BLURAY *bd, uint8_t flags)
uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length)
{
if (!bd) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_get_titles(NULL) failed (%p)\n", bd);
......@@ -1465,7 +1465,7 @@ uint32_t bd_get_titles(BLURAY *bd, uint8_t flags)
if (bd->title_list != NULL) {
nav_free_title_list(bd->title_list);
}
bd->title_list = nav_get_title_list(bd->device_path, flags);
bd->title_list = nav_get_title_list(bd->device_path, flags, min_title_length);
if (!bd->title_list) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "nav_get_title_list(%s) failed (%p)\n", bd->device_path, bd);
......
......@@ -174,9 +174,10 @@ typedef struct bd_title_info {
*
* @param bd BLURAY object
* @param flags title flags
* @param min_title_length filter out titles shorter than min_title_length seconds
* @return number of titles found
*/
uint32_t bd_get_titles(BLURAY *bd, uint8_t flags);
uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length);
/**
*
......
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