[libbluray-devel] Handle Volume Descriptor Pointer

Petri Hintukainen git at videolan.org
Sun Jun 18 20:26:34 CEST 2017


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Jun 14 23:32:11 2017 +0300| [2e4197e66bf2f06f8aad8f9e5e711e6c8e4078b2] | committer: Petri Hintukainen

Handle Volume Descriptor Pointer

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=2e4197e66bf2f06f8aad8f9e5e711e6c8e4078b2
---

 ChangeLog     |  1 +
 src/ecma167.c |  8 +++++++-
 src/ecma167.h |  9 +++++++++
 src/udfread.c | 13 +++++++++++--
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4e8e46..e8352ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 ????-??-??:  Version ?.?.?
 - Fix possible memory corruption with inline files.
 - Improve error resilience and stability.
+- Add support for Volume Descriptor Pointer.
 
 2017-06-07: Version 1.0.0
 
diff --git a/src/ecma167.c b/src/ecma167.c
index 9cf0b3b..6c71158 100644
--- a/src/ecma167.c
+++ b/src/ecma167.c
@@ -106,7 +106,7 @@ void decode_primary_volume(const uint8_t *p, struct primary_volume_descriptor *p
     memcpy(pvd->volume_set_identifier, p + 72, 128);
 }
 
-/* Anchor Volume Description Pointer (ECMA 167 3/10.2) */
+/* Anchor Volume Descriptor Pointer (ECMA 167 3/10.2) */
 void decode_avdp(const uint8_t *p, struct anchor_volume_descriptor *avdp)
 {
     /* Main volume descriptor sequence extent */
@@ -116,6 +116,12 @@ void decode_avdp(const uint8_t *p, struct anchor_volume_descriptor *avdp)
     _decode_extent_ad(p + 24, &avdp->rvds);
 }
 
+/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
+void decode_vdp(const uint8_t *p, struct volume_descriptor_pointer *vdp)
+{
+    _decode_extent_ad(p + 20, &vdp->next_extent);
+}
+
 /* Partition Descriptor (ECMA 167 3/10.5) */
 void decode_partition(const uint8_t *p, struct partition_descriptor *pd)
 {
diff --git a/src/ecma167.h b/src/ecma167.h
index a38e97e..be56d8d 100644
--- a/src/ecma167.h
+++ b/src/ecma167.h
@@ -87,6 +87,7 @@ enum tag_identifier {
     /* ECMA 167, 3/7.2.1) */
     ECMA_PrimaryVolumeDescriptor              = 1,
     ECMA_AnchorVolumeDescriptorPointer        = 2,
+    ECMA_VolumeDescriptorPointer              = 3,
     ECMA_PartitionDescriptor                  = 5,
     ECMA_LogicalVolumeDescriptor              = 6,
     ECMA_TerminatingDescriptor                = 8,
@@ -122,6 +123,14 @@ struct anchor_volume_descriptor {
 
 void decode_avdp(const uint8_t *p, struct anchor_volume_descriptor *avdp);
 
+/* Volume Descriptor Pointer (ECMA 167, 3/10.3) */
+
+struct volume_descriptor_pointer {
+    struct extent_ad next_extent; /* Next Volume Descriptor Sequence Extent */
+};
+
+void decode_vdp(const uint8_t *p, struct volume_descriptor_pointer *vdp);
+
 /* Partition Descriptor (ECMA 167, 3/10.5) */
 
 struct partition_descriptor {
diff --git a/src/udfread.c b/src/udfread.c
index 834226d..4b49170 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -379,15 +379,19 @@ static int _search_vds(udfread_block_input *input, int part_number,
                        struct volume_descriptor_set *vds)
 
 {
+    struct volume_descriptor_pointer vdp;
     uint8_t  buf[UDF_BLOCK_SIZE];
     int      tag_id;
     uint32_t lba;
-    uint32_t end_lba = loc->lba + loc->length / UDF_BLOCK_SIZE;
+    uint32_t end_lba;
     int      have_part = 0, have_lvd = 0, have_pvd = 0;
 
+    memset(vds, 0, sizeof(*vds));
+
+next_extent:
     udf_trace("reading Volume Descriptor Sequence at lba %u, len %u bytes\n", loc->lba, loc->length);
 
-    memset(vds, 0, sizeof(*vds));
+    end_lba = loc->lba + loc->length / UDF_BLOCK_SIZE;
 
     /* parse Volume Descriptor Sequence */
     for (lba = loc->lba; lba < end_lba; lba++) {
@@ -396,6 +400,11 @@ static int _search_vds(udfread_block_input *input, int part_number,
 
         switch (tag_id) {
 
+        case ECMA_VolumeDescriptorPointer:
+            decode_vdp(buf, &vdp);
+            loc = &vdp.next_extent;
+            goto next_extent;
+
         case ECMA_PrimaryVolumeDescriptor:
             udf_log("Primary Volume Descriptor in lba %u\n", lba);
             decode_primary_volume(buf, &vds->pvd);



More information about the libbluray-devel mailing list