[libbluray-devel] clpi_data: move font_info

hpi1 git at videolan.org
Tue Feb 21 22:20:15 CET 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Feb 21 23:08:17 2017 +0200| [43997ddd0f435d4723e996b943c809c71bc4495f] | committer: hpi1

clpi_data: move font_info

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

 src/devtools/clpi_dump.c         |  6 +++---
 src/libbluray/bdnav/clpi_data.h  |  8 +-------
 src/libbluray/bdnav/clpi_parse.c | 28 +++++++++++++++-------------
 src/libbluray/bluray.c           |  4 ++--
 4 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/src/devtools/clpi_dump.c b/src/devtools/clpi_dump.c
index bd64783..da412e9 100644
--- a/src/devtools/clpi_dump.c
+++ b/src/devtools/clpi_dump.c
@@ -220,10 +220,10 @@ _show_clip_info(CLPI_CL *cl, int level)
         indent_printf(level+2, "File Code %s", ci->atc_delta[ii].file_code);
     }
     // show fonts
-    if (cl->font_info.font_count) {
+    if (cl->clip.font_info.font_count) {
         indent_printf(level+1, "Font files");
-        for (ii = 0; ii < cl->font_info.font_count; ii++) {
-            indent_printf(level+2, "Font file %d: %s.otf", ii+1, cl->font_info.font[ii].file_id);
+        for (ii = 0; ii < cl->clip.font_info.font_count; ii++) {
+            indent_printf(level+2, "Font file %d: %s.otf", ii+1, cl->clip.font_info.font[ii].file_id);
         }
     }
 
diff --git a/src/libbluray/bdnav/clpi_data.h b/src/libbluray/bdnav/clpi_data.h
index 8d50956..f82345b 100644
--- a/src/libbluray/bdnav/clpi_data.h
+++ b/src/libbluray/bdnav/clpi_data.h
@@ -77,10 +77,7 @@ typedef struct
     CLPI_TS_TYPE      ts_type_info;
     uint8_t           atc_delta_count;
     CLPI_ATC_DELTA   *atc_delta;
-
-    /* breaks ABI if added here ...
-    CLPI_FONT_INFO    font_info;
-    */
+    CLPI_FONT_INFO    font_info;      /* Text subtitle stream font files */
 } CLPI_CLIP_INFO;
 
 typedef struct
@@ -169,9 +166,6 @@ typedef struct clpi_cl {
     CLPI_EXTENT_START extent_start; /* extent start points (.ssif interleaving) */
     CLPI_PROG_INFO    program_ss;
     CLPI_CPI          cpi_ss;
-
-    /* Text subtitle stream font files */
-    CLPI_FONT_INFO    font_info;
 } CLPI_CL;
 
 #endif // _CLPI_DATA_H_
diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c
index cb19194..34c1dec 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -210,16 +210,17 @@ _parse_clipinfo(BITSTREAM *bits, CLPI_CL *cl)
 
     // font info
     if (cl->clip.application_type == 6 /* Sub TS for a sub-path of Text subtitle */) {
+        CLPI_FONT_INFO *fi = &cl->clip.font_info;
         bs_skip(bits, 8);
-        cl->font_info.font_count = bs_read(bits, 8);
-        if (cl->font_info.font_count) {
-            cl->font_info.font = malloc(cl->font_info.font_count * sizeof(CLPI_FONT));
-            if (!cl->font_info.font) {
+        fi->font_count = bs_read(bits, 8);
+        if (fi->font_count) {
+            fi->font = malloc(fi->font_count * sizeof(CLPI_FONT));
+            if (!fi->font) {
                 BD_DEBUG(DBG_CRIT, "out of memory\n");
                 return 0;
             }
-            for (ii = 0; ii < cl->font_info.font_count; ii++) {
-                bs_read_string(bits, cl->font_info.font[ii].file_id, 5);
+            for (ii = 0; ii < fi->font_count; ii++) {
+                bs_read_string(bits, fi->font[ii].file_id, 5);
                 bs_skip(bits, 8);
             }
         }
@@ -714,7 +715,10 @@ clpi_free(CLPI_CL *cl)
     if (cl == NULL) {
         return;
     }
+
     X_FREE(cl->clip.atc_delta);
+    X_FREE(cl->clip.font_info.font);
+
     if (cl->sequence.atc_seq) {
         for (ii = 0; ii < cl->sequence.num_atc_seq; ii++) {
             X_FREE(cl->sequence.atc_seq[ii].stc_seq);
@@ -731,8 +735,6 @@ clpi_free(CLPI_CL *cl)
     _clean_program(&cl->program_ss);
     _clean_cpi(&cl->cpi_ss);
 
-    X_FREE(cl->font_info.font);
-
     X_FREE(cl);
 }
 
@@ -941,13 +943,13 @@ clpi_copy(const CLPI_CL* src_cl)
             }
         }
 
-        dest_cl->font_info.font_count = src_cl->font_info.font_count;
-        if (dest_cl->font_info.font_count) {
-            dest_cl->font_info.font = malloc(dest_cl->font_info.font_count * sizeof(CLPI_FONT));
-            if (!dest_cl->font_info.font) {
+        dest_cl->clip.font_info.font_count = src_cl->clip.font_info.font_count;
+        if (dest_cl->clip.font_info.font_count) {
+            dest_cl->clip.font_info.font = malloc(dest_cl->clip.font_info.font_count * sizeof(CLPI_FONT));
+            if (!dest_cl->clip.font_info.font) {
                 goto fail;
             }
-            memcpy(dest_cl->font_info.font, src_cl->font_info.font, dest_cl->font_info.font_count * sizeof(CLPI_FONT));
+            memcpy(dest_cl->clip.font_info.font, src_cl->clip.font_info.font, dest_cl->clip.font_info.font_count * sizeof(CLPI_FONT));
         }
     }
 
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 590ef8c..03406a0 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2146,8 +2146,8 @@ static int _preload_textst_subpath(BLURAY *bd)
 
     /* set fonts and encoding from clip info */
     gc_add_font(bd->graphics_controller, NULL, -1);
-    for (ii = 0; ii < bd->st_textst.clip->cl->font_info.font_count; ii++) {
-        char *file = str_printf("%s.otf", bd->st_textst.clip->cl->font_info.font[ii].file_id);
+    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);



More information about the libbluray-devel mailing list