[libbluray-devel] Added initial title to nav_title_open()

hpi1 git at videolan.org
Sat May 14 14:18:29 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue May 10 15:10:48 2011 +0300| [11edeefad7a9e50d35770c2c2753c3ba0103fddc] | committer: hpi1

Added initial title to nav_title_open()

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

 src/libbluray/bdnav/navigation.c |    9 +++++++--
 src/libbluray/bdnav/navigation.h |    2 +-
 src/libbluray/bluray.c           |   10 +++++-----
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 61fddae..b656d7b 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -440,7 +440,7 @@ static void _fill_clip(NAV_TITLE *title,
     *time += clip->out_time - clip->in_time;
 }
 
-NAV_TITLE* nav_title_open(const char *root, const char *playlist)
+NAV_TITLE* nav_title_open(const char *root, const char *playlist, unsigned angle)
 {
     NAV_TITLE *title = NULL;
     char *path;
@@ -459,7 +459,7 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
     path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST" DIR_SEP "%s",
                       root, playlist);
     title->angle_count = 0;
-    title->angle = 0;
+    title->angle = angle;
     title->pl = mpls_parse(path, 0);
     if (title->pl == NULL) {
         BD_DEBUG(DBG_NAV, "Fail: Playlist parse %s\n", path);
@@ -521,6 +521,11 @@ NAV_TITLE* nav_title_open(const char *root, const char *playlist)
     title->mark_list.mark = calloc(title->pl->mark_count, sizeof(NAV_MARK));
 
     _extrapolate_title(title);
+
+    if (title->angle >= title->angle_count) {
+        title->angle = 0;
+    }
+
     return title;
 }
 
diff --git a/src/libbluray/bdnav/navigation.h b/src/libbluray/bdnav/navigation.h
index 88caa56..fa2abf9 100644
--- a/src/libbluray/bdnav/navigation.h
+++ b/src/libbluray/bdnav/navigation.h
@@ -137,7 +137,7 @@ struct nav_title_list_s
 
 BD_PRIVATE uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid);
 BD_PRIVATE char* nav_find_main_title(const char *root);
-BD_PRIVATE NAV_TITLE* nav_title_open(const char *root, const char *playlist);
+BD_PRIVATE NAV_TITLE* nav_title_open(const char *root, const char *playlist, unsigned angle);
 BD_PRIVATE void nav_title_close(NAV_TITLE *title);
 BD_PRIVATE NAV_CLIP* nav_next_clip(NAV_TITLE *title, NAV_CLIP *clip);
 BD_PRIVATE NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index c470862..f989307 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1309,11 +1309,11 @@ static void _close_playlist(BLURAY *bd)
     }
 }
 
-static int _open_playlist(BLURAY *bd, const char *f_name)
+static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
 {
     _close_playlist(bd);
 
-    bd->title = nav_title_open(bd->device_path, f_name);
+    bd->title = nav_title_open(bd->device_path, f_name, angle);
     if (bd->title == NULL) {
         BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
               f_name, bd);
@@ -1357,7 +1357,7 @@ int bd_select_playlist(BLURAY *bd, uint32_t playlist)
         }
     }
 
-    result = _open_playlist(bd, f_name);
+    result = _open_playlist(bd, f_name, 0);
 
     X_FREE(f_name);
     return result;
@@ -1383,7 +1383,7 @@ int bd_select_title(BLURAY *bd, uint32_t title_idx)
     bd->title_idx = title_idx;
     f_name = bd->title_list->title_info[title_idx].name;
 
-    return _open_playlist(bd, f_name);
+    return _open_playlist(bd, f_name, 0);
 }
 
 uint32_t bd_get_current_title(BLURAY *bd)
@@ -1533,7 +1533,7 @@ static BLURAY_TITLE_INFO *_get_title_info(BLURAY *bd, uint32_t title_idx, uint32
     NAV_TITLE *title;
     BLURAY_TITLE_INFO *title_info;
 
-    title = nav_title_open(bd->device_path, mpls_name);
+    title = nav_title_open(bd->device_path, mpls_name, 0);
     if (title == NULL) {
         BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Unable to open title %s! (%p)\n",
               mpls_name, bd);



More information about the libbluray-devel mailing list