[libbluray-devel] [Git][videolan/libbluray][master] 6 commits: nav_clip_time_search: allow NULL for title packet

Petri Hintukainen gitlab at videolan.org
Mon Dec 31 19:35:54 CET 2018


Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
4232318e by hpi1 at 2018-12-31T17:24:21Z
nav_clip_time_search: allow NULL for title packet

- - - - -
34fe270c by hpi1 at 2018-12-31T17:34:38Z
Add missing includes

- - - - -
890b21d1 by hpi1 at 2018-12-31T17:40:21Z
bdnav: add nav_clip_textst_font()

- - - - -
f8b293a8 by hpi1 at 2018-12-31T17:40:51Z
Cosmetics

- - - - -
f59cd460 by hpi1 at 2018-12-31T17:43:02Z
bluray.c: use nav_ functions instead of clpi_ functions

- - - - -
64e24886 by hpi1 at 2018-12-31T17:49:37Z
bdnav: hide internal clpi data

- - - - -


6 changed files:

- src/libbluray/bdnav/clpi_parse.c
- src/libbluray/bdnav/clpi_parse.h
- src/libbluray/bdnav/mpls_parse.c
- src/libbluray/bdnav/navigation.c
- src/libbluray/bdnav/navigation.h
- src/libbluray/bluray.c


Changes:

=====================================
src/libbluray/bdnav/clpi_parse.c
=====================================
@@ -23,6 +23,7 @@
 #endif
 
 #include "clpi_parse.h"
+#include "clpi_data.h"
 
 #include "extdata_parse.h"
 #include "bdmv_parse.h"


=====================================
src/libbluray/bdnav/clpi_parse.h
=====================================
@@ -20,19 +20,21 @@
 #if !defined(_CLPI_PARSE_H_)
 #define _CLPI_PARSE_H_
 
-#include "clpi_data.h"
 #include "util/attributes.h"
 
 #include <stdint.h>
 
+struct clpi_cl;
 struct bd_disc;
 
-BD_PRIVATE uint32_t clpi_find_stc_spn(const CLPI_CL *cl, uint8_t stc_id);
-BD_PRIVATE uint32_t clpi_lookup_spn(const CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_id);
-BD_PRIVATE uint32_t clpi_access_point(const CLPI_CL *cl, uint32_t pkt, int next, int angle_change, uint32_t *time);
-BD_PRIVATE CLPI_CL* clpi_parse(const char *path) BD_ATTR_MALLOC;
-BD_PRIVATE CLPI_CL* clpi_get(struct bd_disc *disc, const char *file);
-BD_PRIVATE CLPI_CL* clpi_copy(const CLPI_CL* src_cl);
-BD_PRIVATE void clpi_free(CLPI_CL **cl);
+BD_PRIVATE struct clpi_cl* clpi_parse(const char *path);
+BD_PRIVATE struct clpi_cl* clpi_get(struct bd_disc *disc, const char *file);
+BD_PRIVATE struct clpi_cl* clpi_copy(const struct clpi_cl* src_cl);
+BD_PRIVATE void clpi_free(struct clpi_cl **cl);
+
+BD_PRIVATE uint32_t clpi_find_stc_spn(const struct clpi_cl *cl, uint8_t stc_id);
+BD_PRIVATE uint32_t clpi_lookup_spn(const struct clpi_cl *cl, uint32_t timestamp, int before, uint8_t stc_id);
+BD_PRIVATE uint32_t clpi_access_point(const struct clpi_cl *cl, uint32_t pkt, int next, int angle_change, uint32_t *time);
+
 
 #endif // _CLPI_PARSE_H_


=====================================
src/libbluray/bdnav/mpls_parse.c
=====================================
@@ -26,6 +26,7 @@
 
 #include "extdata_parse.h"
 #include "bdmv_parse.h"
+#include "mpls_data.h"
 #include "uo_mask.h"
 
 #include "disc/disc.h"


=====================================
src/libbluray/bdnav/navigation.c
=====================================
@@ -25,7 +25,9 @@
 #include "navigation.h"
 
 #include "clpi_parse.h"
+#include "clpi_data.h"
 #include "mpls_parse.h"
+#include "mpls_data.h"
 #include "bdparse.h"
 
 #include "disc/disc.h"
@@ -987,7 +989,9 @@ void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uin
             *clip_pkt = clip->start_pkt;
         }
     }
-    *out_pkt = clip->title_pkt + *clip_pkt - clip->start_pkt;
+    if (out_pkt) {
+        *out_pkt = clip->title_pkt + *clip_pkt - clip->start_pkt;
+    }
 }
 
 /*
@@ -1044,3 +1048,13 @@ NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
     return clip;
 }
 
+char *nav_clip_textst_font(NAV_CLIP *clip, int index)
+{
+    char *file;
+
+    if (index < 0 || index >= clip->cl->clip.font_info.font_count)
+        return NULL;
+
+    file = str_printf("%s.otf", clip->cl->clip.font_info.font[index].file_id);
+    return file;
+}


=====================================
src/libbluray/bdnav/navigation.h
=====================================
@@ -23,9 +23,11 @@
 #include "util/attributes.h"
 
 #include "mpls_data.h"
-#include "clpi_data.h"
+
+#include <stdint.h>
 
 struct bd_disc;
+struct clpi_cl;
 
 #define CONNECT_NON_SEAMLESS 0
 #define CONNECT_SEAMLESS 1
@@ -81,9 +83,9 @@ struct nav_clip_s
 
     NAV_TITLE *title;
 
-    CLPI_CL  *cl;
-
     uint32_t stc_spn;  /* start packet of clip STC sequence */
