[libdvdnav-devel] [Git][videolan/libdvdnav][master] 2 commits: add dvdnav_get_volid_string

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Jun 8 13:58:26 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdnav


Commits:
f5a17889 by Miguel Borges de Freitas at 2022-06-08T14:55:37+01:00
add dvdnav_get_volid_string

- - - - -
35bd5143 by Miguel Borges de Freitas at 2022-06-08T14:55:41+01:00
Update NEWS with dvdnav_get_volid_string addition

- - - - -


3 changed files:

- ChangeLog
- src/dvdnav.c
- src/dvdnav/dvdnav.h


Changes:

=====================================
ChangeLog
=====================================
@@ -1,4 +1,5 @@
 libdvdnav (next)
+ * add dvdnav_get_volid_string to obtain the volume id of the disc
  * add dvdnav_get_number_of_streams API to list tracks
  * add dvdnav_set_active_stream API to activate a stream
  * add dvdnav_toggle_spu_stream API to enable/disable the current SPU stream


=====================================
src/dvdnav.c
=====================================
@@ -955,6 +955,28 @@ dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *this, const char **serial_str
   return DVDNAV_STATUS_OK;
 }
 
+const char * dvdnav_get_volid_string(dvdnav_t *this) {
+  if (!this || !this->vm || !this->vm->dvd) {
+    printerr("Invalid state, vm or reader not available.");
+    return NULL;
+  }
+
+  char *volid_str = malloc(33);
+  if (volid_str == NULL) {
+    printerr("Insufficient memory available.");
+    return NULL;
+  }
+
+  if (DVDUDFVolumeInfo(this->vm->dvd, volid_str, 32, NULL, 0) == -1) {
+    if (DVDISOVolumeInfo(this->vm->dvd, volid_str, 33, NULL, 0) == -1) {
+      printerr("Failed to obtain volume id.");
+      free(volid_str);
+      return NULL;
+    }
+  }
+  return volid_str;
+}
+
 uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
   uint8_t         retval;
 


=====================================
src/dvdnav/dvdnav.h
=====================================
@@ -588,7 +588,7 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self,
  * this is a descriptive string such as `THE_MATRIX' but sometimes is singularly
  * uninformative such as `PDVD-011421'. Some DVD authors even forget to set this,
  * so you may also read the default of the authoring software they used, like
- * `DVDVolume'.
+ * `DVDVolume' (see also dvdnav_get_volid_string).
  */
 dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str);
 
@@ -599,6 +599,19 @@ dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str);
  */
 dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *self, const char **serial_str);
 
+/*
+ * Returns the VolumeIdentifier of the disc or NULL if it could
+ * not be obtained. The VolumeIdentifier might be latin-1 encoded
+ * (8bit unicode) null terminated and max 32 bytes (including '\0');
+ * or coded with '0-9','A-Z','_' null terminated and max 33 bytes
+ * (including '\0').
+ * See also dvdnav_get_title_string
+ *
+ * Note: The string is malloc'd so caller has to free() the returned
+ * string when done with it.
+ */
+const char * dvdnav_get_volid_string(dvdnav_t *self);
+
 /*
  * Get video aspect code.
  * The aspect code does only change on VTS boundaries.



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/compare/6995b0bec10c39f6efdf7def4b81f559b245c231...35bd5143663fe46abfebaf5759ad64791da044f8

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/compare/6995b0bec10c39f6efdf7def4b81f559b245c231...35bd5143663fe46abfebaf5759ad64791da044f8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdnav-devel mailing list