help-vcdimager
[Top][All Lists]
Advanced

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

[VCDImager] vcdimager patch


From: Michael P. Cosby
Subject: [VCDImager] vcdimager patch
Date: Wed, 11 Apr 2001 15:27:52 -0400 (EDT)

        This patch allows vcdimager to create .toc files as well as .cue
files for cdrdao. The main purpose of the patch is to allow a workaround
for certain CD recorders that can't create a pure data CD in disk at once
mode. They need an empty audio track somewhere in the toc file to make
the disk "look" like a CD-EXTRA disk to them.

        Most HP writers that can create VCDs at all have this issue, and the
symptoms look like the following:

cheri:/mp3/vcdimager-0.5.9beta4/frontends/cli# cdrdao write --device
0,0,0 --driver generic-mmc --speed 4 --eject videocd.toc
Cdrdao version 1.1.3 - (C) Andreas Mueller <address@hidden>
  SCSI interface library - (C) Joerg Schilling
  L-EC encoding library - (C) Heiko Eissfeldt
  Paranoia DAE library - (C) Monty

0,0,0: HP CD-Writer+ 7500       Rev: 1.0a
Using driver: Generic SCSI-3/MMC - Version 1.0 (data) (options 0x0000)

Warning: Unit not ready, still trying...
Starting write at speed 2...
Pausing 10 seconds - hit CTRL-C to abort.
Process can be aborted with QUIT signal (usually CTRL-\).
Using POSIX real time scheduling.
Executing power calibration...
cdrdao: Input/output error. : scsi sendcmd: retryable error
CDB:  5D 00 00 00 00 00 00 00 28 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 12 00 00 00 00 26 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x26 Qual 0x00 (invalid field in parameter list) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 0.011s timeout 180s
ERROR: Cannot send cue sheet.
ERROR: Writing failed.

        The patch adds a --music-hack-mode flag, which turns on the creation of 
the
empty music track, and a --toc-file option, which allows you to specify a
toc file to create. For the moment this option is incompatible with
--sectors-2336 since I'm not sure how to specify that to cdrdao in a .toc
file. I've verified the patch with an HP CDWriter+ 7500, rev. 1.0a.

- Michael Cosby

---------- Forwarded message ----------
Date: Wed, 11 Apr 2001 13:53:50 -0500
From: root <address@hidden>
To: address@hidden
Subject: tocfile.diff

diff -u -r z/vcdimager-0.5.9beta4/frontends/cli/vcdimager.c 
vcdimager-0.5.9beta4/frontends/cli/vcdimager.c
--- z/vcdimager-0.5.9beta4/frontends/cli/vcdimager.c    Sat Mar 17 18:13:01 2001
+++ vcdimager-0.5.9beta4/frontends/cli/vcdimager.c      Wed Apr 11 13:36:49 2001
@@ -44,6 +44,7 @@

 /* defaults */
 #define DEFAULT_CUE_FILE       "videocd.cue"
+#define DEFAULT_TOC_FILE       "videocd.toc"
 #define DEFAULT_BIN_FILE       "videocd.bin"
 #define DEFAULT_VOLUME_LABEL   "VideoCD"
 #define DEFAULT_APPLICATION_ID ""
@@ -56,6 +57,7 @@
   const char *type;
   const char *image_fname;
   const char *cue_fname;