+
+    struct clpi_cl *cl;
 };
 
 typedef struct nav_clip_list_s NAV_CLIP_LIST;
@@ -154,4 +156,6 @@ BD_PRIVATE NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned an
 BD_PRIVATE NAV_TITLE_LIST* nav_get_title_list(struct bd_disc *disc, uint32_t flags, uint32_t min_title_length) BD_ATTR_MALLOC;
 BD_PRIVATE void nav_free_title_list(NAV_TITLE_LIST **title_list);
 
+BD_PRIVATE char *nav_clip_textst_font(NAV_CLIP *clip, int index);
+
 #endif // _NAVIGATION_H_


=====================================
src/libbluray/bluray.c
=====================================
@@ -39,7 +39,6 @@
 #include "bdnav/index_parse.h"
 #include "bdnav/meta_parse.h"
 #include "bdnav/meta_data.h"
-#include "bdnav/clpi_parse.h"
 #include "bdnav/sound_parse.h"
 #include "bdnav/uo_mask.h"
 #include "hdmv/hdmv_vm.h"
@@ -488,8 +487,8 @@ static void _update_textst_timer(BLURAY *bd)
                 /* find event position in main path clip */
                 NAV_CLIP *clip = bd->st0.clip;
                 if (clip->cl) {
-                    uint32_t spn = clpi_lookup_spn(clip->cl, cmds.wakeup_time, /*before=*/1,
-                                                   bd->title->pl->play_item[clip->ref].clip[clip->angle].stc_id);
+                    uint32_t spn;
+                    nav_clip_time_search(clip, cmds.wakeup_time, &spn, NULL);
                     if (spn) {
                         bd->gc_wakeup_pos = (uint64_t)spn * 192L;
                   }
@@ -502,8 +501,8 @@ static void _update_textst_timer(BLURAY *bd)
 static void _init_textst_timer(BLURAY *bd)
 {
     if (bd->st_textst.clip && bd->st0.clip->cl) {
-        uint32_t clip_time;
-        clpi_access_point(bd->st0.clip->cl, SPN(bd->st0.clip_block_pos), /*next=*/0, /*angle_change=*/0, &clip_time);
+        uint32_t clip_time, clip_pkt;
+        nav_clip_packet_search(bd->st0.clip, SPN(bd->st0.clip_block_pos), &clip_pkt, &clip_time);
         bd->gc_wakeup_time = clip_time;
         bd->gc_wakeup_pos = 0;
         _update_textst_timer(bd);
@@ -2089,6 +2088,7 @@ static int _preload_textst_subpath(BLURAY *bd)
     unsigned       textst_subclip = 0;
     uint16_t       textst_pid     = 0;
     unsigned       ii;
+    char          *font_file;
 
     if (!bd->graphics_controller) {
         return 0;
@@ -2130,18 +2130,16 @@ static int _preload_textst_subpath(BLURAY *bd)
     gc_decode_ts(bd->graphics_controller, 0x1800, bd->st_textst.buf, SPN(bd->st_textst.clip_size) / 32, -1);
 
     /* set fonts and encoding from clip info */
-    gc_add_font(bd->graphics_controller, NULL, -1);
-    for (ii = 0; ii < bd->st_textst.clip->cl->clip.font_info.font_count; ii++) {
-        char *file = str_printf("%s.otf", bd->st_textst.clip->cl->clip.font_info.font[ii].file_id);
-        if (file) {
-            uint8_t *data = NULL;
-            size_t size = disc_read_file(bd->disc, "BDMV" DIR_SEP "AUXDATA", file, &data);
-            if (data && size > 0 && gc_add_font(bd->graphics_controller, data, size) < 0) {
-                X_FREE(data);
-            }
-            X_FREE(file);
+    gc_add_font(bd->graphics_controller, NULL, -1); /* reset fonts */
+    for (ii = 0; NULL != (font_file = nav_clip_textst_font(bd->st_textst.clip, ii)); ii++) {
+        uint8_t *data = NULL;
+        size_t size = disc_read_file(bd->disc, "BDMV" DIR_SEP "AUXDATA", font_file, &data);
+        if (data && size > 0 && gc_add_font(bd->graphics_controller, data, size) < 0) {
+            X_FREE(data);
         }
+        X_FREE(font_file);
     }
+
     gc_run(bd->graphics_controller, GC_CTRL_PG_CHARCODE, char_code, NULL);
 
     /* start presentation timer */
@@ -3773,6 +3771,7 @@ int bd_get_meta_file(BLURAY *bd, const char *name, void **data, int64_t *size)
  * Database access
  */
 
+#include "bdnav/clpi_parse.h"
 #include "bdnav/mpls_parse.h"
 
 struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref)



View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/08841d104215482bd0329ba4e88c9f30abcd1045...64e2488634232e5ec5e896d77fbf114b3eca9e69

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/08841d104215482bd0329ba4e88c9f30abcd1045...64e2488634232e5ec5e896d77fbf114b3eca9e69
You're receiving this email because of your account on code.videolan.org.


More information about the libbluray-devel mailing list