[libdvdnav-devel] Ifo_types.h patch

321eniluap 321eniluap at gmail.com
Tue Sep 30 14:46:16 CEST 2014


Hi,

This is a patch that fixes a bug I encountered working on an application
(k9copy)  that updates the Ifo files to create a modified version of the
original DVD.

Thanks.
pauline123

--- a/src/dvdread/ifo_types.h    2014-01-02 10:38:07.000000000 -0500
+++ b/dvdread/ifo_types.h    2014-09-30 07:58:24.225452605 -0400
@@ -77,6 +77,7 @@
  * Video Attributes.
  */
 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned char mpeg_version         : 2;
   unsigned char video_format         : 2;
   unsigned char display_aspect_ratio : 2;
@@ -90,12 +92,28 @@
   unsigned char picture_size         : 2;
   unsigned char letterboxed          : 1;
   unsigned char film_mode            : 1;
+#else
+  unsigned char permitted_df         : 2;
+  unsigned char display_aspect_ratio : 2;
+  unsigned char video_format         : 2;
+  unsigned char mpeg_version         : 2;
+
+  unsigned char film_mode            : 1;
+  unsigned char letterboxed          : 1;
+  unsigned char picture_size         : 2;
+
+  unsigned char bit_rate             : 1;
+  unsigned char unknown1             : 1;
+  unsigned char line21_cc_2          : 1;
+  unsigned char line21_cc_1          : 1;
+#endif

 } ATTRIBUTE_PACKED video_attr_t;

 /**
  * Audio Attributes.
  */
 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned char audio_format           : 3;
   unsigned char multichannel_extension : 1;
   unsigned char lang_type              : 2;
@@ -105,22 +126,48 @@
   unsigned char sample_frequency       : 2;
   unsigned char unknown1               : 1;
   unsigned char channels               : 3;
+#else
+  unsigned char application_mode       : 2;
+  unsigned char lang_type              : 2;
+  unsigned char multichannel_extension : 1;
+  unsigned char audio_format           : 3;
+
+  unsigned char channels               : 3;
+  unsigned char unknown1               : 1;
+  unsigned char sample_frequency       : 2;
+  unsigned char quantization           : 2;
+#endif
+
   uint16_t lang_code;
   uint8_t  lang_extension;
   uint8_t  code_extension;
   uint8_t unknown3;
   union {
     struct ATTRIBUTE_PACKED {
+#ifdef WORDS_BIGENDIAN
       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 */
+#else
+      unsigned char mode               : 1;
+      unsigned char mc_intro           : 1;
+      unsigned char version            : 2;
+      unsigned char channel_assignment : 3;
+      unsigned char unknown4           : 1;
+#endif
     } karaoke;
     struct ATTRIBUTE_PACKED {
+#ifdef WORDS_BIGENDIAN
       unsigned char unknown5           : 4;
       unsigned char dolby_encoded      : 1; /* suitable for surround
decoding */
       unsigned char unknown6           : 3;
+#else
+      unsigned char unknown6           : 3;
+      unsigned char dolby_encoded      : 1;
+      unsigned char unknown5           : 4;
+#endif
     } surround;
   } ATTRIBUTE_PACKED app_info;
 } ATTRIBUTE_PACKED audio_attr_t;
@@ -130,6 +177,7 @@
  * MultiChannel Extension
  */
 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned int zero1      : 7;
   unsigned int ach0_gme   : 1;

@@ -153,6 +201,32 @@
   unsigned int ach4_gv2e  : 1;
   unsigned int ach4_gmBe  : 1;
   unsigned int ach4_seBe  : 1;
+#else
+  unsigned int ach0_gme   : 1;
+  unsigned int zero1      : 7;
+
+  unsigned int ach1_gme   : 1;
+  unsigned int zero2      : 7;
+
+  unsigned int ach2_gm2e  : 1;
+  unsigned int ach2_gm1e  : 1;
+  unsigned int ach2_gv2e  : 1;
+  unsigned int ach2_gv1e  : 1;
+  unsigned int zero3      : 4;
+
+  unsigned int ach3_se2e  : 1;
+  unsigned int ach3_gmAe  : 1;
+  unsigned int ach3_gv2e  : 1;
+  unsigned int ach3_gv1e  : 1;
+  unsigned int zero4      : 4;
+
+  unsigned int ach4_seBe  : 1;
+  unsigned int ach4_gmBe  : 1;
+  unsigned int ach4_gv2e  : 1;
+  unsigned int ach4_gv1e  : 1;
+  unsigned int zero5      : 4;
+#endif
+
   uint8_t zero6[19];
 } ATTRIBUTE_PACKED multichannel_ext_t;

@@ -171,9 +245,15 @@
    * language: indicates language if type == 1
    * lang extension: if type == 1 contains the lang extension
    */
+#ifdef WORDS_BIGENDIAN
   unsigned char code_mode : 3;
   unsigned char zero1     : 3;
   unsigned char type      : 2;
