[libbluray-devel] Split nav_clip_packet_search() from nav_packet_search()

hpi1 git at videolan.org
Fri Jun 3 10:12:57 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Jun  1 12:26:47 2016 +0300| [6a76cc7e65a3d26d104580b04ea00cab6ff71e51] | committer: hpi1

Split nav_clip_packet_search() from nav_packet_search()

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

 src/libbluray/bdnav/navigation.c |   22 ++++++++++++++--------
 src/libbluray/bdnav/navigation.h |    1 +
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index c9e03c7..dbf230c 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -776,6 +776,19 @@ NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, u
     return clip;
 }
 
+void nav_clip_packet_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time)
+{
+    *clip_time = clip->in_time;
+    if (clip->cl != NULL) {
+        *clip_pkt = clpi_access_point(clip->cl, pkt, 0, 0, clip_time);
+        if (*clip_pkt < clip->start_pkt) {
+            *clip_pkt = clip->start_pkt;
+        }
+    } else {
+        *clip_pkt = clip->start_pkt;
+    }
+}
+
 // Search for random access point closest to the requested packet
 // Packets are 192 byte TS packets
 // pkt is relative to the beginning of the title
@@ -801,14 +814,7 @@ NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t *clip_pkt,
         *clip_pkt = clip->end_pkt;
     } else {
         clip = &title->clip_list.clip[ii];
-        if (clip->cl != NULL) {
-            *clip_pkt = clpi_access_point(clip->cl, pkt - pos + clip->start_pkt, 0, 0, out_time);
-            if (*clip_pkt < clip->start_pkt) {
-                *clip_pkt = clip->start_pkt;
-            }
-        } else {
-            *clip_pkt = clip->start_pkt;
-        }
+        nav_clip_packet_search(clip, pkt - pos + clip->start_pkt, clip_pkt, out_time);
     }
     if(*out_time < clip->in_time)
         *out_time = 0;
diff --git a/src/libbluray/bdnav/navigation.h b/src/libbluray/bdnav/navigation.h
index 7d2d325..8f683dd 100644
--- a/src/libbluray/bdnav/navigation.h
+++ b/src/libbluray/bdnav/navigation.h
@@ -145,6 +145,7 @@ 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,
                                        uint32_t *out_pkt, uint32_t *out_time);
+BD_PRIVATE void nav_clip_packet_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *clip_pkt, uint32_t *clip_time);
 BD_PRIVATE NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
 BD_PRIVATE void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
 BD_PRIVATE NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt);



More information about the libbluray-devel mailing list