libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] here's a patch that changes nothing...


From: Robert William Fuller
Subject: [Libcdio-devel] here's a patch that changes nothing...
Date: Sat, 08 Mar 2008 22:41:44 -0500
User-agent: Thunderbird 2.0.0.6 (X11/20071013)

This is preliminary work for adding support for audio track pregaps in NRG images. It does not change existing behavior, but it does add necessary fields to the daox and daoi structures. Let me know what you think. I'm assuming I should hold on to these until after the freeze?

Rob

diff -upr libcdio-0.80-clean/lib/driver/image/nrg.c 
libcdio-0.80-patched/lib/driver/image/nrg.c
--- libcdio-0.80-clean/lib/driver/image/nrg.c   2008-03-03 07:04:34.000000000 
-0500
+++ libcdio-0.80-patched/lib/driver/image/nrg.c 2008-03-08 22:32:23.000000000 
-0500
@@ -378,16 +378,16 @@ parse_nrg (_img_private_t *p_env, const 
          p_env->psz_mcn    = calloc(1, CDIO_MCN_SIZE+1);
 
          if (DAOX_ID == opcode) {
-           _daox_array_t *_entries = (void *) chunk->data;
-           disc_mode    = _entries->_unknown[1];
-           p_env->dtyp  = _entries->_unknown[19];
-           memcpy(p_env->psz_mcn, &(_entries->psz_mcn), CDIO_MCN_SIZE);
+           _daox_t *_entries = (void *) chunk->data;
+           disc_mode   = _entries->common.u.unknown[2];
+           p_env->dtyp = _entries->track_info[0].common.u.unknown[0];
+           memcpy(p_env->psz_mcn, &(_entries->common.psz_mcn), 
CDIO_MCN_SIZE-1);
            p_env->psz_mcn[CDIO_MCN_SIZE] = '\0';
          } else {
-           _daoi_array_t *_entries = (void *) chunk->data;
-           disc_mode    = _entries->_unknown[1];
-           p_env->dtyp  = _entries->_unknown[19];
-           memcpy(p_env->psz_mcn, &(_entries->psz_mcn), CDIO_MCN_SIZE);
+           _daoi_t *_entries = (void *) chunk->data;
+           disc_mode   = _entries->common.u.unknown[2];
+           p_env->dtyp = _entries->track_info[0].common.u.unknown[0];
+           memcpy(p_env->psz_mcn, &(_entries->common.psz_mcn), 
CDIO_MCN_SIZE-1);
            p_env->psz_mcn[CDIO_MCN_SIZE] = '\0';
          }
 
diff -upr libcdio-0.80-clean/lib/driver/image/nrg.h 
libcdio-0.80-patched/lib/driver/image/nrg.h
--- libcdio-0.80-clean/lib/driver/image/nrg.h   2006-01-14 04:45:44.000000000 
-0500
+++ libcdio-0.80-patched/lib/driver/image/nrg.h 2008-03-08 22:33:29.000000000 
-0500
@@ -71,19 +71,54 @@ typedef struct {
   uint32_t lsn        GNUC_PACKED; 
 } _cuex_array_t;
 
+/* New DAO[XI] Information from http://en.wikipedia.org/wiki/NRG_(file_format)
+*/
+
 typedef struct {
-  uint32_t _unknown1  GNUC_PACKED;
-  char      psz_mcn[CDIO_MCN_SIZE];             
-  uint8_t  _unknown[64-CDIO_MCN_SIZE-sizeof(uint32_t)];
+  uint8_t    zero[10];
+  uint32_t   sector_size         GNUC_PACKED;
+  union {
+    uint32_t mode                GNUC_PACKED;
+    uint8_t  unknown[4];
+  } u;
+} _dao_array_common_t;
+
+typedef struct {
+  _dao_array_common_t common;
+  uint64_t   index0              GNUC_PACKED;
+  uint64_t   index1              GNUC_PACKED;
+  uint64_t   end_of_track        GNUC_PACKED;
 } _daox_array_t;
 
 typedef struct {
-  uint32_t _unknown1  GNUC_PACKED;
-  char      psz_mcn[CDIO_MCN_SIZE];
-  uint8_t  _unknown[64-CDIO_MCN_SIZE-sizeof(uint32_t)];
+  _dao_array_common_t common;
+  uint32_t   index0              GNUC_PACKED;
+  uint32_t   index1              GNUC_PACKED;
+  uint32_t   end_of_track        GNUC_PACKED;
 } _daoi_array_t;
 
 typedef struct {
+  uint32_t   chunk_size_le       GNUC_PACKED;
+  char       psz_mcn[CDIO_MCN_SIZE-1];
+  union {
+    uint32_t toc_type            GNUC_PACKED;
+    uint8_t  unknown[4];
+  } u;
+  uint8_t    first_track;
+  uint8_t    last_track;
+} _dao_common_t;
+
+typedef struct {
+  _dao_common_t common;
+  _daox_array_t track_info[EMPTY_ARRAY_SIZE];
+} _daox_t;
+
+typedef struct {
+  _dao_common_t common;
+  _daoi_array_t track_info[EMPTY_ARRAY_SIZE];
+} _daoi_t;
+
+typedef struct {
   uint32_t id                    GNUC_PACKED;
   uint32_t len                   GNUC_PACKED;
   char data[EMPTY_ARRAY_SIZE];

reply via email to

[Prev in Thread] Current Thread [Next in Thread]