+  const char *toc_fname;
   char **track_fnames;

   struct add_files_t {
@@ -72,6 +74,7 @@

   int sector_2336_flag;
   int broken_svcd_mode_flag;
+  int music_hack_flag;

   int verbose_flag;
   int quiet_flag;
@@ -221,6 +224,7 @@
   /* g_set_prgname (argv[0]); */

   gl.cue_fname = DEFAULT_CUE_FILE;
+  gl.toc_fname = 0;
   gl.image_fname = DEFAULT_BIN_FILE;
   gl.track_fnames = NULL;

@@ -251,6 +255,9 @@
         {"broken-svcd-mode", '\0', POPT_ARG_NONE, &gl.broken_svcd_mode_flag, 0,
          "enable non-compliant compatibility mode for broken devices"},

+        {"music-hack-mode", '\0', POPT_ARG_NONE, &gl.music_hack_flag, 0,
+         "enable an empty music track for broken HP writer firmware. This sets 
the toc-file flag implicitly"},
+
         {"iso-volume-label", 'l', POPT_ARG_STRING, &gl.volume_label, 0,
          "specify ISO volume label for video cd (default: '" 
DEFAULT_VOLUME_LABEL
          "')", "LABEL"},
@@ -259,6 +266,10 @@
          "specify ISO application id for video cd (default: '" 
DEFAULT_APPLICATION_ID
          "')", "LABEL"},

+        {"toc-file", 'T', POPT_ARG_STRING, &gl.toc_fname, 0,
+         "specify toc file for output, if specified a cue file won't be 
created (default: don't create a .toc file)",
+         "FILE"},
+
         {"cue-file", 'c', POPT_ARG_STRING, &gl.cue_fname, 0,
          "specify cue file for output (default: '" DEFAULT_CUE_FILE "')",
          "FILE"},
@@ -345,6 +356,11 @@

     if (gl.verbose_flag && gl.quiet_flag)
       vcd_error ("I can't be both, quiet and verbose... either one or another 
;-)");
+
+    if( gl.music_hack_flag && !gl.toc_fname ){
+      gl.toc_fname = DEFAULT_TOC_FILE;
+      printf( "Warning: music-hack-flag specified without a toc file. Using 
'%s' as the toc file\n", gl.toc_fname );
+    }

     if ((args = poptGetArgs (optCon)) == NULL)
       vcd_error ("error: need at least one data track as argument "
@@ -433,8 +449,16 @@
                        vcd_data_sink_new_stdio (gl.image_fname),
                        gl.progress_flag ? _progress_callback : NULL, NULL);

-  vcd_obj_write_cuefile (gl_vcd_obj, vcd_data_sink_new_stdio (gl.cue_fname),
-                         gl.image_fname);
+  if( gl.toc_fname ){
+         vcd_obj_write_tocfile (gl_vcd_obj,
+               vcd_data_sink_new_stdio (gl.toc_fname),
+                gl.image_fname, gl.music_hack_flag );
+  } else {
+         vcd_obj_write_cuefile (gl_vcd_obj,
+                vcd_data_sink_new_stdio (gl.cue_fname),
+                gl.image_fname);
+  }
+

   vcd_obj_end_output (gl_vcd_obj);

diff -u -r z/vcdimager-0.5.9beta4/libvcd/vcd.c vcdimager-0.5.9beta4/libvcd/vcd.c
--- z/vcdimager-0.5.9beta4/libvcd/vcd.c Thu Mar 15 05:20:09 2001
+++ vcdimager-0.5.9beta4/libvcd/vcd.c   Wed Apr 11 12:39:11 2001
@@ -559,6 +559,16 @@
 }

 static void
+toc_start (VcdDataSink *sink )
+{
+  char buf[1024] = { 0, };
+
+  snprintf (buf, sizeof (buf), "CD_ROM_XA\r\n" );
+
+  vcd_data_sink_write (sink, buf, 1, strlen (buf));
+}
+
+static void
 cue_track (VcdDataSink *sink, int sect2336, uint8_t num, uint32_t extent)
 {
   char buf[1024] = { 0, };
@@ -575,6 +585,34 @@
   vcd_data_sink_write (sink, buf, 1, strlen (buf));
 }

+static void
+toc_track (VcdDataSink *sink, int sect2336, uint8_t num, uint32_t length,
+       const char fname[] )
+{
+  char buf[1024] = { 0, };
+
+  uint8_t f = length % 75;
+  uint8_t s = (length / 75) % 60;
+  uint8_t m = (length / 75) / 60;
+
+
+  if( !length ){
+    snprintf (buf, sizeof (buf),
+             "// Track %d\r\n"
+             "  TRACK MODE2_%s\r\n"
+             "    DATAFILE \"%s\"\r\n",
+             num, (sect2336 ? "DONT_KNOW" : "RAW" ), fname );
+  } else {
+    snprintf (buf, sizeof (buf),
+             "// Track %d\r\n"
+             "  TRACK MODE2_%s\r\n"
+             "    DATAFILE \"%s\" %2.2d:%2.2d:%2.2d\r\n",
+             num, (sect2336 ? "DONT_KNOW" : "RAW" ), fname, m, s, f);
+  }
+
+  vcd_data_sink_write (sink, buf, 1, strlen (buf));
+}
+
 int
 vcd_obj_write_cuefile (VcdObj *obj, VcdDataSink *cue_file,
                        const char bin_fname[])
@@ -596,6 +634,50 @@

       cue_track (cue_file, obj->bin_file_2336_flag, n+2,
                  track->relative_start_extent + obj->iso_size);
+    }
+
+  vcd_data_sink_destroy (cue_file);
+
+  return 0;
+}
+
+int
+vcd_obj_write_tocfile (VcdObj *obj, VcdDataSink *cue_file,
+                       const char bin_fname[], int music_hack )
+{
+  int n;
+  uint32_t last_extent = 0;
+  VcdListNode *node;
+
+  assert (obj != NULL);
+  assert (obj->in_output);
+
+  toc_start ( cue_file );
+
+  for (n = 0, node = _vcd_list_begin (obj->mpeg_track_list);
+         node != NULL;
+         n++, node = _vcd_list_node_next (node))
+    {
+      mpeg_track_t *track = _vcd_list_node_data (node);
+
+      toc_track (cue_file, obj->bin_file_2336_flag, n+1,
+                 track->relative_start_extent + obj->iso_size - last_extent,
+               bin_fname );
+      last_extent = track->relative_start_extent + obj->iso_size;
+    }
+
+    // cdrdao assumes the rest of the file is the track if it isn't
+    // given a length.
+    toc_track (cue_file, obj->bin_file_2336_flag, n+1,
+                0, bin_fname );
+
+    if( music_hack ){
+      char buf[] =
+               "// Music hack for HP writers\r\n"
+               "  TRACK AUDIO\r\n"
+                "    PREGAP 0:2:0\r\n"
+                "    SILENCE 0:4:0\r\n";
+      vcd_data_sink_write (cue_file, buf, 1, strlen (buf));
     }

   vcd_data_sink_destroy (cue_file);
diff -u -r z/vcdimager-0.5.9beta4/libvcd/vcd.h vcdimager-0.5.9beta4/libvcd/vcd.h
--- z/vcdimager-0.5.9beta4/libvcd/vcd.h Sat Jan 13 08:02:20 2001
+++ vcdimager-0.5.9beta4/libvcd/vcd.h   Wed Apr 11 12:40:22 2001
@@ -117,6 +117,11 @@
 vcd_obj_write_cuefile (VcdObj *obj, VcdDataSink *cue_file,
                        const char bin_fname[]);

+/* spit out toc file; return != 0 --> error */
+int
+vcd_obj_write_tocfile (VcdObj *obj, VcdDataSink *cue_file,
+                       const char bin_fname[], int music_hack );
+
 /* this should be called writing the bin and/or cue file is done---even if
    an error occurred */
 void





reply via email to

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