Seems NRG didn't handle DAO in read_audio_sectors. Ask me how much fun I had with /usr/bin/cmp figuring this out. Here's a clue:

        cmp -l -i 0:352800 foo.bin /nfs/tmp/foo/foo.nrg
        cmp: EOF on foo.bin

Note that 352800 is CDIO_PREGAP_SECTORS * 2352.

The fix follows. If it passes regression tests, I'm going to go ahead and put it in. (I'm going to keep checking things in until Rocky shoots me in the head :-)

diff -up nrg.c.~1.26.~ nrg.c
--- nrg.c.~1.26.~       2008-03-19 21:40:29.000000000 -0400
+++ nrg.c       2008-03-20 03:51:28.000000000 -0400
@@ -893,9 +893,22 @@ _read_audio_sectors_nrg (void *p_user_da
                          unsigned int nblocks)
 {
   _img_private_t *p_env = p_user_data;
-
   CdioListNode_t *node;

+  if (p_env->is_dao) {
+    int ret;
+
+    ret = cdio_stream_seek (p_env->gen.data_source,
+ (lsn + CDIO_PREGAP_SECTORS) * CDIO_CD_FRAMESIZE_RAW, SEEK_SET);
+    if (ret!=0) return ret;
+
+    ret = cdio_stream_read (p_env->gen.data_source, data,
+              CDIO_CD_FRAMESIZE_RAW, nblocks);
+
+    /* ret is number of bytes if okay, but we need to return 0 okay. */
+    return ret == 0;
+  }
+
   if (lsn >= p_env->size)
     {
       cdio_warn ("trying to read beyond image size (%lu >= %lu)",


Reply via email to