[libbluray-devel] [Git][videolan/libbluray][master] 5 commits: mpls_dump: show mark types in text

Petri Hintukainen gitlab at videolan.org
Tue Jul 2 10:55:51 CEST 2019



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
18a883e3 by hpi1 at 2019-07-01T17:38:39Z
mpls_dump: show mark types in text

- - - - -
21f15d2f by hpi1 at 2019-07-02T08:19:07Z
Fix clipping floats

- - - - -
829e0c49 by hpi1 at 2019-07-02T08:21:14Z
Check for NULL

- - - - -
e555789f by hpi1 at 2019-07-02T08:26:07Z
Improve dir_open() logging

- - - - -
8c620f15 by hpi1 at 2019-07-02T08:51:48Z
Add missing const

- - - - -


7 changed files:

- src/devtools/mpls_dump.c
- src/examples/bd_info.c
- src/file/dir_posix.c
- src/file/dir_win32.c
- src/libbluray/bdj/java/org/videolan/media/content/control/GainControlImpl.java
- src/libbluray/bdj/java/org/videolan/media/content/control/PanningControlImpl.java
- src/libbluray/disc/disc.c


Changes:

=====================================
src/devtools/mpls_dump.c
=====================================
@@ -68,6 +68,11 @@ const VALUE_MAP connection_type_map[] = {
   {0, NULL}
 };
 
+const VALUE_MAP mark_type_map[] = {
+  {BLURAY_MARK_ENTRY, "Entry (chapter)"},
+  {BLURAY_MARK_LINK,  "Link"},
+  {0, NULL}
+};
 
 static char *
 _mk_path(const char *base, const char *sub)
@@ -251,7 +256,9 @@ _show_marks(MPLS_PL *pl, int level)
 
         plm = &pl->play_mark[ii];
         indent_printf(level, "PlayMark %d", ii);
-        indent_printf(level+1, "Type: %02x", plm->mark_type);
+        indent_printf(level+1, "Type: %s (%02x)",
+                      _lookup_str(mark_type_map, plm->mark_type),
+                      plm->mark_type);
         if (plm->play_item_ref < pl->list_count) {
             pi = &pl->play_item[plm->play_item_ref];
             indent_printf(level+1, "PlayItem: %s", pi->clip[0].clip_id);


=====================================
src/examples/bd_info.c
=====================================
@@ -52,6 +52,8 @@ static const char *_hex2str(const uint8_t *data, size_t len)
     size_t i;
 
     str = (char*)realloc(str, 2*len + 1);
+    if (!str)
+        return "";
     *str = 0;
 
     for (i = 0; i < len; i++) {


=====================================
src/file/dir_posix.c
=====================================
@@ -94,7 +94,6 @@ static BD_DIR_H *_dir_open_posix(const char* dirname)
 {
     BD_DIR_H *dir = calloc(1, sizeof(BD_DIR_H));
 
-    BD_DEBUG(DBG_DIR, "Opening POSIX dir %s... (%p)\n", dirname, (void*)dir);
     if (!dir) {
         return NULL;
     }
@@ -103,10 +102,11 @@ static BD_DIR_H *_dir_open_posix(const char* dirname)
     dir->read = _dir_read_posix;
 
     if ((dir->internal = opendir(dirname))) {
+        BD_DEBUG(DBG_DIR, "Opened POSIX dir %s (%p)\n", dirname, (void*)dir);
         return dir;
     }
 
-    BD_DEBUG(DBG_DIR, "Error opening dir! (%p)\n", (void*)dir);
+    BD_DEBUG(DBG_DIR, "Error opening dir %s\n", dirname);
 
     X_FREE(dir);
 


=====================================
src/file/dir_win32.c
=====================================
@@ -108,14 +108,13 @@ static BD_DIR_H *_dir_open_win32(const char* dirname)
     BD_DIR_H *dir = calloc(1, sizeof(BD_DIR_H));
     dir_data_t *priv = NULL;
 
-    BD_DEBUG(DBG_DIR, "Opening WIN32 dir %s... (%p)\n", dirname, (void*)dir);
-
     if (!dir) {
         return NULL;
     }
 
     priv = _open_impl(dirname);
     if (priv) {
+        BD_DEBUG(DBG_DIR, "Opened WIN32 dir %s (%p)\n", dirname, (void*)dir);
         dir->close = _dir_close_win32;
         dir->read = _dir_read_win32;
         dir->internal = priv;


=====================================
src/libbluray/bdj/java/org/videolan/media/content/control/GainControlImpl.java
=====================================
@@ -43,7 +43,7 @@ abstract class GainControlImpl {
     }
 
     public float setDB(float gain) {
-        this.level = Math.max(1.0f, Math.min(0.0f, (float)Math.pow(10.0f, gain / 10.0f)));
+        this.level = Math.max(0.0f, Math.min(1.0f, (float)Math.pow(10.0f, gain / 10.0f)));
         this.gain = gain;
         setGain(this.mute, this.level);
         return this.gain;
@@ -54,7 +54,7 @@ abstract class GainControlImpl {
     }
 
     public float setLevel(float level) {
-        this.level = Math.max(1.0f, Math.min(0.0f, level));
+        this.level = Math.max(0.0f, Math.min(1.0f, level));
         this.gain = 10.0f * (float)(Math.log(this.level) / Math.log(10.0f));
 
         setGain(this.mute, this.level);


=====================================
src/libbluray/bdj/java/org/videolan/media/content/control/PanningControlImpl.java
=====================================
@@ -77,7 +77,7 @@ public class PanningControlImpl implements PanningControl {
     private float clip(float val) {
         if (val != val) /* NaN */
             return 0.0f;
-        return Math.min(-1.0f, Math.max(1.0f, val));
+        return Math.max(-1.0f, Math.min(1.0f, val));
     }
 
     private BDHandler player;


=====================================
src/libbluray/disc/disc.c
=====================================
@@ -582,7 +582,7 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
 BD_FILE_H *disc_open_path_dec(BD_DISC *p, const char *rel_path)
 {
     size_t size = strlen(rel_path);
-    char *suf = (size > 5) ? rel_path + (size - 5) : rel_path;
+    const char *suf = (size > 5) ? rel_path + (size - 5) : rel_path;
 
     /* check if it's a stream */
     if (strncmp(rel_path, "BDMV" DIR_SEP "STREAM", 11)) { // not equal



View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/4a0c87e530bf22e9b960deac6eb1523c47fdb130...8c620f1525ddc228ef91e3407f01f2dc868c7110

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/4a0c87e530bf22e9b960deac6eb1523c47fdb130...8c620f1525ddc228ef91e3407f01f2dc868c7110
You're receiving this email because of your account on code.videolan.org.



More information about the libbluray-devel mailing list