[libbluray-devel] Added min_title_length parameter to bd_get_titles()

hpi1 git at videolan.org
Mon Jun 13 19:37:59 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Jun 13 20:36:16 2011 +0300| [17896a40e6ddbe12473db77549ff0207ef748a64] | committer: hpi1

Added min_title_length parameter to bd_get_titles()

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=17896a40e6ddbe12473db77549ff0207ef748a64
---

 player_wrappers/xine/input_bluray.c |    2 +-
 src/examples/bdsplice.c             |    2 +-
 src/examples/libbluray_test.c       |    2 +-
 src/examples/list_titles.c          |    6 +-----
 src/libbluray/bdnav/navigation.c    |    7 ++++++-
 src/libbluray/bdnav/navigation.h    |    2 +-
 src/libbluray/bluray.c              |    4 ++--
 src/libbluray/bluray.h              |    3 ++-
 8 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/player_wrappers/xine/input_bluray.c b/player_wrappers/xine/input_bluray.c
index 9dabf2a..5e0078d 100644
--- a/player_wrappers/xine/input_bluray.c
+++ b/player_wrappers/xine/input_bluray.c
@@ -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)
diff --git a/src/examples/bdsplice.c b/src/examples/bdsplice.c
index c7b6b9e..4d61b06 100644
--- a/src/examples/bdsplice.c
+++ b/src/examples/bdsplice.c
@@ -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;
diff --git a/src/examples/libbluray_test.c b/src/examples/libbluray_test.c
index 5fc4a6b..47e3014 100644
--- a/src/examples/libbluray_test.c
+++ b/src/examples/libbluray_test.c
@@ -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;
diff --git a/src/examples/list_titles.c b/src/examples/list_titles.c
index d9f3138..a987951 100644
--- a/src/examples/list_titles.c
+++ b/src/examples/list_titles.c
@@ -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,
diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 7c27a1f..bce26a7 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -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;
diff --git a/src/libbluray/bdnav/navigation.h b/src/libbluray/bdnav/navigation.h
index fa2abf9..497e903 100644
--- a/src/libbluray/bdnav/navigation.h
+++ b/src/libbluray/bdnav/navigation.h
@@ -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_
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 5de1105..e6984ba 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -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);
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 43b9c43..c0566d9 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -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);
 
 /**
  *



More information about the libbluray-devel mailing list