[DVDnav-discuss] Using libdvdnav on ARM Based NAS

Erik Hovland erik at hovland.org
Wed Dec 10 04:34:05 CET 2008


> I have figured it out.  It was a memory alignment issue, but not one I
> expected.  In ifo_types.h, structure audio_attr_t, when checking a sizeof on
> the structure on my PC, it returned a size of 8, which I expected.  When I
> read the sizeof this structure on my ARM NAS, it returned a size of 11.
> This would account for the zero check fail errors because the 3 bytes of
> extra padding was added to the each instantiated structure. Here is the
> structure from 4.1.3:
>
> typedef struct {
>  unsigned char audio_format           : 3;
>  unsigned char multichannel_extension : 1;
>  unsigned char lang_type              : 2;
>  unsigned char application_mode       : 2;
>
>  unsigned char quantization           : 2;
>  unsigned char sample_frequency       : 2;
>  unsigned char unknown1               : 1;
>  unsigned char channels               : 3;
>  uint16_t lang_code;
>  uint8_t  lang_extension;
>  uint8_t  code_extension;
>  uint8_t unknown3;
>  union {
>    struct ATTRIBUTE_PACKED {
>      unsigned char unknown4           : 1;
>      unsigned char channel_assignment : 3;
>      unsigned char version            : 2;
>      unsigned char mc_intro           : 1; /* probably 0: true, 1:false */
>      unsigned char mode               : 1; /* Karaoke mode 0: solo 1: duet
> */
>    } karaoke;
>    struct ATTRIBUTE_PACKED {
>      unsigned char unknown5           : 4;
>      unsigned char dolby_encoded      : 1; /* suitable for surround
> decoding */
>      unsigned char unknown6           : 3;
>    } surround;
>  } app_info;
> } ATTRIBUTE_PACKED audio_attr_t;
>
> I saw that there was no ATTRIBUTE__PACKED on the app_info union and when I
> added this to line 123, the size of the structure was read as 8 on my NAS.
> I simply changed " } app_info;" to "} ATTRIBUTE_PACKED app_info;"  I then
> recompiled and ran the menus examples in libdvdnav and I saw no zero check
> errors.  Just for completeless, I read the size of the structure on my PC
> with the change and it remained as 8, so it seems to have no effect when
> running on x86.

Attached is the proposed fix in patch form. To help w/ the application
of the change.

E

-- 
Erik Hovland
erik at hovland.org
http://hovland.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pack-app_info-in-audio_attr_t.patch
Type: text/x-diff
Size: 587 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/attachments/20081209/34a81ca3/attachment.patch>


More information about the DVDnav-discuss mailing list