[libbluray-devel] Add UDF volume identifier to DISC_INFO

hpi1 git at videolan.org
Tue Feb 10 12:15:31 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Feb 10 13:10:04 2015 +0200| [ce45fc9df574faf90aff991ed0bbdad70436f5e5] | committer: hpi1

Add UDF volume identifier to DISC_INFO

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

 ChangeLog                   |    1 +
 src/examples/bd_info.c      |    3 +++
 src/libbluray/bluray.c      |    2 ++
 src/libbluray/bluray.h      |    1 +
 src/libbluray/disc/disc.c   |   11 ++++++++++-
 src/libbluray/disc/disc.h   |    3 +++
 src/libbluray/disc/udf_fs.c |    5 +++++
 src/libbluray/disc/udf_fs.h |    1 +
 8 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e6f9c5a..7a42e91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 - Add support for UDF image files and unmounted discs
+- Add UDF volume identifier to DISC_INFO
 - Fix infinite loop with some broken HDMV menus
 
 2015-01-26: Version 0.7.0
diff --git a/src/examples/bd_info.c b/src/examples/bd_info.c
index 3e4eca6..093ab22 100644
--- a/src/examples/bd_info.c
+++ b/src/examples/bd_info.c
@@ -167,6 +167,9 @@ int main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
+    if (info->udf_volume_id) {
+        printf("Volume Identifier   : %s\n", info->udf_volume_id);
+    }
     printf("BluRay detected     : %s\n", _yes_no(info->bluray_detected));
     if (info->bluray_detected) {
         printf("First Play supported: %s\n", _yes_no(info->first_play_supported));
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 37cb198..a868a73 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -836,6 +836,8 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
     bd->disc_info.bdplus_gen         = enc_info->bdplus_gen;
     bd->disc_info.bdplus_date        = enc_info->bdplus_date;
 
+    bd->disc_info.udf_volume_id      = disc_volume_id(bd->disc);
+
     bd->disc_info.bluray_detected        = 0;
     bd->disc_info.top_menu_supported     = 0;
     bd->disc_info.first_play_supported   = 0;
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 69fd70b..7065e71 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -118,6 +118,7 @@ typedef struct {
     char bdj_org_id[9];      /* (BD-J) disc organization ID */
     char bdj_disc_id[33];    /* (BD-J) disc ID */
 
+    const char *udf_volume_id; /* optional UDF volume identifier */
 } BLURAY_DISC_INFO;
 
 /*
diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c
index d4cfed9..082f23d 100644
--- a/src/libbluray/disc/disc.c
+++ b/src/libbluray/disc/disc.c
@@ -51,6 +51,8 @@ struct bd_disc {
     BD_FILE_H * (*pf_file_open_bdrom)(void *, const char *);
     BD_DIR_H *  (*pf_dir_open_bdrom)(void *, const char *);
     void        (*pf_fs_close)(void *);
+
+    const char   *udf_volid;
 };
 
 /*
@@ -241,6 +243,8 @@ BD_DISC *disc_open(const char *device_path,
                 p->pf_file_open_bdrom = udf_file_open;
                 p->pf_dir_open_bdrom  = udf_dir_open;
 
+                p->udf_volid = udf_volume_id(udf);
+
                 /* root not accessible with stdio */
                 X_FREE(p->disc_root);
             }
@@ -280,11 +284,16 @@ void disc_close(BD_DISC **pp)
  *
  */
 
-BD_PRIVATE const char *disc_root(BD_DISC *p)
+const char *disc_root(BD_DISC *p)
 {
     return p->disc_root;
 }
 
+const char *disc_volume_id(BD_DISC *p)
+{
+    return p ? p->udf_volid : NULL;
+}
+
 /*
  * VFS
  */
diff --git a/src/libbluray/disc/disc.h b/src/libbluray/disc/disc.h
index 68ede26..78231e0 100644
--- a/src/libbluray/disc/disc.h
+++ b/src/libbluray/disc/disc.h
@@ -46,6 +46,9 @@ BD_PRIVATE void     disc_close(BD_DISC **);
 /* Get BD-ROM root path */
 BD_PRIVATE const char *disc_root(BD_DISC *disc);
 
+/* Get UDF volume ID */
+BD_PRIVATE const char *disc_volume_id(BD_DISC *);
+
 /* Open VFS file (relative to disc root) */
 BD_PRIVATE struct bd_file_s *disc_open_file(BD_DISC *disc, const char *dir, const char *file);
 BD_PRIVATE struct bd_file_s *disc_open_path(BD_DISC *disc, const char *path);
diff --git a/src/libbluray/disc/udf_fs.c b/src/libbluray/disc/udf_fs.c
index c99d648..6d5f25b 100644
--- a/src/libbluray/disc/udf_fs.c
+++ b/src/libbluray/disc/udf_fs.c
@@ -218,6 +218,11 @@ void *udf_image_open(const char *img_path)
     return (void*)udf;
 }
 
+const char *udf_volume_id(void *udf)
+{
+    return udfread_get_volume_id(udf);
+}
+
 void udf_image_close(void *udf)
 {
     udfread_close(udf);
diff --git a/src/libbluray/disc/udf_fs.h b/src/libbluray/disc/udf_fs.h
index 1b75ab2..4b40a27 100644
--- a/src/libbluray/disc/udf_fs.h
+++ b/src/libbluray/disc/udf_fs.h
@@ -28,6 +28,7 @@ struct bd_dir_s;
 BD_PRIVATE void *udf_image_open(const char *img_path);
 BD_PRIVATE void  udf_image_close(void *udf);
 
+BD_PRIVATE const char       *udf_volume_id(void *udf);
 BD_PRIVATE struct bd_file_s *udf_file_open(void *udf, const char *filename);
 BD_PRIVATE struct bd_dir_s  *udf_dir_open(void *udf, const char* dirname);
 



More information about the libbluray-devel mailing list