[libdvdnav-devel] [Git][videolan/libdvdread][master] 4 commits: nav_types: document the size of each (packed) structure
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Wed Dec 2 18:33:15 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
525184f0 by Steve Lhomme at 2026-12-02T19:31:21+01:00
nav_types: document the size of each (packed) structure
Some parts of the packed structures are not packed, so the size differ from a
packed version (in comment).
- - - - -
705b5efe by Steve Lhomme at 2026-12-02T19:31:21+01:00
nav_read: use the defines to check the (packed) structure sizes
Some of them are not packed (and using unpacked structures). So these
sizes are the sizes the compiler decides. Luckily they match on all platforms.
- - - - -
03d0b630 by Steve Lhomme at 2026-12-02T19:31:21+01:00
nav_types: document the estimated size of each non-packed structure
- - - - -
9fb07c19 by Steve Lhomme at 2026-12-02T19:31:21+01:00
nav_read: use the defines to check estimated unpacked structure sizes
- - - - -
2 changed files:
- src/dvdread/nav_types.h
- src/nav_read.c
Changes:
=====================================
src/dvdread/nav_types.h
=====================================
@@ -61,6 +61,7 @@ typedef struct {
dvd_time_t e_eltm; /**< Cell elapsed time */
char vobu_isrc[32];
} ATTRIBUTE_PACKED pci_gi_t;
+#define PGI_GI_DATA_SIZE 60U
/**
* Non Seamless Angle Information
@@ -68,6 +69,7 @@ typedef struct {
typedef struct {
uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */
} ATTRIBUTE_PACKED nsml_agli_t;
+#define NSML_AGLI_DATA_SIZE 36U
/**
* Highlight General Information
@@ -98,6 +100,7 @@ typedef struct {
uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */
uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */
} ATTRIBUTE_PACKED hl_gi_t;
+#define HL_GI_DATA_SIZE 22U
/**
@@ -111,6 +114,7 @@ typedef struct {
typedef struct {
uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */
} ATTRIBUTE_PACKED btn_colit_t;
+#define BTN_COLIT_DATA_SIZE 24U
/* btni_t, hli_t and pci_t are not read as packed structures but bit by bit
* in navRead_PCI(), they must not be packed */
@@ -146,6 +150,7 @@ typedef struct {
unsigned int right : 6; /**< button index when pressing right */
vm_cmd_t cmd;
} btni_t;
+#define BTNI_DATA_SIZE 20U // packed: 18
/**
* Highlight Information
@@ -155,6 +160,7 @@ typedef struct {
btn_colit_t btn_colit;
btni_t btnit[36];
} hli_t;
+#define HLI_DATA_SIZE 768U // packed: 694
/**
* PCI packet
@@ -165,6 +171,7 @@ typedef struct {
hli_t hli;
uint8_t zero1[189];
} pci_t;
+#define PCI_DATA_SIZE 1056U // packed: 979
#if PRAGMA_PACK
#pragma pack(push, 1)
@@ -188,6 +195,7 @@ typedef struct {
uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */
dvd_time_t c_eltm; /**< Cell elapsed time */
} ATTRIBUTE_PACKED dsi_gi_t;
+#define DSI_GI_DATA_SIZE 32U
/**
* Seamless Playback Information
@@ -206,6 +214,7 @@ typedef struct {
uint32_t gap_len2;
} vob_a[8];
} ATTRIBUTE_PACKED sml_pbi_t;
+#define SML_PBI_DATA_SIZE 148U
/**
* Seamless Angle Information for one angle
@@ -214,6 +223,7 @@ typedef struct {
uint32_t address; /**< offset to next ILVU, high bit is before/after */
uint16_t size; /**< byte size of the ILVU pointed to by address */
} ATTRIBUTE_PACKED sml_agl_data_t;
+#define SML_AGL_DATA_SIZE 6U
/**
* Seamless Angle Information
@@ -221,6 +231,7 @@ typedef struct {
typedef struct {
sml_agl_data_t data[9];
} ATTRIBUTE_PACKED sml_agli_t;
+#define SML_AGLI_DATA_SIZE 54U
/**
* VOBU Search Information
@@ -233,6 +244,7 @@ typedef struct {
uint32_t bwda[19]; /**< Backwards, time */
uint32_t prev_video;
} ATTRIBUTE_PACKED vobu_sri_t;
+#define VOBU_SRI_DATA_SIZE 168U
#define SRI_END_OF_CELL 0x3fffffff
@@ -243,6 +255,7 @@ typedef struct {
uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */
uint32_t sp_synca[32]; /**< offset to first subpicture packet */
} ATTRIBUTE_PACKED synci_t;
+#define SYNCI_DATA_SIZE 144U
/**
* DSI packet
@@ -255,6 +268,7 @@ typedef struct {
synci_t synci;
uint8_t zero1[471];
} ATTRIBUTE_PACKED dsi_t;
+#define DSI_DATA_SIZE 1017U
#if PRAGMA_PACK
=====================================
src/nav_read.c
=====================================
@@ -43,20 +43,20 @@
#define CHECK_NAV_STRUCT_SIZE(strt, size) \
static_assert(sizeof(strt) == size, STRINGIFY_NAME(strt) " not " STRINGIFY_NAME(size) " bytes")
-CHECK_NAV_STRUCT_SIZE(pci_gi_t, 60);
-CHECK_NAV_STRUCT_SIZE(nsml_agli_t, 36);
-CHECK_NAV_STRUCT_SIZE(hl_gi_t, 22);
-CHECK_NAV_STRUCT_SIZE(btn_colit_t, 24);
-CHECK_NAV_STRUCT_SIZE(btni_t, 20);
-CHECK_NAV_STRUCT_SIZE(hli_t, 768);
-CHECK_NAV_STRUCT_SIZE(pci_t, 1056);
-CHECK_NAV_STRUCT_SIZE(dsi_gi_t, 32);
-CHECK_NAV_STRUCT_SIZE(sml_pbi_t, 148);
-CHECK_NAV_STRUCT_SIZE(sml_agl_data_t, 6);
-CHECK_NAV_STRUCT_SIZE(sml_agli_t, 54);
-CHECK_NAV_STRUCT_SIZE(vobu_sri_t, 168);
-CHECK_NAV_STRUCT_SIZE(synci_t, 144);
-CHECK_NAV_STRUCT_SIZE(dsi_t, 1017);
+CHECK_NAV_STRUCT_SIZE(pci_gi_t, PGI_GI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(nsml_agli_t, NSML_AGLI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(hl_gi_t, HL_GI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(btn_colit_t, BTN_COLIT_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(btni_t, BTNI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(hli_t, HLI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(pci_t, PCI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(dsi_gi_t, DSI_GI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(sml_pbi_t, SML_PBI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(sml_agl_data_t, SML_AGL_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(sml_agli_t, SML_AGLI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(vobu_sri_t, VOBU_SRI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(synci_t, SYNCI_DATA_SIZE);
+CHECK_NAV_STRUCT_SIZE(dsi_t, DSI_DATA_SIZE);
#define CHECK_VALUE(arg)\
if(!(arg)) {\
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/925cbd346e95bc977dd6278b47decd27fe591e61...9fb07c19b1f6737a8f127fe55ddda2ecf14f6363
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/925cbd346e95bc977dd6278b47decd27fe591e61...9fb07c19b1f6737a8f127fe55ddda2ecf14f6363
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the libdvdnav-devel
mailing list