+#else
+  unsigned char type      : 2;
+  unsigned char zero1     : 3;
+  unsigned char code_mode : 3;
+#endif
   uint8_t  zero2;
   uint16_t lang_code;
   uint8_t  lang_extension;
@@ -205,6 +285,7 @@
  * Cell Playback Information.
  */
 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned int block_mode       : 2;
   unsigned int block_type       : 2;
   unsigned int seamless_play    : 1;
@@ -215,6 +297,18 @@
   unsigned int playback_mode    : 1;  /**< When set, enter StillMode after
each VOBU */
   unsigned int restricted       : 1;  /**< ?? drop out of fastforward? */
   unsigned int unknown2         : 6;
+#else
+  unsigned int seamless_angle   : 1;
+  unsigned int stc_discontinuity: 1;
+  unsigned int interleaved      : 1;
+  unsigned int seamless_play    : 1;
+  unsigned int block_type       : 2;
+  unsigned int block_mode       : 2;
+
+  unsigned int unknown2         : 6;
+  unsigned int restricted       : 1;
+  unsigned int playback_mode    : 1;
+#endif
   uint8_t still_time;
   uint8_t cell_cmd_nr;
   dvd_time_t playback_time;
@@ -245,6 +339,7 @@
  * User Operations.
  */
 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned int zero                           : 7; /* 25-31 */
   unsigned int video_pres_mode_change         : 1; /* 24 */

@@ -274,6 +369,38 @@
   unsigned int title_play                     : 1;
   unsigned int chapter_search_or_play         : 1;
   unsigned int title_or_time_play             : 1; /* 0 */
+#else
+  unsigned int video_pres_mode_change         : 1; /* 24 */
+  unsigned int zero                           : 7; /* 25-31 */
+
+  unsigned int resume                         : 1; /* 16 */
+  unsigned int button_select_or_activate      : 1;
+  unsigned int still_off                      : 1;
+  unsigned int pause_on                       : 1;
+  unsigned int audio_stream_change            : 1;
+  unsigned int subpic_stream_change           : 1;
+  unsigned int angle_change                   : 1;
+  unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */
+
+  unsigned int forward_scan                   : 1; /* 8 */
+  unsigned int backward_scan                  : 1;
+  unsigned int title_menu_call                : 1;
+  unsigned int root_menu_call                 : 1;
+  unsigned int subpic_menu_call               : 1;
+  unsigned int audio_menu_call                : 1;
+  unsigned int angle_menu_call                : 1;
+  unsigned int chapter_menu_call              : 1; /* 15 */
+
+  unsigned int title_or_time_play             : 1; /* 0 */
+  unsigned int chapter_search_or_play         : 1;
+  unsigned int title_play                     : 1;
+  unsigned int stop                           : 1;
+  unsigned int go_up                          : 1;
+  unsigned int time_or_chapter_search         : 1;
+  unsigned int prev_or_top_pg_search          : 1;
+  unsigned int next_pg_search                 : 1; /* 7 */
+
+#endif
 } ATTRIBUTE_PACKED user_ops_t;

 /**
@@ -310,9 +437,15 @@
  */
 typedef struct {
   uint8_t  entry_id;
+#ifdef WORDS_BIGENDIAN
   unsigned int block_mode : 2;
   unsigned int block_type : 2;
   unsigned int unknown1   : 4;
+#else
+  unsigned int unknown1   : 4;
+  unsigned int block_type : 2;
+  unsigned int block_mode : 2;
+#endif
   uint16_t ptl_id_mask;
   uint32_t pgc_start_byte;
   pgc_t *pgc;
@@ -438,6 +571,7 @@
 } ATTRIBUTE_PACKED vmgi_mat_t;

 typedef struct {
+#ifdef WORDS_BIGENDIAN
   unsigned int zero_1                    : 1;
   unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc
title */
   unsigned int jlc_exists_in_cell_cmd    : 1;
@@ -446,6 +580,16 @@
   unsigned int jlc_exists_in_tt_dom      : 1;
   unsigned int chapter_search_or_play    : 1; /* UOP 1 */
   unsigned int title_or_time_play        : 1; /* UOP 0 */
+#else
+  unsigned int title_or_time_play        : 1;
+  unsigned int chapter_search_or_play    : 1;
+  unsigned int jlc_exists_in_tt_dom      : 1;
+  unsigned int jlc_exists_in_button_cmd  : 1;
+  unsigned int jlc_exists_in_prepost_cmd : 1;
+  unsigned int jlc_exists_in_cell_cmd    : 1;
+  unsigned int multi_or_random_pgc_title : 1;
+  unsigned int zero_1                    : 1;
+#endif
 } ATTRIBUTE_PACKED playback_type_t;

 /**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvdnav-devel/attachments/20140930/42ce72c3/attachment.html>


More information about the libdvdnav-devel mailing list