Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 638646 | Differences between
and this patch

Collapse All | Expand All

(-)vcdimager-0.7.24.ORIG/amiga/rint.c (-1 / +1 lines)
Lines 51-57 Link Here
51
#endif /* defined(vax)||defined(tahoe) */
51
#endif /* defined(vax)||defined(tahoe) */
52
52
53
53
54
double 
54
double
55
copysign (double x, double y)
55
copysign (double x, double y)
56
{
56
{
57
#ifdef national
57
#ifdef national
(-)vcdimager-0.7.24.ORIG/example/info1.c (-8 / +8 lines)
Lines 18-24 Link Here
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
/* Simple example of using the libvcdinfo library. */
20
/* Simple example of using the libvcdinfo library. */
21
21
22
22
23
#include <stdio.h>
23
#include <stdio.h>
24
#ifdef HAVE_CONFIG_H
24
#ifdef HAVE_CONFIG_H
Lines 43-49 Link Here
43
  char *psz = NULL;
43
  char *psz = NULL;
44
44
45
  /* Set to give only errors on open, not warnings. */
45
  /* Set to give only errors on open, not warnings. */
46
  vcd_loglevel_default = VCD_LOG_ERROR; 
46
  vcd_loglevel_default = VCD_LOG_ERROR;
47
47
48
  if ( vcdinfo_open(&p_vcdinfo, &psz_source, DRIVER_DEVICE,
48
  if ( vcdinfo_open(&p_vcdinfo, &psz_source, DRIVER_DEVICE,
49
                    NULL) != VCDINFO_OPEN_VCD) {
49
                    NULL) != VCDINFO_OPEN_VCD) {
Lines 63-69 Link Here
63
  psz = vcdinfo_get_preparer_id(p_vcdinfo);
63
  psz = vcdinfo_get_preparer_id(p_vcdinfo);
64
  printf ("Preparer id: `%s'\n",    psz);
64
  printf ("Preparer id: `%s'\n",    psz);
65
  free(psz);
65
  free(psz);
66
  
66
67
  psz = vcdinfo_get_publisher_id(p_vcdinfo);
67
  psz = vcdinfo_get_publisher_id(p_vcdinfo);
68
  printf ("Publisher id: `%s'\n",  psz);
68
  printf ("Publisher id: `%s'\n",  psz);
69
  free(psz);
69
  free(psz);
Lines 75-91 Link Here
75
  psz = vcdinfo_get_application_id(p_vcdinfo);
75
  psz = vcdinfo_get_application_id(p_vcdinfo);
76
  printf ("Application id: `%s'\n", psz);
76
  printf ("Application id: `%s'\n", psz);
77
  free(psz);
77
  free(psz);
78
  
78
79
  { 
79
  {
80
    const iso9660_pvd_t *p_pvd = vcdinfo_get_pvd(p_vcdinfo);
80
    const iso9660_pvd_t *p_pvd = vcdinfo_get_pvd(p_vcdinfo);
81
81
82
    if (iso9660_get_pvd_type(p_pvd) != ISO_VD_PRIMARY)
82
    if (iso9660_get_pvd_type(p_pvd) != ISO_VD_PRIMARY)
83
      printf ("Unexpected descriptor type\n");
83
      printf ("Unexpected descriptor type\n");
84
    
84
85
    if (strncmp (iso9660_get_pvd_id(p_pvd), ISO_STANDARD_ID, 
85
    if (strncmp (iso9660_get_pvd_id(p_pvd), ISO_STANDARD_ID,
86
		 strlen (ISO_STANDARD_ID)))
86
		 strlen (ISO_STANDARD_ID)))
87
      printf ("Unexpected ID encountered (expected `" ISO_STANDARD_ID "'");
87
      printf ("Unexpected ID encountered (expected `" ISO_STANDARD_ID "'");
88
  
88
89
    printf("PVD ID: `%.5s'\n",  iso9660_get_pvd_id(p_pvd));
89
    printf("PVD ID: `%.5s'\n",  iso9660_get_pvd_id(p_pvd));
90
    printf("PVD version: %d\n", iso9660_get_pvd_version(p_pvd));
90
    printf("PVD version: %d\n", iso9660_get_pvd_version(p_pvd));
91
  }
91
  }
(-)vcdimager-0.7.24.ORIG/frontends/cli/cdxa2mpeg.c (-5 / +5 lines)
Lines 1-4 Link Here
1
/* -*- c -*- 
1
/* -*- c -*-
2
   $Id: cdxa2mpeg.c,v 1.10 2005/02/02 00:37:37 rocky Exp $
2
   $Id: cdxa2mpeg.c,v 1.10 2005/02/02 00:37:37 rocky Exp $
3
3
4
   Copyright (C) 2001, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org>
4
   Copyright (C) 2001, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org>
Lines 17-23 Link Here
17
   along with this program; if not, write to the Free Software
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* quick'n'dirty RIFF CD-XA 2 MPEG converter */
21
/* quick'n'dirty RIFF CD-XA 2 MPEG converter */
22
22
23
#ifdef HAVE_CONFIG_H
23
#ifdef HAVE_CONFIG_H
Lines 127-133 Link Here
127
    vcd_warn ("size not a multiple of %u bytes!!", CDIO_CD_FRAMESIZE_RAW);
127
    vcd_warn ("size not a multiple of %u bytes!!", CDIO_CD_FRAMESIZE_RAW);
128
  sectors = size / CDIO_CD_FRAMESIZE_RAW;
128
  sectors = size / CDIO_CD_FRAMESIZE_RAW;
129
129
130
  vcd_info ("CD-XA data[%u] (%u sectors)", (unsigned int) size, 
130
  vcd_info ("CD-XA data[%u] (%u sectors)", (unsigned int) size,
131
            (unsigned int) sectors);
131
            (unsigned int) sectors);
132
132
133
  if (ctxt->fd_out)
133
  if (ctxt->fd_out)
Lines 351-363 Link Here
351
      }
351
      }
352
352
353
    if (args[1]) {
353
    if (args[1]) {
354
      if ( strcmp(args[0], args[1]) == 0 ) 
354
      if ( strcmp(args[0], args[1]) == 0 )
355
        {
355
        {
356
          vcd_error ("input and output can't refer to the same file");
356
          vcd_error ("input and output can't refer to the same file");
357
          poptFreeContext(optCon);
357
          poptFreeContext(optCon);
358
          exit (EXIT_FAILURE);
358
          exit (EXIT_FAILURE);
359
        }
359
        }
360
           
360
361
      out = fopen (args[1], "wb");
361
      out = fopen (args[1], "wb");
362
      if (!out)
362
      if (!out)
363
        {
363
        {
(-)vcdimager-0.7.24.ORIG/frontends/cli/vcdimager.c (-47 / +47 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* Private includes */
21
/* Private includes */
22
#include "vcd.h"
22
#include "vcd.h"
23
#include "vcd_assert.h"
23
#include "vcd_assert.h"
Lines 51-57 Link Here
51
#define DEFAULT_ALBUM_ID       ""
51
#define DEFAULT_ALBUM_ID       ""
52
#define DEFAULT_TYPE           "vcd2"
52
#define DEFAULT_TYPE           "vcd2"
53
53
54
/* global stuff kept as a singleton makes for less typing effort :-) 
54
/* global stuff kept as a singleton makes for less typing effort :-)
55
 */
55
 */
56
56
57
struct add_files_t {
57
struct add_files_t {
Lines 111-117 Link Here
111
111
112
static VcdObj_t *gl_vcd_obj = NULL;
112
static VcdObj_t *gl_vcd_obj = NULL;
113
113
114
static void 
114
static void
115
_vcd_log_handler (vcd_log_level_t level, const char message[])
115
_vcd_log_handler (vcd_log_level_t level, const char message[])
116
{
116
{
117
  if (level == VCD_LOG_DEBUG && !gl.verbose_flag)
117
  if (level == VCD_LOG_DEBUG && !gl.verbose_flag)
Lines 119-125 Link Here
119
119
120
  if (level == VCD_LOG_INFO && gl.quiet_flag)
120
  if (level == VCD_LOG_INFO && gl.quiet_flag)
121
    return;
121
    return;
122
  
122
123
  gl.default_vcd_log_handler (level, message);
123
  gl.default_vcd_log_handler (level, message);
124
}
124
}
125
125
Lines 136-148 Link Here
136
    *fname1 = strdup (tmp);
136
    *fname1 = strdup (tmp);
137
  else
137
  else
138
    rc = -1;
138
    rc = -1;
139
  
139
140
  tmp = strtok(NULL, ",");
140
  tmp = strtok(NULL, ",");
141
  if (tmp)
141
  if (tmp)
142
    *fname2 = strdup (tmp);
142
    *fname2 = strdup (tmp);
143
  else
143
  else
144
    rc = -1;
144
    rc = -1;
145
  
145
146
  tmp = strtok(NULL, ",");
146
  tmp = strtok(NULL, ",");
147
  if (tmp)
147
  if (tmp)
148
    rc = -1;
148
    rc = -1;
Lines 180-186 Link Here
180
  gl.volume_label = DEFAULT_VOLUME_ID;
180
  gl.volume_label = DEFAULT_VOLUME_ID;
181
  gl.application_id = DEFAULT_APPLICATION_ID;
181
  gl.application_id = DEFAULT_APPLICATION_ID;
182
  gl.album_id = DEFAULT_ALBUM_ID;
182
  gl.album_id = DEFAULT_ALBUM_ID;
183
  
183
184
  gl.volume_count = 1;
184
  gl.volume_count = 1;
185
  gl.volume_number = 1;
185
  gl.volume_number = 1;
186
186
Lines 199-205 Link Here
199
      CL_ADD_FILE_RAW
199
      CL_ADD_FILE_RAW
200
    };
200
    };
201
201
202
    struct poptOption optionsTable[] = 
202
    struct poptOption optionsTable[] =
203
      {
203
      {
204
        {"type", 't', POPT_ARG_STRING, &gl.type, 0,
204
        {"type", 't', POPT_ARG_STRING, &gl.type, 0,
205
         "select VideoCD type ('vcd11', 'vcd2', 'svcd' or 'hqvcd')"
205
         "select VideoCD type ('vcd11', 'vcd2', 'svcd' or 'hqvcd')"
Lines 208-214 Link Here
208
        {"cue-file", 'c', POPT_ARG_STRING, &gl.cue_fname, 0,
208
        {"cue-file", 'c', POPT_ARG_STRING, &gl.cue_fname, 0,
209
         "specify cue file for output (default: '" DEFAULT_CUE_FILE "')",
209
         "specify cue file for output (default: '" DEFAULT_CUE_FILE "')",
210
         "FILE"},
210
         "FILE"},
211
      
211
212
        {"bin-file", 'b', POPT_ARG_STRING, &gl.image_fname, 0,
212
        {"bin-file", 'b', POPT_ARG_STRING, &gl.image_fname, 0,
213
         "specify bin file for output (default: '" DEFAULT_BIN_FILE "')",
213
         "specify bin file for output (default: '" DEFAULT_BIN_FILE "')",
214
         "FILE"},
214
         "FILE"},
Lines 218-224 Link Here
218
         "')", "LABEL"},
218
         "')", "LABEL"},
219
219
220
        {"iso-application-id", '\0', POPT_ARG_STRING, &gl.application_id, 0,
220
        {"iso-application-id", '\0', POPT_ARG_STRING, &gl.application_id, 0,
221
         "specify ISO application id for video cd (default: '" 
221
         "specify ISO application id for video cd (default: '"
222
         DEFAULT_APPLICATION_ID "')", "LABEL"},
222
         DEFAULT_APPLICATION_ID "')", "LABEL"},
223
223
224
        {"info-album-id", '\0', POPT_ARG_STRING, &gl.album_id, 0,
224
        {"info-album-id", '\0', POPT_ARG_STRING, &gl.album_id, 0,
Lines 236-282 Link Here
236
236
237
        {"update-scan-offsets", '\0', POPT_ARG_NONE, &gl.update_scan_offsets, 0,
237
        {"update-scan-offsets", '\0', POPT_ARG_NONE, &gl.update_scan_offsets, 0,
238
         "update scan data offsets in video mpeg2 stream"},
238
         "update scan data offsets in video mpeg2 stream"},
239
        
239
240
        {"sector-2336", '\0', POPT_ARG_NONE, &gl.sector_2336_flag, 0,
240
        {"sector-2336", '\0', POPT_ARG_NONE, &gl.sector_2336_flag, 0,
241
         "use 2336 byte sectors for output"},
241
         "use 2336 byte sectors for output"},
242
242
243
        {"add-dir", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIR, 
243
        {"add-dir", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIR,
244
         "add empty dir to ISO fs", "ISO_DIRNAME"},
244
         "add empty dir to ISO fs", "ISO_DIRNAME"},
245
245
246
        {"add-file", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE, 
246
        {"add-file", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE,
247
         "add single file to ISO fs", "FILE,ISO_FILENAME"},
247
         "add single file to ISO fs", "FILE,ISO_FILENAME"},
248
248
249
        {"add-file-2336", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE_RAW, 
249
        {"add-file-2336", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE_RAW,
250
         "add file containing full 2336 byte sectors to ISO fs",
250
         "add file containing full 2336 byte sectors to ISO fs",
251
         "FILE,ISO_FILENAME"},
251
         "FILE,ISO_FILENAME"},
252
252
253
        {"create-time", 'T', POPT_ARG_STRING, &gl.create_timestr, 0,
253
        {"create-time", 'T', POPT_ARG_STRING, &gl.create_timestr, 0,
254
         "specify creation date on files in CD image (default: current date)"},
254
         "specify creation date on files in CD image (default: current date)"},
255
      
255
256
        {"progress", 'p', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
256
        {"progress", 'p', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
257
         NULL, 0, "show progress"},
257
         NULL, 0, "show progress"},
258
258
259
        {"check", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, 
259
        {"check", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
260
         &gl.check_flag, 0, "enabled check mode"},
260
         &gl.check_flag, 0, "enabled check mode"},
261
261
262
        {"verbose", 'v', POPT_ARG_NONE, &gl.verbose_flag, 0, "be verbose"},
262
        {"verbose", 'v', POPT_ARG_NONE, &gl.verbose_flag, 0, "be verbose"},
263
263
264
        {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0, 
264
        {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0,
265
         "show only critical messages"},
265
         "show only critical messages"},
266
266
267
        {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
267
        {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
268
         "display version and copyright information and exit"},
268
         "display version and copyright information and exit"},
269
269
270
        POPT_AUTOHELP 
270
        POPT_AUTOHELP
271
271
272
        {NULL, 0, 0, NULL, 0}
272
        {NULL, 0, 0, NULL, 0}
273
      };
273
      };
274
    
274
275
    poptContext optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
275
    poptContext optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
276
    poptSetOtherOptionHelp (optCon, "[OPTION...] <mpeg-tracks...>");
276
    poptSetOtherOptionHelp (optCon, "[OPTION...] <mpeg-tracks...>");
277
277
278
    if (poptReadDefaultConfig (optCon, 0)) 
278
    if (poptReadDefaultConfig (optCon, 0))
279
      fprintf (stderr, "warning, reading popt configuration failed\n"); 
279
      fprintf (stderr, "warning, reading popt configuration failed\n");
280
280
281
    while ((opt = poptGetNextOpt (optCon)) != -1)
281
    while ((opt = poptGetNextOpt (optCon)) != -1)
282
      switch (opt)
282
      switch (opt)
Lines 296-302 Link Here
296
            gl_add_dir (strdup (arg));
296
            gl_add_dir (strdup (arg));
297
          }
297
          }
298
          break;
298
          break;
299
          
299
300
        case CL_ADD_FILE:
300
        case CL_ADD_FILE:
301
        case CL_ADD_FILE_RAW:
301
        case CL_ADD_FILE_RAW:
302
          {
302
          {
Lines 305-311 Link Here
305
305
306
            vcd_assert (arg != NULL);
306
            vcd_assert (arg != NULL);
307
307
308
            if(!_parse_file_arg (arg, &fname1, &fname2)) 
308
            if(!_parse_file_arg (arg, &fname1, &fname2))
309
              gl_add_file (fname1, fname2, (opt == CL_ADD_FILE_RAW));
309
              gl_add_file (fname1, fname2, (opt == CL_ADD_FILE_RAW));
310
            else
310
            else
311
              {
311
              {
Lines 323-329 Link Here
323
323
324
    if (gl.verbose_flag && gl.quiet_flag)
324
    if (gl.verbose_flag && gl.quiet_flag)
325
      vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
325
      vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
326
    
326
327
    if ((args = poptGetArgs (optCon)) == NULL)
327
    if ((args = poptGetArgs (optCon)) == NULL)
328
      vcd_error ("error: need at least one data track as argument "
328
      vcd_error ("error: need at least one data track as argument "
329
                 "-- try --help");
329
                 "-- try --help");
Lines 343-349 Link Here
343
      struct {
343
      struct {
344
        const char *str;
344
        const char *str;
345
        vcd_type_t id;
345
        vcd_type_t id;
346
      } type_str[] = 
346
      } type_str[] =
347
        {
347
        {
348
          { "vcd10", VCD_TYPE_VCD },
348
          { "vcd10", VCD_TYPE_VCD },
349
          { "vcd11", VCD_TYPE_VCD11 },
349
          { "vcd11", VCD_TYPE_VCD11 },
Lines 353-362 Link Here
353
          { "hqvcd", VCD_TYPE_HQVCD },
353
          { "hqvcd", VCD_TYPE_HQVCD },
354
          { NULL, }
354
          { NULL, }
355
        };
355
        };
356
      
356
357
      int i = 0;
357
      int i = 0;
358
358
359
      while (type_str[i].str) 
359
      while (type_str[i].str)
360
        if (strcasecmp(gl.type, type_str[i].str))
360
        if (strcasecmp(gl.type, type_str[i].str))
361
          i++;
361
          i++;
362
        else
362
        else
Lines 364-370 Link Here
364
364
365
      if (!type_str[i].str)
365
      if (!type_str[i].str)
366
        vcd_error ("invalid type given");
366
        vcd_error ("invalid type given");
367
        
367
368
      type_id = type_str[i].id;
368
      type_id = type_str[i].id;
369
    }
369
    }
370
370
Lines 383-394 Link Here
383
    vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_PREPARER_ID, "GNU VCDIMAGER CHECK MODE");
383
    vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_PREPARER_ID, "GNU VCDIMAGER CHECK MODE");
384
384
385
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_VOLUME_ID, gl.volume_label);
385
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_VOLUME_ID, gl.volume_label);
386
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_APPLICATION_ID, 
386
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_APPLICATION_ID,
387
                         gl.application_id);
387
                         gl.application_id);
388
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_ALBUM_ID, gl.album_id);
388
  vcd_obj_set_param_str (gl_vcd_obj, VCD_PARM_ALBUM_ID, gl.album_id);
389
389
390
  vcd_obj_set_param_uint (gl_vcd_obj, VCD_PARM_VOLUME_COUNT, gl.volume_count);
390
  vcd_obj_set_param_uint (gl_vcd_obj, VCD_PARM_VOLUME_COUNT, gl.volume_count);
391
  vcd_obj_set_param_uint (gl_vcd_obj, VCD_PARM_VOLUME_NUMBER, 
391
  vcd_obj_set_param_uint (gl_vcd_obj, VCD_PARM_VOLUME_NUMBER,
392
                          gl.volume_number);
392
                          gl.volume_number);
393
393
394
  if (type_id == VCD_TYPE_SVCD)
394
  if (type_id == VCD_TYPE_SVCD)
Lines 398-423 Link Here
398
      vcd_obj_set_param_bool (gl_vcd_obj, VCD_PARM_SVCD_VCD3_ENTRYSVD,
398
      vcd_obj_set_param_bool (gl_vcd_obj, VCD_PARM_SVCD_VCD3_ENTRYSVD,
399
                              gl.broken_svcd_mode_flag);
399
                              gl.broken_svcd_mode_flag);
400
400
401
      vcd_obj_set_param_bool (gl_vcd_obj, VCD_PARM_UPDATE_SCAN_OFFSETS, 
401
      vcd_obj_set_param_bool (gl_vcd_obj, VCD_PARM_UPDATE_SCAN_OFFSETS,
402
                              gl.update_scan_offsets);
402
                              gl.update_scan_offsets);
403
    }
403
    }
404
404
405
  create_time = time(NULL);
405
  create_time = time(NULL);
406
  if (gl.create_timestr != NULL) {
406
  if (gl.create_timestr != NULL) {
407
    if (!strcmp (gl.create_timestr, "TESTING")) 
407
    if (!strcmp (gl.create_timestr, "TESTING"))
408
      create_time = 269236800L;
408
      create_time = 269236800L;
409
    else {
409
    else {
410
#ifdef HAVE_STRPTIME
410
#ifdef HAVE_STRPTIME
411
      struct tm tm;
411
      struct tm tm;
412
      
412
413
      if (NULL == strptime(gl.create_timestr, "%Y-%m-%d %H:%M:%S", &tm)) {
413
      if (NULL == strptime(gl.create_timestr, "%Y-%m-%d %H:%M:%S", &tm)) {
414
        vcd_warn("Trouble converting date string %s using strptime.", 
414
        vcd_warn("Trouble converting date string %s using strptime.",
415
                 gl.create_timestr);
415
                 gl.create_timestr);
416
        vcd_warn("String should match %%Y-%%m-%%d %%H:%%M:%%S");
416
        vcd_warn("String should match %%Y-%%m-%%d %%H:%%M:%%S");
417
      } else {
417
      } else {
418
        create_time = mktime(&tm);
418
        create_time = mktime(&tm);
419
      }
419
      }
420
#else 
420
#else
421
      create_time = 269236800L;
421
      create_time = 269236800L;
422
#endif
422
#endif
423
    }
423
    }
Lines 429-442 Link Here
429
429
430
    if (p->fname)
430
    if (p->fname)
431
      {
431
      {
432
        fprintf (stdout, "debug: adding [%s] as [%s] (raw=%d)\n", 
432
        fprintf (stdout, "debug: adding [%s] as [%s] (raw=%d)\n",
433
                 p->fname, p->iso_fname, p->raw_flag);
433
                 p->fname, p->iso_fname, p->raw_flag);
434
        
434
435
        if (vcd_obj_add_file(gl_vcd_obj, p->iso_fname,
435
        if (vcd_obj_add_file(gl_vcd_obj, p->iso_fname,
436
                             vcd_data_source_new_stdio (p->fname),
436
                             vcd_data_source_new_stdio (p->fname),
437
                             p->raw_flag))
437
                             p->raw_flag))
438
          {
438
          {
439
            fprintf (stderr, 
439
            fprintf (stderr,
440
                     "error while adding file `%s' as `%s' to (S)VCD\n",
440
                     "error while adding file `%s' as `%s' to (S)VCD\n",
441
                     p->fname, p->iso_fname);
441
                     p->fname, p->iso_fname);
442
            exit (EXIT_FAILURE);
442
            exit (EXIT_FAILURE);
Lines 448-454 Link Here
448
448
449
        if (vcd_obj_add_dir(gl_vcd_obj, p->iso_fname))
449
        if (vcd_obj_add_dir(gl_vcd_obj, p->iso_fname))
450
          {
450
          {
451
            fprintf (stderr, 
451
            fprintf (stderr,
452
                     "error while adding dir `%s' to (S)VCD\n", p->iso_fname);
452
                     "error while adding dir `%s' to (S)VCD\n", p->iso_fname);
453
            exit (EXIT_FAILURE);
453
            exit (EXIT_FAILURE);
454
          }
454
          }
Lines 458-464 Link Here
458
  for (n = 0; gl.track_fnames[n] != NULL; n++)
458
  for (n = 0; gl.track_fnames[n] != NULL; n++)
459
    {
459
    {
460
      VcdDataSource_t *data_source;
460
      VcdDataSource_t *data_source;
461
      
461
462
      data_source = vcd_data_source_new_stdio (gl.track_fnames[n]);
462
      data_source = vcd_data_source_new_stdio (gl.track_fnames[n]);
463
463
464
      vcd_assert (data_source != NULL);
464
      vcd_assert (data_source != NULL);
Lines 477-485 Link Here
477
477
478
    vcd_image_sink_set_arg (p_image_sink, "bin", gl.image_fname);
478
    vcd_image_sink_set_arg (p_image_sink, "bin", gl.image_fname);
479
    vcd_image_sink_set_arg (p_image_sink, "cue", gl.cue_fname);
479
    vcd_image_sink_set_arg (p_image_sink, "cue", gl.cue_fname);
480
    vcd_image_sink_set_arg (p_image_sink, "sector", 
480
    vcd_image_sink_set_arg (p_image_sink, "sector",
481
                            gl.sector_2336_flag ? "2336" : "2352");
481
                            gl.sector_2336_flag ? "2336" : "2352");
482
    
482
483
    if (!p_image_sink)
483
    if (!p_image_sink)
484
      {
484
      {
485
        vcd_error ("failed to create image object");
485
        vcd_error ("failed to create image object");
Lines 493-515 Link Here
493
    vcd_obj_end_output (gl_vcd_obj);
493
    vcd_obj_end_output (gl_vcd_obj);
494
494
495
    {
495
    {
496
      unsigned _bytes = sectors * 
496
      unsigned _bytes = sectors *
497
        (gl.sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW);
497
        (gl.sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW);
498
      char *_msfstr = cdio_lba_to_msf_str (sectors);
498
      char *_msfstr = cdio_lba_to_msf_str (sectors);
499
499
500
      fprintf (stdout, 
500
      fprintf (stdout,
501
               "finished ok, image created with %d sectors [%s] (%d bytes)\n",
501
               "finished ok, image created with %d sectors [%s] (%d bytes)\n",
502
               sectors, _msfstr, _bytes);
502
               sectors, _msfstr, _bytes);
503
      
503
504
      free (_msfstr);
504
      free (_msfstr);
505
    }
505
    }
506
  }
506
  }
507
507
508
  return EXIT_SUCCESS;
508
  return EXIT_SUCCESS;
509
}
509
}
510
511
510
512
/* 
511
512
/*
513
 * Local variables:
513
 * Local variables:
514
 *  c-file-style: "gnu"
514
 *  c-file-style: "gnu"
515
 *  tab-width: 8
515
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/frontends/cli/vcd-info.c (-235 / +237 lines)
Lines 19-25 Link Here
19
    along with this program; if not, write to the Free Foundation
19
    along with this program; if not, write to the Free Foundation
20
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
*/
21
*/
22
22
23
#ifdef HAVE_CONFIG_H
23
#ifdef HAVE_CONFIG_H
24
# include "config.h"
24
# include "config.h"
25
#endif
25
#endif
Lines 39-44 Link Here
39
#define POPT_ARGFLAG_OPTIONAL 0
39
#define POPT_ARGFLAG_OPTIONAL 0
40
#endif
40
#endif
41
41
42
/* We don't want to pull in cdio's config */
43
#define __CDIO_CONFIG_H__
42
#include <cdio/cdio.h>
44
#include <cdio/cdio.h>
43
#include <cdio/bytesex.h>
45
#include <cdio/bytesex.h>
44
#include <cdio/iso9660.h>
46
#include <cdio/iso9660.h>
Lines 67-74 Link Here
67
  char *access_mode;
69
  char *access_mode;
68
70
69
  /* Boolean values set by command-line options to reduce output.
71
  /* Boolean values set by command-line options to reduce output.
70
     Note: because these are used by popt, the datatype here has to be 
72
     Note: because these are used by popt, the datatype here has to be
71
     int, not bool. 
73
     int, not bool.
72
  */
74
  */
73
  uint32_t debug_level;
75
  uint32_t debug_level;
74
  int      no_ext_psd_flag;  /* Ignore information in /EXT/PSD_X.VCD */
76
  int      no_ext_psd_flag;  /* Ignore information in /EXT/PSD_X.VCD */
Lines 85-91 Link Here
85
      int delimiter;  /* True supresses delimiters between sections   */
87
      int delimiter;  /* True supresses delimiters between sections   */
86
      int header;     /* True supresses the section headers           */
88
      int header;     /* True supresses the section headers           */
87
    } no;
89
    } no;
88
    
90
89
    struct entries_t  /* Switches for the ENTRIES section. */
91
    struct entries_t  /* Switches for the ENTRIES section. */
90
    {
92
    {
91
      int any;   /* True if any of the below variables are set true. */
93
      int any;   /* True if any of the below variables are set true. */
Lines 101-107 Link Here
101
    {
103
    {
102
      int any;
104
      int any;
103
      int all;
105
      int all;
104
      int album; /* Show album description info. */ 
106
      int album; /* Show album description info. */
105
      int cc;    /* Show data cc. */
107
      int cc;    /* Show data cc. */
106
      int count; /* Show volume count */
108
      int count; /* Show volume count */
107
      int id;    /* Show ID */
109
      int id;    /* Show ID */
Lines 122-128 Link Here
122
      int vers;  /* Show INFO version. */
124
      int vers;  /* Show INFO version. */
123
      int vol;   /* Show volume number */
125
      int vol;   /* Show volume number */
124
    } info;
126
    } info;
125
    
127
126
    struct pvd_t  /* Switches for the PVD section. */
128
    struct pvd_t  /* Switches for the PVD section. */
127
    {
129
    {
128
      int any;    /* True if any of the below variables are set true. */
130
      int any;    /* True if any of the below variables are set true. */
Lines 146-152 Link Here
146
    int scandata; /* Show scan data group -- needs to broken out. */
148
    int scandata; /* Show scan data group -- needs to broken out. */
147
    int search;
149
    int search;
148
    int source;   /* Show image source and size. */
150
    int source;   /* Show image source and size. */
149
    int tracks;   
151
    int tracks;
150
  } show;
152
  } show;
151
153
152
}
154
}
Lines 164-170 Link Here
164
_bitset_get_bit (const uint8_t bitvec[], int bit)
166
_bitset_get_bit (const uint8_t bitvec[], int bit)
165
{
167
{
166
  bool result = false;
168
  bool result = false;
167
  
169
168
  if (_vcd_bit_set_p (bitvec[bit / 8], (bit % 8)))
170
  if (_vcd_bit_set_p (bitvec[bit / 8], (bit % 8)))
169
    result = true;
171
    result = true;
170
172
Lines 201-207 Link Here
201
  iso9660_stat_t *statbuf;
203
  iso9660_stat_t *statbuf;
202
  CdIo_t *p_cdio;
204
  CdIo_t *p_cdio;
203
  vcd2_ext_pbc_status_t ret_status;
205
  vcd2_ext_pbc_status_t ret_status;
204
  
206
205
  if (!vcdinfo_has_pbc(p_vcdinfo))
207
  if (!vcdinfo_has_pbc(p_vcdinfo))
206
    return PBC_VCD2_NO_PBC;
208
    return PBC_VCD2_NO_PBC;
207
209
Lines 232-253 Link Here
232
static void
234
static void
233
dump_lot (const vcdinfo_obj_t *p_vcdinfo, bool ext)
235
dump_lot (const vcdinfo_obj_t *p_vcdinfo, bool ext)
234
{
236
{
235
  const LotVcd_t *lot = ext 
237
  const LotVcd_t *lot = ext
236
    ? vcdinfo_get_lot_x(p_vcdinfo) : vcdinfo_get_lot(p_vcdinfo);
238
    ? vcdinfo_get_lot_x(p_vcdinfo) : vcdinfo_get_lot(p_vcdinfo);
237
  
239
238
  unsigned n, tmp;
240
  unsigned n, tmp;
239
  const uint16_t max_lid = vcdinfo_get_num_LIDs(p_vcdinfo);
241
  const uint16_t max_lid = vcdinfo_get_num_LIDs(p_vcdinfo);
240
  unsigned int mult = vcdinfo_get_offset_mult(p_vcdinfo);
242
  unsigned int mult = vcdinfo_get_offset_mult(p_vcdinfo);
241
243
242
  if (!gl.show.no.header)
244
  if (!gl.show.no.header)
243
    fprintf (stdout, 
245
    fprintf (stdout,
244
             (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD 
246
             (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
245
              || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
247
              || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
246
             ? "SVCD/LOT.SVD\n"
248
             ? "SVCD/LOT.SVD\n"
247
             : (ext ? "EXT/LOT_X.VCD\n": "VCD/LOT.VCD\n"));
249
             : (ext ? "EXT/LOT_X.VCD\n": "VCD/LOT.VCD\n"));
248
250
249
  if (lot->reserved)
251
  if (lot->reserved)
250
    fprintf (stdout, " RESERVED = 0x%4.4x (should be 0x0000)\n", 
252
    fprintf (stdout, " RESERVED = 0x%4.4x (should be 0x0000)\n",
251
             uint16_from_be (lot->reserved));
253
             uint16_from_be (lot->reserved));
252
254
253
  for (n = 0; n < LOT_VCD_OFFSETS; n++)
255
  for (n = 0; n < LOT_VCD_OFFSETS; n++)
Lines 258-266 Link Here
258
            fprintf (stdout, "warning, LID[1] should have offset = 0!\n");
260
            fprintf (stdout, "warning, LID[1] should have offset = 0!\n");
259
261
260
          if (n >= max_lid)
262
          if (n >= max_lid)
261
            fprintf (stdout, 
263
            fprintf (stdout,
262
                     "warning, the following entry is greater than the maximum lid field in info\n");
264
                     "warning, the following entry is greater than the maximum lid field in info\n");
263
          fprintf (stdout, " LID[%d]: offset = %d (0x%4.4x)\n", 
265
          fprintf (stdout, " LID[%d]: offset = %d (0x%4.4x)\n",
264
                   n + 1, tmp * mult, tmp);
266
                   n + 1, tmp * mult, tmp);
265
        }
267
        }
266
      else if (n < max_lid)
268
      else if (n < max_lid)
Lines 278-292 Link Here
278
  CdioList_t *offset_list;
280
  CdioList_t *offset_list;
279
281
280
  if (!p_vcdinfo) return;
282
  if (!p_vcdinfo) return;
281
  
283
282
  mult = vcdinfo_get_offset_mult(p_vcdinfo);
284
  mult = vcdinfo_get_offset_mult(p_vcdinfo);
283
  psd  = ext ? vcdinfo_get_psd_x(p_vcdinfo) : vcdinfo_get_psd(p_vcdinfo);
285
  psd  = ext ? vcdinfo_get_psd_x(p_vcdinfo) : vcdinfo_get_psd(p_vcdinfo);
284
  offset_list = ext 
286
  offset_list = ext
285
    ? vcdinfo_get_offset_x_list(p_vcdinfo) 
287
    ? vcdinfo_get_offset_x_list(p_vcdinfo)
286
    : vcdinfo_get_offset_list(p_vcdinfo);
288
    : vcdinfo_get_offset_list(p_vcdinfo);
287
289
288
  fprintf (stdout, 
290
  fprintf (stdout,
289
           (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD 
291
           (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
290
            || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
292
            || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
291
           ? "SVCD/PSD.SVD\n"
293
           ? "SVCD/PSD.SVD\n"
292
           : (ext ? "EXT/PSD_X.VCD\n": "VCD/PSD.VCD\n"));
294
           : (ext ? "EXT/PSD_X.VCD\n": "VCD/PSD.VCD\n"));
Lines 297-303 Link Here
297
      unsigned _rofs = ofs->offset * mult;
299
      unsigned _rofs = ofs->offset * mult;
298
300
299
      uint8_t type;
301
      uint8_t type;
300
      
302
301
      type = psd[_rofs];
303
      type = psd[_rofs];
302
304
303
      switch (type)
305
      switch (type)
Lines 305-311 Link Here
305
        case PSD_TYPE_PLAY_LIST:
307
        case PSD_TYPE_PLAY_LIST:
306
          {
308
          {
307
            const PsdPlayListDescriptor_t *pld = (const void *) (psd + _rofs);
309
            const PsdPlayListDescriptor_t *pld = (const void *) (psd + _rofs);
308
            
310
309
            int i;
311
            int i;
310
            uint16_t lid = vcdinf_pld_get_lid(pld);
312
            uint16_t lid = vcdinf_pld_get_lid(pld);
311
313
Lines 315-327 Link Here
315
                     "  prev: %s | next: %s | return: %s\n"
317
                     "  prev: %s | next: %s | return: %s\n"
316
                     "  playtime: %d/15s | wait: %ds | autowait: %ds\n",
318
                     "  playtime: %d/15s | wait: %ds | autowait: %ds\n",
317
                     n, vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext),
319
                     n, vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext),
318
                     pld->noi, lid, 
320
                     pld->noi, lid,
319
                     _vcd_bool_str(vcdinfo_is_rejected(uint16_from_be(pld->lid))),
321
                     _vcd_bool_str(vcdinfo_is_rejected(uint16_from_be(pld->lid))),
320
                     vcdinfo_ofs2str(p_vcdinfo, 
322
                     vcdinfo_ofs2str(p_vcdinfo,
321
                                     vcdinf_pld_get_prev_offset(pld), ext),
323
                                     vcdinf_pld_get_prev_offset(pld), ext),
322
                     vcdinfo_ofs2str(p_vcdinfo, 
324
                     vcdinfo_ofs2str(p_vcdinfo,
323
                                     vcdinf_pld_get_next_offset(pld), ext),
325
                                     vcdinf_pld_get_next_offset(pld), ext),
324
                     vcdinfo_ofs2str(p_vcdinfo, 
326
                     vcdinfo_ofs2str(p_vcdinfo,
325
                                     vcdinf_pld_get_return_offset(pld),
327
                                     vcdinf_pld_get_return_offset(pld),
326
                                     ext),
328
                                     ext),
327
                     vcdinf_get_play_time(pld), vcdinf_get_wait_time (pld),
329
                     vcdinf_get_play_time(pld), vcdinf_get_wait_time (pld),
Lines 338-352 Link Here
338
        case PSD_TYPE_END_LIST:
340
        case PSD_TYPE_END_LIST:
339
          {
341
          {
340
            const PsdEndListDescriptor_t *d = (const void *) (psd + _rofs);
342
            const PsdEndListDescriptor_t *d = (const void *) (psd + _rofs);
341
            fprintf (stdout, " PSD[%.2d] (%s): end list descriptor\n", n, 
343
            fprintf (stdout, " PSD[%.2d] (%s): end list descriptor\n", n,
342
                     vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext));
344
                     vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext));
343
            if (vcdinfo_get_VCD_type(p_vcdinfo) != VCD_TYPE_VCD2)
345
            if (vcdinfo_get_VCD_type(p_vcdinfo) != VCD_TYPE_VCD2)
344
              {
346
              {
345
                fprintf (stdout, 
347
                fprintf (stdout,
346
                         "  next disc number: %d (if 0 stop PBC handling)\n", 
348
                         "  next disc number: %d (if 0 stop PBC handling)\n",
347
                         d->next_disc);
349
                         d->next_disc);
348
                fprintf (stdout, 
350
                fprintf (stdout,
349
                         "  change picture item: %s\n", 
351
                         "  change picture item: %s\n",
350
                         vcdinfo_pin2str (uint16_from_be (d->change_pic)));
352
                         vcdinfo_pin2str (uint16_from_be (d->change_pic)));
351
              }
353
              }
352
            fprintf (stdout, "\n");
354
            fprintf (stdout, "\n");
Lines 373-402 Link Here
373
                     *(uint8_t *) &d->flags,
375
                     *(uint8_t *) &d->flags,
374
                     vcdinf_get_num_selections(d),
376
                     vcdinf_get_num_selections(d),
375
                     vcdinf_get_bsn(d),
377
                     vcdinf_get_bsn(d),
376
                     lid, 
378
                     lid,
377
                     _vcd_bool_str (vcdinf_psd_get_lid_rejected(d)),
379
                     _vcd_bool_str (vcdinf_psd_get_lid_rejected(d)),
378
                     vcdinfo_ofs2str(p_vcdinfo, 
380
                     vcdinfo_ofs2str(p_vcdinfo,
379
                                     vcdinf_psd_get_prev_offset(d),   ext),
381
                                     vcdinf_psd_get_prev_offset(d),   ext),
380
                     vcdinfo_ofs2str(p_vcdinfo, 
382
                     vcdinfo_ofs2str(p_vcdinfo,
381
                                     vcdinf_psd_get_next_offset(d),   ext),
383
                                     vcdinf_psd_get_next_offset(d),   ext),
382
                     vcdinfo_ofs2str(p_vcdinfo, 
384
                     vcdinfo_ofs2str(p_vcdinfo,
383
                                     vcdinf_psd_get_return_offset(d), ext),
385
                                     vcdinf_psd_get_return_offset(d), ext),
384
                     vcdinfo_ofs2str(p_vcdinfo, 
386
                     vcdinfo_ofs2str(p_vcdinfo,
385
                                     vcdinf_psd_get_default_offset(d),ext),
387
                                     vcdinf_psd_get_default_offset(d),ext),
386
                     vcdinfo_ofs2str(p_vcdinfo, vcdinf_get_timeout_offset(d),
388
                     vcdinfo_ofs2str(p_vcdinfo, vcdinf_get_timeout_offset(d),
387
                                     ext),
389
                                     ext),
388
                     vcdinf_get_timeout_time(d),
390
                     vcdinf_get_timeout_time(d),
389
                     vcdinf_get_loop_count(d), 
391
                     vcdinf_get_loop_count(d),
390
                     _vcd_bool_str (vcdinf_has_jump_delay(d)),
392
                     _vcd_bool_str (vcdinf_has_jump_delay(d)),
391
                     vcdinfo_pin2str (vcdinf_psd_get_itemid(d)));
393
                     vcdinfo_pin2str (vcdinf_psd_get_itemid(d)));
392
394
393
            for (i = 0; i < vcdinf_get_num_selections(d); i++)
395
            for (i = 0; i < vcdinf_get_num_selections(d); i++)
394
              fprintf (stdout, "  ofs[%d]: %s\n", i,
396
              fprintf (stdout, "  ofs[%d]: %s\n", i,
395
                       vcdinfo_ofs2str (p_vcdinfo, 
397
                       vcdinfo_ofs2str (p_vcdinfo,
396
                                        vcdinf_psd_get_offset(d, i), 
398
                                        vcdinf_psd_get_offset(d, i),
397
                                        ext));
399
                                        ext));
398
400
399
            if (type == PSD_TYPE_EXT_SELECTION_LIST 
401
            if (type == PSD_TYPE_EXT_SELECTION_LIST
400
                || d->flags.SelectionAreaFlag)
402
                || d->flags.SelectionAreaFlag)
401
              {
403
              {
402
                const PsdSelectionListDescriptorExtended_t *d2 =
404
                const PsdSelectionListDescriptorExtended_t *d2 =
Lines 420-426 Link Here
420
          }
422
          }
421
          break;
423
          break;
422
        default:
424
        default:
423
          fprintf (stdout, " PSD[%2d] (%s): unkown descriptor type (0x%2.2x)\n", 
425
          fprintf (stdout, " PSD[%2d] (%s): unkown descriptor type (0x%2.2x)\n",
424
                   n, vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext), type);
426
                   n, vcdinfo_ofs2str (p_vcdinfo, ofs->offset, ext), type);
425
427
426
          fprintf (stdout, "  hexdump: ");
428
          fprintf (stdout, "  hexdump: ");
Lines 441-453 Link Here
441
  int n;
443
  int n;
442
444
443
  if (!gl.show.no.header)
445
  if (!gl.show.no.header)
444
    fprintf (stdout, 
446
    fprintf (stdout,
445
             (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD 
447
             (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
446
              || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
448
              || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
447
             ? "SVCD/INFO.SVD\n" 
449
             ? "SVCD/INFO.SVD\n"
448
             : "VCD/INFO.VCD\n");
450
             : "VCD/INFO.VCD\n");
449
451
450
  if (gl.show.info.id) 
452
  if (gl.show.info.id)
451
    fprintf (stdout, " ID: `%.8s'\n", info->ID);
453
    fprintf (stdout, " ID: `%.8s'\n", info->ID);
452
  if (gl.show.info.vers)
454
  if (gl.show.info.vers)
453
    fprintf (stdout, " version: 0x%2.2x\n", info->version);
455
    fprintf (stdout, " version: 0x%2.2x\n", info->version);
Lines 456-465 Link Here
456
  if (gl.show.info.album)
458
  if (gl.show.info.album)
457
    fprintf (stdout, " album id: `%.16s'\n", vcdinfo_get_album_id(p_vcdinfo));
459
    fprintf (stdout, " album id: `%.16s'\n", vcdinfo_get_album_id(p_vcdinfo));
458
  if (gl.show.info.count)
460
  if (gl.show.info.count)
459
    fprintf (stdout, " volume count: %d\n", 
461
    fprintf (stdout, " volume count: %d\n",
460
             vcdinfo_get_volume_count(p_vcdinfo));
462
             vcdinfo_get_volume_count(p_vcdinfo));
461
  if (gl.show.info.vol)
463
  if (gl.show.info.vol)
462
    fprintf (stdout, " volume number: %d\n", 
464
    fprintf (stdout, " volume number: %d\n",
463
             vcdinfo_get_volume_num(p_vcdinfo));
465
             vcdinfo_get_volume_num(p_vcdinfo));
464
466
465
  if (gl.show.info.pal)
467
  if (gl.show.info.pal)
Lines 469-484 Link Here
469
        {
471
        {
470
          if (n == 48)
472
          if (n == 48)
471
            fprintf (stdout, "\n  (bslbf)  ");
473
            fprintf (stdout, "\n  (bslbf)  ");
472
          
474
473
          fprintf (stdout, n % 8 ? "%d" : " %d",
475
          fprintf (stdout, n % 8 ? "%d" : " %d",
474
                   _bitset_get_bit (info->pal_flags, n));
476
                   _bitset_get_bit (info->pal_flags, n));
475
        }
477
        }
476
      fprintf (stdout, "\n");
478
      fprintf (stdout, "\n");
477
      
479
478
      fprintf (stdout, " flags:\n");
480
      fprintf (stdout, " flags:\n");
479
      fprintf (stdout, 
481
      fprintf (stdout,
480
               ((vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD 
482
               ((vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
481
                 || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD) 
483
                 || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
482
                ? "  reserved1: %s\n"
484
                ? "  reserved1: %s\n"
483
                : "  karaoke area: %s\n"),
485
                : "  karaoke area: %s\n"),
484
               _vcd_bool_str (info->flags.reserved1));
486
               _vcd_bool_str (info->flags.reserved1));
Lines 495-503 Link Here
495
  if (gl.show.info.st2)
497
  if (gl.show.info.st2)
496
    fprintf (stdout, "  start track #2: %s\n", _vcd_bool_str (info->flags.use_track3));
498
    fprintf (stdout, "  start track #2: %s\n", _vcd_bool_str (info->flags.use_track3));
497
  if (gl.show.info.pbc) {
499
  if (gl.show.info.pbc) {
498
    fprintf (stdout, 
500
    fprintf (stdout,
499
             ((vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD 
501
             ((vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
500
               || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD) 
502
               || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
501
              ? "  reserved2: %s\n"
503
              ? "  reserved2: %s\n"
502
              : "  extended pbc: %s\n"),
504
              : "  extended pbc: %s\n"),
503
             _vcd_bool_str (info->flags.pbc_x));
505
             _vcd_bool_str (info->flags.pbc_x));
Lines 513-532 Link Here
513
        fprintf(stdout, " Missing EXT/PSD_X.VCD for extended PBC info.\n");
515
        fprintf(stdout, " Missing EXT/PSD_X.VCD for extended PBC info.\n");
514
        break;
516
        break;
515
      case PBC_VCD2_BAD_LOT_SIZE:
517
      case PBC_VCD2_BAD_LOT_SIZE:
516
        fprintf(stdout, 
518
        fprintf(stdout,
517
                " Size of EXT/LOT_X.VCD != LOT_VCD_SIZE*ISO_BLOCKSIZE\n");
519
                " Size of EXT/LOT_X.VCD != LOT_VCD_SIZE*ISO_BLOCKSIZE\n");
518
        break;
520
        break;
519
      case PBC_VCD2_EXT:
521
      case PBC_VCD2_EXT:
520
        fprintf(stdout, " Detected extended VCD2.0 PBC files.\n");
522
        fprintf(stdout, " Detected extended VCD2.0 PBC files.\n");
521
        break;
523
        break;
522
      case PBC_VCD2_NOPE: 
524
      case PBC_VCD2_NOPE:
523
        break;
525
        break;
524
      }
526
      }
525
  }
527
  }
526
  
528
527
529
528
  if (gl.show.info.psds)
530
  if (gl.show.info.psds)
529
    fprintf (stdout, " psd size: %u\n", 
531
    fprintf (stdout, " psd size: %u\n",
530
             (unsigned int) uint32_from_be (info->psd_size));
532
             (unsigned int) uint32_from_be (info->psd_size));
531
533
532
  if (gl.show.info.seg) {
534
  if (gl.show.info.seg) {
Lines 534-542 Link Here
534
    fprintf (stdout, " first segment addr: %s\n", psz_msf);
536
    fprintf (stdout, " first segment addr: %s\n", psz_msf);
535
    free(psz_msf);
537
    free(psz_msf);
536
  }
538
  }
537
    
539
538
  if (gl.show.info.ofm)
540
  if (gl.show.info.ofm)
539
    fprintf (stdout, " offset multiplier: 0x%2.2x\n", 
541
    fprintf (stdout, " offset multiplier: 0x%2.2x\n",
540
             vcdinfo_get_offset_mult(p_vcdinfo));
542
             vcdinfo_get_offset_mult(p_vcdinfo));
541
543
542
  if (gl.show.info.lidn)
544
  if (gl.show.info.lidn)
Lines 545-551 Link Here
545
547
546
  if (gl.show.info.segn)
548
  if (gl.show.info.segn)
547
    fprintf (stdout, " number of segments: %d\n", num_segments);
549
    fprintf (stdout, " number of segments: %d\n", num_segments);
548
  
550
549
  if (gl.show.info.segs)
551
  if (gl.show.info.segs)
550
    for (n = 0; n < num_segments; n++)
552
    for (n = 0; n < num_segments; n++)
551
      {
553
      {
Lines 557-563 Link Here
557
        psz_msf = cdio_msf_to_str(&msf);
559
        psz_msf = cdio_msf_to_str(&msf);
558
        fprintf (stdout, " SEGMENT[%4.4d]: track# 0, LSN %6u "
560
        fprintf (stdout, " SEGMENT[%4.4d]: track# 0, LSN %6u "
559
                 "(MSF %s), %2u sectors\n",
561
                 "(MSF %s), %2u sectors\n",
560
                 n, (unsigned int) lsn, psz_msf, 
562
                 n, (unsigned int) lsn, psz_msf,
561
                 (unsigned int) vcdinfo_get_seg_sector_count(p_vcdinfo, n));
563
                 (unsigned int) vcdinfo_get_seg_sector_count(p_vcdinfo, n));
562
        free(psz_msf);
564
        free(psz_msf);
563
565
Lines 566-582 Link Here
566
                                        vcdinfo_get_seg_audio_type(p_vcdinfo, n)),
568
                                        vcdinfo_get_seg_audio_type(p_vcdinfo, n)),
567
                 vcdinfo_video_type2str(p_vcdinfo, n),
569
                 vcdinfo_video_type2str(p_vcdinfo, n),
568
                 _vcd_bool_str (info->spi_contents[n].item_cont),
570
                 _vcd_bool_str (info->spi_contents[n].item_cont),
569
                 (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_VCD2) 
571
                 (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_VCD2)
570
                   ? "" : ",\n   SVCD subtitle (OGT) substream:",
572
                   ? "" : ",\n   SVCD subtitle (OGT) substream:",
571
                 (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_VCD2) 
573
                 (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_VCD2)
572
                   ? "" : vcdinfo_ogt2str(p_vcdinfo, n));
574
                   ? "" : vcdinfo_ogt2str(p_vcdinfo, n));
573
      }
575
      }
574
  
576
575
  if (gl.show.info.start)
577
  if (gl.show.info.start)
576
    if (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
578
    if (vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_SVCD
577
        || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
579
        || vcdinfo_get_VCD_type(p_vcdinfo) == VCD_TYPE_HQVCD)
578
      for (n = 0; n < 5; n++)
580
      for (n = 0; n < 5; n++)
579
        fprintf (stdout, " volume start time[%d]: %d secs\n", 
581
        fprintf (stdout, " volume start time[%d]: %d secs\n",
580
                 n, uint16_from_be (info->playing_time[n]));
582
                 n, uint16_from_be (info->playing_time[n]));
581
}
583
}
582
584
Lines 588-596 Link Here
588
590
589
  num_entries = vcdinfo_get_num_entries(obj);
591
  num_entries = vcdinfo_get_num_entries(obj);
590
592
591
  if (!gl.show.no.header) 
593
  if (!gl.show.no.header)
592
    fprintf (stdout, 
594
    fprintf (stdout,
593
             (vcdinfo_get_VCD_type(obj) == VCD_TYPE_SVCD 
595
             (vcdinfo_get_VCD_type(obj) == VCD_TYPE_SVCD
594
              || vcdinfo_get_VCD_type(obj) == VCD_TYPE_HQVCD)
596
              || vcdinfo_get_VCD_type(obj) == VCD_TYPE_HQVCD)
595
             ? "SVCD/ENTRIES.SVD\n"
597
             ? "SVCD/ENTRIES.SVD\n"
596
             : "VCD/ENTRIES.VCD\n");
598
             : "VCD/ENTRIES.VCD\n");
Lines 602-608 Link Here
602
  else
604
  else
603
    vcd_warn ("unexpected ID signature encountered");
605
    vcd_warn ("unexpected ID signature encountered");
604
606
605
  if (gl.show.entries.id) 
607
  if (gl.show.entries.id)
606
    fprintf (stdout, " ID: `%.8s'\n", entries->ID);
608
    fprintf (stdout, " ID: `%.8s'\n", entries->ID);
607
  if (gl.show.entries.vers)
609
  if (gl.show.entries.vers)
608
    fprintf (stdout, " version: 0x%2.2x\n", entries->version);
610
    fprintf (stdout, " version: 0x%2.2x\n", entries->version);
Lines 612-618 Link Here
612
  if (gl.show.entries.count)
614
  if (gl.show.entries.count)
613
    fprintf (stdout, " entries: %d\n", num_entries);
615
    fprintf (stdout, " entries: %d\n", num_entries);
614
616
615
  if (gl.show.entries.data) 
617
  if (gl.show.entries.data)
616
    for (n = 0; n < num_entries; n++)
618
    for (n = 0; n < num_entries; n++)
617
      {
619
      {
618
        const lsn_t  lsn = vcdinfo_get_entry_lsn(obj, n);
620
        const lsn_t  lsn = vcdinfo_get_entry_lsn(obj, n);
Lines 630-638 Link Here
630
      }
632
      }
631
}
633
}
632
634
633
/* 
635
/*
634
   Dump the track contents using information from TRACKS.SVCD.
636
   Dump the track contents using information from TRACKS.SVCD.
635
   See also dump_tracks which gives similar information but doesn't 
637
   See also dump_tracks which gives similar information but doesn't
636
   need TRACKS.SVCD
638
   need TRACKS.SVCD
637
*/
639
*/
638
static void
640
static void
Lines 649-657 Link Here
649
651
650
  fprintf (stdout, " ID: `%.8s'\n", tracks->file_id);
652
  fprintf (stdout, " ID: `%.8s'\n", tracks->file_id);
651
  fprintf (stdout, " version: 0x%2.2x\n", tracks->version);
653
  fprintf (stdout, " version: 0x%2.2x\n", tracks->version);
652
  
654
653
  fprintf (stdout, " tracks: %d\n", tracks->tracks);
655
  fprintf (stdout, " tracks: %d\n", tracks->tracks);
654
  
656
655
  for (j = 0; j < tracks->tracks; j++)
657
  for (j = 0; j < tracks->tracks; j++)
656
    {
658
    {
657
      const char *video_types[] =
659
      const char *video_types[] =
Lines 675-686 Link Here
675
        };
677
        };
676
      char *psz_msf = cdio_msf_to_str(&(tracks->playing_time[j]));
678
      char *psz_msf = cdio_msf_to_str(&(tracks->playing_time[j]));
677
679
678
      fprintf (stdout, 
680
      fprintf (stdout,
679
               " track[%.2d]: %s,"
681
               " track[%.2d]: %s,"
680
               " audio: %s, video: %s,\n"
682
               " audio: %s, video: %s,\n"
681
               "            SVCD subtitle (OGT) stream: %s\n",
683
               "            SVCD subtitle (OGT) stream: %s\n",
682
               j, psz_msf,
684
               j, psz_msf,
683
               vcdinfo_audio_type2str(obj, 
685
               vcdinfo_audio_type2str(obj,
684
                                      vcdinfo_get_track_audio_type(obj, j+1)),
686
                                      vcdinfo_get_track_audio_type(obj, j+1)),
685
               video_types[tracks2->contents[j].video],
687
               video_types[tracks2->contents[j].video],
686
               ogt_str[tracks2->contents[j].ogt]);
688
               ogt_str[tracks2->contents[j].ogt]);
Lines 698-708 Link Here
698
               tracks_v30->track[j].audio_info,
700
               tracks_v30->track[j].audio_info,
699
               tracks_v30->track[j].ogt_info);
701
               tracks_v30->track[j].ogt_info);
700
      free(psz_msf);
702
      free(psz_msf);
701
      
703
702
    }
704
    }
703
}
705
}
704
706
705
/* 
707
/*
706
   Dump the track contents based on low-level CD datas.
708
   Dump the track contents based on low-level CD datas.
707
   See also dump_tracks which gives more information but requires
709
   See also dump_tracks which gives more information but requires
708
   TRACKS.SVCD to exist on the medium.
710
   TRACKS.SVCD to exist on the medium.
Lines 723-734 Link Here
723
  for (i = first_track_num; i <= CDIO_CDROM_LEADOUT_TRACK; i++) {
725
  for (i = first_track_num; i <= CDIO_CDROM_LEADOUT_TRACK; i++) {
724
    msf_t msf;
726
    msf_t msf;
725
    char *psz_msf;
727
    char *psz_msf;
726
    
728
727
    if (!cdio_get_track_msf(cdio, i, &msf)) {
729
    if (!cdio_get_track_msf(cdio, i, &msf)) {
728
      vcd_error("Error getting information for track %i.\n", i);
730
      vcd_error("Error getting information for track %i.\n", i);
729
      continue;
731
      continue;
730
    }
732
    }
731
    
733
732
    psz_msf = cdio_msf_to_str(&msf);
734
    psz_msf = cdio_msf_to_str(&msf);
733
    if (i == CDIO_CDROM_LEADOUT_TRACK) {
735
    if (i == CDIO_CDROM_LEADOUT_TRACK) {
734
      printf("%3d: %s  %06u  leadout\n",
736
      printf("%3d: %s  %06u  leadout\n",
Lines 741-747 Link Here
741
             (int) i, psz_msf,
743
             (int) i, psz_msf,
742
             (unsigned int) cdio_msf_to_lsn(&msf),
744
             (unsigned int) cdio_msf_to_lsn(&msf),
743
             track_format2str[cdio_get_track_format(cdio, i)]);
745
             track_format2str[cdio_get_track_format(cdio, i)]);
744
      
746
745
    }
747
    }
746
    free(psz_msf);
748
    free(psz_msf);
747
    /* skip to leadout? */
749
    /* skip to leadout? */
Lines 776-782 Link Here
776
          const uint32_t lsn = cdio_msf_to_lsn(msf);
778
          const uint32_t lsn = cdio_msf_to_lsn(msf);
777
          char *psz_msf;
779
          char *psz_msf;
778
780
779
          if (!gl.debug_level >= 1
781
          if (!(gl.debug_level >= 1)
780
              && n > PRINTED_POINTS
782
              && n > PRINTED_POINTS
781
              && n < scandata_count - PRINTED_POINTS)
783
              && n < scandata_count - PRINTED_POINTS)
782
            continue;
784
            continue;
Lines 787-793 Link Here
787
789
788
          free(psz_msf);
790
          free(psz_msf);
789
791
790
          if (!gl.debug_level >= 1
792
          if (!(gl.debug_level >= 1)
791
              && n == PRINTED_POINTS
793
              && n == PRINTED_POINTS
792
              && scandata_count > (PRINTED_POINTS * 2))
794
              && scandata_count > (PRINTED_POINTS * 2))
793
            fprintf (stdout, " [..skipping...]\n");
795
            fprintf (stdout, " [..skipping...]\n");
Lines 795-810 Link Here
795
    }
797
    }
796
  else if (_sd1->version == SCANDATA_VERSION_SVCD)
798
  else if (_sd1->version == SCANDATA_VERSION_SVCD)
797
    {
799
    {
798
      const ScandataDat2_t *_sd2 = 
800
      const ScandataDat2_t *_sd2 =
799
        (const void *) &_sd1->cum_playtimes[track_count];
801
        (const void *) &_sd1->cum_playtimes[track_count];
800
802
801
      const ScandataDat3_t *_sd3 = 
803
      const ScandataDat3_t *_sd3 =
802
        (const void *) &_sd2->spi_indexes[spi_count];
804
        (const void *) &_sd2->spi_indexes[spi_count];
803
805
804
      const ScandataDat4_t *_sd4 = 
806
      const ScandataDat4_t *_sd4 =
805
        (const void *) &_sd3->mpeg_track_offsets[track_count];
807
        (const void *) &_sd3->mpeg_track_offsets[track_count];
806
808
807
      const int scandata_ofs0 = 
809
      const int scandata_ofs0 =
808
        __cd_offsetof (ScandataDat3_t, mpeg_track_offsets[track_count])
810
        __cd_offsetof (ScandataDat3_t, mpeg_track_offsets[track_count])
809
        - __cd_offsetof (ScandataDat3_t, mpeg_track_offsets);
811
        - __cd_offsetof (ScandataDat3_t, mpeg_track_offsets);
810
812
Lines 821-847 Link Here
821
          fprintf (stdout, "  cumulative_playingtime[%d]: %s\n", n, psz_msf);
823
          fprintf (stdout, "  cumulative_playingtime[%d]: %s\n", n, psz_msf);
822
          free(psz_msf);
824
          free(psz_msf);
823
        }
825
        }
824
 
826
825
      for (n = 0; n < spi_count; n++)
827
      for (n = 0; n < spi_count; n++)
826
        {
828
        {
827
          const int _ofs = uint16_from_be (_sd2->spi_indexes[n]);
829
          const int _ofs = uint16_from_be (_sd2->spi_indexes[n]);
828
830
829
          fprintf (stdout, "  segment scandata ofs[n]: %d\n", _ofs);
831
          fprintf (stdout, "  segment scandata ofs[n]: %d\n", _ofs);
830
        }
832
        }
831
 
833
832
      fprintf (stdout, " sequence scandata ofs: %d\n",
834
      fprintf (stdout, " sequence scandata ofs: %d\n",
833
               uint16_from_be (_sd3->mpegtrack_start_index));
835
               uint16_from_be (_sd3->mpegtrack_start_index));
834
836
835
      for (n = 0; n < track_count; n++)
837
      for (n = 0; n < track_count; n++)
836
        {
838
        {
837
          const int _ofs = 
839
          const int _ofs =
838
            uint16_from_be (_sd3->mpeg_track_offsets[n].table_offset);
840
            uint16_from_be (_sd3->mpeg_track_offsets[n].table_offset);
839
          const int _toc = _sd3->mpeg_track_offsets[n].track_num;
841
          const int _toc = _sd3->mpeg_track_offsets[n].track_num;
840
842
841
          fprintf (stdout, "  track [%d]: TOC num: %d, sd offset: %d\n",
843
          fprintf (stdout, "  track [%d]: TOC num: %d, sd offset: %d\n",
842
                   n, _toc, _ofs);
844
                   n, _toc, _ofs);
843
        }
845
        }
844
  
846
845
      fprintf (stdout, " (scanpoint[0] offset = %d)\n", scandata_ofs0);
847
      fprintf (stdout, " (scanpoint[0] offset = %d)\n", scandata_ofs0);
846
848
847
      for (n = 0; n < scandata_count; n++)
849
      for (n = 0; n < scandata_count; n++)
Lines 850-870 Link Here
850
          const uint32_t lsn = cdio_msf_to_lsn(msf);
852
          const uint32_t lsn = cdio_msf_to_lsn(msf);
851
          char *psz_msf = cdio_msf_to_str(msf);
853
          char *psz_msf = cdio_msf_to_str(msf);
852
854
853
          if (!gl.debug_level >= 1
855
          if (!(gl.debug_level >= 1)
854
              && n > PRINTED_POINTS
856
              && n > PRINTED_POINTS
855
              && n < scandata_count - PRINTED_POINTS) {
857
              && n < scandata_count - PRINTED_POINTS) {
856
            free(psz_msf);
858
            free(psz_msf);
857
            continue;
859
            continue;
858
          }
860
          }
859
          
860
861
861
          fprintf (stdout, 
862
863
          fprintf (stdout,
862
                   "  scanpoint[%.4d] (ofs:%5d): LSN %lu (MSF %s)\n",
864
                   "  scanpoint[%.4d] (ofs:%5d): LSN %lu (MSF %s)\n",
863
                   n, scandata_ofs0 + (n * 3), (unsigned long int) lsn, 
865
                   n, scandata_ofs0 + (n * 3), (unsigned long int) lsn,
864
                   psz_msf);
866
                   psz_msf);
865
          free(psz_msf);
867
          free(psz_msf);
866
868
867
          if (!gl.debug_level >= 1
869
          if (!(gl.debug_level >= 1)
868
              && n == PRINTED_POINTS
870
              && n == PRINTED_POINTS
869
              && scandata_count > (PRINTED_POINTS * 2))
871
              && scandata_count > (PRINTED_POINTS * 2))
870
            fprintf (stdout, " [..skipping...]\n");
872
            fprintf (stdout, " [..skipping...]\n");
Lines 885-891 Link Here
885
  fprintf (stdout, " ID: `%.8s'\n", searchdat->file_id);
887
  fprintf (stdout, " ID: `%.8s'\n", searchdat->file_id);
886
  fprintf (stdout, " version: 0x%2.2x\n", searchdat->version);
888
  fprintf (stdout, " version: 0x%2.2x\n", searchdat->version);
887
  fprintf (stdout, " scanpoints: %u\n", (unsigned int) scan_points);
889
  fprintf (stdout, " scanpoints: %u\n", (unsigned int) scan_points);
888
  fprintf (stdout, " scaninterval: %lu (in 0.5sec units -- must be `1')\n", 
890
  fprintf (stdout, " scaninterval: %lu (in 0.5sec units -- must be `1')\n",
889
           (unsigned long int) searchdat->time_interval);
891
           (unsigned long int) searchdat->time_interval);
890
892
891
  for (m = 0; m < scan_points;m++)
893
  for (m = 0; m < scan_points;m++)
Lines 895-905 Link Here
895
      const uint32_t lsn = cdio_msf_to_lsn(msf);
897
      const uint32_t lsn = cdio_msf_to_lsn(msf);
896
      char *psz_msf;
898
      char *psz_msf;
897
899
898
      if (!gl.debug_level >= 1 
900
      if (!(gl.debug_level >= 1)
899
          && m > PRINTED_POINTS 
901
          && m > PRINTED_POINTS
900
          && m < (scan_points - PRINTED_POINTS))
902
          && m < (scan_points - PRINTED_POINTS))
901
        continue;
903
        continue;
902
      
904
903
      psz_msf = cdio_msf_to_str(msf);
905
      psz_msf = cdio_msf_to_str(msf);
904
      ss2 = m * searchdat->time_interval;
906
      ss2 = m * searchdat->time_interval;
905
907
Lines 912-919 Link Here
912
               " sector: LSN %lu (MSF %s)\n", m, hh, mm, ss, ss2,
914
               " sector: LSN %lu (MSF %s)\n", m, hh, mm, ss, ss2,
913
               (unsigned long int) lsn, psz_msf);
915
               (unsigned long int) lsn, psz_msf);
914
      free(psz_msf);
916
      free(psz_msf);
915
      
917
916
      if (!gl.debug_level >= 1
918
      if (!(gl.debug_level >= 1)
917
          && m == PRINTED_POINTS && scan_points > (PRINTED_POINTS * 2))
919
          && m == PRINTED_POINTS && scan_points > (PRINTED_POINTS * 2))
918
        fprintf (stdout, " [..skipping...]\n");
920
        fprintf (stdout, " [..skipping...]\n");
919
    }
921
    }
Lines 928-941 Link Here
928
  CdioListNode_t *entnode;
930
  CdioListNode_t *entnode;
929
  CdIo_t *cdio = vcdinfo_get_cd_image(obj);
931
  CdIo_t *cdio = vcdinfo_get_cd_image(obj);
930
932
931
  entlist = iso9660_fs_readdir (cdio, pathname, true);
933
  entlist = iso9660_fs_readdir (cdio, pathname);
932
    
934
933
  fprintf (stdout, " %s:\n", pathname);
935
  fprintf (stdout, " %s:\n", pathname);
934
936
935
  vcd_assert (entlist != NULL);
937
  vcd_assert (entlist != NULL);
936
938
937
  /* just iterate */
939
  /* just iterate */
938
  
940
939
  _CDIO_LIST_FOREACH (entnode, entlist)
941
  _CDIO_LIST_FOREACH (entnode, entlist)
940
    {
942
    {
941
      iso9660_stat_t *statbuf = _cdio_list_node_data (entnode);
943
      iso9660_stat_t *statbuf = _cdio_list_node_data (entnode);
Lines 943-957 Link Here
943
      char _fullname[4096] = { 0, };
945
      char _fullname[4096] = { 0, };
944
946
945
      snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, _name);
947
      snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, _name);
946
  
948
947
      strncat (_fullname, "/", sizeof (_fullname)-strlen(_fullname)-1);
949
      strncat (_fullname, "/", sizeof (_fullname)-strlen(_fullname)-1);
948
950
949
      if (statbuf->type == _STAT_DIR
951
      if (statbuf->type == _STAT_DIR
950
          && strcmp (_name, ".") 
952
          && strcmp (_name, ".")
951
          && strcmp (_name, ".."))
953
          && strcmp (_name, ".."))
952
        _cdio_list_append (dirlist, strdup (_fullname));
954
        _cdio_list_append (dirlist, strdup (_fullname));
953
955
954
      fprintf (stdout, 
956
      fprintf (stdout,
955
               "  %c %s %d %d [fn %.2d] [LSN %6lu] ",
957
               "  %c %s %d %d [fn %.2d] [LSN %6lu] ",
956
               (statbuf->type == _STAT_DIR) ? 'd' : '-',
958
               (statbuf->type == _STAT_DIR) ? 'd' : '-',
957
               iso9660_get_xa_attr_str (statbuf->xa.attributes),
959
               iso9660_get_xa_attr_str (statbuf->xa.attributes),
Lines 971-977 Link Here
971
973
972
    }
974
    }
973
975
974
  _cdio_list_free (entlist, true);
976
  _cdio_list_free (entlist, true, NULL);
975
977
976
  fprintf (stdout, "\n");
978
  fprintf (stdout, "\n");
977
979
Lines 984-990 Link Here
984
      _dump_fs_recurse (obj, _fullname);
986
      _dump_fs_recurse (obj, _fullname);
985
    }
987
    }
986
988
987
  _cdio_list_free (dirlist, true);
989
  _cdio_list_free (dirlist, true, NULL);
988
}
990
}
989
991
990
static void
992
static void
Lines 994-1000 Link Here
994
  const lsn_t extent = iso9660_get_root_lsn(pvd);
996
  const lsn_t extent = iso9660_get_root_lsn(pvd);
995
997
996
  fprintf (stdout, "ISO9660 filesystem dump\n");
998
  fprintf (stdout, "ISO9660 filesystem dump\n");
997
  fprintf (stdout, " root directory in PVD set to LSN %lu\n\n", 
999
  fprintf (stdout, " root directory in PVD set to LSN %lu\n\n",
998
           (unsigned long int) extent);
1000
           (unsigned long int) extent);
999
1001
1000
  _dump_fs_recurse (obj, "/");
1002
  _dump_fs_recurse (obj, "/");
Lines 1008-1021 Link Here
1008
  if (!gl.show.no.header)
1010
  if (!gl.show.no.header)
1009
    fprintf (stdout, "ISO9660 primary volume descriptor\n");
1011
    fprintf (stdout, "ISO9660 primary volume descriptor\n");
1010
1012
1011
  
1013
1012
  if (iso9660_get_pvd_type(pvd) != ISO_VD_PRIMARY)
1014
  if (iso9660_get_pvd_type(pvd) != ISO_VD_PRIMARY)
1013
    vcd_warn ("unexpected descriptor type");
1015
    vcd_warn ("unexpected descriptor type");
1014
1016
1015
  if (strncmp (iso9660_get_pvd_id(pvd), ISO_STANDARD_ID, 
1017
  if (strncmp (iso9660_get_pvd_id(pvd), ISO_STANDARD_ID,
1016
               strlen (ISO_STANDARD_ID)))
1018
               strlen (ISO_STANDARD_ID)))
1017
    vcd_warn ("unexpected ID encountered (expected `" ISO_STANDARD_ID "'");
1019
    vcd_warn ("unexpected ID encountered (expected `" ISO_STANDARD_ID "'");
1018
  
1020
1019
  if (gl.show.pvd.id)
1021
  if (gl.show.pvd.id)
1020
    fprintf (stdout, " ID: `%.5s'\n", iso9660_get_pvd_id(pvd));
1022
    fprintf (stdout, " ID: `%.5s'\n", iso9660_get_pvd_id(pvd));
1021
1023
Lines 1027-1033 Link Here
1027
    fprintf (stdout, " system id: `%s'\n",    psz);
1029
    fprintf (stdout, " system id: `%s'\n",    psz);
1028
    free(psz);
1030
    free(psz);
1029
  }
1031
  }
1030
  
1032
1031
1033
1032
  if (gl.show.pvd.vol)
1034
  if (gl.show.pvd.vol)
1033
    fprintf (stdout, " volume id: `%s'\n",
1035
    fprintf (stdout, " volume id: `%s'\n",
Lines 1054-1067 Link Here
1054
    fprintf (stdout, " application id: `%s'\n", psz);
1056
    fprintf (stdout, " application id: `%s'\n", psz);
1055
    free(psz);
1057
    free(psz);
1056
  }
1058
  }
1057
  
1059
1058
  if (gl.show.pvd.iso)
1060
  if (gl.show.pvd.iso)
1059
    fprintf (stdout, " ISO size: %d blocks (logical blocksize: %d bytes)\n", 
1061
    fprintf (stdout, " ISO size: %d blocks (logical blocksize: %d bytes)\n",
1060
             iso9660_get_pvd_space_size(pvd), 
1062
             iso9660_get_pvd_space_size(pvd),
1061
             iso9660_get_pvd_block_size(pvd));
1063
             iso9660_get_pvd_block_size(pvd));
1062
1064
1063
  if (gl.show.pvd.xa) 
1065
  if (gl.show.pvd.xa)
1064
    fprintf (stdout, " XA marker present: %s\n", 
1066
    fprintf (stdout, " XA marker present: %s\n",
1065
             _vcd_bool_str (vcdinfo_has_xa(p_vcdinfo)));
1067
             _vcd_bool_str (vcdinfo_has_xa(p_vcdinfo)));
1066
}
1068
}
1067
1069
Lines 1071-1104 Link Here
1071
  CdIo_t *p_cdio;
1073
  CdIo_t *p_cdio;
1072
1074
1073
  if (!p_vcdinfo) return;
1075
  if (!p_vcdinfo) return;
1074
  
1076
1075
  p_cdio = vcdinfo_get_cd_image(p_vcdinfo);
1077
  p_cdio = vcdinfo_get_cd_image(p_vcdinfo);
1076
1078
1077
  if (gl.show.pvd.any) 
1079
  if (gl.show.pvd.any)
1078
    {
1080
    {
1079
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1081
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1080
      dump_pvd (p_vcdinfo);
1082
      dump_pvd (p_vcdinfo);
1081
    }
1083
    }
1082
  
1084
1083
  if (gl.show.fs) 
1085
  if (gl.show.fs)
1084
    {
1086
    {
1085
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1087
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1086
      dump_fs (p_vcdinfo);
1088
      dump_fs (p_vcdinfo);
1087
    }
1089
    }
1088
1090
1089
  if (gl.show.info.any) 
1091
  if (gl.show.info.any)
1090
    {
1092
    {
1091
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1093
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1092
      dump_info (p_vcdinfo);
1094
      dump_info (p_vcdinfo);
1093
    }
1095
    }
1094
  
1096
1095
  if (gl.show.entries.any) 
1097
  if (gl.show.entries.any)
1096
    {
1098
    {
1097
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1099
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1098
      dump_entries (p_vcdinfo);
1100
      dump_entries (p_vcdinfo);
1099
    }
1101
    }
1100
1102
1101
  if (gl.show.psd) 
1103
  if (gl.show.psd)
1102
    {
1104
    {
1103
      if (vcdinfo_get_psd_size (p_vcdinfo))
1105
      if (vcdinfo_get_psd_size (p_vcdinfo))
1104
        {
1106
        {
Lines 1108-1122 Link Here
1108
              if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1110
              if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1109
              dump_lot (p_vcdinfo, false);
1111
              dump_lot (p_vcdinfo, false);
1110
            }
1112
            }
1111
          
1113
1112
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1114
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1113
          dump_psd (p_vcdinfo, false);
1115
          dump_psd (p_vcdinfo, false);
1114
        }
1116
        }
1115
      
1117
1116
      if (vcdinfo_get_psd_x_size(p_vcdinfo) && ! gl.no_ext_psd_flag )
1118
      if (vcdinfo_get_psd_x_size(p_vcdinfo) && ! gl.no_ext_psd_flag )
1117
        {
1119
        {
1118
          vcdinfo_visit_lot (p_vcdinfo, true);
1120
          vcdinfo_visit_lot (p_vcdinfo, true);
1119
          if (gl.show.lot) 
1121
          if (gl.show.lot)
1120
            {
1122
            {
1121
              if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1123
              if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1122
              dump_lot (p_vcdinfo, true);
1124
              dump_lot (p_vcdinfo, true);
Lines 1126-1143 Link Here
1126
        }
1128
        }
1127
    }
1129
    }
1128
1130
1129
  if (gl.show.tracks) 
1131
  if (gl.show.tracks)
1130
    {
1132
    {
1131
      if (vcdinfo_get_tracksSVD(p_vcdinfo))
1133
      if (vcdinfo_get_tracksSVD(p_vcdinfo))
1132
        {
1134
        {
1133
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1135
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1134
          dump_tracks_svd (p_vcdinfo);
1136
          dump_tracks_svd (p_vcdinfo);
1135
        } 
1137
        }
1136
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1138
      if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1137
      dump_tracks (p_cdio);
1139
      dump_tracks (p_cdio);
1138
    }
1140
    }
1139
  
1141
1140
  if (gl.show.search) 
1142
  if (gl.show.search)
1141
    {
1143
    {
1142
      if (vcdinfo_get_searchDat(p_vcdinfo))
1144
      if (vcdinfo_get_searchDat(p_vcdinfo))
1143
        {
1145
        {
Lines 1145-1160 Link Here
1145
          dump_search_dat (p_vcdinfo);
1147
          dump_search_dat (p_vcdinfo);
1146
        }
1148
        }
1147
    }
1149
    }
1148
  
1149
1150
1150
  if (gl.show.scandata) 
1151
1152
  if (gl.show.scandata)
1151
    {
1153
    {
1152
      if (vcdinfo_get_scandata(p_vcdinfo))
1154
      if (vcdinfo_get_scandata(p_vcdinfo))
1153
        {
1155
        {
1154
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1156
          if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1155
          dump_scandata_dat (p_vcdinfo);
1157
          dump_scandata_dat (p_vcdinfo);
1156
        }
1158
        }
1157
      
1159
1158
    }
1160
    }
1159
  if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1161
  if (!gl.show.no.delimiter) fprintf (stdout, DELIM);
1160
1162
Lines 1168-1174 Link Here
1168
  CdIo_t *p_cdio;
1170
  CdIo_t *p_cdio;
1169
  iso9660_stat_t *p_statbuf;
1171
  iso9660_stat_t *p_statbuf;
1170
  vcdinfo_open_return_t open_rc;
1172
  vcdinfo_open_return_t open_rc;
1171
  
1173
1172
  if (!gl.show.no.banner)
1174
  if (!gl.show.no.banner)
1173
    {
1175
    {
1174
      if (!gl.show.no.delimiter)
1176
      if (!gl.show.no.delimiter)
Lines 1201-1207 Link Here
1201
1203
1202
  size = cdio_get_disc_last_lsn (p_cdio);
1204
  size = cdio_get_disc_last_lsn (p_cdio);
1203
1205
1204
  if (gl.show.source) 
1206
  if (gl.show.source)
1205
    {
1207
    {
1206
      if (NULL == *image_fname) {
1208
      if (NULL == *image_fname) {
1207
        *image_fname = vcdinfo_get_default_device(obj);
1209
        *image_fname = vcdinfo_get_default_device(obj);
Lines 1211-1220 Link Here
1211
      }
1213
      }
1212
      fprintf (stdout, "Image size: %d sectors\n", size);
1214
      fprintf (stdout, "Image size: %d sectors\n", size);
1213
    }
1215
    }
1214
    
1216
1215
  if (open_rc == VCDINFO_OPEN_OTHER) {
1217
  if (open_rc == VCDINFO_OPEN_OTHER) {
1216
    vcd_warn ("Medium is not VCD image");
1218
    vcd_warn ("Medium is not VCD image");
1217
    if (gl.show.fs) 
1219
    if (gl.show.fs)
1218
      {
1220
      {
1219
        if (vcdinfo_has_xa(obj))
1221
        if (vcdinfo_has_xa(obj))
1220
        {
1222
        {
Lines 1246-1255 Link Here
1246
  if (vcdinfo_read_psd (obj))
1248
  if (vcdinfo_read_psd (obj))
1247
    {
1249
    {
1248
      /* ISO9660 crosscheck */
1250
      /* ISO9660 crosscheck */
1249
      p_statbuf = iso9660_fs_stat (p_cdio, 
1251
      p_statbuf = iso9660_fs_stat (p_cdio,
1250
                                 ((vcdinfo_get_VCD_type(obj) == VCD_TYPE_SVCD 
1252
                                 ((vcdinfo_get_VCD_type(obj) == VCD_TYPE_SVCD
1251
                             || vcdinfo_get_VCD_type(obj) == VCD_TYPE_HQVCD)
1253
                             || vcdinfo_get_VCD_type(obj) == VCD_TYPE_HQVCD)
1252
                                  ? "/SVCD/PSD.SVD;1" 
1254
                                  ? "/SVCD/PSD.SVD;1"
1253
                                  : "/VCD/PSD.VCD;1"));
1255
                                  : "/VCD/PSD.VCD;1"));
1254
      if (!p_statbuf)
1256
      if (!p_statbuf)
1255
        vcd_warn ("no PSD file entry found in ISO9660 fs");
1257
        vcd_warn ("no PSD file entry found in ISO9660 fs");
Lines 1260-1272 Link Here
1260
          vcd_warn ("psd file entry in ISO9660 not at fixed LSN");
1262
          vcd_warn ("psd file entry in ISO9660 not at fixed LSN");
1261
        free(p_statbuf);
1263
        free(p_statbuf);
1262
      }
1264
      }
1263
          
1265
1264
    }
1266
    }
1265
1267
1266
  dump_all (obj);
1268
  dump_all (obj);
1267
  vcdinfo_close(obj);
1269
  vcdinfo_close(obj);
1268
  return;
1270
  return;
1269
  
1271
1270
 err_exit:
1272
 err_exit:
1271
  poptFreeContext(optCon);
1273
  poptFreeContext(optCon);
1272
  exit (EXIT_FAILURE);
1274
  exit (EXIT_FAILURE);
Lines 1275-1292 Link Here
1275
static vcd_log_handler_t  gl_default_vcd_log_handler  = NULL;
1277
static vcd_log_handler_t  gl_default_vcd_log_handler  = NULL;
1276
static cdio_log_handler_t gl_default_cdio_log_handler = NULL;
1278
static cdio_log_handler_t gl_default_cdio_log_handler = NULL;
1277
1279
1278
static void 
1280
static void
1279
_vcd_log_handler (vcd_log_level_t level, const char message[])
1281
_vcd_log_handler (vcd_log_level_t level, const char message[])
1280
{
1282
{
1281
  if (level == VCD_LOG_DEBUG && !gl.debug_level >= 1)
1283
  if (level == VCD_LOG_DEBUG && !(gl.debug_level >= 1))
1282
    return;
1284
    return;
1283
1285
1284
  if (level == VCD_LOG_INFO && gl.quiet_flag)
1286
  if (level == VCD_LOG_INFO && gl.quiet_flag)
1285
    return;
1287
    return;
1286
  
1288
1287
  if (level == VCD_LOG_WARN && gl.suppress_warnings)
1289
  if (level == VCD_LOG_WARN && gl.suppress_warnings)
1288
    return;
1290
    return;
1289
  
1291
1290
  gl_default_vcd_log_handler (level, message);
1292
  gl_default_vcd_log_handler (level, message);
1291
}
1293
}
1292
1294
Lines 1302-1315 Link Here
1302
  OP_SOURCE_SECTOR_2336,
1304
  OP_SOURCE_SECTOR_2336,
1303
1305
1304
  /* These are the remaining configuration options */
1306
  /* These are the remaining configuration options */
1305
  OP_VERSION,       OP_ENTRIES,   OP_INFO,      OP_PVD,       OP_SHOW, 
1307
  OP_VERSION,       OP_ENTRIES,   OP_INFO,      OP_PVD,       OP_SHOW,
1306
  OP_ACCESS_MODE
1308
  OP_ACCESS_MODE
1307
1309
1308
};
1310
};
1309
1311
1310
/* Initialize global variables. */
1312
/* Initialize global variables. */
1311
static void 
1313
static void
1312
init() 
1314
init()
1313
{
1315
{
1314
  gl.debug_level      = 0;
1316
  gl.debug_level      = 0;
1315
  gl.quiet_flag       = false;
1317
  gl.quiet_flag       = false;
Lines 1334-1356 Link Here
1334
1336
1335
/* Comparison function called by bearch() to find sub-option record. */
1337
/* Comparison function called by bearch() to find sub-option record. */
1336
static int
1338
static int
1337
compare_subopts(const void *key1, const void *key2) 
1339
compare_subopts(const void *key1, const void *key2)
1338
{
1340
{
1339
  subopt_entry_t *a = (subopt_entry_t *) key1;
1341
  subopt_entry_t *a = (subopt_entry_t *) key1;
1340
  subopt_entry_t *b = (subopt_entry_t *) key2;
1342
  subopt_entry_t *b = (subopt_entry_t *) key2;
1341
  return (strncmp(a->name, b->name, 30));
1343
  return (strncmp(a->name, b->name, 30));
1342
}
1344
}
1343
1345
1344
/* Do processing of a --show-xxx sub option. 
1346
/* Do processing of a --show-xxx sub option.
1345
   Basically we find the option in the array, set it's corresponding
1347
   Basically we find the option in the array, set it's corresponding
1346
   flag variable to true as well as the "show.all" false. 
1348
   flag variable to true as well as the "show.all" false.
1347
*/
1349
*/
1348
static void
1350
static void
1349
process_suboption(const char *subopt, subopt_entry_t *sublist, const int num,
1351
process_suboption(const char *subopt, subopt_entry_t *sublist, const int num,
1350
                  const char *subopt_name, int *any_flag) 
1352
                  const char *subopt_name, int *any_flag)
1351
{
1353
{
1352
  subopt_entry_t *subopt_rec = 
1354
  subopt_entry_t *subopt_rec =
1353
    bsearch(subopt, sublist, num, sizeof(subopt_entry_t), 
1355
    bsearch(subopt, sublist, num, sizeof(subopt_entry_t),
1354
            &compare_subopts);
1356
            &compare_subopts);
1355
  if (subopt_rec != NULL) {
1357
  if (subopt_rec != NULL) {
1356
    if (strcmp(subopt_name, "help") != 0) {
1358
    if (strcmp(subopt_name, "help") != 0) {
Lines 1363-1372 Link Here
1363
    unsigned int i;
1365
    unsigned int i;
1364
    bool is_help=strcmp(subopt, "help")==0;
1366
    bool is_help=strcmp(subopt, "help")==0;
1365
    if (is_help) {
1367
    if (is_help) {
1366
      fprintf (stderr, "The list of sub options for \"%s\" are:\n", 
1368
      fprintf (stderr, "The list of sub options for \"%s\" are:\n",
1367
               subopt_name);
1369
               subopt_name);
1368
    } else {
1370
    } else {
1369
      fprintf (stderr, "Invalid option following \"%s\": %s.\n", 
1371
      fprintf (stderr, "Invalid option following \"%s\": %s.\n",
1370
               subopt_name, subopt);
1372
               subopt_name, subopt);
1371
      fprintf (stderr, "Should be one of: ");
1373
      fprintf (stderr, "Should be one of: ");
1372
    }
1374
    }
Lines 1393-1490 Link Here
1393
  /* Command-line options */
1395
  /* Command-line options */
1394
  struct poptOption optionsTable[] = {
1396
  struct poptOption optionsTable[] = {
1395
1397
1396
    {"access-mode", 'a', 
1398
    {"access-mode", 'a',
1397
     POPT_ARG_STRING, &gl.access_mode, 
1399
     POPT_ARG_STRING, &gl.access_mode,
1398
     OP_ACCESS_MODE,
1400
     OP_ACCESS_MODE,
1399
     "set CD-ROM access mode (IOCTL, READ_10, READ_CD)", "ACCESS"},
1401
     "set CD-ROM access mode (IOCTL, READ_10, READ_CD)", "ACCESS"},
1400
1402
1401
    {"bin-file", 'b', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1403
    {"bin-file", 'b', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1402
     OP_SOURCE_BINCUE, "set \"bin\" CD-ROM disk image file as source", "FILE"},
1404
     OP_SOURCE_BINCUE, "set \"bin\" CD-ROM disk image file as source", "FILE"},
1403
1405
1404
    {"cue-file", 'c', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1406
    {"cue-file", 'c', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1405
     OP_SOURCE_BINCUE, "set \"cue\" CD-ROM disk image file as source", "FILE"},
1407
     OP_SOURCE_BINCUE, "set \"cue\" CD-ROM disk image file as source", "FILE"},
1406
1408
1407
    {"nrg-file", 'N', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1409
    {"nrg-file", 'N', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1408
     OP_SOURCE_NRG, "set Nero CD-ROM disk image file as source", "FILE"},
1410
     OP_SOURCE_NRG, "set Nero CD-ROM disk image file as source", "FILE"},
1409
1411
1410
    {"toc-file", '\0', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1412
    {"toc-file", '\0', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1411
     OP_SOURCE_CDRDAO, "set \"toc\" CD-ROM disk image file as source", "FILE"},
1413
     OP_SOURCE_CDRDAO, "set \"toc\" CD-ROM disk image file as source", "FILE"},
1412
1414
1413
    {"input", 'i', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1415
    {"input", 'i', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1414
     OP_SOURCE_UNDEF,
1416
     OP_SOURCE_UNDEF,
1415
     "set source and determine if \"bin\" image or device", "FILE"},
1417
     "set source and determine if \"bin\" image or device", "FILE"},
1416
1418
1417
    {"no-ext-psd", '\0', POPT_ARG_NONE, &gl.no_ext_psd_flag, 0,
1419
    {"no-ext-psd", '\0', POPT_ARG_NONE, &gl.no_ext_psd_flag, 0,
1418
     "ignore information in /EXT/PSD_X.VCD"},
1420
     "ignore information in /EXT/PSD_X.VCD"},
1419
1421
1420
    {"sector-2336", '\0', 
1422
    {"sector-2336", '\0',
1421
     POPT_ARG_NONE, &sector_2336_flag, 
1423
     POPT_ARG_NONE, &sector_2336_flag,
1422
     OP_SOURCE_SECTOR_2336,
1424
     OP_SOURCE_SECTOR_2336,
1423
     "use 2336 byte sector mode for image file"},
1425
     "use 2336 byte sector mode for image file"},
1424
1426
1425
    {"cdrom-device", 'C', 
1427
    {"cdrom-device", 'C',
1426
     POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1428
     POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1427
     OP_SOURCE_DEVICE,
1429
     OP_SOURCE_DEVICE,
1428
     "set CD-ROM device as source", "DEVICE"},
1430
     "set CD-ROM device as source", "DEVICE"},
1429
1431
1430
    {"debug", 'd', POPT_ARG_INT, &gl.debug_level, 0, 
1432
    {"debug", 'd', POPT_ARG_INT, &gl.debug_level, 0,
1431
     "Set debugging output to LEVEL"},
1433
     "Set debugging output to LEVEL"},
1432
1434
1433
    {"terse", 't', POPT_ARG_NONE, &terse_flag, 0, 
1435
    {"terse", 't', POPT_ARG_NONE, &terse_flag, 0,
1434
     "same as --no-header --no-banner --no-delimiter"},
1436
     "same as --no-header --no-banner --no-delimiter"},
1435
1437
1436
    {"no-banner", 'B', POPT_ARG_NONE, &gl.show.no.banner, 0,
1438
    {"no-banner", 'B', POPT_ARG_NONE, &gl.show.no.banner, 0,
1437
     "do not show program banner header and RCS version string"},
1439
     "do not show program banner header and RCS version string"},
1438
    
1440
1439
    {"no-delimiter", 'D', POPT_ARG_NONE, &gl.show.no.delimiter, 0,
1441
    {"no-delimiter", 'D', POPT_ARG_NONE, &gl.show.no.delimiter, 0,
1440
     "do not show delimiter lines around various sections of output"},
1442
     "do not show delimiter lines around various sections of output"},
1441
    
1443
1442
    {"no-header", 'H', POPT_ARG_NONE, &gl.show.no.header, 0,
1444
    {"no-header", 'H', POPT_ARG_NONE, &gl.show.no.header, 0,
1443
     "do not show section header titles"},
1445
     "do not show section header titles"},
1444
    
1446
1445
    {"show-entries", '\0', POPT_ARG_STRING, &opt_arg, OP_ENTRIES, 
1447
    {"show-entries", '\0', POPT_ARG_STRING, &opt_arg, OP_ENTRIES,
1446
     "show specific entry of the ENTRIES section "},
1448
     "show specific entry of the ENTRIES section "},
1447
    
1449
1448
    {"show-entries-all", 'E', POPT_ARG_NONE, &gl.show.entries.all, OP_SHOW, 
1450
    {"show-entries-all", 'E', POPT_ARG_NONE, &gl.show.entries.all, OP_SHOW,
1449
     "show ENTRIES section"},
1451
     "show ENTRIES section"},
1450
    
1452
1451
    {"show-filesystem", 'F', POPT_ARG_NONE, &gl.show.fs, OP_SHOW, 
1453
    {"show-filesystem", 'F', POPT_ARG_NONE, &gl.show.fs, OP_SHOW,
1452
     "show filesystem info"},
1454
     "show filesystem info"},
1453
    
1455
1454
    {"show-info", '\0', POPT_ARG_STRING, &opt_arg, OP_INFO, 
1456
    {"show-info", '\0', POPT_ARG_STRING, &opt_arg, OP_INFO,
1455
     "show specific entry of the INFO section "},
1457
     "show specific entry of the INFO section "},
1456
    
1458
1457
    {"show-info-all", 'I', POPT_ARG_NONE, &gl.show.info.all, OP_SHOW, 
1459
    {"show-info-all", 'I', POPT_ARG_NONE, &gl.show.info.all, OP_SHOW,
1458
     "show INFO section"},
1460
     "show INFO section"},
1459
    
1461
1460
    {"show-lot", 'L', POPT_ARG_NONE, &gl.show.lot, OP_SHOW, 
1462
    {"show-lot", 'L', POPT_ARG_NONE, &gl.show.lot, OP_SHOW,
1461
     "show LOT section"},
1463
     "show LOT section"},
1462
    
1464
1463
    {"show-psd", 'p', POPT_ARG_NONE, &gl.show.psd, OP_SHOW, 
1465
    {"show-psd", 'p', POPT_ARG_NONE, &gl.show.psd, OP_SHOW,
1464
     "show PSD section(s)"},
1466
     "show PSD section(s)"},
1465
    
1467
1466
    {"show-pvd-all", 'P', POPT_ARG_NONE, &gl.show.pvd.all, OP_SHOW, 
1468
    {"show-pvd-all", 'P', POPT_ARG_NONE, &gl.show.pvd.all, OP_SHOW,
1467
     "show PVD section(s)"},
1469
     "show PVD section(s)"},
1468
    
1470
1469
    {"show-pvd", '\0', POPT_ARG_STRING, &opt_arg, OP_PVD, 
1471
    {"show-pvd", '\0', POPT_ARG_STRING, &opt_arg, OP_PVD,
1470
     "show a specific entry of the Primary Volume Descriptor (PVD) section"},
1472
     "show a specific entry of the Primary Volume Descriptor (PVD) section"},
1471
    
1473
1472
    {"show-scandata", 's', POPT_ARG_NONE, &gl.show.scandata, OP_SHOW, 
1474
    {"show-scandata", 's', POPT_ARG_NONE, &gl.show.scandata, OP_SHOW,
1473
     "show scan data"},
1475
     "show scan data"},
1474
1476
1475
    {"show-search", 'X', POPT_ARG_NONE, &gl.show.search, OP_SHOW, 
1477
    {"show-search", 'X', POPT_ARG_NONE, &gl.show.search, OP_SHOW,
1476
     "show search data"},
1478
     "show search data"},
1477
1479
1478
    {"show-source", 'S', POPT_ARG_NONE, &gl.show.source, OP_SHOW, 
1480
    {"show-source", 'S', POPT_ARG_NONE, &gl.show.source, OP_SHOW,
1479
     "show source image filename and size"},
1481
     "show source image filename and size"},
1480
1482
1481
    {"show-tracks", 'T', POPT_ARG_NONE, &gl.show.tracks, OP_SHOW, 
1483
    {"show-tracks", 'T', POPT_ARG_NONE, &gl.show.tracks, OP_SHOW,
1482
     "show tracks"},
1484
     "show tracks"},
1483
1485
1484
    {"show-format", 'f', POPT_ARG_NONE, &gl.show.format, OP_SHOW, 
1486
    {"show-format", 'f', POPT_ARG_NONE, &gl.show.format, OP_SHOW,
1485
     "show VCD format (VCD 1.1, VCD 2.0, SVCD, ...)"},
1487
     "show VCD format (VCD 1.1, VCD 2.0, SVCD, ...)"},
1486
    
1488
1487
    {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0, 
1489
    {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0,
1488
     "show only critical messages"},
1490
     "show only critical messages"},
1489
1491
1490
    {"version", 'V', POPT_ARG_NONE, NULL, OP_VERSION,
1492
    {"version", 'V', POPT_ARG_NONE, NULL, OP_VERSION,
Lines 1550-1570 Link Here
1550
      {
1552
      {
1551
      case OP_ENTRIES:
1553
      case OP_ENTRIES:
1552
        {
1554
        {
1553
          process_suboption(opt_arg, entries_sublist,     
1555
          process_suboption(opt_arg, entries_sublist,
1554
                            sizeof(entries_sublist) / sizeof(subopt_entry_t),
1556
                            sizeof(entries_sublist) / sizeof(subopt_entry_t),
1555
                            "--show-entries", &gl.show.entries.any);
1557
                            "--show-entries", &gl.show.entries.any);
1556
          break;
1558
          break;
1557
        }
1559
        }
1558
      case OP_INFO:
1560
      case OP_INFO:
1559
        {
1561
        {
1560
          process_suboption(opt_arg, info_sublist,     
1562
          process_suboption(opt_arg, info_sublist,
1561
                            sizeof(info_sublist) / sizeof(subopt_entry_t),
1563
                            sizeof(info_sublist) / sizeof(subopt_entry_t),
1562
                            "--show-info", &gl.show.info.any);
1564
                            "--show-info", &gl.show.info.any);
1563
          break;
1565
          break;
1564
        }
1566
        }
1565
      case OP_PVD:
1567
      case OP_PVD:
1566
        {
1568
        {
1567
          process_suboption(opt_arg, pvd_sublist,     
1569
          process_suboption(opt_arg, pvd_sublist,
1568
                            sizeof(pvd_sublist) / sizeof(subopt_entry_t),
1570
                            sizeof(pvd_sublist) / sizeof(subopt_entry_t),
1569
                            "--show-pvd", &gl.show.pvd.any);
1571
                            "--show-pvd", &gl.show.pvd.any);
1570
          break;
1572
          break;
Lines 1584-1593 Link Here
1584
        break;
1586
        break;
1585
1587
1586
      case OP_SOURCE_UNDEF:
1588
      case OP_SOURCE_UNDEF:
1587
      case OP_SOURCE_BINCUE: 
1589
      case OP_SOURCE_BINCUE:
1588
      case OP_SOURCE_CDRDAO: 
1590
      case OP_SOURCE_CDRDAO:
1589
      case OP_SOURCE_NRG: 
1591
      case OP_SOURCE_NRG:
1590
      case OP_SOURCE_DEVICE: 
1592
      case OP_SOURCE_DEVICE:
1591
      case OP_SOURCE_SECTOR_2336:
1593
      case OP_SOURCE_SECTOR_2336:
1592
        {
1594
        {
1593
          /* Check that we didn't speciy both DEVICE and SECTOR */
1595
          /* Check that we didn't speciy both DEVICE and SECTOR */
Lines 1601-1624 Link Here
1601
          case OP_SOURCE_BINCUE:
1603
          case OP_SOURCE_BINCUE:
1602
            /* Going from 2352 (default) to 2336 is okay. */
1604
            /* Going from 2352 (default) to 2336 is okay. */
1603
            okay = OP_SOURCE_SECTOR_2336 == opt;
1605
            okay = OP_SOURCE_SECTOR_2336 == opt;
1604
            if (okay) 
1606
            if (okay)
1605
              gl.source_type = OP_SOURCE_SECTOR_2336;
1607
              gl.source_type = OP_SOURCE_SECTOR_2336;
1606
            break;
1608
            break;
1607
          case OP_SOURCE_SECTOR_2336:
1609
          case OP_SOURCE_SECTOR_2336:
1608
            /* Make sure a we didn't do a second device. FIX: 
1610
            /* Make sure a we didn't do a second device. FIX:
1609
               This also allows two -bin options if we had -2336 in the middle
1611
               This also allows two -bin options if we had -2336 in the middle
1610
             */
1612
             */
1611
            okay = OP_SOURCE_DEVICE != opt;
1613
            okay = OP_SOURCE_DEVICE != opt;
1612
            break;
1614
            break;
1613
          case OP_SOURCE_NRG: 
1615
          case OP_SOURCE_NRG:
1614
          case OP_SOURCE_CDRDAO: 
1616
          case OP_SOURCE_CDRDAO:
1615
          case OP_SOURCE_DEVICE:
1617
          case OP_SOURCE_DEVICE:
1616
            /* This case is implied, but we'll make it explicit anyway. */
1618
            /* This case is implied, but we'll make it explicit anyway. */
1617
            okay = false;
1619
            okay = false;
1618
            break;
1620
            break;
1619
          }
1621
          }
1620
1622
1621
          if (!okay) 
1623
          if (!okay)
1622
          {
1624
          {
1623
            fprintf (stderr, "only one source allowed! - try --help\n");
1625
            fprintf (stderr, "only one source allowed! - try --help\n");
1624
            poptFreeContext(optCon);
1626
            poptFreeContext(optCon);
Lines 1628-1634 Link Here
1628
        }
1630
        }
1629
1631
1630
      default:
1632
      default:
1631
        fprintf (stderr, "%s: %s\n", 
1633
        fprintf (stderr, "%s: %s\n",
1632
                 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
1634
                 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
1633
                 poptStrerror(opt));
1635
                 poptStrerror(opt));
1634
        fprintf (stderr, "error while parsing command line - try --help\n");
1636
        fprintf (stderr, "error while parsing command line - try --help\n");
Lines 1645-1657 Link Here
1645
      }
1647
      }
1646
1648
1647
      if (source_name) {
1649
      if (source_name) {
1648
        fprintf ( stderr, 
1650
        fprintf ( stderr,
1649
                  "source file specified as an option and without "
1651
                  "source file specified as an option and without "
1650
                  " - try --help\n");
1652
                  " - try --help\n");
1651
        poptFreeContext(optCon);
1653
        poptFreeContext(optCon);
1652
        exit (EXIT_FAILURE);
1654
        exit (EXIT_FAILURE);
1653
      }
1655
      }
1654
      
1656
1655
      source_name    = strdup(args[0]);
1657
      source_name    = strdup(args[0]);
1656
      gl.source_type = OP_SOURCE_UNDEF;
1658
      gl.source_type = OP_SOURCE_UNDEF;
1657
    }
1659
    }
Lines 1666-1691 Link Here
1666
1668
1667
  /* Handle massive show flag reversals below. */
1669
  /* Handle massive show flag reversals below. */
1668
  if (gl.show.all) {
1670
  if (gl.show.all) {
1669
    gl.show.entries.all  = gl.show.pvd.all  = gl.show.info.all 
1671
    gl.show.entries.all  = gl.show.pvd.all  = gl.show.info.all
1670
      = gl.show.format   = gl.show.fs       = gl.show.lot    = gl.show.psd
1672
      = gl.show.format   = gl.show.fs       = gl.show.lot    = gl.show.psd
1671
      = gl.show.scandata = gl.show.scandata = gl.show.search = gl.show.source 
1673
      = gl.show.scandata = gl.show.scandata = gl.show.search = gl.show.source
1672
      = gl.show.tracks   = true;
1674
      = gl.show.tracks   = true;
1673
  } 
1675
  }
1674
1676
1675
  if (gl.show.entries.all) 
1677
  if (gl.show.entries.all)
1676
    memset(&gl.show.entries, true, sizeof(gl.show.entries));
1678
    memset(&gl.show.entries, true, sizeof(gl.show.entries));
1677
  
1679
1678
  if (gl.show.pvd.all) 
1680
  if (gl.show.pvd.all)
1679
    memset(&gl.show.pvd, true, sizeof(gl.show.pvd));
1681
    memset(&gl.show.pvd, true, sizeof(gl.show.pvd));
1680
  
1682
1681
  if (gl.show.info.all) 
1683
  if (gl.show.info.all)
1682
    memset(&gl.show.info, true, sizeof(gl.show.info));
1684
    memset(&gl.show.info, true, sizeof(gl.show.info));
1683
  
1685
1684
  if (terse_flag) 
1686
  if (terse_flag)
1685
    memset(&gl.show.no, true, sizeof(gl.show.no));
1687
    memset(&gl.show.no, true, sizeof(gl.show.no));
1686
  
1688
1687
  gl_default_vcd_log_handler  = vcd_log_set_handler (_vcd_log_handler);
1689
  gl_default_vcd_log_handler  = vcd_log_set_handler (_vcd_log_handler);
1688
  gl_default_cdio_log_handler = 
1690
  gl_default_cdio_log_handler =
1689
    cdio_log_set_handler ( (cdio_log_handler_t) _vcd_log_handler);
1691
    cdio_log_set_handler ( (cdio_log_handler_t) _vcd_log_handler);
1690
1692
1691
  dump (&source_name);
1693
  dump (&source_name);
Lines 1694-1701 Link Here
1694
  poptFreeContext(optCon);
1696
  poptFreeContext(optCon);
1695
  return EXIT_SUCCESS;
1697
  return EXIT_SUCCESS;
1696
}
1698
}
1697
1699
1698
/* 
1700
/*
1699
 * Local variables:
1701
 * Local variables:
1700
 *  c-file-style: "gnu"
1702
 *  c-file-style: "gnu"
1701
 *  tab-width: 8
1703
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_build.c (-44 / +51 lines)
Lines 7-13 Link Here
7
    it under the terms of the GNU General Public License as published by
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
9
    (at your option) any later version.
10
    
10
11
    This program is distributed in the hope that it will be useful,
11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 27-34 Link Here
27
#include <string.h>
27
#include <string.h>
28
#include <errno.h>
28
#include <errno.h>
29
29
30
#ifdef HAVE_TIME_H
31
#define __USE_XOPEN
32
#include <time.h>
33
#endif
34
30
#include <popt.h>
35
#include <popt.h>
31
36
37
/* We don't want to pull in cdio's config */
38
#define __CDIO_CONFIG_H__
32
#include <libxml/parserInternals.h>
39
#include <libxml/parserInternals.h>
33
#include <libxml/parser.h>
40
#include <libxml/parser.h>
34
#include <libxml/valid.h>
41
#include <libxml/valid.h>
Lines 60-66 Link Here
60
  _init_done = true;
67
  _init_done = true;
61
68
62
  xmlKeepBlanksDefaultValue = false;
69
  xmlKeepBlanksDefaultValue = false;
63
  xmlIndentTreeOutput = true; 
70
  xmlIndentTreeOutput = true;
64
71
65
  vcd_xml_dtd_init ();
72
  vcd_xml_dtd_init ();
66
}
73
}
Lines 83-94 Link Here
83
  /* assert (_init_done == true); */
90
  /* assert (_init_done == true); */
84
91
85
  ctxt = xmlCreateFileParserCtxt (filename);
92
  ctxt = xmlCreateFileParserCtxt (filename);
86
  
93
87
  if (!ctxt)
94
  if (!ctxt)
88
    return NULL;
95
    return NULL;
89
96
90
  /* ctxt->keepBlanks = false; */
97
  /* ctxt->keepBlanks = false; */
91
  ctxt->pedantic = true; 
98
  ctxt->pedantic = true;
92
  ctxt->validate = true;
99
  ctxt->validate = true;
93
100
94
  if (ctxt->sax)
101
  if (ctxt->sax)
Lines 102-111 Link Here
102
109
103
  ctxt->vctxt.nodeMax = 0;
110
  ctxt->vctxt.nodeMax = 0;
104
111
105
  if (!ctxt->directory 
112
  if (!ctxt->directory
106
      && (directory = xmlParserGetDirectory(filename)))
113
      && (directory = xmlParserGetDirectory(filename)))
107
    ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
114
    ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
108
  
115
109
  xmlParseDocument(ctxt);
116
  xmlParseDocument(ctxt);
110
117
111
  if (ctxt->wellFormed && ctxt->valid)
118
  if (ctxt->wellFormed && ctxt->valid)
Lines 117-123 Link Here
117
    }
124
    }
118
125
119
  xmlFreeParserCtxt(ctxt);
126
  xmlFreeParserCtxt(ctxt);
120
    
127
121
  return(ret);
128
  return(ret);
122
}
129
}
123
130
Lines 171-177 Link Here
171
{
178
{
172
  const char **args = NULL;
179
  const char **args = NULL;
173
  int n, opt = 0;
180
  int n, opt = 0;
174
  enum { 
181
  enum {
175
    CL_VERSION = 1,
182
    CL_VERSION = 1,
176
    CL_IMG_TYPE,
183
    CL_IMG_TYPE,
177
    CL_IMG_OPT,
184
    CL_IMG_OPT,
Lines 183-189 Link Here
183
    CL_DUMP_DTD
190
    CL_DUMP_DTD
184
  };
191
  };
185
  poptContext optCon = NULL;
192
  poptContext optCon = NULL;
186
  struct poptOption optionsTable[] = 
193
  struct poptOption optionsTable[] =
187
    {
194
    {
188
      {"image-type", 'i', POPT_ARG_STRING, NULL, CL_IMG_TYPE,
195
      {"image-type", 'i', POPT_ARG_STRING, NULL, CL_IMG_TYPE,
189
       "specify image type for output (default: '" DEFAULT_IMG_TYPE "')",
196
       "specify image type for output (default: '" DEFAULT_IMG_TYPE "')",
Lines 195-201 Link Here
195
      {"cue-file", 'c', POPT_ARG_STRING, NULL, CL_CUE_FILE,
202
      {"cue-file", 'c', POPT_ARG_STRING, NULL, CL_CUE_FILE,
196
       "specify cue file for output (default: '" DEFAULT_CUE_FILE "')",
203
       "specify cue file for output (default: '" DEFAULT_CUE_FILE "')",
197
       "FILE"},
204
       "FILE"},
198
      
205
199
      {"bin-file", 'b', POPT_ARG_STRING, NULL, CL_BIN_FILE,
206
      {"bin-file", 'b', POPT_ARG_STRING, NULL, CL_BIN_FILE,
200
       "specify bin file for output (default: '" DEFAULT_BIN_FILE "')",
207
       "specify bin file for output (default: '" DEFAULT_BIN_FILE "')",
201
       "FILE"},
208
       "FILE"},
Lines 212-236 Link Here
212
      {"create-time", 'T', POPT_ARG_STRING, &gl.create_timestr, 0,
219
      {"create-time", 'T', POPT_ARG_STRING, &gl.create_timestr, 0,
213
       "specify creation date on files in CD image (default: current date)"},
220
       "specify creation date on files in CD image (default: current date)"},
214
221
215
      {"progress", 'p', POPT_ARG_NONE, &gl.progress_flag, 0,  
222
      {"progress", 'p', POPT_ARG_NONE, &gl.progress_flag, 0,
216
       "show progress"}, 
223
       "show progress"},
217
224
218
      {"dump-dtd", '\0', POPT_ARG_NONE, NULL, CL_DUMP_DTD,
225
      {"dump-dtd", '\0', POPT_ARG_NONE, NULL, CL_DUMP_DTD,
219
       "dump internal DTD to stdout"},
226
       "dump internal DTD to stdout"},
220
227
221
      {"check", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, 
228
      {"check", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
222
       &gl.check_flag, 0, "enable check mode (undocumented)"},
229
       &gl.check_flag, 0, "enable check mode (undocumented)"},
223
230
224
      {"file-prefix", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN,
231
      {"file-prefix", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN,
225
       &gl.file_prefix, 0, "add prefix string to all filenames (undocumented)"}, 
232
       &gl.file_prefix, 0, "add prefix string to all filenames (undocumented)"},
226
233
227
      { "filename-encoding", '\0', POPT_ARG_STRING, &vcd_xml_filename_charset, 0,
234
      { "filename-encoding", '\0', POPT_ARG_STRING, &vcd_xml_filename_charset, 0,
228
        "use given charset encoding for filenames instead of UTF8" },
235
        "use given charset encoding for filenames instead of UTF8" },
229
236
230
      {"verbose", 'v', POPT_ARG_NONE, &gl.verbose_flag, 0, 
237
      {"verbose", 'v', POPT_ARG_NONE, &gl.verbose_flag, 0,
231
       "be verbose"},
238
       "be verbose"},
232
	
239
233
      {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0, 
240
      {"quiet", 'q', POPT_ARG_NONE, &gl.quiet_flag, 0,
234
       "show only critical messages"},
241
       "show only critical messages"},
235
242
236
      {"gui", '\0', POPT_ARG_NONE, &gl.gui_flag, 0, "enable GUI mode"},
243
      {"gui", '\0', POPT_ARG_NONE, &gl.gui_flag, 0, "enable GUI mode"},
Lines 238-244 Link Here
238
      {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
245
      {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
239
       "display version and copyright information and exit"},
246
       "display version and copyright information and exit"},
240
247
241
      POPT_AUTOHELP 
248
      POPT_AUTOHELP
242
249
243
      {NULL, 0, 0, NULL, 0}
250
      {NULL, 0, 0, NULL, 0}
244
    };
251
    };
Lines 246-253 Link Here
246
  optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
253
  optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
247
  poptSetOtherOptionHelp (optCon, "[OPTION...] <xml-control-file>");
254
  poptSetOtherOptionHelp (optCon, "[OPTION...] <xml-control-file>");
248
255
249
  if (poptReadDefaultConfig (optCon, 0)) 
256
  if (poptReadDefaultConfig (optCon, 0))
250
    fprintf (stderr, "warning, reading popt configuration failed\n"); 
257
    fprintf (stderr, "warning, reading popt configuration failed\n");
251
258
252
  while ((opt = poptGetNextOpt (optCon)) != -1)
259
  while ((opt = poptGetNextOpt (optCon)) != -1)
253
    switch (opt)
260
    switch (opt)
Lines 302-308 Link Here
302
309
303
      case CL_IMG_TYPE:
310
      case CL_IMG_TYPE:
304
	opt_arg = poptGetOptArg (optCon);
311
	opt_arg = poptGetOptArg (optCon);
305
	  
312
306
	if (!strcmp (opt_arg, "bincue"))
313
	if (!strcmp (opt_arg, "bincue"))
307
	  gl.img_type = IMG_TYPE_BINCUE;
314
	  gl.img_type = IMG_TYPE_BINCUE;
308
	else if (!strcmp (opt_arg, "cdrdao"))
315
	else if (!strcmp (opt_arg, "cdrdao"))
Lines 317-325 Link Here
317
	{
324
	{
318
	  char buf[1024] = { 0, }, *buf2;
325
	  char buf[1024] = { 0, }, *buf2;
319
	  opt_arg = poptGetOptArg (optCon);
326
	  opt_arg = poptGetOptArg (optCon);
320
	 
327
321
	  strncpy (buf, opt_arg, sizeof (buf));
328
	  strncpy (buf, opt_arg, sizeof (buf));
322
	  
329
323
	  if ((buf2 = strchr (buf, '=')))
330
	  if ((buf2 = strchr (buf, '=')))
324
	    {
331
	    {
325
	      *buf2 = '\0';
332
	      *buf2 = '\0';
Lines 337-343 Link Here
337
344
338
  if (gl.verbose_flag && gl.quiet_flag)
345
  if (gl.verbose_flag && gl.quiet_flag)
339
    vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
346
    vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
340
    
347
341
  if ((args = poptGetArgs (optCon)) == NULL)
348
  if ((args = poptGetArgs (optCon)) == NULL)
342
    vcd_error ("xml input file argument missing -- try --help");
349
    vcd_error ("xml input file argument missing -- try --help");
343
350
Lines 380-402 Link Here
380
  _CDIO_LIST_FOREACH (node, gl.img_options)
387
  _CDIO_LIST_FOREACH (node, gl.img_options)
381
    {
388
    {
382
      struct key_val_t *_cons = _cdio_list_node_data (node);
389
      struct key_val_t *_cons = _cdio_list_node_data (node);
383
      
390
384
      if (vcd_image_sink_set_arg (image_sink, _cons->key, _cons->val))
391
      if (vcd_image_sink_set_arg (image_sink, _cons->key, _cons->val))
385
	vcd_error ("error while setting image option '%s' (key='%s')", 
392
	vcd_error ("error while setting image option '%s' (key='%s')",
386
		   _cons->key, _cons->val);
393
		   _cons->key, _cons->val);
387
    }
394
    }
388
  
395
389
  return image_sink;
396
  return image_sink;
390
}
397
}
391
398
392
int 
399
int
393
main (int argc, const char *argv[])
400
main (int argc, const char *argv[])
394
{
401
{
395
  time_t create_time;
402
  time_t create_time;
396
  xmlDocPtr vcd_doc;
403
  xmlDocPtr vcd_doc;
397
404
398
  memset(&gl, 0, sizeof(gl));
405
  memset(&gl, 0, sizeof(gl));
399
  
406
400
  vcd_xml_progname = "vcdxbuild";
407
  vcd_xml_progname = "vcdxbuild";
401
408
402
  _init_xml ();
409
  _init_xml ();
Lines 449-461 Link Here
449
    VcdImageSink_t *image_sink;
456
    VcdImageSink_t *image_sink;
450
457
451
    vcd_xml_init (&vcdxml);
458
    vcd_xml_init (&vcdxml);
452
    
459
453
    if (!(root = xmlDocGetRootElement (vcd_doc)))
460
    if (!(root = xmlDocGetRootElement (vcd_doc)))
454
      vcd_error ("XML document seems to be empty (no root node found)");
461
      vcd_error ("XML document seems to be empty (no root node found)");
455
462
456
    if (!(ns = xmlSearchNsByHref (vcd_doc, root, (const xmlChar *) VIDEOCD_DTD_XMLNS)))
463
    if (!(ns = xmlSearchNsByHref (vcd_doc, root, (const xmlChar *) VIDEOCD_DTD_XMLNS)))
457
      vcd_error ("Namespace not found in document");
464
      vcd_error ("Namespace not found in document");
458
    
465
459
    if (vcd_xml_parse (&vcdxml, vcd_doc, root, ns))
466
    if (vcd_xml_parse (&vcdxml, vcd_doc, root, ns))
460
      vcd_error ("parsing tree failed");
467
      vcd_error ("parsing tree failed");
461
468
Lines 466-508 Link Here
466
      }
473
      }
467
474
468
    vcdxml.file_prefix = gl.file_prefix;
475
    vcdxml.file_prefix = gl.file_prefix;
469
    
476
470
    create_time = time(NULL);
477
    create_time = time(NULL);
471
    if (gl.create_timestr != NULL) {
478
    if (gl.create_timestr != NULL) {
472
      if (!strcmp (gl.create_timestr, "TESTING")) 
479
      if (!strcmp (gl.create_timestr, "TESTING"))
473
	create_time = 269236800L;
480
	create_time = 269236800L;
474
      else {
481
      else {
475
#ifdef HAVE_STRPTIME
482
#ifdef HAVE_STRPTIME
476
	struct tm tm;
483
	struct tm tm;
477
	
484
478
	if (NULL == strptime(gl.create_timestr, "%Y-%m-%d %H:%M:%S", &tm)) {
485
	if (NULL == strptime(gl.create_timestr, "%Y-%m-%d %H:%M:%S", &tm)) {
479
	  vcd_warn("Trouble converting date string %s using strptime.", 
486
	  vcd_warn("Trouble converting date string %s using strptime.",
480
		   gl.create_timestr);
487
		   gl.create_timestr);
481
	  vcd_warn("String should match %%Y-%%m-%%d %%H:%%M:%%S");
488
	  vcd_warn("String should match %%Y-%%m-%%d %%H:%%M:%%S");
482
	} else {
489
	} else {
483
	  create_time = mktime(&tm);
490
	  create_time = mktime(&tm);
484
	}
491
	}
485
#else 
492
#else
486
	create_time = 269236800L;
493
	create_time = 269236800L;
487
#endif
494
#endif
488
      }
495
      }
489
    }
496
    }
490
  
497
491
    if (vcd_xml_master (&vcdxml, image_sink, &create_time)) {
498
    if (vcd_xml_master (&vcdxml, image_sink, &create_time)) {
492
      vcd_warn ("building videocd failed");
499
      vcd_warn ("building videocd failed");
493
      goto err_exit;
500
      goto err_exit;
494
    }
501
    }
495
    
502
496
    
503
497
    vcd_xml_destroy(&vcdxml);
504
    vcd_xml_destroy(&vcdxml);
498
  } 
505
  }
499
506
500
  xmlFreeDoc (vcd_doc);
507
  xmlFreeDoc (vcd_doc);
501
  free(gl.xml_fname);
508
  free(gl.xml_fname);
502
  _cdio_list_free (gl.img_options, true);
509
  _cdio_list_free (gl.img_options, true, NULL);
503
  return EXIT_SUCCESS;
510
  return EXIT_SUCCESS;
504
 err_exit: 
511
 err_exit:
505
  free(gl.xml_fname);
512
  free(gl.xml_fname);
506
  _cdio_list_free (gl.img_options, true);
513
  _cdio_list_free (gl.img_options, true, NULL);
507
  return EXIT_FAILURE;
514
  return EXIT_FAILURE;
508
}
515
}
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_common.c (-8 / +11 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 25-30 Link Here
25
#include <stdio.h>
25
#include <stdio.h>
26
#include <stdlib.h>
26
#include <stdlib.h>
27
27
28
/* We don't want to pull in cdio's config */
29
#define __CDIO_CONFIG_H__
30
28
/* Private includes */
31
/* Private includes */
29
#include "vcd_assert.h"
32
#include "vcd_assert.h"
30
#include "vcd.h"
33
#include "vcd.h"
Lines 48-54 Link Here
48
51
49
static vcd_log_handler_t __default_vcd_log_handler = 0;
52
static vcd_log_handler_t __default_vcd_log_handler = 0;
50
53
51
static void 
54
static void
52
_vcd_xml_log_handler (vcd_log_level_t level, const char message[])
55
_vcd_xml_log_handler (vcd_log_level_t level, const char message[])
53
{
56
{
54
57
Lines 96-102 Link Here
96
  __default_vcd_log_handler = vcd_log_set_handler (_vcd_xml_log_handler);
99
  __default_vcd_log_handler = vcd_log_set_handler (_vcd_xml_log_handler);
97
}
100
}
98
101
99
int 
102
int
100
vcd_xml_scan_progress_cb (const vcd_mpeg_prog_info_t *info, void *user_data)
103
vcd_xml_scan_progress_cb (const vcd_mpeg_prog_info_t *info, void *user_data)
101
{
104
{
102
  const bool _last = info->current_pos == info->length;
105
  const bool _last = info->current_pos == info->length;
Lines 133-139 Link Here
133
136
134
  if (!vcd_xml_show_progress)
137
  if (!vcd_xml_show_progress)
135
    return 0;
138
    return 0;
136
  
139
137
  if (vcd_xml_gui_mode)
140
  if (vcd_xml_gui_mode)
138
    fprintf (stdout, "<progress operation=\"extract\" id=\"%s\" position=\"%ld\" size=\"%ld\" />\n",
141
    fprintf (stdout, "<progress operation=\"extract\" id=\"%s\" position=\"%ld\" size=\"%ld\" />\n",
139
	     (char *) user_data, info->done, info->total);
142
	     (char *) user_data, info->done, info->total);
Lines 142-148 Link Here
142
      fprintf (stdout, "#extract[%s]: %ld/%ld (%2.0f%%)          \r",
145
      fprintf (stdout, "#extract[%s]: %ld/%ld (%2.0f%%)          \r",
143
	       (char *) user_data, info->done, info->total,
146
	       (char *) user_data, info->done, info->total,
144
	       (double) info->done / info->total * 100);
147
	       (double) info->done / info->total * 100);
145
      
148
146
      if (_last)
149
      if (_last)
147
	{
150
	{
148
	  fflush (stdout);
151
	  fflush (stdout);
Lines 173-179 Link Here
173
	       info->in_track, info->total_tracks, info->sectors_written,
176
	       info->in_track, info->total_tracks, info->sectors_written,
174
	       info->total_sectors,
177
	       info->total_sectors,
175
	       (double) info->sectors_written / info->total_sectors * 100);
178
	       (double) info->sectors_written / info->total_sectors * 100);
176
      
179
177
      if (_last)
180
      if (_last)
178
	{
181
	{
179
	  fflush (stdout);
182
	  fflush (stdout);
Lines 243-254 Link Here
243
246
244
  temp = size - 1;
247
  temp = size - 1;
245
  if (from) {
248
  if (from) {
246
    if (NULL != handler->output)  
249
    if (NULL != handler->output)
247
      ret = handler->output (out, &out_size, (const unsigned char *) in, &temp);
250
      ret = handler->output (out, &out_size, (const unsigned char *) in, &temp);
248
    else
251
    else
249
      return strdup(in);
252
      return strdup(in);
250
  } else {
253
  } else {
251
    if (NULL != handler->input)  
254
    if (NULL != handler->input)
252
      ret = handler->input (out, &out_size, (const unsigned char *) in, &temp);
255
      ret = handler->input (out, &out_size, (const unsigned char *) in, &temp);
253
    else
256
    else
254
      return strdup(in);
257
      return strdup(in);
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_common.h (-1 / +1 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_XML_COMMON_H__
21
#ifndef __VCD_XML_COMMON_H__
22
#define __VCD_XML_COMMON_H__
22
#define __VCD_XML_COMMON_H__
23
23
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_dtd.c (-13 / +13 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 43-55 Link Here
43
43
44
static xmlExternalEntityLoader _xmlExternalEntityLoaderDefault = 0;
44
static xmlExternalEntityLoader _xmlExternalEntityLoaderDefault = 0;
45
45
46
static xmlParserInputPtr 
46
static xmlParserInputPtr
47
_xmlExternalEntityLoader (const char *sysid, const char *pubid, 
47
_xmlExternalEntityLoader (const char *sysid, const char *pubid,
48
			  xmlParserCtxtPtr context)
48
			  xmlParserCtxtPtr context)
49
{
49
{
50
  vcd_assert (vcd_xml_dtd_loaded >= 0);
50
  vcd_assert (vcd_xml_dtd_loaded >= 0);
51
51
52
  vcd_debug ("EEL sysid=[%s] pubid=[%s]", 
52
  vcd_debug ("EEL sysid=[%s] pubid=[%s]",
53
	     sysid ? sysid : "NULL", pubid ? pubid : "NULL");
53
	     sysid ? sysid : "NULL", pubid ? pubid : "NULL");
54
54
55
  if ((pubid && !strcmp (pubid, VIDEOCD_DTD_PUBID))
55
  if ((pubid && !strcmp (pubid, VIDEOCD_DTD_PUBID))
Lines 57-86 Link Here
57
    {
57
    {
58
      xmlParserInputBufferPtr _input_buf;
58
      xmlParserInputBufferPtr _input_buf;
59
59
60
      _input_buf = xmlParserInputBufferCreateMem (videocd_dtd, 
60
      _input_buf = xmlParserInputBufferCreateMem (videocd_dtd,
61
						  strlen (videocd_dtd),
61
						  strlen (videocd_dtd),
62
						  XML_CHAR_ENCODING_8859_1);
62
						  XML_CHAR_ENCODING_8859_1);
63
      
63
64
      vcd_xml_dtd_loaded++;
64
      vcd_xml_dtd_loaded++;
65
65
66
      return xmlNewIOInputStream (context, _input_buf, 
66
      return xmlNewIOInputStream (context, _input_buf,
67
				  XML_CHAR_ENCODING_8859_1);
67
				  XML_CHAR_ENCODING_8859_1);
68
    }
68
    }
69
  
69
70
  /*   fprintf (stderr, "unsupported doctype (pubid: %s, sysid: %s) encountered\n", */
70
  /*   fprintf (stderr, "unsupported doctype (pubid: %s, sysid: %s) encountered\n", */
71
  /* 	   pubid, sysid); */
71
  /* 	   pubid, sysid); */
72
  
72
73
  /* exit (EXIT_FAILURE); */
73
  /* exit (EXIT_FAILURE); */
74
74
75
  return _xmlExternalEntityLoaderDefault (sysid, pubid, context); 
75
  return _xmlExternalEntityLoaderDefault (sysid, pubid, context);
76
}
76
}
77
77
78
void 
78
void
79
vcd_xml_dtd_init (void)
79
vcd_xml_dtd_init (void)
80
{
80
{
81
  vcd_assert (vcd_xml_dtd_loaded == -1);
81
  vcd_assert (vcd_xml_dtd_loaded == -1);
82
  
82
83
  _xmlExternalEntityLoaderDefault = xmlGetExternalEntityLoader (); 
83
  _xmlExternalEntityLoaderDefault = xmlGetExternalEntityLoader ();
84
  xmlSetExternalEntityLoader (_xmlExternalEntityLoader);
84
  xmlSetExternalEntityLoader (_xmlExternalEntityLoader);
85
85
86
  vcd_xml_dtd_loaded++;
86
  vcd_xml_dtd_loaded++;
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_dtd.h (-1 / +1 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_XML_DTD_H__
21
#ifndef __VCD_XML_DTD_H__
22
#define __VCD_XML_DTD_H__
22
#define __VCD_XML_DTD_H__
23
23
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_dump.c (-46 / +46 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
23
# include "config.h"
23
# include "config.h"
24
#endif
24
#endif
Lines 40-47 Link Here
40
40
41
static const char _rcsid[] = "$Id: vcd_xml_dump.c,v 1.29 2005/07/07 07:03:12 rocky Exp $";
41
static const char _rcsid[] = "$Id: vcd_xml_dump.c,v 1.29 2005/07/07 07:03:12 rocky Exp $";
42
42
43
static xmlNodePtr 
43
static xmlNodePtr
44
_get_node (xmlDocPtr doc, xmlNodePtr cur, xmlNsPtr ns, 
44
_get_node (xmlDocPtr doc, xmlNodePtr cur, xmlNsPtr ns,
45
	   const char nodename[], bool folder)
45
	   const char nodename[], bool folder)
46
{
46
{
47
  xmlNodePtr n = NULL;
47
  xmlNodePtr n = NULL;
Lines 55-67 Link Here
55
	continue;
55
	continue;
56
56
57
      vcd_assert (!xmlStrcmp (n->children->name, (const xmlChar *) "name"));
57
      vcd_assert (!xmlStrcmp (n->children->name, (const xmlChar *) "name"));
58
      
58
59
      tmp = xmlNodeListGetString (doc, n->children->children, 1);
59
      tmp = xmlNodeListGetString (doc, n->children->children, 1);
60
      
60
61
      if (!xmlStrcmp (tmp, (const xmlChar *) nodename))
61
      if (!xmlStrcmp (tmp, (const xmlChar *) nodename))
62
	break;
62
	break;
63
    }
63
    }
64
  
64
65
  if (!n)
65
  if (!n)
66
    {
66
    {
67
      n = xmlNewNode (ns, _node_id);
67
      n = xmlNewNode (ns, _node_id);
Lines 84-90 Link Here
84
  return n;
84
  return n;
85
}
85
}
86
86
87
static xmlNodePtr 
87
static xmlNodePtr
88
_get_node_pathname (xmlDocPtr doc, xmlNodePtr cur, xmlNsPtr ns, const char pathname[], bool folder)
88
_get_node_pathname (xmlDocPtr doc, xmlNodePtr cur, xmlNsPtr ns, const char pathname[], bool folder)
89
{
89
{
90
  char *_dir, *c;
90
  char *_dir, *c;
Lines 126-134 Link Here
126
126
127
  if (!pbc_id)
127
  if (!pbc_id)
128
    return;
128
    return;
129
  
129
130
  node = xmlNewChild (cur, ns, (const xmlChar *) tag_id, NULL);
130
  node = xmlNewChild (cur, ns, (const xmlChar *) tag_id, NULL);
131
  
131
132
  xmlSetProp (node, (const xmlChar *) "ref", (const xmlChar *) pbc_id);
132
  xmlSetProp (node, (const xmlChar *) "ref", (const xmlChar *) pbc_id);
133
133
134
  if (_area)
134
  if (_area)
Lines 162-170 Link Here
162
  xmlKeepBlanksDefault(0);
162
  xmlKeepBlanksDefault(0);
163
163
164
  doc = xmlNewDoc ((const xmlChar *) "1.0");
164
  doc = xmlNewDoc ((const xmlChar *) "1.0");
165
  
165
166
  dtd = xmlNewDtd (doc, (const xmlChar *) "videocd", 
166
  dtd = xmlNewDtd (doc, (const xmlChar *) "videocd",
167
		   (const xmlChar *) VIDEOCD_DTD_PUBID, 
167
		   (const xmlChar *) VIDEOCD_DTD_PUBID,
168
		   (const xmlChar *) VIDEOCD_DTD_SYSID);
168
		   (const xmlChar *) VIDEOCD_DTD_SYSID);
169
  xmlAddChild ((xmlNodePtr) doc, (xmlNodePtr) dtd);
169
  xmlAddChild ((xmlNodePtr) doc, (xmlNodePtr) dtd);
170
170
Lines 177-183 Link Here
177
  ns = xmlNewNs (vcd_node, (const xmlChar *) VIDEOCD_DTD_XMLNS, NULL);
177
  ns = xmlNewNs (vcd_node, (const xmlChar *) VIDEOCD_DTD_XMLNS, NULL);
178
  xmlSetNs (vcd_node, ns);
178
  xmlSetNs (vcd_node, ns);
179
179
180
  switch (obj->vcd_type) 
180
  switch (obj->vcd_type)
181
    {
181
    {
182
    case VCD_TYPE_VCD:
182
    case VCD_TYPE_VCD:
183
      xmlSetProp (vcd_node, (const xmlChar *) "class", (const xmlChar *) "vcd");
183
      xmlSetProp (vcd_node, (const xmlChar *) "class", (const xmlChar *) "vcd");
Lines 214-220 Link Here
214
  _CDIO_LIST_FOREACH (node, obj->option_list)
214
  _CDIO_LIST_FOREACH (node, obj->option_list)
215
    {
215
    {
216
      struct option_t *_option = _cdio_list_node_data (node);
216
      struct option_t *_option = _cdio_list_node_data (node);
217
      
217
218
      section = xmlNewChild (vcd_node, ns, (const xmlChar *) "option", NULL);
218
      section = xmlNewChild (vcd_node, ns, (const xmlChar *) "option", NULL);
219
      xmlSetProp (section, (const xmlChar *) "name", (const xmlChar *) _option->name);
219
      xmlSetProp (section, (const xmlChar *) "name", (const xmlChar *) _option->name);
220
      xmlSetProp (section, (const xmlChar *) "value", (const xmlChar *) _option->value);
220
      xmlSetProp (section, (const xmlChar *) "value", (const xmlChar *) _option->value);
Lines 225-231 Link Here
225
  section = xmlNewChild (vcd_node, ns, (const xmlChar *) "info", NULL);
225
  section = xmlNewChild (vcd_node, ns, (const xmlChar *) "info", NULL);
226
226
227
  xmlNewChild (section, ns, (const xmlChar *) "album-id", (const xmlChar *) obj->info.album_id);
227
  xmlNewChild (section, ns, (const xmlChar *) "album-id", (const xmlChar *) obj->info.album_id);
228
  
228
229
  snprintf (buf, sizeof (buf), "%d", obj->info.volume_count);
229
  snprintf (buf, sizeof (buf), "%d", obj->info.volume_count);
230
  xmlNewChild (section, ns, (const xmlChar *) "volume-count", (const xmlChar *) buf);
230
  xmlNewChild (section, ns, (const xmlChar *) "volume-count", (const xmlChar *) buf);
231
231
Lines 260-266 Link Here
260
      _CDIO_LIST_FOREACH (node, obj->filesystem)
260
      _CDIO_LIST_FOREACH (node, obj->filesystem)
261
	{
261
	{
262
	  struct filesystem_t *p = _cdio_list_node_data (node);
262
	  struct filesystem_t *p = _cdio_list_node_data (node);
263
	  
263
264
	  if (p->file_src)
264
	  if (p->file_src)
265
	    { /* file */
265
	    { /* file */
266
	      unsigned char *psz_fname_utf8 = vcd_xml_filename_to_utf8 (p->file_src);
266
	      unsigned char *psz_fname_utf8 = vcd_xml_filename_to_utf8 (p->file_src);
Lines 288-294 Link Here
288
	  struct segment_t *_segment =  _cdio_list_node_data (node);
288
	  struct segment_t *_segment =  _cdio_list_node_data (node);
289
	  xmlNodePtr seg_node;
289
	  xmlNodePtr seg_node;
290
	  CdioListNode_t *node2;
290
	  CdioListNode_t *node2;
291
	  
291
292
	  seg_node = xmlNewChild (section, ns, (const xmlChar *) "segment-item", NULL);
292
	  seg_node = xmlNewChild (section, ns, (const xmlChar *) "segment-item", NULL);
293
	  xmlSetProp (seg_node, (const xmlChar *) "src", vcd_xml_filename_to_utf8 (_segment->src));
293
	  xmlSetProp (seg_node, (const xmlChar *) "src", vcd_xml_filename_to_utf8 (_segment->src));
294
	  xmlSetProp (seg_node, (const xmlChar *) "id", (const xmlChar *) _segment->id);
294
	  xmlSetProp (seg_node, (const xmlChar *) "id", (const xmlChar *) _segment->id);
Lines 305-311 Link Here
305
    }
305
    }
306
306
307
  /* sequences */
307
  /* sequences */
308
    
308
309
  section = xmlNewChild (vcd_node, ns, (const xmlChar *) "sequence-items", NULL);
309
  section = xmlNewChild (vcd_node, ns, (const xmlChar *) "sequence-items", NULL);
310
310
311
  _CDIO_LIST_FOREACH (node, obj->sequence_list)
311
  _CDIO_LIST_FOREACH (node, obj->sequence_list)
Lines 313-336 Link Here
313
      struct sequence_t *p_sequence =  _cdio_list_node_data (node);
313
      struct sequence_t *p_sequence =  _cdio_list_node_data (node);
314
      xmlNodePtr seq_node;
314
      xmlNodePtr seq_node;
315
      CdioListNode_t *node2;
315
      CdioListNode_t *node2;
316
      unsigned char *psz_xml_fname_utf8 = 
316
      unsigned char *psz_xml_fname_utf8 =
317
	vcd_xml_filename_to_utf8 (p_sequence->src);
317
	vcd_xml_filename_to_utf8 (p_sequence->src);
318
318
319
      seq_node = xmlNewChild (section, ns, (const xmlChar *) "sequence-item", 
319
      seq_node = xmlNewChild (section, ns, (const xmlChar *) "sequence-item",
320
			      NULL);
320
			      NULL);
321
      xmlSetProp (seq_node, (const xmlChar *) "src", psz_xml_fname_utf8);
321
      xmlSetProp (seq_node, (const xmlChar *) "src", psz_xml_fname_utf8);
322
      free(psz_xml_fname_utf8);
322
      free(psz_xml_fname_utf8);
323
      
323
324
      xmlSetProp (seq_node, (const xmlChar *) "id", 
324
      xmlSetProp (seq_node, (const xmlChar *) "id",
325
		  (const xmlChar *) p_sequence->id);
325
		  (const xmlChar *) p_sequence->id);
326
326
327
      if (p_sequence->default_entry_id)
327
      if (p_sequence->default_entry_id)
328
	{
328
	{
329
	  xmlNodePtr ent_node;
329
	  xmlNodePtr ent_node;
330
330
331
	  ent_node = xmlNewChild (seq_node, ns, 
331
	  ent_node = xmlNewChild (seq_node, ns,
332
				  (const xmlChar *) "default-entry", NULL);
332
				  (const xmlChar *) "default-entry", NULL);
333
	  xmlSetProp (ent_node, (const xmlChar *) "id", 
333
	  xmlSetProp (ent_node, (const xmlChar *) "id",
334
		      (const xmlChar *) p_sequence->default_entry_id);
334
		      (const xmlChar *) p_sequence->default_entry_id);
335
	}
335
	}
336
336
Lines 341-349 Link Here
341
	  char buf[80];
341
	  char buf[80];
342
342
343
	  snprintf (buf, sizeof (buf), "%f", p_entry->timestamp);
343
	  snprintf (buf, sizeof (buf), "%f", p_entry->timestamp);
344
	  ent_node = xmlNewChild (seq_node, ns, (const xmlChar *) "entry", 
344
	  ent_node = xmlNewChild (seq_node, ns, (const xmlChar *) "entry",
345
				  (const xmlChar *) buf);
345
				  (const xmlChar *) buf);
346
	  xmlSetProp (ent_node, (const xmlChar *) "id", 
346
	  xmlSetProp (ent_node, (const xmlChar *) "id",
347
		      (const xmlChar *) p_entry->id);
347
		      (const xmlChar *) p_entry->id);
348
	}
348
	}
349
349
Lines 353-359 Link Here
353
	  char buf[80];
353
	  char buf[80];
354
354
355
	  snprintf (buf, sizeof (buf), "%f", *_ap_ts);
355
	  snprintf (buf, sizeof (buf), "%f", *_ap_ts);
356
	  xmlNewChild (seq_node, ns, (const xmlChar *) "auto-pause", 
356
	  xmlNewChild (seq_node, ns, (const xmlChar *) "auto-pause",
357
		       (const xmlChar *) buf);
357
		       (const xmlChar *) buf);
358
	}
358
	}
359
    }
359
    }
Lines 368-374 Link Here
368
	{
368
	{
369
	  pbc_t *_pbc = _cdio_list_node_data (node);
369
	  pbc_t *_pbc = _cdio_list_node_data (node);
370
	  xmlNodePtr pl = NULL;
370
	  xmlNodePtr pl = NULL;
371
	  
371
372
	  switch (_pbc->type)
372
	  switch (_pbc->type)
373
	    {
373
	    {
374
	      char buf[80];
374
	      char buf[80];
Lines 396-404 Link Here
396
	      _CDIO_LIST_FOREACH (node2, _pbc->item_id_list)
396
	      _CDIO_LIST_FOREACH (node2, _pbc->item_id_list)
397
		{
397
		{
398
		  const char *_id = _cdio_list_node_data (node2);
398
		  const char *_id = _cdio_list_node_data (node2);
399
		  
399
400
		  if (_id)
400
		  if (_id)
401
		    xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "play-item", NULL), 
401
		    xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "play-item", NULL),
402
				(const xmlChar *) "ref", (const xmlChar *) _id);
402
				(const xmlChar *) "ref", (const xmlChar *) _id);
403
		  else
403
		  else
404
		    xmlNewChild (pl, ns, (const xmlChar *) "play-item", NULL);
404
		    xmlNewChild (pl, ns, (const xmlChar *) "play-item", NULL);
Lines 423-440 Link Here
423
		  break;
423
		  break;
424
424
425
		case _SEL_MULTI_DEF:
425
		case _SEL_MULTI_DEF:
426
		  xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "multi-default", NULL), 
426
		  xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "multi-default", NULL),
427
			      (const xmlChar *) "numeric", (const xmlChar *) "enabled");
427
			      (const xmlChar *) "numeric", (const xmlChar *) "enabled");
428
		  break;
428
		  break;
429
429
430
		case _SEL_MULTI_DEF_NO_NUM:
430
		case _SEL_MULTI_DEF_NO_NUM:
431
		  xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "multi-default", NULL), 
431
		  xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "multi-default", NULL),
432
			      (const xmlChar *) "numeric", (const xmlChar *) "disabled");
432
			      (const xmlChar *) "numeric", (const xmlChar *) "disabled");
433
		  break;
433
		  break;
434
		}
434
		}
435
435
436
	      if (_pbc->timeout_id)
436
	      if (_pbc->timeout_id)
437
		xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "timeout", NULL), 
437
		xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "timeout", NULL),
438
			    (const xmlChar *) "ref", (const xmlChar *) _pbc->timeout_id);
438
			    (const xmlChar *) "ref", (const xmlChar *) _pbc->timeout_id);
439
439
440
	      snprintf (buf, sizeof (buf), "%d", _pbc->timeout_time);
440
	      snprintf (buf, sizeof (buf), "%d", _pbc->timeout_time);
Lines 442-458 Link Here
442
442
443
	      snprintf (buf, sizeof (buf), "%d", _pbc->loop_count);
443
	      snprintf (buf, sizeof (buf), "%d", _pbc->loop_count);
444
	      xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "loop", (const xmlChar *) buf),
444
	      xmlSetProp (xmlNewChild (pl, ns, (const xmlChar *) "loop", (const xmlChar *) buf),
445
			  (const xmlChar *) "jump-timing", 
445
			  (const xmlChar *) "jump-timing",
446
			  (_pbc->jump_delayed ? (const xmlChar *) "delayed" : (const xmlChar *) "immediate"));
446
			  (_pbc->jump_delayed ? (const xmlChar *) "delayed" : (const xmlChar *) "immediate"));
447
447
448
	      if (_pbc->item_id)
448
	      if (_pbc->item_id)
449
		xmlSetProp (xmlNewChild (pl, ns, 
449
		xmlSetProp (xmlNewChild (pl, ns,
450
					 (const xmlChar *) "play-item", NULL), 
450
					 (const xmlChar *) "play-item", NULL),
451
			    (const xmlChar *) "ref", 
451
			    (const xmlChar *) "ref",
452
			    (const xmlChar *) _pbc->item_id);
452
			    (const xmlChar *) _pbc->item_id);
453
453
454
	      {
454
	      {
455
		CdioListNode_t *node3 = 
455
		CdioListNode_t *node3 =
456
		  _cdio_list_begin (_pbc->select_area_list);
456
		  _cdio_list_begin (_pbc->select_area_list);
457
457
458
		_CDIO_LIST_FOREACH (node2, _pbc->select_id_list)
458
		_CDIO_LIST_FOREACH (node2, _pbc->select_id_list)
Lines 470-476 Link Here
470
		  }
470
		  }
471
	      }
471
	      }
472
	      break;
472
	      break;
473
	      
473
474
	    case PBC_END:
474
	    case PBC_END:
475
	      pl = xmlNewChild (section, ns, (const xmlChar *) "endlist", NULL);
475
	      pl = xmlNewChild (section, ns, (const xmlChar *) "endlist", NULL);
476
476
Lines 488-494 Link Here
488
	    default:
488
	    default:
489
	      vcd_assert_not_reached ();
489
	      vcd_assert_not_reached ();
490
	    }
490
	    }
491
	  
491
492
	  xmlSetProp (pl, (const xmlChar *) "id", (const xmlChar *) _pbc->id);
492
	  xmlSetProp (pl, (const xmlChar *) "id", (const xmlChar *) _pbc->id);
493
	  if (_pbc->rejected)
493
	  if (_pbc->rejected)
494
	    xmlSetProp (pl, (const xmlChar *) "rejected", (const xmlChar *) "true");
494
	    xmlSetProp (pl, (const xmlChar *) "rejected", (const xmlChar *) "true");
Lines 504-515 Link Here
504
vcd_xml_dump (vcdxml_t *obj, const char xml_fname[])
504
vcd_xml_dump (vcdxml_t *obj, const char xml_fname[])
505
{
505
{
506
  _make_xml (obj, xml_fname);
506
  _make_xml (obj, xml_fname);
507
  
507
508
  return 0;
508
  return 0;
509
}
509
}
510
510
511
/* 
511
/*
512
   Print command line used as a XML comment. Start is either 0 or 
512
   Print command line used as a XML comment. Start is either 0 or
513
   1. The program might be invoked either from a binary or a libtool
513
   1. The program might be invoked either from a binary or a libtool
514
   wrapper script to invoke the module.
514
   wrapper script to invoke the module.
515
*/
515
*/
Lines 528-545 Link Here
528
    retval = strdup (" command arguments used: ");
528
    retval = strdup (" command arguments used: ");
529
    break;
529
    break;
530
  default:
530
  default:
531
    fprintf (stderr, "internal error: expecting start=0 or start=1\n"); 
531
    fprintf (stderr, "internal error: expecting start=0 or start=1\n");
532
    retval = strdup (" command line used: ");
532
    retval = strdup (" command line used: ");
533
    start=0;
533
    start=0;
534
  }
534
  }
535
  
535
536
536
537
  len = strlen (retval);
537
  len = strlen (retval);
538
538
539
  for (idx = start; idx < argc; idx++)
539
  for (idx = start; idx < argc; idx++)
540
    {
540
    {
541
      len += strlen (argv[idx]) + 1;
541
      len += strlen (argv[idx]) + 1;
542
      
542
543
      retval = realloc (retval, len + 1);
543
      retval = realloc (retval, len + 1);
544
544
545
      strcat (retval, argv[idx]);
545
      strcat (retval, argv[idx]);
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_dump.h (-2 / +2 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_XML_DUMP_H__
21
#ifndef __VCD_XML_DUMP_H__
22
#define __VCD_XML_DUMP_H__
22
#define __VCD_XML_DUMP_H__
23
23
Lines 26-32 Link Here
26
int vcd_xml_dump (vcdxml_t *obj, const char xml_fname[]);
26
int vcd_xml_dump (vcdxml_t *obj, const char xml_fname[]);
27
27
28
/*!
28
/*!
29
   Print command line used as a XML comment. Start is either 0 or 
29
   Print command line used as a XML comment. Start is either 0 or
30
   1. The program might be invoked either from a binary or a libtool
30
   1. The program might be invoked either from a binary or a libtool
31
   wrapper script to invoke the module.
31
   wrapper script to invoke the module.
32
*/
32
*/
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_gen.c (-34 / +34 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 71-77 Link Here
71
  struct {
71
  struct {
72
    const char *str;
72
    const char *str;
73
    vcd_type_t id;
73
    vcd_type_t id;
74
  } type_str[] = 
74
  } type_str[] =
75
    {
75
    {
76
      { "vcd10", VCD_TYPE_VCD },
76
      { "vcd10", VCD_TYPE_VCD },
77
      { "vcd11", VCD_TYPE_VCD11 },
77
      { "vcd11", VCD_TYPE_VCD11 },
Lines 81-90 Link Here
81
      { "hqvcd", VCD_TYPE_HQVCD },
81
      { "hqvcd", VCD_TYPE_HQVCD },
82
      { NULL, VCD_TYPE_INVALID }
82
      { NULL, VCD_TYPE_INVALID }
83
    };
83
    };
84
      
84
85
  int i = 0;
85
  int i = 0;
86
86
87
  while (type_str[i].str) 
87
  while (type_str[i].str)
88
    if (strcasecmp(arg, type_str[i].str))
88
    if (strcasecmp(arg, type_str[i].str))
89
      i++;
89
      i++;
90
    else
90
    else
Lines 92-98 Link Here
92
92
93
  if (!type_str[i].str)
93
  if (!type_str[i].str)
94
    fprintf (stderr, "invalid type given\n");
94
    fprintf (stderr, "invalid type given\n");
95
        
95
96
  return type_str[i].id;
96
  return type_str[i].id;
97
}
97
}
98
98
Lines 109-121 Link Here
109
    *fname1 = strdup (tmp);
109
    *fname1 = strdup (tmp);
110
  else
110
  else
111
    rc = -1;
111
    rc = -1;
112
  
112
113
  tmp = strtok(NULL, ",");
113
  tmp = strtok(NULL, ",");
114
  if (tmp)
114
  if (tmp)
115
    *fname2 = strdup (tmp);
115
    *fname2 = strdup (tmp);
116
  else
116
  else
117
    rc = -1;
117
    rc = -1;
118
  
118
119
  tmp = strtok(NULL, ",");
119
  tmp = strtok(NULL, ",");
120
  if (tmp)
120
  if (tmp)
121
    rc = -1;
121
    rc = -1;
Lines 140-146 Link Here
140
140
141
  {
141
  {
142
    struct filesystem_t *_file = calloc(1, sizeof (struct filesystem_t));
142
    struct filesystem_t *_file = calloc(1, sizeof (struct filesystem_t));
143
    
143
144
    _file->name = strdup (pathname);
144
    _file->name = strdup (pathname);
145
    _file->file_src = NULL;
145
    _file->file_src = NULL;
146
    _file->file_raw = false;
146
    _file->file_raw = false;
Lines 150-156 Link Here
150
}
150
}
151
151
152
static void
152
static void
153
_add_dirtree (vcdxml_t *obj, const char pathname[], 
153
_add_dirtree (vcdxml_t *obj, const char pathname[],
154
          const char iso_pathname[])
154
          const char iso_pathname[])
155
{
155
{
156
  DIR *dir = NULL;
156
  DIR *dir = NULL;
Lines 235-241 Link Here
235
{
235
{
236
  vcdxml_t obj;
236
  vcdxml_t obj;
237
  int n;
237
  int n;
238
  
238
239
  char *xml_fname = strdup (DEFAULT_XML_FNAME);
239
  char *xml_fname = strdup (DEFAULT_XML_FNAME);
240
  char *type_str = strdup (DEFAULT_TYPE);
240
  char *type_str = strdup (DEFAULT_TYPE);
241
  int broken_svcd_mode_flag = 0;
241
  int broken_svcd_mode_flag = 0;
Lines 252-258 Link Here
252
  obj.pvd.volume_id = strdup (DEFAULT_VOLUME_ID);
252
  obj.pvd.volume_id = strdup (DEFAULT_VOLUME_ID);
253
  obj.pvd.application_id = strdup (DEFAULT_APPLICATION_ID);
253
  obj.pvd.application_id = strdup (DEFAULT_APPLICATION_ID);
254
  obj.info.album_id = strdup (DEFAULT_ALBUM_ID);
254
  obj.info.album_id = strdup (DEFAULT_ALBUM_ID);
255
  
255
256
  obj.info.volume_count = 1;
256
  obj.info.volume_count = 1;
257
  obj.info.volume_number = 1;
257
  obj.info.volume_number = 1;
258
258
Lines 268-274 Link Here
268
      CL_ADD_FILE_RAW
268
      CL_ADD_FILE_RAW
269
    };
269
    };
270
270
271
    struct poptOption optionsTable[] = 
271
    struct poptOption optionsTable[] =
272
      {
272
      {
273
        {"output-file", 'o', POPT_ARG_STRING, &xml_fname, 0,
273
        {"output-file", 'o', POPT_ARG_STRING, &xml_fname, 0,
274
         "specify xml file for output (default: '" DEFAULT_XML_FNAME "')",
274
         "specify xml file for output (default: '" DEFAULT_XML_FNAME "')",
Lines 303-319 Link Here
303
         "update scan data offsets in video mpeg2 stream"},
303
         "update scan data offsets in video mpeg2 stream"},
304
304
305
        {"nopbc", '\0', POPT_ARG_NONE, &nopbc_flag, 0, "don't create PBC"},
305
        {"nopbc", '\0', POPT_ARG_NONE, &nopbc_flag, 0, "don't create PBC"},
306
        
306
307
        {"add-dirtree", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIRTREE,
307
        {"add-dirtree", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIRTREE,
308
         "add directory contents recursively to ISO fs root", "DIR"},
308
         "add directory contents recursively to ISO fs root", "DIR"},
309
309
310
        {"add-dir", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIR, 
310
        {"add-dir", '\0', POPT_ARG_STRING, NULL, CL_ADD_DIR,
311
         "add empty dir to ISO fs", "ISO_DIRNAME"},
311
         "add empty dir to ISO fs", "ISO_DIRNAME"},
312
312
313
        {"add-file", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE, 
313
        {"add-file", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE,
314
         "add single file to ISO fs", "FILE,ISO_FILENAME"},
314
         "add single file to ISO fs", "FILE,ISO_FILENAME"},
315
315
316
        {"add-file-2336", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE_RAW, 
316
        {"add-file-2336", '\0', POPT_ARG_STRING, NULL, CL_ADD_FILE_RAW,
317
         "add file containing full 2336 byte sectors to ISO fs",
317
         "add file containing full 2336 byte sectors to ISO fs",
318
         "FILE,ISO_FILENAME"},
318
         "FILE,ISO_FILENAME"},
319
319
Lines 327-342 Link Here
327
        {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
327
        {"version", 'V', POPT_ARG_NONE, NULL, CL_VERSION,
328
         "display version and copyright information and exit"},
328
         "display version and copyright information and exit"},
329
329
330
        POPT_AUTOHELP 
330
        POPT_AUTOHELP
331
331
332
        {NULL, 0, 0, NULL, 0}
332
        {NULL, 0, 0, NULL, 0}
333
      };
333
      };
334
    
334
335
    poptContext optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
335
    poptContext optCon = poptGetContext ("vcdimager", argc, argv, optionsTable, 0);
336
    poptSetOtherOptionHelp (optCon, "mpeg-track1 [mpeg-track2...]");
336
    poptSetOtherOptionHelp (optCon, "mpeg-track1 [mpeg-track2...]");
337
337
338
    if (poptReadDefaultConfig (optCon, 0)) 
338
    if (poptReadDefaultConfig (optCon, 0))
339
      fprintf (stderr, "warning, reading popt configuration failed\n"); 
339
      fprintf (stderr, "warning, reading popt configuration failed\n");
340
340
341
    while ((opt = poptGetNextOpt (optCon)) != -1)
341
    while ((opt = poptGetNextOpt (optCon)) != -1)
342
      switch (opt)
342
      switch (opt)
Lines 352-358 Link Here
352
            const char *arg = poptGetOptArg (optCon);
352
            const char *arg = poptGetOptArg (optCon);
353
353
354
            vcd_assert (arg != NULL);
354
            vcd_assert (arg != NULL);
355
            
355
356
            _add_dirtree (&obj, arg, "");
356
            _add_dirtree (&obj, arg, "");
357
          }
357
          }
358
          break;
358
          break;
Lines 362-368 Link Here
362
            const char *arg = poptGetOptArg (optCon);
362
            const char *arg = poptGetOptArg (optCon);
363
363
364
            vcd_assert (arg != NULL);
364
            vcd_assert (arg != NULL);
365
            
365
366
            _add_dir (&obj, arg);
366
            _add_dir (&obj, arg);
367
          }
367
          }
368
          break;
368
          break;
Lines 375-381 Link Here
375
375
376
            vcd_assert (arg != NULL);
376
            vcd_assert (arg != NULL);
377
377
378
            if(!_parse_file_arg (arg, &fname1, &fname2)) 
378
            if(!_parse_file_arg (arg, &fname1, &fname2))
379
              {
379
              {
380
                struct filesystem_t *_file = calloc(1, sizeof (struct filesystem_t));
380
                struct filesystem_t *_file = calloc(1, sizeof (struct filesystem_t));
381
381
Lines 401-407 Link Here
401
401
402
    if (_verbose_flag && _quiet_flag)
402
    if (_verbose_flag && _quiet_flag)
403
      fprintf (stderr, "I can't be both, quiet and verbose... either one or another ;-)");
403
      fprintf (stderr, "I can't be both, quiet and verbose... either one or another ;-)");
404
    
404
405
    if ((args = poptGetArgs (optCon)) == NULL)
405
    if ((args = poptGetArgs (optCon)) == NULL)
406
      {
406
      {
407
        fprintf (stderr, "error: need at least one data track as argument "
407
        fprintf (stderr, "error: need at least one data track as argument "
Lines 427-433 Link Here
427
                 CDIO_CD_MAX_TRACKS - 1);
427
                 CDIO_CD_MAX_TRACKS - 1);
428
        exit (EXIT_FAILURE);
428
        exit (EXIT_FAILURE);
429
      }
429
      }
430
                        
430
431
    if ((obj.vcd_type = _parse_type_arg (type_str)) == VCD_TYPE_INVALID)
431
    if ((obj.vcd_type = _parse_type_arg (type_str)) == VCD_TYPE_INVALID)
432
      exit (EXIT_FAILURE);
432
      exit (EXIT_FAILURE);
433
433
Lines 447-453 Link Here
447
      || obj.vcd_type == VCD_TYPE_VCD)
447
      || obj.vcd_type == VCD_TYPE_VCD)
448
    nopbc_flag = true;
448
    nopbc_flag = true;
449
449
450
  if (!nopbc_flag) 
450
  if (!nopbc_flag)
451
    {
451
    {
452
      pbc_t *_pbc;
452
      pbc_t *_pbc;
453
      CdioListNode_t *node;
453
      CdioListNode_t *node;
Lines 474-480 Link Here
474
          _pbc->wait_time = 5;
474
          _pbc->wait_time = 5;
475
475
476
          _cdio_list_append (_pbc->item_id_list, strdup (_sequence->id));
476
          _cdio_list_append (_pbc->item_id_list, strdup (_sequence->id));
477
          
477
478
          _cdio_list_append (obj.pbc_list, _pbc);
478
          _cdio_list_append (obj.pbc_list, _pbc);
479
479
480
          n++;
480
          n++;
Lines 489-518 Link Here
489
      _cdio_list_append (obj.pbc_list, _pbc);
489
      _cdio_list_append (obj.pbc_list, _pbc);
490
    }
490
    }
491
491
492
  if ((obj.vcd_type == VCD_TYPE_SVCD 
492
  if ((obj.vcd_type == VCD_TYPE_SVCD
493
       || obj.vcd_type == VCD_TYPE_HQVCD)
493
       || obj.vcd_type == VCD_TYPE_HQVCD)
494
      && update_scan_offsets_flag)
494
      && update_scan_offsets_flag)
495
    {
495
    {
496
      struct option_t *_opt = calloc(1, sizeof (struct option_t));
496
      struct option_t *_opt = calloc(1, sizeof (struct option_t));
497
      
497
498
      _opt->name = strdup (OPT_UPDATE_SCAN_OFFSETS);
498
      _opt->name = strdup (OPT_UPDATE_SCAN_OFFSETS);
499
      _opt->value = strdup ("true");
499
      _opt->value = strdup ("true");
500
500
501
      _cdio_list_append (obj.option_list, _opt);
501
      _cdio_list_append (obj.option_list, _opt);
502
    }
502
    }
503
503
504
  if (obj.vcd_type == VCD_TYPE_SVCD 
504
  if (obj.vcd_type == VCD_TYPE_SVCD
505
      && broken_svcd_mode_flag)
505
      && broken_svcd_mode_flag)
506
    {
506
    {
507
      struct option_t *_opt = calloc(1, sizeof (struct option_t));
507
      struct option_t *_opt = calloc(1, sizeof (struct option_t));
508
      
508
509
      _opt->name = strdup (OPT_SVCD_VCD3_MPEGAV);
509
      _opt->name = strdup (OPT_SVCD_VCD3_MPEGAV);
510
      _opt->value = strdup ("true");
510
      _opt->value = strdup ("true");
511
511
512
      _cdio_list_append (obj.option_list, _opt);
512
      _cdio_list_append (obj.option_list, _opt);
513
513
514
      _opt = calloc(1, sizeof (struct option_t));
514
      _opt = calloc(1, sizeof (struct option_t));
515
      
515
516
      _opt->name = strdup (OPT_SVCD_VCD3_ENTRYSVD);
516
      _opt->name = strdup (OPT_SVCD_VCD3_ENTRYSVD);
517
      _opt->value = strdup ("true");
517
      _opt->value = strdup ("true");
518
518
Lines 526-534 Link Here
526
526
527
  return EXIT_SUCCESS;
527
  return EXIT_SUCCESS;
528
}
528
}
529
530
529
531
/* 
530
531
/*
532
 * Local variables:
532
 * Local variables:
533
 *  c-file-style: "gnu"
533
 *  c-file-style: "gnu"
534
 *  tab-width: 8
534
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcdxml.h (-12 / +12 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifndef __VCDXML_H__
22
#ifndef __VCDXML_H__
23
#define __VCDXML_H__
23
#define __VCDXML_H__
24
24
Lines 103-109 Link Here
103
struct entry_point_t {
103
struct entry_point_t {
104
  char *id;
104
  char *id;
105
  double timestamp;
105
  double timestamp;
106
  
106
107
  /* used for restoring */
107
  /* used for restoring */
108
  uint32_t extent;
108
  uint32_t extent;
109
};
109
};
Lines 112-118 Link Here
112
{
112
{
113
  char *id;
113
  char *id;
114
  char *src;
114
  char *src;
115
  
115
116
  CdioList_t *autopause_list; /* double * */
116
  CdioList_t *autopause_list; /* double * */
117
117
118
  /* used for restoring vcds */
118
  /* used for restoring vcds */
Lines 151-165 Link Here
151
151
152
  vcd_assert (p_vcdxml != NULL);
152
  vcd_assert (p_vcdxml != NULL);
153
153
154
  _cdio_list_free (p_vcdxml->option_list,   true);
154
  _cdio_list_free (p_vcdxml->option_list,   true, NULL);
155
  _cdio_list_free (p_vcdxml->segment_list,  true);
155
  _cdio_list_free (p_vcdxml->segment_list,  true, NULL);
156
156
157
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->pbc_list)
157
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->pbc_list)
158
    {
158
    {
159
      pbc_t *p_pbc = _cdio_list_node_data(p_node);
159
      pbc_t *p_pbc = _cdio_list_node_data(p_node);
160
      vcd_pbc_destroy(p_pbc);
160
      vcd_pbc_destroy(p_pbc);
161
    }
161
    }
162
  
162
163
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->sequence_list)
163
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->sequence_list)
164
    {
164
    {
165
      struct sequence_t *p_sequence = _cdio_list_node_data(p_node);
165
      struct sequence_t *p_sequence = _cdio_list_node_data(p_node);
Lines 172-181 Link Here
172
	  struct entry_point_t *p_entry = _cdio_list_node_data(p_node2);
172
	  struct entry_point_t *p_entry = _cdio_list_node_data(p_node2);
173
	  free(p_entry->id);
173
	  free(p_entry->id);
174
	}
174
	}
175
      _cdio_list_free (p_sequence->entry_point_list, true);
175
      _cdio_list_free (p_sequence->entry_point_list, true, NULL);
176
      _cdio_list_free (p_sequence->autopause_list, true);
176
      _cdio_list_free (p_sequence->autopause_list, true, NULL);
177
    }
177
    }
178
  
178
179
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->filesystem)
179
  _CDIO_LIST_FOREACH (p_node, p_vcdxml->filesystem)
180
    {
180
    {
181
      struct filesystem_t *p_fs = _cdio_list_node_data(p_node);
181
      struct filesystem_t *p_fs = _cdio_list_node_data(p_node);
Lines 183-191 Link Here
183
      free(p_fs->file_src);
183
      free(p_fs->file_src);
184
    }
184
    }
185
185
186
  _cdio_list_free (p_vcdxml->filesystem,    true);
186
  _cdio_list_free (p_vcdxml->filesystem, true, NULL);
187
  _cdio_list_free (p_vcdxml->pbc_list, true);
187
  _cdio_list_free (p_vcdxml->pbc_list, true, NULL);
188
  _cdio_list_free (p_vcdxml->sequence_list, true);
188
  _cdio_list_free (p_vcdxml->sequence_list, true, NULL);
189
  free (p_vcdxml->comment);
189
  free (p_vcdxml->comment);
190
  free (p_vcdxml->info.album_id);
190
  free (p_vcdxml->info.album_id);
191
  free (p_vcdxml->pvd.volume_id);
191
  free (p_vcdxml->pvd.volume_id);
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_master.c (-31 / +31 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* Private headers */
21
/* Private headers */
22
#include "image_sink.h"
22
#include "image_sink.h"
23
#include "stream_stdio.h"
23
#include "stream_stdio.h"
Lines 49-55 Link Here
49
{
49
{
50
  vcd_assert (pathname != 0);
50
  vcd_assert (pathname != 0);
51
51
52
  if (prefix) 
52
  if (prefix)
53
    {
53
    {
54
      VcdDataSource_t *retval = 0;
54
      VcdDataSource_t *retval = 0;
55
      char *tmp = calloc(1, strlen (prefix) + strlen (pathname) + 1);
55
      char *tmp = calloc(1, strlen (prefix) + strlen (pathname) + 1);
Lines 63-70 Link Here
63
  return vcd_data_source_new_stdio (pathname);
63
  return vcd_data_source_new_stdio (pathname);
64
}
64
}
65
65
66
bool 
66
bool
67
vcd_xml_master (const vcdxml_t *p_vcdxml, VcdImageSink_t *p_image_sink, 
67
vcd_xml_master (const vcdxml_t *p_vcdxml, VcdImageSink_t *p_image_sink,
68
		time_t *create_time)
68
		time_t *create_time)
69
{
69
{
70
  VcdObj_t *_vcd;
70
  VcdObj_t *_vcd;
Lines 78-110 Link Here
78
  _vcd = vcd_obj_new (p_vcdxml->vcd_type);
78
  _vcd = vcd_obj_new (p_vcdxml->vcd_type);
79
79
80
  if (vcd_xml_check_mode)
80
  if (vcd_xml_check_mode)
81
    vcd_obj_set_param_str (_vcd, VCD_PARM_PREPARER_ID, 
81
    vcd_obj_set_param_str (_vcd, VCD_PARM_PREPARER_ID,
82
			   "GNU VCDIMAGER CHECK MODE");
82
			   "GNU VCDIMAGER CHECK MODE");
83
83
84
  if (p_vcdxml->info.album_id)
84
  if (p_vcdxml->info.album_id)
85
    vcd_obj_set_param_str (_vcd, VCD_PARM_ALBUM_ID, p_vcdxml->info.album_id);
85
    vcd_obj_set_param_str (_vcd, VCD_PARM_ALBUM_ID, p_vcdxml->info.album_id);
86
86
87
  vcd_obj_set_param_uint (_vcd, VCD_PARM_VOLUME_NUMBER, 
87
  vcd_obj_set_param_uint (_vcd, VCD_PARM_VOLUME_NUMBER,
88
			  p_vcdxml->info.volume_number);
88
			  p_vcdxml->info.volume_number);
89
  vcd_obj_set_param_uint (_vcd, VCD_PARM_VOLUME_COUNT, 
89
  vcd_obj_set_param_uint (_vcd, VCD_PARM_VOLUME_COUNT,
90
			  p_vcdxml->info.volume_count);
90
			  p_vcdxml->info.volume_count);
91
  vcd_obj_set_param_uint (_vcd, VCD_PARM_RESTRICTION, 
91
  vcd_obj_set_param_uint (_vcd, VCD_PARM_RESTRICTION,
92
			  p_vcdxml->info.restriction);
92
			  p_vcdxml->info.restriction);
93
  vcd_obj_set_param_bool (_vcd, VCD_PARM_NEXT_VOL_SEQ2, 
93
  vcd_obj_set_param_bool (_vcd, VCD_PARM_NEXT_VOL_SEQ2,
94
			  p_vcdxml->info.use_sequence2);
94
			  p_vcdxml->info.use_sequence2);
95
  vcd_obj_set_param_bool (_vcd, VCD_PARM_NEXT_VOL_LID2, 
95
  vcd_obj_set_param_bool (_vcd, VCD_PARM_NEXT_VOL_LID2,
96
			  p_vcdxml->info.use_lid2);
96
			  p_vcdxml->info.use_lid2);
97
97
98
  if (p_vcdxml->pvd.volume_id)
98
  if (p_vcdxml->pvd.volume_id)
99
    vcd_obj_set_param_str (_vcd, VCD_PARM_VOLUME_ID, 
99
    vcd_obj_set_param_str (_vcd, VCD_PARM_VOLUME_ID,
100
			   p_vcdxml->pvd.volume_id);
100
			   p_vcdxml->pvd.volume_id);
101
101
102
  if (p_vcdxml->pvd.publisher_id)
102
  if (p_vcdxml->pvd.publisher_id)
103
    vcd_obj_set_param_str (_vcd, VCD_PARM_PUBLISHER_ID, 
103
    vcd_obj_set_param_str (_vcd, VCD_PARM_PUBLISHER_ID,
104
			   p_vcdxml->pvd.publisher_id);
104
			   p_vcdxml->pvd.publisher_id);
105
105
106
  if (p_vcdxml->pvd.application_id)
106
  if (p_vcdxml->pvd.application_id)
107
    vcd_obj_set_param_str (_vcd, VCD_PARM_APPLICATION_ID, 
107
    vcd_obj_set_param_str (_vcd, VCD_PARM_APPLICATION_ID,
108
			   p_vcdxml->pvd.application_id);
108
			   p_vcdxml->pvd.application_id);
109
109
110
  _CDIO_LIST_FOREACH (node, p_vcdxml->option_list)
110
  _CDIO_LIST_FOREACH (node, p_vcdxml->option_list)
Lines 156-162 Link Here
156
	  continue;
156
	  continue;
157
	}
157
	}
158
158
159
      switch (_opt_cfg_p->val_type) 
159
      switch (_opt_cfg_p->val_type)
160
	{
160
	{
161
	case OPT_BOOL:
161
	case OPT_BOOL:
162
	  {
162
	  {
Lines 187-200 Link Here
187
	    char *endptr;
187
	    char *endptr;
188
188
189
	    _value = strtol (_option->value, &endptr, 10);
189
	    _value = strtol (_option->value, &endptr, 10);
190
	    
190
191
	    if (*endptr)
191
	    if (*endptr)
192
	      {
192
	      {
193
		vcd_error ("error while converting string '%s' to integer", 
193
		vcd_error ("error while converting string '%s' to integer",
194
			   _option->value);
194
			   _option->value);
195
		_value = 0;
195
		_value = 0;
196
	      }
196
	      }
197
	   
197
198
	    vcd_obj_set_param_uint (_vcd, _opt_cfg_p->parm_id, _value);
198
	    vcd_obj_set_param_uint (_vcd, _opt_cfg_p->parm_id, _value);
199
	  }
199
	  }
200
	  break;
200
	  break;
Lines 203-209 Link Here
203
	  vcd_assert_not_reached ();
203
	  vcd_assert_not_reached ();
204
	  break;
204
	  break;
205
	}
205
	}
206
    }  
206
    }
207
207
208
  _CDIO_LIST_FOREACH (node, p_vcdxml->pbc_list)
208
  _CDIO_LIST_FOREACH (node, p_vcdxml->pbc_list)
209
    {
209
    {
Lines 217-242 Link Here
217
  _CDIO_LIST_FOREACH (node, p_vcdxml->filesystem)
217
  _CDIO_LIST_FOREACH (node, p_vcdxml->filesystem)
218
    {
218
    {
219
      struct filesystem_t *dentry = _cdio_list_node_data (node);
219
      struct filesystem_t *dentry = _cdio_list_node_data (node);
220
      
220
221
      if (dentry->file_src) 
221
      if (dentry->file_src)
222
	{
222
	{
223
	  VcdDataSource_t *_source = mk_dsource (p_vcdxml->file_prefix, 
223
	  VcdDataSource_t *_source = mk_dsource (p_vcdxml->file_prefix,
224
					       dentry->file_src);
224
					       dentry->file_src);
225
	  
225
226
	  vcd_assert (_source != NULL);
226
	  vcd_assert (_source != NULL);
227
227
228
	  vcd_obj_add_file (_vcd, dentry->name, _source, dentry->file_raw);
228
	  vcd_obj_add_file (_vcd, dentry->name, _source, dentry->file_raw);
229
	}
229
	}
230
      else
230
      else
231
	vcd_obj_add_dir (_vcd, dentry->name);
231
	vcd_obj_add_dir (_vcd, dentry->name);
232
      
232
233
    }
233
    }
234
234
235
  idx = 0;
235
  idx = 0;
236
  _CDIO_LIST_FOREACH (node, p_vcdxml->segment_list)
236
  _CDIO_LIST_FOREACH (node, p_vcdxml->segment_list)
237
    {
237
    {
238
      struct segment_t *p_segment = _cdio_list_node_data (node);
238
      struct segment_t *p_segment = _cdio_list_node_data (node);
239
      VcdDataSource_t *_source = mk_dsource (p_vcdxml->file_prefix, 
239
      VcdDataSource_t *_source = mk_dsource (p_vcdxml->file_prefix,
240
					   p_segment->src);
240
					   p_segment->src);
241
      CdioListNode_t *p_node2;
241
      CdioListNode_t *p_node2;
242
      VcdMpegSource_t *_mpeg_src;
242
      VcdMpegSource_t *_mpeg_src;
Lines 248-259 Link Here
248
      _mpeg_src = vcd_mpeg_source_new (_source);
248
      _mpeg_src = vcd_mpeg_source_new (_source);
249
249
250
      vcd_mpeg_source_scan (_mpeg_src, !_relaxed_aps, _update_scan_offsets,
250
      vcd_mpeg_source_scan (_mpeg_src, !_relaxed_aps, _update_scan_offsets,
251
			    vcd_xml_show_progress 
251
			    vcd_xml_show_progress
252
			    ? vcd_xml_scan_progress_cb : NULL,
252
			    ? vcd_xml_scan_progress_cb : NULL,
253
			    p_segment->id);
253
			    p_segment->id);
254
254
255
      vcd_obj_append_segment_play_item (_vcd, _mpeg_src, p_segment->id);
255
      vcd_obj_append_segment_play_item (_vcd, _mpeg_src, p_segment->id);
256
      
256
257
      _CDIO_LIST_FOREACH (p_node2, p_segment->autopause_list)
257
      _CDIO_LIST_FOREACH (p_node2, p_segment->autopause_list)
258
	{
258
	{
259
	  double *_ap_ts = _cdio_list_node_data (p_node2);
259
	  double *_ap_ts = _cdio_list_node_data (p_node2);
Lines 265-271 Link Here
265
    }
265
    }
266
266
267
  vcd_debug ("sequence count %d", _cdio_list_length (p_vcdxml->sequence_list));
267
  vcd_debug ("sequence count %d", _cdio_list_length (p_vcdxml->sequence_list));
268
  
268
269
  idx = 0;
269
  idx = 0;
270
  _CDIO_LIST_FOREACH (node, p_vcdxml->sequence_list)
270
  _CDIO_LIST_FOREACH (node, p_vcdxml->sequence_list)
271
    {
271
    {
Lines 286-299 Link Here
286
			    ? vcd_xml_scan_progress_cb : NULL,
286
			    ? vcd_xml_scan_progress_cb : NULL,
287
			    sequence->id);
287
			    sequence->id);
288
288
289
      vcd_obj_append_sequence_play_item (_vcd, _mpeg_src, sequence->id, 
289
      vcd_obj_append_sequence_play_item (_vcd, _mpeg_src, sequence->id,
290
					 sequence->default_entry_id);
290
					 sequence->default_entry_id);
291
291
292
      _CDIO_LIST_FOREACH (node2, sequence->entry_point_list)
292
      _CDIO_LIST_FOREACH (node2, sequence->entry_point_list)
293
	{
293
	{
294
	  struct entry_point_t *entry = _cdio_list_node_data (node2);
294
	  struct entry_point_t *entry = _cdio_list_node_data (node2);
295
295
296
	  vcd_obj_add_sequence_entry (_vcd, sequence->id, entry->timestamp, 
296
	  vcd_obj_add_sequence_entry (_vcd, sequence->id, entry->timestamp,
297
				      entry->id);
297
				      entry->id);
298
	}
298
	}
299
299
Lines 315-322 Link Here
315
315
316
    sectors = vcd_obj_begin_output (_vcd);
316
    sectors = vcd_obj_begin_output (_vcd);
317
317
318
    vcd_obj_write_image (_vcd, p_image_sink, vcd_xml_show_progress 
318
    vcd_obj_write_image (_vcd, p_image_sink, vcd_xml_show_progress
319
			 ? vcd_xml_write_progress_cb : NULL, 
319
			 ? vcd_xml_write_progress_cb : NULL,
320
			 NULL, &_vcd_time);
320
			 NULL, &_vcd_time);
321
321
322
    vcd_obj_end_output (_vcd);
322
    vcd_obj_end_output (_vcd);
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_master.h (-2 / +2 lines)
Lines 17-30 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_XML_MASTER_H__
21
#ifndef __VCD_XML_MASTER_H__
22
#define __VCD_XML_MASTER_H__
22
#define __VCD_XML_MASTER_H__
23
#include "vcdxml.h"
23
#include "vcdxml.h"
24
24
25
#include <time.h>
25
#include <time.h>
26
26
27
bool vcd_xml_master (const vcdxml_t *p_vcdxml, 
27
bool vcd_xml_master (const vcdxml_t *p_vcdxml,
28
		     VcdImageSink_t *p_image_sink, time_t *p_create_time);
28
		     VcdImageSink_t *p_image_sink, time_t *p_create_time);
29
29
30
#endif /* __VCD_XML_MASTER_H__ */
30
#endif /* __VCD_XML_MASTER_H__ */
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_minfo.c (-18 / +18 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 56-63 Link Here
56
{
56
{
57
  int _i;
57
  int _i;
58
58
59
  for (_i = 0; _i < _TAG_LEVEL; _i++) 
59
  for (_i = 0; _i < _TAG_LEVEL; _i++)
60
    fputs ("  ", _TAG_FD);  
60
    fputs ("  ", _TAG_FD);
61
}
61
}
62
62
63
static void
63
static void
Lines 99-112 Link Here
99
}
99
}
100
100
101
static void
101
static void
102
_TAG_COMMENT (const char fmt[]) 
102
_TAG_COMMENT (const char fmt[])
103
{
103
{
104
  _TAG_INDENT ();
104
  _TAG_INDENT ();
105
  fprintf (_TAG_FD, " <!-- %s -->\n", fmt);
105
  fprintf (_TAG_FD, " <!-- %s -->\n", fmt);
106
}
106
}
107
107
108
static void
108
static void
109
_TAG_PRINT (const char tag[], const char fmt[], ...) 
109
_TAG_PRINT (const char tag[], const char fmt[], ...)
110
{
110
{
111
  va_list args;
111
  va_list args;
112
  va_start (args, fmt);
112
  va_start (args, fmt);
Lines 168-180 Link Here
168
      {"output-file", 'o', POPT_ARG_STRING, &_output_file, OP_NONE,
168
      {"output-file", 'o', POPT_ARG_STRING, &_output_file, OP_NONE,
169
       "file for XML output", "FILE"},
169
       "file for XML output", "FILE"},
170
170
171
      {"progress", 'p', POPT_ARG_NONE, &_progress_flag, 0,  
171
      {"progress", 'p', POPT_ARG_NONE, &_progress_flag, 0,
172
       "show progress"}, 
172
       "show progress"},
173
      
173
174
      {"verbose", 'v', POPT_ARG_NONE, &_verbose_flag, OP_NONE, 
174
      {"verbose", 'v', POPT_ARG_NONE, &_verbose_flag, OP_NONE,
175
       "be verbose"},
175
       "be verbose"},
176
    
176
177
      {"quiet", 'q', POPT_ARG_NONE, &_quiet_flag, OP_NONE, 
177
      {"quiet", 'q', POPT_ARG_NONE, &_quiet_flag, OP_NONE,
178
       "show only critical messages"},
178
       "show only critical messages"},
179
179
180
      {"gui", '\0', POPT_ARG_NONE, &_gui_flag, 0, "enable GUI mode"},
180
      {"gui", '\0', POPT_ARG_NONE, &_gui_flag, 0, "enable GUI mode"},
Lines 266-272 Link Here
266
    _TAG_OPEN ("mpeg-info", "src=\"%s\"", _mpeg_fname);
266
    _TAG_OPEN ("mpeg-info", "src=\"%s\"", _mpeg_fname);
267
267
268
    if (_generic_info)
268
    if (_generic_info)
269
      { 
269
      {
270
        const struct vcd_mpeg_stream_info *_info = vcd_mpeg_source_get_info (src);
270
        const struct vcd_mpeg_stream_info *_info = vcd_mpeg_source_get_info (src);
271
        int i;
271
        int i;
272
272
Lines 302-308 Link Here
302
            _TAG_PRINT ("horizontal-size", "%d", _vinfo->hsize);
302
            _TAG_PRINT ("horizontal-size", "%d", _vinfo->hsize);
303
            _TAG_PRINT ("vertical-size", "%d", _vinfo->vsize);
303
            _TAG_PRINT ("vertical-size", "%d", _vinfo->vsize);
304
            _TAG_PRINT ("frame-rate", "%f", _vinfo->frate);
304
            _TAG_PRINT ("frame-rate", "%f", _vinfo->frate);
305
            
305
306
            _TAG_PRINT ("bit-rate", "%d", _vinfo->bitrate);
306
            _TAG_PRINT ("bit-rate", "%d", _vinfo->bitrate);
307
307
308
            if (_dump_aps && _vinfo->aps_list)
308
            if (_dump_aps && _vinfo->aps_list)
Lines 314-323 Link Here
314
                _CDIO_LIST_FOREACH (n, _vinfo->aps_list)
314
                _CDIO_LIST_FOREACH (n, _vinfo->aps_list)
315
                  {
315
                  {
316
                    struct aps_data *_data = _cdio_list_node_data (n);
316
                    struct aps_data *_data = _cdio_list_node_data (n);
317
                    
317
318
                    _TAG_INDENT ();
318
                    _TAG_INDENT ();
319
                    fprintf (_TAG_FD, "<aps packet-no=\"%u\">%f</aps>\n",
319
                    fprintf (_TAG_FD, "<aps packet-no=\"%u\">%f</aps>\n",
320
                             (unsigned int) _data->packet_no, 
320
                             (unsigned int) _data->packet_no,
321
                             _data->timestamp);
321
                             _data->timestamp);
322
                  }
322
                  }
323
323
Lines 345-351 Link Here
345
345
346
              _TAG_COMMENT (_str[i]);
346
              _TAG_COMMENT (_str[i]);
347
            }
347
            }
348
            
348
349
            _TAG_PRINT ("layer", "%d", _ainfo->layer);
349
            _TAG_PRINT ("layer", "%d", _ainfo->layer);
350
            _TAG_PRINT ("sampling-frequency", "%d", _ainfo->sampfreq);
350
            _TAG_PRINT ("sampling-frequency", "%d", _ainfo->sampfreq);
351
            _TAG_PRINT ("bit-rate", "%d", _ainfo->bitrate);
351
            _TAG_PRINT ("bit-rate", "%d", _ainfo->bitrate);
Lines 394-401 Link Here
394
394
395
  return EXIT_SUCCESS;
395
  return EXIT_SUCCESS;
396
}
396
}
397
397
398
/* 
398
/*
399
 * Local variables:
399
 * Local variables:
400
 *  c-file-style: "gnu"
400
 *  c-file-style: "gnu"
401
 *  tab-width: 8
401
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_parse.c (-90 / +90 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 50-56 Link Here
50
} handlers_t;
50
} handlers_t;
51
51
52
#define GET_ELEM_(id, doc, node, ns) \
52
#define GET_ELEM_(id, doc, node, ns) \
53
 if ((!xmlStrcmp (node->name, (const xmlChar *) id)) && (node->ns == ns)) 
53
 if ((!xmlStrcmp (node->name, (const xmlChar *) id)) && (node->ns == ns))
54
54
55
#define GET_ELEM_STR(str, id, doc, node, ns) \
55
#define GET_ELEM_STR(str, id, doc, node, ns) \
56
 if ((!xmlStrcmp (node->name, (const xmlChar *) id)) && (node->ns == ns)) \
56
 if ((!xmlStrcmp (node->name, (const xmlChar *) id)) && (node->ns == ns)) \
Lines 76-82 Link Here
76
  long retval = 0;
76
  long retval = 0;
77
  char *_tmp = NULL;
77
  char *_tmp = NULL;
78
  char *endptr;
78
  char *endptr;
79
  
79
80
  GET_ELEM_STR (_tmp, id, doc, node, ns);
80
  GET_ELEM_STR (_tmp, id, doc, node, ns);
81
81
82
  if (!_tmp)
82
  if (!_tmp)
Lines 100-106 Link Here
100
  double retval = 0;
100
  double retval = 0;
101
  char *_tmp = NULL;
101
  char *_tmp = NULL;
102
  char *endptr;
102
  char *endptr;
103
  
103
104
  GET_ELEM_STR (_tmp, id, doc, node, ns);
104
  GET_ELEM_STR (_tmp, id, doc, node, ns);
105
105
106
  if (!_tmp)
106
  if (!_tmp)
Lines 113-119 Link Here
113
  retval = strtod (_tmp, &endptr);
113
  retval = strtod (_tmp, &endptr);
114
114
115
  if (*endptr)
115
  if (*endptr)
116
    vcd_error ("XML: error while converting string '%s' to floating point.", 
116
    vcd_error ("XML: error while converting string '%s' to floating point.",
117
	       _tmp);
117
	       _tmp);
118
118
119
  return retval;
119
  return retval;
Lines 121-136 Link Here
121
121
122
122
123
/*
123
/*
124
 * options 
124
 * options
125
 */
125
 */
126
126
127
static bool
127
static bool
128
_parse_option (vcdxml_t *obj, xmlDocPtr doc, xmlNodePtr node, xmlNsPtr ns)
128
_parse_option (vcdxml_t *obj, xmlDocPtr doc, xmlNodePtr node, xmlNsPtr ns)
129
{
129
{
130
  if (!xmlStrcmp (node->name, (const xmlChar *) "option")) 
130
  if (!xmlStrcmp (node->name, (const xmlChar *) "option"))
131
    {
131
    {
132
      struct option_t *_option = calloc(1, sizeof (struct option_t));
132
      struct option_t *_option = calloc(1, sizeof (struct option_t));
133
	  
133
134
      GET_PROP_STR (_option->name, "name", doc, node, ns);
134
      GET_PROP_STR (_option->name, "name", doc, node, ns);
135
      GET_PROP_STR (_option->value, "value", doc, node, ns);
135
      GET_PROP_STR (_option->value, "value", doc, node, ns);
136
136
Lines 197-203 Link Here
197
}
197
}
198
198
199
/*
199
/*
200
 * segment items block 
200
 * segment items block
201
 */
201
 */
202
202
203
static bool
203
static bool
Lines 226-232 Link Here
226
	{
226
	{
227
	  double *_ap_ts = calloc(1, sizeof (double));
227
	  double *_ap_ts = calloc(1, sizeof (double));
228
	  *_ap_ts = 0;
228
	  *_ap_ts = 0;
229
	  
229
230
	  GET_ELEM_DOUBLE (*_ap_ts, "auto-pause", doc, cur, ns);
230
	  GET_ELEM_DOUBLE (*_ap_ts, "auto-pause", doc, cur, ns);
231
231
232
	  _cdio_list_append (segment->autopause_list, _ap_ts);
232
	  _cdio_list_append (segment->autopause_list, _ap_ts);
Lines 250-256 Link Here
250
      if (cur->ns != ns)
250
      if (cur->ns != ns)
251
	continue;
251
	continue;
252
252
253
      if (!xmlStrcmp (cur->name, (const xmlChar *) "segment-item")) 
253
      if (!xmlStrcmp (cur->name, (const xmlChar *) "segment-item"))
254
	rc = _parse_mpeg_segment (obj, doc, cur, ns);
254
	rc = _parse_mpeg_segment (obj, doc, cur, ns);
255
      else
255
      else
256
	vcd_assert_not_reached ();
256
	vcd_assert_not_reached ();
Lines 263-273 Link Here
263
}
263
}
264
264
265
/*
265
/*
266
 * PBC block 
266
 * PBC block
267
 */
267
 */
268
268
269
static void
269
static void
270
_parse_common_pbcattrs (pbc_t *pbc, xmlDocPtr doc, xmlNodePtr node, 
270
_parse_common_pbcattrs (pbc_t *pbc, xmlDocPtr doc, xmlNodePtr node,
271
			xmlNsPtr ns)
271
			xmlNsPtr ns)
272
{
272
{
273
  char *_tmp = NULL;
273
  char *_tmp = NULL;
Lines 282-291 Link Here
282
}
282
}
283
283
284
static long
284
static long
285
_get_prop_long (const char _prop_name[], xmlDocPtr doc, xmlNodePtr node, 
285
_get_prop_long (const char _prop_name[], xmlDocPtr doc, xmlNodePtr node,
286
		xmlNsPtr ns)
286
		xmlNsPtr ns)
287
{
287
{
288
  if (xmlHasProp (node, (const xmlChar *) _prop_name)) 
288
  if (xmlHasProp (node, (const xmlChar *) _prop_name))
289
    {
289
    {
290
      char *str = (char *) xmlGetProp (node, (const xmlChar *) _prop_name);
290
      char *str = (char *) xmlGetProp (node, (const xmlChar *) _prop_name);
291
      long retval = 0;
291
      long retval = 0;
Lines 297-308 Link Here
297
      retval = strtol (str, &endptr, 10);
297
      retval = strtol (str, &endptr, 10);
298
298
299
      if (*endptr)
299
      if (*endptr)
300
	vcd_error ("XML: error while converting string '%s' to an integer.", 
300
	vcd_error ("XML: error while converting string '%s' to an integer.",
301
		   str);
301
		   str);
302
302
303
      return retval;
303
      return retval;
304
    }
304
    }
305
  
305
306
  return 0;
306
  return 0;
307
}
307
}
308
308
Lines 315-337 Link Here
315
  const uint32_t x2 = _get_prop_long ("x2", doc, node, ns);
315
  const uint32_t x2 = _get_prop_long ("x2", doc, node, ns);
316
  const uint32_t y2 = _get_prop_long ("y2", doc, node, ns);
316
  const uint32_t y2 = _get_prop_long ("y2", doc, node, ns);
317
317
318
  if (x1 > 255) 
318
  if (x1 > 255)
319
    vcd_warn ("XML: value of x1 (%u) is greater than 255", (unsigned int) x1);
319
    vcd_warn ("XML: value of x1 (%u) is greater than 255", (unsigned int) x1);
320
320
321
  if (x2 > 255) 
321
  if (x2 > 255)
322
    vcd_error ("XML: value of x2 (%u) is greater than 255", (unsigned int) x2);
322
    vcd_error ("XML: value of x2 (%u) is greater than 255", (unsigned int) x2);
323
323
324
  if (y1 > 255) 
324
  if (y1 > 255)
325
    vcd_error ("XML: value of y1 (%u) is greater than 255", (unsigned int) y1);
325
    vcd_error ("XML: value of y1 (%u) is greater than 255", (unsigned int) y1);
326
326
327
  if (y2 > 255) 
327
  if (y2 > 255)
328
    vcd_error ("XML: value of y2 (%u) is greater than 255", (unsigned int) y2);
328
    vcd_error ("XML: value of y2 (%u) is greater than 255", (unsigned int) y2);
329
329
330
  *pp_area = vcd_pbc_area_new ( x1, y1, x2, y2);
330
  *pp_area = vcd_pbc_area_new ( x1, y1, x2, y2);
331
}
331
}
332
332
333
static bool
333
static bool
334
_parse_pbc_selection (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node, 
334
_parse_pbc_selection (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node,
335
		      xmlNsPtr ns)
335
		      xmlNsPtr ns)
336
{
336
{
337
  xmlNodePtr cur;
337
  xmlNodePtr cur;
Lines 345-371 Link Here
345
345
346
  FOR_EACH (cur, node)
346
  FOR_EACH (cur, node)
347
    {
347
    {
348
      if (cur->ns != ns) 
348
      if (cur->ns != ns)
349
	continue; 
349
	continue;
350
      
350
351
      if (!xmlStrcmp (cur->name, (const xmlChar *) "prev"))
351
      if (!xmlStrcmp (cur->name, (const xmlChar *) "prev"))
352
	{ 
352
	{
353
	  GET_PROP_STR (p_pbc->prev_id, (const xmlChar *) "ref", doc, cur, ns);
353
	  GET_PROP_STR (p_pbc->prev_id, (const xmlChar *) "ref", doc, cur, ns);
354
	  _get_area_props (&p_pbc->prev_area, doc, cur, ns);
354
	  _get_area_props (&p_pbc->prev_area, doc, cur, ns);
355
	}
355
	}
356
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "next"))
356
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "next"))
357
	{ 
357
	{
358
	  GET_PROP_STR (p_pbc->next_id, "ref", doc, cur, ns); 
358
	  GET_PROP_STR (p_pbc->next_id, "ref", doc, cur, ns);
359
	  _get_area_props (&p_pbc->next_area, doc, cur, ns);
359
	  _get_area_props (&p_pbc->next_area, doc, cur, ns);
360
	}
360
	}
361
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "return"))
361
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "return"))
362
	{
362
	{
363
	  GET_PROP_STR (p_pbc->retn_id, "ref", doc, cur, ns); 
363
	  GET_PROP_STR (p_pbc->retn_id, "ref", doc, cur, ns);
364
	  _get_area_props (&p_pbc->return_area, doc, cur, ns);
364
	  _get_area_props (&p_pbc->return_area, doc, cur, ns);
365
	}
365
	}
366
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "timeout"))
366
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "timeout"))
367
	{ 
367
	{
368
	  GET_PROP_STR (p_pbc->timeout_id, "ref", doc, cur, ns); 
368
	  GET_PROP_STR (p_pbc->timeout_id, "ref", doc, cur, ns);
369
	}
369
	}
370
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "multi-default"))
370
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "multi-default"))
371
	{
371
	{
Lines 373-397 Link Here
373
373
374
	  p_pbc->selection_type = _SEL_MULTI_DEF;
374
	  p_pbc->selection_type = _SEL_MULTI_DEF;
375
375
376
	  GET_PROP_STR (_numeric, "numeric", doc, cur, ns); 
376
	  GET_PROP_STR (_numeric, "numeric", doc, cur, ns);
377
	  if (_numeric && !strcmp (_numeric, "disabled"))
377
	  if (_numeric && !strcmp (_numeric, "disabled"))
378
	    p_pbc->selection_type = _SEL_MULTI_DEF_NO_NUM;
378
	    p_pbc->selection_type = _SEL_MULTI_DEF_NO_NUM;
379
	}
379
	}
380
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "default"))
380
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "default"))
381
	{ 
381
	{
382
	  p_pbc->selection_type = _SEL_NORMAL;
382
	  p_pbc->selection_type = _SEL_NORMAL;
383
	  GET_PROP_STR (p_pbc->default_id, "ref", doc, cur, ns); 
383
	  GET_PROP_STR (p_pbc->default_id, "ref", doc, cur, ns);
384
	}
384
	}
385
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "bsn"))
385
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "bsn"))
386
	{ p_pbc->bsn = _get_elem_long ("bsn", doc, cur, ns); }
386
	{ p_pbc->bsn = _get_elem_long ("bsn", doc, cur, ns); }
387
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "loop"))
387
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "loop"))
388
	{ 
388
	{
389
	  char *_tmp = NULL;
389
	  char *_tmp = NULL;
390
	  
390
391
	  p_pbc->loop_count = _get_elem_long ("loop", doc, cur, ns); 
391
	  p_pbc->loop_count = _get_elem_long ("loop", doc, cur, ns);
392
392
393
	  GET_PROP_STR (_tmp, "jump-timing", doc, cur, ns);
393
	  GET_PROP_STR (_tmp, "jump-timing", doc, cur, ns);
394
	  
394
395
	  if (_tmp && !strcmp (_tmp, "delayed"))
395
	  if (_tmp && !strcmp (_tmp, "delayed"))
396
	    p_pbc->jump_delayed = true;
396
	    p_pbc->jump_delayed = true;
397
	}
397
	}
Lines 403-409 Link Here
403
	{
403
	{
404
	  char *_select_ref = NULL;
404
	  char *_select_ref = NULL;
405
405
406
	  GET_PROP_STR (_select_ref, "ref", doc, cur, ns); 
406
	  GET_PROP_STR (_select_ref, "ref", doc, cur, ns);
407
407
408
	  _cdio_list_append (p_pbc->select_id_list, _select_ref);
408
	  _cdio_list_append (p_pbc->select_id_list, _select_ref);
409
409
Lines 413-419 Link Here
413
	    _get_area_props (&_area, doc, cur, ns);
413
	    _get_area_props (&_area, doc, cur, ns);
414
	    _cdio_list_append (p_pbc->select_area_list, _area);
414
	    _cdio_list_append (p_pbc->select_area_list, _area);
415
	  }
415
	  }
416
	  
416
417
	}
417
	}
418
      else
418
      else
419
	vcd_assert_not_reached ();
419
	vcd_assert_not_reached ();
Lines 425-431 Link Here
425
}
425
}
426
426
427
static bool
427
static bool
428
_parse_pbc_playlist (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node, 
428
_parse_pbc_playlist (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node,
429
		     xmlNsPtr ns)
429
		     xmlNsPtr ns)
430
{
430
{
431
  xmlNodePtr cur;
431
  xmlNodePtr cur;
Lines 437-445 Link Here
437
437
438
  FOR_EACH (cur, node)
438
  FOR_EACH (cur, node)
439
    {
439
    {
440
      if (cur->ns != ns) 
440
      if (cur->ns != ns)
441
	continue; 
441
	continue;
442
      
442
443
      if (!xmlStrcmp (cur->name, (const xmlChar *) "prev"))
443
      if (!xmlStrcmp (cur->name, (const xmlChar *) "prev"))
444
	{ GET_PROP_STR (_pbc->prev_id, "ref", doc, cur, ns); }
444
	{ GET_PROP_STR (_pbc->prev_id, "ref", doc, cur, ns); }
445
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "next"))
445
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "next"))
Lines 456-462 Link Here
456
	{
456
	{
457
	  char *_item_ref = NULL;
457
	  char *_item_ref = NULL;
458
458
459
	  GET_PROP_STR (_item_ref, "ref", doc, cur, ns); 
459
	  GET_PROP_STR (_item_ref, "ref", doc, cur, ns);
460
460
461
	  _cdio_list_append (_pbc->item_id_list, _item_ref);
461
	  _cdio_list_append (_pbc->item_id_list, _item_ref);
462
	}
462
	}
Lines 470-476 Link Here
470
}
470
}
471
471
472
static bool
472
static bool
473
_parse_pbc_endlist (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node, 
473
_parse_pbc_endlist (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node,
474
		    xmlNsPtr ns)
474
		    xmlNsPtr ns)
475
{
475
{
476
  xmlNodePtr cur;
476
  xmlNodePtr cur;
Lines 482-489 Link Here
482
482
483
  FOR_EACH (cur, node)
483
  FOR_EACH (cur, node)
484
    {
484
    {
485
      if (cur->ns != ns) 
485
      if (cur->ns != ns)
486
	continue; 
486
	continue;
487
487
488
      if (!xmlStrcmp (cur->name, (const xmlChar *) "next-volume"))
488
      if (!xmlStrcmp (cur->name, (const xmlChar *) "next-volume"))
489
	{ _pbc->next_disc = _get_elem_long ("next-volume", doc, cur, ns); }
489
	{ _pbc->next_disc = _get_elem_long ("next-volume", doc, cur, ns); }
Lines 507-522 Link Here
507
    {
507
    {
508
      bool rc = true;
508
      bool rc = true;
509
509
510
      if (cur->ns != ns) 
510
      if (cur->ns != ns)
511
	continue; 
511
	continue;
512
512
513
      if (!xmlStrcmp (cur->name, (const xmlChar *) "selection")) 
513
      if (!xmlStrcmp (cur->name, (const xmlChar *) "selection"))
514
	rc = _parse_pbc_selection (p_obj, doc, cur, ns);
514
	rc = _parse_pbc_selection (p_obj, doc, cur, ns);
515
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "playlist")) 
515
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "playlist"))
516
	rc = _parse_pbc_playlist (p_obj, doc, cur, ns);
516
	rc = _parse_pbc_playlist (p_obj, doc, cur, ns);
517
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "endlist")) 
517
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "endlist"))
518
	rc = _parse_pbc_endlist (p_obj, doc, cur, ns);
518
	rc = _parse_pbc_endlist (p_obj, doc, cur, ns);
519
      else 
519
      else
520
	vcd_assert_not_reached ();
520
	vcd_assert_not_reached ();
521
521
522
      if (rc)
522
      if (rc)
Lines 531-537 Link Here
531
 */
531
 */
532
532
533
static bool
533
static bool
534
_parse_mpeg_sequence (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node, 
534
_parse_mpeg_sequence (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node,
535
		      xmlNsPtr ns)
535
		      xmlNsPtr ns)
536
{
536
{
537
  struct sequence_t *sequence;
537
  struct sequence_t *sequence;
Lines 561-567 Link Here
561
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "entry"))
561
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "entry"))
562
	{
562
	{
563
	  struct entry_point_t *entry = calloc(1, sizeof (struct entry_point_t));
563
	  struct entry_point_t *entry = calloc(1, sizeof (struct entry_point_t));
564
	  
564
565
	  GET_PROP_STR (entry->id, "id", doc, cur, ns);
565
	  GET_PROP_STR (entry->id, "id", doc, cur, ns);
566
	  GET_ELEM_DOUBLE (entry->timestamp, "entry", doc, cur, ns);
566
	  GET_ELEM_DOUBLE (entry->timestamp, "entry", doc, cur, ns);
567
567
Lines 571-577 Link Here
571
	{
571
	{
572
	  double *_ap_ts = calloc(1, sizeof (double));
572
	  double *_ap_ts = calloc(1, sizeof (double));
573
	  *_ap_ts = 0;
573
	  *_ap_ts = 0;
574
	  
574
575
	  GET_ELEM_DOUBLE (*_ap_ts, "auto-pause", doc, cur, ns);
575
	  GET_ELEM_DOUBLE (*_ap_ts, "auto-pause", doc, cur, ns);
576
576
577
	  _cdio_list_append (sequence->autopause_list, _ap_ts);
577
	  _cdio_list_append (sequence->autopause_list, _ap_ts);
Lines 596-602 Link Here
596
	continue;
596
	continue;
597
597
598
598
599
      if (!xmlStrcmp (cur->name, (const xmlChar *) "sequence-item")) 
599
      if (!xmlStrcmp (cur->name, (const xmlChar *) "sequence-item"))
600
	rc = _parse_mpeg_sequence (p_obj, doc, cur, ns);
600
	rc = _parse_mpeg_sequence (p_obj, doc, cur, ns);
601
      else
601
      else
602
	vcd_assert_not_reached ();
602
	vcd_assert_not_reached ();
Lines 609-619 Link Here
609
}
609
}
610
610
611
/*
611
/*
612
 * filesystem block 
612
 * filesystem block
613
 */
613
 */
614
614
615
static bool
615
static bool
616
_parse_file (vcdxml_t *p_obj, const char path[], xmlDocPtr doc, 
616
_parse_file (vcdxml_t *p_obj, const char path[], xmlDocPtr doc,
617
	     xmlNodePtr node, xmlNsPtr ns)
617
	     xmlNodePtr node, xmlNsPtr ns)
618
{
618
{
619
  xmlNodePtr cur;
619
  xmlNodePtr cur;
Lines 648-657 Link Here
648
    char *_tmp;
648
    char *_tmp;
649
649
650
    _tmp = malloc (strlen (path) + strlen (_name) + 1);
650
    _tmp = malloc (strlen (path) + strlen (_name) + 1);
651
    
651
652
    strcpy (_tmp, path);
652
    strcpy (_tmp, path);
653
    strcat (_tmp, _name);
653
    strcat (_tmp, _name);
654
	    
654
655
    _data = malloc (sizeof (struct filesystem_t));
655
    _data = malloc (sizeof (struct filesystem_t));
656
    _data->name = _tmp;
656
    _data->name = _tmp;
657
    _data->file_src = strdup (_src);
657
    _data->file_src = strdup (_src);
Lines 664-670 Link Here
664
}
664
}
665
665
666
static bool
666
static bool
667
_parse_folder (vcdxml_t *p_obj, const char path[], xmlDocPtr doc, 
667
_parse_folder (vcdxml_t *p_obj, const char path[], xmlDocPtr doc,
668
	       xmlNodePtr node, xmlNsPtr ns)
668
	       xmlNodePtr node, xmlNsPtr ns)
669
{
669
{
670
  xmlNodePtr cur;
670
  xmlNodePtr cur;
Lines 676-685 Link Here
676
    {
676
    {
677
      bool rc = true;
677
      bool rc = true;
678
678
679
      if (cur->ns != ns) 
679
      if (cur->ns != ns)
680
	continue; 
680
	continue;
681
681
682
      if (!xmlStrcmp (cur->name, (const xmlChar *) "name")) 
682
      if (!xmlStrcmp (cur->name, (const xmlChar *) "name"))
683
	{
683
	{
684
	  xmlChar *_tmp;
684
	  xmlChar *_tmp;
685
685
Lines 695-722 Link Here
695
695
696
	  {
696
	  {
697
	    struct filesystem_t *_data;
697
	    struct filesystem_t *_data;
698
	    
698
699
	    _data = malloc (sizeof (struct filesystem_t));
699
	    _data = malloc (sizeof (struct filesystem_t));
700
	    _data->name = strdup (new_path);
700
	    _data->name = strdup (new_path);
701
	    _data->file_src = NULL;
701
	    _data->file_src = NULL;
702
702
703
	    _cdio_list_append (p_obj->filesystem, _data);
703
	    _cdio_list_append (p_obj->filesystem, _data);
704
	  }
704
	  }
705
	  
705
706
706
707
	  strcat (new_path, "/");
707
	  strcat (new_path, "/");
708
	  
708
709
	  rc = false;
709
	  rc = false;
710
	  
710
711
	  /* fixme, free _tmp?? */
711
	  /* fixme, free _tmp?? */
712
	}
712
	}
713
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "folder")) 
713
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "folder"))
714
	rc = _parse_folder (p_obj, new_path, doc, cur, ns);
714
	rc = _parse_folder (p_obj, new_path, doc, cur, ns);
715
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "file"))
715
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "file"))
716
	rc = _parse_file (p_obj, new_path, doc, cur, ns);
716
	rc = _parse_file (p_obj, new_path, doc, cur, ns);
717
      else 
717
      else
718
	vcd_assert_not_reached ();
718
	vcd_assert_not_reached ();
719
      
719
720
      if (new_path == NULL)
720
      if (new_path == NULL)
721
	rc = true;
721
	rc = true;
722
722
Lines 724-730 Link Here
724
	free(new_path);
724
	free(new_path);
725
	return rc;
725
	return rc;
726
      }
726
      }
727
      
727
728
    }
728
    }
729
729
730
  free(new_path);
730
  free(new_path);
Lines 732-738 Link Here
732
}
732
}
733
733
734
static bool
734
static bool
735
_parse_filesystem (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node, 
735
_parse_filesystem (vcdxml_t *p_obj, xmlDocPtr doc, xmlNodePtr node,
736
		   xmlNsPtr ns)
736
		   xmlNsPtr ns)
737
{
737
{
738
  xmlNodePtr cur;
738
  xmlNodePtr cur;
Lines 741-754 Link Here
741
    {
741
    {
742
      bool rc = true;
742
      bool rc = true;
743
743
744
      if (cur->ns != ns) 
744
      if (cur->ns != ns)
745
	continue; 
745
	continue;
746
746
747
      if (!xmlStrcmp (cur->name, (const xmlChar *) "folder")) 
747
      if (!xmlStrcmp (cur->name, (const xmlChar *) "folder"))
748
	rc = _parse_folder (p_obj, "", doc, cur, ns);
748
	rc = _parse_folder (p_obj, "", doc, cur, ns);
749
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "file"))
749
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "file"))
750
	rc = _parse_file (p_obj, "", doc, cur, ns);
750
	rc = _parse_file (p_obj, "", doc, cur, ns);
751
      else 
751
      else
752
	vcd_assert_not_reached ();
752
	vcd_assert_not_reached ();
753
753
754
      if (rc)
754
      if (rc)
Lines 777-786 Link Here
777
    { "hqvcd", "1.0", VCD_TYPE_HQVCD },
777
    { "hqvcd", "1.0", VCD_TYPE_HQVCD },
778
    { NULL, NULL, VCD_TYPE_INVALID }
778
    { NULL, NULL, VCD_TYPE_INVALID }
779
  };
779
  };
780
      
780
781
  int i = 0;
781
  int i = 0;
782
782
783
  while (type_str[i].class) 
783
  while (type_str[i].class)
784
    if (strcasecmp(class, type_str[i].class)
784
    if (strcasecmp(class, type_str[i].class)
785
	|| strcasecmp(version, type_str[i].version))
785
	|| strcasecmp(version, type_str[i].version))
786
      i++;
786
      i++;
Lines 809-833 Link Here
809
  FOR_EACH (cur, node)
809
  FOR_EACH (cur, node)
810
    {
810
    {
811
      bool rc = false;
811
      bool rc = false;
812
      
812
813
      if (cur->ns != ns)
813
      if (cur->ns != ns)
814
	continue;
814
	continue;
815
815
816
      if (!xmlStrcmp (cur->name, (const xmlChar *) "meta")) 
816
      if (!xmlStrcmp (cur->name, (const xmlChar *) "meta"))
817
	{ /* NOOP */ }
817
	{ /* NOOP */ }
818
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "option")) 
818
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "option"))
819
	rc = _parse_option (p_obj, doc, cur, ns);
819
	rc = _parse_option (p_obj, doc, cur, ns);
820
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "info")) 
820
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "info"))
821
	rc = _parse_info (p_obj, doc, cur, ns);
821
	rc = _parse_info (p_obj, doc, cur, ns);
822
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "pvd")) 
822
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "pvd"))
823
	rc = _parse_pvd (p_obj, doc, cur, ns);
823
	rc = _parse_pvd (p_obj, doc, cur, ns);
824
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "pbc")) 
824
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "pbc"))
825
	rc = _parse_pbc (p_obj, doc, cur, ns);
825
	rc = _parse_pbc (p_obj, doc, cur, ns);
826
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "segment-items")) 
826
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "segment-items"))
827
	rc = _parse_segments (p_obj, doc, cur, ns);
827
	rc = _parse_segments (p_obj, doc, cur, ns);
828
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "filesystem")) 
828
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "filesystem"))
829
	rc = _parse_filesystem (p_obj, doc, cur, ns);
829
	rc = _parse_filesystem (p_obj, doc, cur, ns);
830
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "sequence-items")) 
830
      else if (!xmlStrcmp (cur->name, (const xmlChar *) "sequence-items"))
831
	rc = _parse_sequences (p_obj, doc, cur, ns);
831
	rc = _parse_sequences (p_obj, doc, cur, ns);
832
      else vcd_warn ("XML: unexpected element: %s", cur->name);
832
      else vcd_warn ("XML: unexpected element: %s", cur->name);
833
833
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_parse.h (-1 / +1 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_XML_PARSE_H__
21
#ifndef __VCD_XML_PARSE_H__
22
#define __VCD_XML_PARSE_H__
22
#define __VCD_XML_PARSE_H__
23
23
(-)vcdimager-0.7.24.ORIG/frontends/xml/vcd_xml_rip.c (-103 / +103 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
/* Private headers */
22
/* Private headers */
23
#include "vcd_read.h"
23
#include "vcd_read.h"
24
#include "vcdxml.h"
24
#include "vcdxml.h"
Lines 81-90 Link Here
81
    {
81
    {
82
    case _STAT_DIR:
82
    case _STAT_DIR:
83
	{
83
	{
84
	  struct filesystem_t *p_fs 
84
	  struct filesystem_t *p_fs
85
	    = calloc(1, sizeof (struct filesystem_t));
85
	    = calloc(1, sizeof (struct filesystem_t));
86
	  _cdio_list_append (p_vcdxml->filesystem, p_fs);
86
	  _cdio_list_append (p_vcdxml->filesystem, p_fs);
87
	  
87
88
	  p_fs->name = strdup (pathname);
88
	  p_fs->name = strdup (pathname);
89
	}
89
	}
90
      break;
90
      break;
Lines 103-109 Link Here
103
	{
103
	{
104
	  char namebuf2[strlen (namebuf) + 2];
104
	  char namebuf2[strlen (namebuf) + 2];
105
	  int i;
105
	  int i;
106
		
106
107
	  namebuf2[0] = '_';
107
	  namebuf2[0] = '_';
108
108
109
	  for (i = 0; namebuf[i]; i++)
109
	  for (i = 0; namebuf[i]; i++)
Lines 123-140 Link Here
123
	if (p_fs->file_raw)
123
	if (p_fs->file_raw)
124
	  {
124
	  {
125
	    if (p_fs->size % ISO_BLOCKSIZE == 0)
125
	    if (p_fs->size % ISO_BLOCKSIZE == 0)
126
	      { 
126
	      {
127
		p_fs->size /= ISO_BLOCKSIZE;
127
		p_fs->size /= ISO_BLOCKSIZE;
128
		p_fs->size *= M2RAW_SECTOR_SIZE;
128
		p_fs->size *= M2RAW_SECTOR_SIZE;
129
	      }
129
	      }
130
	    else if (p_fs->size % M2RAW_SECTOR_SIZE == 0)
130
	    else if (p_fs->size % M2RAW_SECTOR_SIZE == 0)
131
	      vcd_warn ("detected wrong size calculation for form2 file `%s'; fixing up", namebuf);
131
	      vcd_warn ("detected wrong size calculation for form2 file `%s'; fixing up", namebuf);
132
	    else 
132
	    else
133
	      vcd_error ("form2 file has invalid file size");
133
	      vcd_error ("form2 file has invalid file size");
134
	  }
134
	  }
135
      }
135
      }
136
      break;
136
      break;
137
      
137
138
    default:
138
    default:
139
      vcd_assert_not_reached ();
139
      vcd_assert_not_reached ();
140
      break;
140
      break;
Lines 142-151 Link Here
142
}
142
}
143
143
144
static int
144
static int
145
_parse_isofs_r (vcdxml_t *p_vcdxml, CdIo_t *p_cdio, 
145
_parse_isofs_r (vcdxml_t *p_vcdxml, CdIo_t *p_cdio,
146
		const char pathname[])
146
		const char pathname[])
147
{ 
147
{
148
  CdioList_t *entlist = iso9660_fs_readdir (p_cdio, pathname, true);
148
  CdioList_t *entlist = iso9660_fs_readdir (p_cdio, pathname);
149
  CdioListNode_t *entnode;
149
  CdioListNode_t *entnode;
150
150
151
  if (entlist == NULL)
151
  if (entlist == NULL)
Lines 162-169 Link Here
162
162
163
      if (NULL == statbuf)
163
      if (NULL == statbuf)
164
	return -1;
164
	return -1;
165
      
165
166
      if (!strcmp (_name, ".") 
166
      if (!strcmp (_name, ".")
167
	  || !strcmp (_name, "..")
167
	  || !strcmp (_name, "..")
168
	  || !strcmp (_name, "MPEGAV")
168
	  || !strcmp (_name, "MPEGAV")
169
	  || !strcmp (_name, "MPEG2")
169
	  || !strcmp (_name, "MPEG2")
Lines 184-190 Link Here
184
      }
184
      }
185
    }
185
    }
186
186
187
  _cdio_list_free (entlist, true);
187
  _cdio_list_free (entlist, true, NULL);
188
188
189
  return 0;
189
  return 0;
190
}
190
}
Lines 313-319 Link Here
313
      track_t track = vcdinf_get_track(&entries, idx);
313
      track_t track = vcdinf_get_track(&entries, idx);
314
      bool newtrack = (track != ltrack);
314
      bool newtrack = (track != ltrack);
315
      ltrack = track;
315
      ltrack = track;
316
      
316
317
      vcd_assert (extent >= CDIO_PREGAP_SECTORS);
317
      vcd_assert (extent >= CDIO_PREGAP_SECTORS);
318
      extent = cdio_lba_to_lsn(extent);
318
      extent = cdio_lba_to_lsn(extent);
319
319
Lines 339-345 Link Here
339
339
340
	  snprintf (buf, sizeof (buf), "entry-%3.3d", idx);
340
	  snprintf (buf, sizeof (buf), "entry-%3.3d", idx);
341
	  p_new_sequence->default_entry_id = strdup (buf);
341
	  p_new_sequence->default_entry_id = strdup (buf);
342
	  
342
343
	  _cdio_list_append (p_vcdxml->sequence_list, p_new_sequence);
343
	  _cdio_list_append (p_vcdxml->sequence_list, p_new_sequence);
344
	}
344
	}
345
      else
345
      else
Lines 348-354 Link Here
348
	  struct sequence_t *p_seq =
348
	  struct sequence_t *p_seq =
349
	    _cdio_list_node_data (_cdio_list_end (p_vcdxml->sequence_list));
349
	    _cdio_list_node_data (_cdio_list_end (p_vcdxml->sequence_list));
350
350
351
	  struct entry_point_t *p_entry = 
351
	  struct entry_point_t *p_entry =
352
	    calloc(1, sizeof (struct entry_point_t));
352
	    calloc(1, sizeof (struct entry_point_t));
353
353
354
	  snprintf (buf, sizeof (buf), "entry-%3.3d", idx);
354
	  snprintf (buf, sizeof (buf), "entry-%3.3d", idx);
Lines 370-376 Link Here
370
{
370
{
371
  if (s)
371
  if (s)
372
    return strdup (s);
372
    return strdup (s);
373
  
373
374
  return NULL;
374
  return NULL;
375
}
375
}
376
376
Lines 390-396 Link Here
390
{
390
{
391
  static char buf[80];
391
  static char buf[80];
392
  vcdinfo_itemid_t itemid;
392
  vcdinfo_itemid_t itemid;
393
  
393
394
  vcdinfo_classify_itemid (pin, &itemid);
394
  vcdinfo_classify_itemid (pin, &itemid);
395
395
396
  switch(itemid.type) {
396
  switch(itemid.type) {
Lines 419-432 Link Here
419
  static char buf[80];
419
  static char buf[80];
420
  unsigned sl_num = 0, el_num = 0, pl_num = 0;
420
  unsigned sl_num = 0, el_num = 0, pl_num = 0;
421
  vcdinfo_offset_t *ofs = NULL;
421
  vcdinfo_offset_t *ofs = NULL;
422
  
422
423
  if (offset == PSD_OFS_DISABLED)
423
  if (offset == PSD_OFS_DISABLED)
424
    return NULL;
424
    return NULL;
425
425
426
  _CDIO_LIST_FOREACH (node, _ctx->offset_list)
426
  _CDIO_LIST_FOREACH (node, _ctx->offset_list)
427
    {
427
    {
428
      ofs = _cdio_list_node_data (node);
428
      ofs = _cdio_list_node_data (node);
429
	
429
430
      switch (ofs->type)
430
      switch (ofs->type)
431
	{
431
	{
432
	case PSD_TYPE_PLAY_LIST:
432
	case PSD_TYPE_PLAY_LIST:
Lines 506-524 Link Here
506
      p_pbc = vcd_pbc_new (PBC_PLAYLIST);
506
      p_pbc = vcd_pbc_new (PBC_PLAYLIST);
507
      {
507
      {
508
	const PsdPlayListDescriptor_t *d = (const void *) _buf;
508
	const PsdPlayListDescriptor_t *d = (const void *) _buf;
509
	p_pbc->prev_id = _xstrdup (_ofs2id (vcdinf_pld_get_prev_offset(d), 
509
	p_pbc->prev_id = _xstrdup (_ofs2id (vcdinf_pld_get_prev_offset(d),
510
					   _ctx));
510
					   _ctx));
511
	p_pbc->next_id = _xstrdup (_ofs2id (vcdinf_pld_get_next_offset(d),
511
	p_pbc->next_id = _xstrdup (_ofs2id (vcdinf_pld_get_next_offset(d),
512
					   _ctx));
512
					   _ctx));
513
	p_pbc->retn_id = _xstrdup (_ofs2id (vcdinf_pld_get_return_offset(d),
513
	p_pbc->retn_id = _xstrdup (_ofs2id (vcdinf_pld_get_return_offset(d),
514
					   _ctx));
514
					   _ctx));
515
	
515
516
	p_pbc->playing_time = (double) (vcdinf_get_play_time(d)) / 15.0;
516
	p_pbc->playing_time = (double) (vcdinf_get_play_time(d)) / 15.0;
517
	p_pbc->wait_time       = vcdinf_get_wait_time(d);
517
	p_pbc->wait_time       = vcdinf_get_wait_time(d);
518
	p_pbc->auto_pause_time = vcdinf_get_autowait_time(d);
518
	p_pbc->auto_pause_time = vcdinf_get_autowait_time(d);
519
519
520
	for (n = 0; n < vcdinf_pld_get_noi(d); n++) {
520
	for (n = 0; n < vcdinf_pld_get_noi(d); n++) {
521
	  _cdio_list_append (p_pbc->item_id_list, 
521
	  _cdio_list_append (p_pbc->item_id_list,
522
			    _xstrdup(_pin2id(vcdinf_pld_get_play_item(d,n)
522
			    _xstrdup(_pin2id(vcdinf_pld_get_play_item(d,n)
523
					     )));
523
					     )));
524
	  }
524
	  }
Lines 531-539 Link Here
531
      {
531
      {
532
	const PsdSelectionListDescriptor_t *d = (const void *) _buf;
532
	const PsdSelectionListDescriptor_t *d = (const void *) _buf;
533
	p_pbc->bsn = vcdinf_get_bsn(d);
533
	p_pbc->bsn = vcdinf_get_bsn(d);
534
	p_pbc->prev_id = _xstrdup (_ofs2id (vcdinf_psd_get_prev_offset(d), 
534
	p_pbc->prev_id = _xstrdup (_ofs2id (vcdinf_psd_get_prev_offset(d),
535
					   _ctx));
535
					   _ctx));
536
	p_pbc->next_id = _xstrdup (_ofs2id (vcdinf_psd_get_next_offset(d), 
536
	p_pbc->next_id = _xstrdup (_ofs2id (vcdinf_psd_get_next_offset(d),
537
					   _ctx));
537
					   _ctx));
538
	p_pbc->retn_id = _xstrdup (_ofs2id (vcdinf_psd_get_return_offset(d),
538
	p_pbc->retn_id = _xstrdup (_ofs2id (vcdinf_psd_get_return_offset(d),
539
					   _ctx));
539
					   _ctx));
Lines 562-568 Link Here
562
	    break;
562
	    break;
563
	  }
563
	  }
564
564
565
	p_pbc->timeout_id   = _xstrdup (_ofs2id (vcdinf_get_timeout_offset(d), 
565
	p_pbc->timeout_id   = _xstrdup (_ofs2id (vcdinf_get_timeout_offset(d),
566
						_ctx));
566
						_ctx));
567
	p_pbc->timeout_time = vcdinf_get_timeout_time (d);
567
	p_pbc->timeout_time = vcdinf_get_timeout_time (d);
568
	p_pbc->jump_delayed = vcdinf_has_jump_delay(d);
568
	p_pbc->jump_delayed = vcdinf_has_jump_delay(d);
Lines 571-577 Link Here
571
571
572
	for (n = 0; n < vcdinf_get_num_selections(d); n++)
572
	for (n = 0; n < vcdinf_get_num_selections(d); n++)
573
	  {
573
	  {
574
	    _cdio_list_append (p_pbc->select_id_list, 
574
	    _cdio_list_append (p_pbc->select_id_list,
575
			      _xstrdup(_ofs2id(vcdinf_psd_get_offset(d,n),
575
			      _xstrdup(_ofs2id(vcdinf_psd_get_offset(d,n),
576
					       _ctx)));
576
					       _ctx)));
577
	  }
577
	  }
Lines 579-585 Link Here
579
	if (d->type == PSD_TYPE_EXT_SELECTION_LIST
579
	if (d->type == PSD_TYPE_EXT_SELECTION_LIST
580
	    || d->flags.SelectionAreaFlag)
580
	    || d->flags.SelectionAreaFlag)
581
	  {
581
	  {
582
	    PsdSelectionListDescriptorExtended_t *d2 = 
582
	    PsdSelectionListDescriptorExtended_t *d2 =
583
	      (void *) &d->ofs[d->nos];
583
	      (void *) &d->ofs[d->nos];
584
584
585
	    p_pbc->prev_area = calloc(1, sizeof (pbc_area_t));
585
	    p_pbc->prev_area = calloc(1, sizeof (pbc_area_t));
Lines 601-607 Link Here
601
		_cdio_list_append (p_pbc->select_area_list, p_area);
601
		_cdio_list_append (p_pbc->select_area_list, p_area);
602
	      }
602
	      }
603
603
604
	    vcd_assert (_cdio_list_length (p_pbc->select_area_list) 
604
	    vcd_assert (_cdio_list_length (p_pbc->select_area_list)
605
			== _cdio_list_length (p_pbc->select_id_list));
605
			== _cdio_list_length (p_pbc->select_id_list));
606
	  }
606
	  }
607
      }
607
      }
Lines 611-620 Link Here
611
      p_pbc = vcd_pbc_new (PBC_END);
611
      p_pbc = vcd_pbc_new (PBC_END);
612
      {
612
      {
613
	const PsdEndListDescriptor_t *d = (const void *) _buf;
613
	const PsdEndListDescriptor_t *d = (const void *) _buf;
614
	
614
615
	p_pbc->next_disc = d->next_disc;
615
	p_pbc->next_disc = d->next_disc;
616
	p_pbc->image_id = _xstrdup (_pin2id (uint16_from_be (d->change_pic)));
616
	p_pbc->image_id = _xstrdup (_pin2id (uint16_from_be (d->change_pic)));
617
      }      
617
      }
618
      break;
618
      break;
619
619
620
    default:
620
    default:
Lines 632-638 Link Here
632
}
632
}
633
633
634
static void
634
static void
635
_visit_pbc (pbc_ctx_t *p_pbc_ctx, lid_t lid, unsigned int offset, 
635
_visit_pbc (pbc_ctx_t *p_pbc_ctx, lid_t lid, unsigned int offset,
636
	    bool in_lot)
636
	    bool in_lot)
637
{
637
{
638
  CdioListNode_t *node;
638
  CdioListNode_t *node;
Lines 683-689 Link Here
683
             */
683
             */
684
            ofs->lid = lid;
684
            ofs->lid = lid;
685
          }
685
          }
686
          
686
687
          return; /* already been there... */
687
          return; /* already been there... */
688
        }
688
        }
689
    }
689
    }
Lines 700-712 Link Here
700
    case PSD_TYPE_PLAY_LIST:
700
    case PSD_TYPE_PLAY_LIST:
701
      _cdio_list_append (p_pbc_ctx->offset_list, ofs);
701
      _cdio_list_append (p_pbc_ctx->offset_list, ofs);
702
      {
702
      {
703
        const PsdPlayListDescriptor_t *d = 
703
        const PsdPlayListDescriptor_t *d =
704
	  (const void *) (p_pbc_ctx->psd + _rofs);
704
	  (const void *) (p_pbc_ctx->psd + _rofs);
705
        const lid_t lid = vcdinf_pld_get_lid(d);
705
        const lid_t lid = vcdinf_pld_get_lid(d);
706
706
707
        if (!ofs->lid)
707
        if (!ofs->lid)
708
          ofs->lid = lid;
708
          ofs->lid = lid;
709
        else 
709
        else
710
          if (ofs->lid != lid)
710
          if (ofs->lid != lid)
711
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
711
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
712
                      ofs->lid, lid);
712
                      ofs->lid, lid);
Lines 729-735 Link Here
729
729
730
        if (!ofs->lid)
730
        if (!ofs->lid)
731
          ofs->lid = lid;
731
          ofs->lid = lid;
732
        else 
732
        else
733
          if (ofs->lid != lid)
733
          if (ofs->lid != lid)
734
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
734
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
735
                      ofs->lid, lid);
735
                      ofs->lid, lid);
Lines 742-748 Link Here
742
742
743
        for (idx = 0; idx < vcdinf_get_num_selections(d); idx++)
743
        for (idx = 0; idx < vcdinf_get_num_selections(d); idx++)
744
          _visit_pbc (p_pbc_ctx, 0, vcdinf_psd_get_offset (d, idx), false);
744
          _visit_pbc (p_pbc_ctx, 0, vcdinf_psd_get_offset (d, idx), false);
745
        
745
746
      }
746
      }
747
      break;
747
      break;
748
748
Lines 768-774 Link Here
768
    if ((tmp = vcdinf_get_lot_offset(lot, n)) != PSD_OFS_DISABLED)
768
    if ((tmp = vcdinf_get_lot_offset(lot, n)) != PSD_OFS_DISABLED)
769
      _visit_pbc (p_pbc_ctx, n + 1, tmp, true);
769
      _visit_pbc (p_pbc_ctx, n + 1, tmp, true);
770
770
771
  _vcd_list_sort (p_pbc_ctx->offset_list, 
771
  _vcd_list_sort (p_pbc_ctx->offset_list,
772
		  (_cdio_list_cmp_func_t) vcdinf_lid_t_cmp);
772
		  (_cdio_list_cmp_func_t) vcdinf_lid_t_cmp);
773
}
773
}
774
774
Lines 798-804 Link Here
798
	extended = true;
798
	extended = true;
799
	_lot_vcd_sector = statbuf->lsn;
799
	_lot_vcd_sector = statbuf->lsn;
800
	vcd_assert (statbuf->size == ISO_BLOCKSIZE * LOT_VCD_SIZE);
800
	vcd_assert (statbuf->size == ISO_BLOCKSIZE * LOT_VCD_SIZE);
801
      }  
801
      }
802
802
803
      free(statbuf);
803
      free(statbuf);
804
      if (extended &&
804
      if (extended &&
Lines 817-825 Link Here
817
  else {
817
  else {
818
    if (extended)
818
    if (extended)
819
      vcd_info ("ignoring detected extended VCD2.0 PBC files");
819
      vcd_info ("ignoring detected extended VCD2.0 PBC files");
820
    
820
821
    _pbc_ctx.extended = false;
821
    _pbc_ctx.extended = false;
822
    
822
823
    _lot_vcd_sector = LOT_VCD_SECTOR;
823
    _lot_vcd_sector = LOT_VCD_SECTOR;
824
    _psd_vcd_sector = PSD_VCD_SECTOR;
824
    _psd_vcd_sector = PSD_VCD_SECTOR;
825
    _psd_size = p_vcdxml->info.psd_size;
825
    _psd_size = p_vcdxml->info.psd_size;
Lines 832-847 Link Here
832
  _pbc_ctx.offset_list = _cdio_list_new ();
832
  _pbc_ctx.offset_list = _cdio_list_new ();
833
833
834
  /* read in LOT */
834
  /* read in LOT */
835
  
835
836
  _pbc_ctx.lot = calloc(1, ISO_BLOCKSIZE * LOT_VCD_SIZE);
836
  _pbc_ctx.lot = calloc(1, ISO_BLOCKSIZE * LOT_VCD_SIZE);
837
  
837
838
  if (cdio_read_mode2_sectors (p_cdio, _pbc_ctx.lot, _lot_vcd_sector, false, 
838
  if (cdio_read_mode2_sectors (p_cdio, _pbc_ctx.lot, _lot_vcd_sector, false,
839
			       LOT_VCD_SIZE)) {
839
			       LOT_VCD_SIZE)) {
840
    _cdio_list_free (_pbc_ctx.offset_list, true);
840
    _cdio_list_free (_pbc_ctx.offset_list, true, NULL);
841
    free(_pbc_ctx.lot);
841
    free(_pbc_ctx.lot);
842
    return -1;
842
    return -1;
843
  }
843
  }
844
  
844
845
845
846
  /* read in PSD */
846
  /* read in PSD */
847
847
Lines 853-859 Link Here
853
    rc = -1;
853
    rc = -1;
854
    goto free_and_return;
854
    goto free_and_return;
855
  }
855
  }
856
  
856
857
857
858
  /* traverse it */
858
  /* traverse it */
859
859
Lines 865-877 Link Here
865
      pbc_t *_pbc;
865
      pbc_t *_pbc;
866
866
867
      vcd_assert (ofs->offset != PSD_OFS_DISABLED);
867
      vcd_assert (ofs->offset != PSD_OFS_DISABLED);
868
      
868
869
      if ((_pbc = _pbc_node_read (&_pbc_ctx, ofs->offset)))
869
      if ((_pbc = _pbc_node_read (&_pbc_ctx, ofs->offset)))
870
	_cdio_list_append (p_vcdxml->pbc_list, _pbc);
870
	_cdio_list_append (p_vcdxml->pbc_list, _pbc);
871
    }
871
    }
872
872
873
 free_and_return:
873
 free_and_return:
874
  _cdio_list_free (_pbc_ctx.offset_list, true);
874
  _cdio_list_free (_pbc_ctx.offset_list, true, NULL);
875
  free(_pbc_ctx.lot);
875
  free(_pbc_ctx.lot);
876
  free(_pbc_ctx.psd);
876
  free(_pbc_ctx.psd);
877
  return 0;
877
  return 0;
Lines 881-887 Link Here
881
_rip_isofs (vcdxml_t *p_vcdxml, CdIo_t *p_cdio)
881
_rip_isofs (vcdxml_t *p_vcdxml, CdIo_t *p_cdio)
882
{
882
{
883
  CdioListNode_t *node;
883
  CdioListNode_t *node;
884
  
884
885
  _CDIO_LIST_FOREACH (node, p_vcdxml->filesystem)
885
  _CDIO_LIST_FOREACH (node, p_vcdxml->filesystem)
886
    {
886
    {
887
      struct filesystem_t *_fs = _cdio_list_node_data (node);
887
      struct filesystem_t *_fs = _cdio_list_node_data (node);
Lines 892-900 Link Here
892
      if (!_fs->file_src)
892
      if (!_fs->file_src)
893
	continue;
893
	continue;
894
894
895
      vcd_info ("extracting %s to %s (lsn %u, size %u, raw %d)", 
895
      vcd_info ("extracting %s to %s (lsn %u, size %u, raw %d)",
896
		_fs->name, _fs->file_src,
896
		_fs->name, _fs->file_src,
897
		(unsigned int) _fs->lsn, (unsigned int) _fs->size, 
897
		(unsigned int) _fs->lsn, (unsigned int) _fs->size,
898
		_fs->file_raw);
898
		_fs->file_raw);
899
899
900
      if (!(outfd = fopen (_fs->file_src, "wb")))
900
      if (!(outfd = fopen (_fs->file_src, "wb")))
Lines 927-933 Link Here
927
	perror ("ftruncate()");
927
	perror ("ftruncate()");
928
928
929
      fclose (outfd);
929
      fclose (outfd);
930
      
930
931
    }
931
    }
932
932
933
  return 0;
933
  return 0;
Lines 956-962 Link Here
956
      memset (&mpeg_ctx, 0, sizeof (VcdMpegStreamCtx));
956
      memset (&mpeg_ctx, 0, sizeof (VcdMpegStreamCtx));
957
957
958
      vcd_info ("extracting %s... (start lsn %u, %d segments)",
958
      vcd_info ("extracting %s... (start lsn %u, %d segments)",
959
		p_seg->src, (unsigned int) start_extent, 
959
		p_seg->src, (unsigned int) start_extent,
960
		p_seg->segments_count);
960
		p_seg->segments_count);
961
961
962
      if (!(outfd = fopen (p_seg->src, "wb")))
962
      if (!(outfd = fopen (p_seg->src, "wb")))
Lines 977-984 Link Here
977
977
978
	  memset (&buf, 0, sizeof (buf));
978
	  memset (&buf, 0, sizeof (buf));
979
	  cdio_read_mode2_sector (p_cdio, &buf, start_extent + n, true);
979
	  cdio_read_mode2_sector (p_cdio, &buf, start_extent + n, true);
980
	  
980
981
	  if (!buf.subheader[0] 
981
	  if (!buf.subheader[0]
982
              && !buf.subheader[1]
982
              && !buf.subheader[1]
983
              && (buf.subheader[2] | SM_FORM2) == SM_FORM2
983
              && (buf.subheader[2] | SM_FORM2) == SM_FORM2
984
              && !buf.subheader[3])
984
              && !buf.subheader[3])
Lines 1002-1008 Link Here
1002
	  if (buf.subheader[2] & SM_TRIG)
1002
	  if (buf.subheader[2] & SM_TRIG)
1003
	    {
1003
	    {
1004
	      double *_ap_ts = calloc(1, sizeof (double));
1004
	      double *_ap_ts = calloc(1, sizeof (double));
1005
	      
1005
1006
	      vcd_debug ("autopause @%u (%f)", (unsigned int) n, last_pts);
1006
	      vcd_debug ("autopause @%u (%f)", (unsigned int) n, last_pts);
1007
	      *_ap_ts = last_pts;
1007
	      *_ap_ts = last_pts;
1008
1008
Lines 1060-1078 Link Here
1060
	vcd_info("Track %d selected, skipping track %d", i_track,counter-1);
1060
	vcd_info("Track %d selected, skipping track %d", i_track,counter-1);
1061
	continue;
1061
	continue;
1062
      }
1062
      }
1063
	  
1063
1064
      if (i_track < 0 && -i_track==counter++) {
1064
      if (i_track < 0 && -i_track==counter++) {
1065
	vcd_info("Skipping track %d", -i_track);
1065
	vcd_info("Skipping track %d", -i_track);
1066
	continue;
1066
	continue;
1067
      }
1067
      }
1068
	  
1068
1069
      memset (&mpeg_ctx, 0, sizeof (VcdMpegStreamCtx));
1069
      memset (&mpeg_ctx, 0, sizeof (VcdMpegStreamCtx));
1070
1070
1071
      start_lsn = _seq->start_extent;
1071
      start_lsn = _seq->start_extent;
1072
      end_lsn = _nseq ? _nseq->start_extent : cdio_get_disc_last_lsn (p_cdio);
1072
      end_lsn = _nseq ? _nseq->start_extent : cdio_get_disc_last_lsn (p_cdio);
1073
1073
1074
      vcd_info ("extracting %s... (start lsn %lu (+%lu))",
1074
      vcd_info ("extracting %s... (start lsn %lu (+%lu))",
1075
		_seq->src, (long unsigned int) start_lsn, 
1075
		_seq->src, (long unsigned int) start_lsn,
1076
		(long unsigned int) (end_lsn - start_lsn));
1076
		(long unsigned int) (end_lsn - start_lsn));
1077
1077
1078
      if (!(outfd = fopen (_seq->src, "wb")))
1078
      if (!(outfd = fopen (_seq->src, "wb")))
Lines 1101-1107 Link Here
1101
	      const int secs_left = end_lsn - n;
1101
	      const int secs_left = end_lsn - n;
1102
1102
1103
	      memset (buf, 0, sizeof (buf));
1103
	      memset (buf, 0, sizeof (buf));
1104
	      cdio_read_mode2_sectors (p_cdio, buf, n, true, (secs_left > 15 
1104
	      cdio_read_mode2_sectors (p_cdio, buf, n, true, (secs_left > 15
1105
							   ? 15 : secs_left));
1105
							   ? 15 : secs_left));
1106
	    }
1106
	    }
1107
1107
Lines 1113-1119 Link Here
1113
	      vcd_warn ("encountered non-form2 sector -- leaving loop");
1113
	      vcd_warn ("encountered non-form2 sector -- leaving loop");
1114
	      break;
1114
	      break;
1115
	    }
1115
	    }
1116
	  
1116
1117
	  if (in_data)
1117
	  if (in_data)
1118
	    { /* end conditions... */
1118
	    { /* end conditions... */
1119
	      if (!buf[buf_idx].subheader[0])
1119
	      if (!buf[buf_idx].subheader[0])
Lines 1124-1130 Link Here
1124
1124
1125
	      if (!(buf[buf_idx].subheader[2] & SM_REALT))
1125
	      if (!(buf[buf_idx].subheader[2] & SM_REALT))
1126
		{
1126
		{
1127
		  vcd_debug ("subheader: no realtime data anymore @%u", 
1127
		  vcd_debug ("subheader: no realtime data anymore @%u",
1128
			     (unsigned int) n);
1128
			     (unsigned int) n);
1129
		  break;
1129
		  break;
1130
		}
1130
		}
Lines 1150-1156 Link Here
1150
	    {
1150
	    {
1151
	      CdioListNode_t *_node;
1151
	      CdioListNode_t *_node;
1152
1152
1153
	      vcd_mpeg_parse_packet (buf[buf_idx].data, M2F2_SECTOR_SIZE, 
1153
	      vcd_mpeg_parse_packet (buf[buf_idx].data, M2F2_SECTOR_SIZE,
1154
				     false, &mpeg_ctx);
1154
				     false, &mpeg_ctx);
1155
1155
1156
	      if (!mpeg_ctx.packet.zero)
1156
	      if (!mpeg_ctx.packet.zero)
Lines 1158-1164 Link Here
1158
1158
1159
	      if (!first_data && !mpeg_ctx.packet.zero)
1159
	      if (!first_data && !mpeg_ctx.packet.zero)
1160
		first_data = n;
1160
		first_data = n;
1161
	      
1161
1162
	      if (mpeg_ctx.packet.has_pts)
1162
	      if (mpeg_ctx.packet.has_pts)
1163
		{
1163
		{
1164
		  last_pts = mpeg_ctx.packet.pts;
1164
		  last_pts = mpeg_ctx.packet.pts;
Lines 1173-1197 Link Here
1173
		{
1173
		{
1174
		  double *_ap_ts = calloc(1, sizeof (double));
1174
		  double *_ap_ts = calloc(1, sizeof (double));
1175
1175
1176
		  vcd_debug ("autopause @%u (%f)", (unsigned int) n, 
1176
		  vcd_debug ("autopause @%u (%f)", (unsigned int) n,
1177
			     last_pts);
1177
			     last_pts);
1178
		  *_ap_ts = last_pts;
1178
		  *_ap_ts = last_pts;
1179
1179
1180
		  _cdio_list_append (_seq->autopause_list, _ap_ts);
1180
		  _cdio_list_append (_seq->autopause_list, _ap_ts);
1181
		}
1181
		}
1182
	      
1182
1183
	      _CDIO_LIST_FOREACH (_node, _seq->entry_point_list)
1183
	      _CDIO_LIST_FOREACH (_node, _seq->entry_point_list)
1184
		{
1184
		{
1185
		  struct entry_point_t *_ep = _cdio_list_node_data (_node);
1185
		  struct entry_point_t *_ep = _cdio_list_node_data (_node);
1186
1186
1187
		  if (_ep->extent == n)
1187
		  if (_ep->extent == n)
1188
		    {
1188
		    {
1189
		      vcd_debug ("entry point @%u (%f)", (unsigned int) n, 
1189
		      vcd_debug ("entry point @%u (%f)", (unsigned int) n,
1190
				 last_pts);
1190
				 last_pts);
1191
		      _ep->timestamp = last_pts;
1191
		      _ep->timestamp = last_pts;
1192
		    }
1192
		    }
1193
		}
1193
		}
1194
	      
1194
1195
	      if (first_data)
1195
	      if (first_data)
1196
		{
1196
		{
1197
		  fwrite (buf[buf_idx].data, M2F2_SECTOR_SIZE, 1, outfd);
1197
		  fwrite (buf[buf_idx].data, M2F2_SECTOR_SIZE, 1, outfd);
Lines 1204-1217 Link Here
1204
		}
1204
		}
1205
1205
1206
	    } /* if (in_data) */
1206
	    } /* if (in_data) */
1207
	  
1207
1208
	  if (buf[buf_idx].subheader[2] & SM_EOF)
1208
	  if (buf[buf_idx].subheader[2] & SM_EOF)
1209
	    {
1209
	    {
1210
	      vcd_debug ("encountered subheader EOF @%u", (unsigned int) n);
1210
	      vcd_debug ("encountered subheader EOF @%u", (unsigned int) n);
1211
	      break;
1211
	      break;
1212
	    }
1212
	    }
1213
	} /* for */
1213
	} /* for */
1214
      
1214
1215
      _progress.done = _progress.total;
1215
      _progress.done = _progress.total;
1216
      vcd_xml_read_progress_cb (&_progress, _seq->src);
1216
      vcd_xml_read_progress_cb (&_progress, _seq->src);
1217
1217
Lines 1221-1230 Link Here
1221
1221
1222
	  if (n == end_lsn)
1222
	  if (n == end_lsn)
1223
	    vcd_debug ("stream till end of track");
1223
	    vcd_debug ("stream till end of track");
1224
	  
1224
1225
	  length = (1 + last_nonzero) - first_data;
1225
	  length = (1 + last_nonzero) - first_data;
1226
1226
1227
	  vcd_debug ("truncating file to %u packets", 
1227
	  vcd_debug ("truncating file to %u packets",
1228
		     (unsigned int) length);
1228
		     (unsigned int) length);
1229
1229
1230
	  fflush (outfd);
1230
	  fflush (outfd);
Lines 1241-1247 Link Here
1241
static vcd_log_handler_t  gl_default_vcd_log_handler = NULL;
1241
static vcd_log_handler_t  gl_default_vcd_log_handler = NULL;
1242
static cdio_log_handler_t gl_default_cdio_log_handler = NULL;
1242
static cdio_log_handler_t gl_default_cdio_log_handler = NULL;
1243
1243
1244
static void 
1244
static void
1245
_vcd_log_handler (vcd_log_level_t level, const char message[])
1245
_vcd_log_handler (vcd_log_level_t level, const char message[])
1246
{
1246
{
1247
  if (level == VCD_LOG_DEBUG && !_verbose_flag)
1247
  if (level == VCD_LOG_DEBUG && !_verbose_flag)
Lines 1249-1255 Link Here
1249
1249
1250
  if (level == VCD_LOG_INFO && _quiet_flag)
1250
  if (level == VCD_LOG_INFO && _quiet_flag)
1251
    return;
1251
    return;
1252
  
1252
1253
  gl_default_vcd_log_handler (level, message);
1253
  gl_default_vcd_log_handler (level, message);
1254
}
1254
}
1255
1255
Lines 1279-1286 Link Here
1279
  int _track_flag=0;
1279
  int _track_flag=0;
1280
  int _x_track_flag=0;
1280
  int _x_track_flag=0;
1281
1281
1282
  enum { 
1282
  enum {
1283
    OP_SOURCE_UNDEF = DRIVER_UNKNOWN, 
1283
    OP_SOURCE_UNDEF = DRIVER_UNKNOWN,
1284
    OP_SOURCE_BINCUE= DRIVER_BINCUE,
1284
    OP_SOURCE_BINCUE= DRIVER_BINCUE,
1285
    OP_SOURCE_NRG   = DRIVER_NRG,
1285
    OP_SOURCE_NRG   = DRIVER_NRG,
1286
    OP_SOURCE_CDRDAO= DRIVER_CDRDAO,
1286
    OP_SOURCE_CDRDAO= DRIVER_CDRDAO,
Lines 1293-1299 Link Here
1293
  vcd_xml_init (&vcdxml);
1293
  vcd_xml_init (&vcdxml);
1294
1294
1295
  gl_default_vcd_log_handler  = vcd_log_set_handler (_vcd_log_handler);
1295
  gl_default_vcd_log_handler  = vcd_log_set_handler (_vcd_log_handler);
1296
  gl_default_cdio_log_handler = 
1296
  gl_default_cdio_log_handler =
1297
    cdio_log_set_handler ( (cdio_log_handler_t) _vcd_log_handler);
1297
    cdio_log_set_handler ( (cdio_log_handler_t) _vcd_log_handler);
1298
1298
1299
  {
1299
  {
Lines 1304-1322 Link Here
1304
       "specify xml file for output (default: '" DEFAULT_XML_FNAME "')",
1304
       "specify xml file for output (default: '" DEFAULT_XML_FNAME "')",
1305
       "FILE"},
1305
       "FILE"},
1306
1306
1307
      {"bin-file", 'b', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1307
      {"bin-file", 'b', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1308
       OP_SOURCE_BINCUE,
1308
       OP_SOURCE_BINCUE,
1309
       "set image file as source (default: '" DEFAULT_IMG_FNAME "')", 
1309
       "set image file as source (default: '" DEFAULT_IMG_FNAME "')",
1310
       "FILE"},
1310
       "FILE"},
1311
1311
1312
      {"cue-file", 'c', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1312
      {"cue-file", 'c', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1313
       OP_SOURCE_BINCUE, "set \"cue\" CD-ROM disk image file as source", "FILE"},
1313
       OP_SOURCE_BINCUE, "set \"cue\" CD-ROM disk image file as source", "FILE"},
1314
1314
1315
      {"nrg-file", 'N', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1315
      {"nrg-file", 'N', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1316
       OP_SOURCE_NRG, "set Nero CD-ROM disk image image file as source",
1316
       OP_SOURCE_NRG, "set Nero CD-ROM disk image image file as source",
1317
       "FILE"},
1317
       "FILE"},
1318
1318
1319
      {"toc-file", '\0', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1319
      {"toc-file", '\0', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1320
       OP_SOURCE_CDRDAO, "set \"toc\" CD-ROM disk image file as source", "FILE"},
1320
       OP_SOURCE_CDRDAO, "set \"toc\" CD-ROM disk image file as source", "FILE"},
1321
      {"cdrom-device", 'C', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1321
      {"cdrom-device", 'C', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1322
       OP_SOURCE_CDROM,"set CDROM device as source", "DEVICE"},
1322
       OP_SOURCE_CDROM,"set CDROM device as source", "DEVICE"},
Lines 1324-1331 Link Here
1324
      {"sector-2336", '\0', POPT_ARG_NONE, &sector_2336_flag, 0,
1324
      {"sector-2336", '\0', POPT_ARG_NONE, &sector_2336_flag, 0,
1325
       "use 2336 byte sector mode for image file"},
1325
       "use 2336 byte sector mode for image file"},
1326
1326
1327
      {"input", 'i', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, 
1327
      {"input", 'i', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name,
1328
       OP_SOURCE_UNDEF, 
1328
       OP_SOURCE_UNDEF,
1329
       "set source and determine if \"bin\" image or device", "FILE"},
1329
       "set source and determine if \"bin\" image or device", "FILE"},
1330
1330
1331
      {"no-ext-psd", '\0', POPT_ARG_NONE, &no_ext_psd_flag, 0,
1331
      {"no-ext-psd", '\0', POPT_ARG_NONE, &no_ext_psd_flag, 0,
Lines 1346-1374 Link Here
1346
      {"nosegments", '\0', POPT_ARG_NONE, &noseg_flag, 0,
1346
      {"nosegments", '\0', POPT_ARG_NONE, &noseg_flag, 0,
1347
       "don't extract segment play items"},
1347
       "don't extract segment play items"},
1348
1348
1349
      {"progress", 'p', POPT_ARG_NONE, &_progress_flag, 0,  
1349
      {"progress", 'p', POPT_ARG_NONE, &_progress_flag, 0,
1350
       "show progress"}, 
1350
       "show progress"},
1351
1351
1352
      { "track", 't', POPT_ARG_INT, &_track_flag, 0,
1352
      { "track", 't', POPT_ARG_INT, &_track_flag, 0,
1353
	"rip only this track"},
1353
	"rip only this track"},
1354
      
1354
1355
      { "notrack", 'T', POPT_ARG_INT, &_x_track_flag, 0,
1355
      { "notrack", 'T', POPT_ARG_INT, &_x_track_flag, 0,
1356
	"do not rip this track"},
1356
	"do not rip this track"},
1357
      
1357
1358
      { "filename-encoding", '\0', POPT_ARG_STRING, &vcd_xml_filename_charset, 0,
1358
      { "filename-encoding", '\0', POPT_ARG_STRING, &vcd_xml_filename_charset, 0,
1359
        "use given charset encoding for filenames instead of UTF8" },
1359
        "use given charset encoding for filenames instead of UTF8" },
1360
1360
1361
      {"verbose", 'v', POPT_ARG_NONE, &_verbose_flag, 0, 
1361
      {"verbose", 'v', POPT_ARG_NONE, &_verbose_flag, 0,
1362
       "be verbose"},
1362
       "be verbose"},
1363
    
1363
1364
      {"quiet", 'q', POPT_ARG_NONE, &_quiet_flag, 0, 
1364
      {"quiet", 'q', POPT_ARG_NONE, &_quiet_flag, 0,
1365
       "show only critical messages"},
1365
       "show only critical messages"},
1366
1366
1367
      {"gui", '\0', POPT_ARG_NONE, &_gui_flag, 0, "enable GUI mode"},
1367
      {"gui", '\0', POPT_ARG_NONE, &_gui_flag, 0, "enable GUI mode"},
1368
1368
1369
      {"version", 'V', POPT_ARG_NONE, NULL, OP_VERSION,
1369
      {"version", 'V', POPT_ARG_NONE, NULL, OP_VERSION,
1370
       "display version and copyright information and exit"},
1370
       "display version and copyright information and exit"},
1371
	   
1371
1372
      POPT_AUTOHELP {NULL, 0, 0, NULL, 0}
1372
      POPT_AUTOHELP {NULL, 0, 0, NULL, 0}
1373
    };
1373
    };
1374
1374
Lines 1396-1404 Link Here
1396
	    }
1396
	    }
1397
	  source_type = opt;
1397
	  source_type = opt;
1398
	  break;
1398
	  break;
1399
	
1399
1400
	default:
1400
	default:
1401
	  fprintf (stderr, "%s: %s\n", 
1401
	  fprintf (stderr, "%s: %s\n",
1402
		   poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
1402
		   poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
1403
		   poptStrerror(opt));
1403
		   poptStrerror(opt));
1404
	  fprintf (stderr, "error while parsing command line - try --help\n");
1404
	  fprintf (stderr, "error while parsing command line - try --help\n");
Lines 1409-1415 Link Here
1409
1409
1410
    if (_verbose_flag && _quiet_flag)
1410
    if (_verbose_flag && _quiet_flag)
1411
      vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
1411
      vcd_error ("I can't be both, quiet and verbose... either one or another ;-)");
1412
    
1412
1413
    if (poptGetArgs (optCon) != NULL)
1413
    if (poptGetArgs (optCon) != NULL)
1414
      vcd_error ("Why are you giving me non-option arguments? -- try --help");
1414
      vcd_error ("Why are you giving me non-option arguments? -- try --help");
1415
1415
Lines 1437-1443 Link Here
1437
   */
1437
   */
1438
  if (NULL == source_name && source_type == DRIVER_UNKNOWN) {
1438
  if (NULL == source_name && source_type == DRIVER_UNKNOWN) {
1439
    char **cd_drives=NULL;
1439
    char **cd_drives=NULL;
1440
    cd_drives = cdio_get_devices_with_cap(NULL, 
1440
    cd_drives = cdio_get_devices_with_cap(NULL,
1441
                (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD
1441
                (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD
1442
                |CDIO_FS_UNKNOWN),
1442
                |CDIO_FS_UNKNOWN),
1443
                                          true);
1443
                                          true);
Lines 1453-1470 Link Here
1453
    vcd_error ("Error determining place to read from.");
1453
    vcd_error ("Error determining place to read from.");
1454
    exit (EXIT_FAILURE);
1454
    exit (EXIT_FAILURE);
1455
  }
1455
  }
1456
  
1456
1457
  if (NULL == source_name) 
1457
  if (NULL == source_name)
1458
    source_name = cdio_get_default_device(img_src);
1458
    source_name = cdio_get_default_device(img_src);
1459
1459
1460
  vcdxml.comment = vcd_xml_dump_cl_comment (argc, argv, 
1460
  vcdxml.comment = vcd_xml_dump_cl_comment (argc, argv,
1461
					      nocommand_comment_flag);
1461
					      nocommand_comment_flag);
1462
1462
1463
  /* start with ISO9660 PVD */
1463
  /* start with ISO9660 PVD */
1464
  _parse_pvd (&vcdxml, img_src);
1464
  _parse_pvd (&vcdxml, img_src);
1465
1465
1466
  _parse_isofs (&vcdxml, img_src); 
1466
  _parse_isofs (&vcdxml, img_src);
1467
  
1467
1468
  /* needs to be parsed in order */
1468
  /* needs to be parsed in order */
1469
  _parse_info (&vcdxml, img_src);
1469
  _parse_info (&vcdxml, img_src);
1470
  _parse_entries (&vcdxml, img_src);
1470
  _parse_entries (&vcdxml, img_src);
Lines 1473-1479 Link Here
1473
  _parse_pbc (&vcdxml, img_src, no_ext_psd_flag);
1473
  _parse_pbc (&vcdxml, img_src, no_ext_psd_flag);
1474
1474
1475
  if (_x_track_flag) _track_flag = - _x_track_flag;
1475
  if (_x_track_flag) _track_flag = - _x_track_flag;
1476
  
1476
1477
  if (norip_flag || noseq_flag || noseg_flag || _track_flag) {
1477
  if (norip_flag || noseq_flag || noseg_flag || _track_flag) {
1478
    vcd_warn ("Entry offsets inside sequence-items may incorrect...");
1478
    vcd_warn ("Entry offsets inside sequence-items may incorrect...");
1479
    vcd_warn ("and auto-pause locations might not be checked.");
1479
    vcd_warn ("and auto-pause locations might not be checked.");
(-)vcdimager-0.7.24.ORIG/include/libvcd/files.h (-6 / +6 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef VCDFILES_H
21
#ifndef VCDFILES_H
22
#define VCDFILES_H
22
#define VCDFILES_H
23
23
Lines 58-64 Link Here
58
void
58
void
59
set_entries_vcd(VcdObj_t *p_vcdobj, void *p_buf);
59
set_entries_vcd(VcdObj_t *p_vcdobj, void *p_buf);
60
60
61
void 
61
void
62
set_info_vcd (VcdObj_t *p_vcdobj, void *p_buf);
62
set_info_vcd (VcdObj_t *p_vcdobj, void *p_buf);
63
63
64
uint32_t
64
uint32_t
Lines 73-85 Link Here
73
void
73
void
74
set_tracks_svd (VcdObj_t *p_vcdobj, void *p_buf);
74
set_tracks_svd (VcdObj_t *p_vcdobj, void *p_buf);
75
75
76
uint32_t 
76
uint32_t
77
get_search_dat_size (const VcdObj_t *p_vcdobj);
77
get_search_dat_size (const VcdObj_t *p_vcdobj);
78
78
79
void
79
void
80
set_search_dat (VcdObj_t *p_vcdobj, void *p_buf);
80
set_search_dat (VcdObj_t *p_vcdobj, void *p_buf);
81
81
82
uint32_t 
82
uint32_t
83
get_scandata_dat_size (const VcdObj_t *p_vcdobj);
83
get_scandata_dat_size (const VcdObj_t *p_vcdobj);
84
84
85
void
85
void
Lines 91-98 Link Here
91
91
92
#endif /* VCDFILES_H */
92
#endif /* VCDFILES_H */
93
93
94
94
95
/* 
95
/*
96
 * Local variables:
96
 * Local variables:
97
 *  c-file-style: "gnu"
97
 *  c-file-style: "gnu"
98
 *  tab-width: 8
98
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/include/libvcd/files_private.h (-34 / +34 lines)
Lines 20-26 Link Here
20
20
21
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
*/
22
*/
23
23
24
#ifndef __VCD_FILES_PRIVATE_H__
24
#ifndef __VCD_FILES_PRIVATE_H__
25
#define __VCD_FILES_PRIVATE_H__
25
#define __VCD_FILES_PRIVATE_H__
26
26
Lines 34-43 Link Here
34
#define ENTRIES_ID_SVCD "ENTRYVCD" /* not ENTRYSVD! */
34
#define ENTRIES_ID_SVCD "ENTRYVCD" /* not ENTRYSVD! */
35
35
36
#define ENTRIES_VERSION_VCD   0x01
36
#define ENTRIES_VERSION_VCD   0x01
37
#define ENTRIES_SPTAG_VCD     0x00   
37
#define ENTRIES_SPTAG_VCD     0x00
38
38
39
#define ENTRIES_VERSION_VCD11 0x01
39
#define ENTRIES_VERSION_VCD11 0x01
40
#define ENTRIES_SPTAG_VCD11   0x00   
40
#define ENTRIES_SPTAG_VCD11   0x00
41
41
42
#define ENTRIES_VERSION_VCD2  0x02
42
#define ENTRIES_VERSION_VCD2  0x02
43
#define ENTRIES_SPTAG_VCD2    0x00
43
#define ENTRIES_SPTAG_VCD2    0x00
Lines 74-86 Link Here
74
#define INFO_ID_HQVCD "HQ-VCD  "
74
#define INFO_ID_HQVCD "HQ-VCD  "
75
75
76
#define INFO_VERSION_VCD   0x01
76
#define INFO_VERSION_VCD   0x01
77
#define INFO_SPTAG_VCD     0x00   
77
#define INFO_SPTAG_VCD     0x00
78
78
79
#define INFO_VERSION_VCD11 0x01
79
#define INFO_VERSION_VCD11 0x01
80
#define INFO_SPTAG_VCD11   0x01   
80
#define INFO_SPTAG_VCD11   0x01
81
81
82
#define INFO_VERSION_VCD2  0x02
82
#define INFO_VERSION_VCD2  0x02
83
#define INFO_SPTAG_VCD2    0x00   
83
#define INFO_SPTAG_VCD2    0x00
84
84
85
#define INFO_VERSION_SVCD  0x01
85
#define INFO_VERSION_SVCD  0x01
86
#define INFO_SPTAG_SVCD    0x00
86
#define INFO_SPTAG_SVCD    0x00
Lines 102-109 Link Here
102
                                              0x1 ==> restricted category 1,
102
                                              0x1 ==> restricted category 1,
103
                                              0x2 ==> restricted category 2,
103
                                              0x2 ==> restricted category 2,
104
                                              0x3 ==> restricted category 3 */
104
                                              0x3 ==> restricted category 3 */
105
  bool       special_info : 1;                /**< Special Information is 
105
  bool       special_info : 1;                /**< Special Information is
106
                                                   encoded 
106
                                                   encoded
107
                                                   in the pictures */
107
                                                   in the pictures */
108
  bool       user_data_cc : 1;                /**< MPEG User Data is used
108
  bool       user_data_cc : 1;                /**< MPEG User Data is used
109
                                                   for Closed Caption */
109
                                                   for Closed Caption */
Lines 112-124 Link Here
112
                                                 disc has the same album
112
                                                 disc has the same album
113
                                                 id then start the next
113
                                                 id then start the next
114
                                                 disc at List ID #2,
114
                                                 disc at List ID #2,
115
                                                 otherwise List ID #1 */ 
115
                                                 otherwise List ID #1 */
116
  bool       use_track3 : 1;                  /**< If == 1 and the PSD is
116
  bool       use_track3 : 1;                  /**< If == 1 and the PSD is
117
                                                 not interpreted  and
117
                                                 not interpreted  and
118
                                                 next disc has same album
118
                                                 next disc has same album
119
                                                 id, then start next disc
119
                                                 id, then start next disc
120
                                                 with track 3, otherwise
120
                                                 with track 3, otherwise
121
                                                 start with track 2 */ 
121
                                                 start with track 2 */
122
  bool       pbc_x : 1;                       /**< extended PBC available */
122
  bool       pbc_x : 1;                       /**< extended PBC available */
123
#else
123
#else
124
  bool       pbc_x : 1;
124
  bool       pbc_x : 1;
Lines 143-149 Link Here
143
  VCD_FILES_VIDEO_PAL_MOTION = 7
143
  VCD_FILES_VIDEO_PAL_MOTION = 7
144
};
144
};
145
145
146
typedef struct 
146
typedef struct
147
{
147
{
148
#if defined(BITFIELD_LSBF)
148
#if defined(BITFIELD_LSBF)
149
  bitfield_t audio_type : 2;                /**< Audio characteristics:
149
  bitfield_t audio_type : 2;                /**< Audio characteristics:
Lines 152-158 Link Here
152
                                                    stream without extension
152
                                                    stream without extension
153
                                              0x2 - Two MPEG1 or MPEG2 audio
153
                                              0x2 - Two MPEG1 or MPEG2 audio
154
                                                    streams without extension
154
                                                    streams without extension
155
                                              0x3 - One MPEG2 multi-channel 
155
                                              0x3 - One MPEG2 multi-channel
156
                                                    audio stream w/ extension*/
156
                                                    audio stream w/ extension*/
157
  bitfield_t video_type : 3;                /**< Video characteristics:
157
  bitfield_t video_type : 3;                /**< Video characteristics:
158
                                              0x0 - No MPEG video data
158
                                              0x0 - No MPEG video data
Lines 163-178 Link Here
163
                                              0x5 - PAL still picture
163
                                              0x5 - PAL still picture
164
                                              0x6 - Reserved (PAL hires?)
164
                                              0x6 - Reserved (PAL hires?)
165
                                              0x7 - PAL motion picture */
165
                                              0x7 - PAL motion picture */
166
  bool       item_cont : 1;                 /**< Indicates segment is 
166
  bool       item_cont : 1;                 /**< Indicates segment is
167
                                                 continuation
167
                                                 continuation
168
                                              0x0 - 1st or only segment of item
168
                                              0x0 - 1st or only segment of item
169
                                              0x1 - 2nd or later
169
                                              0x1 - 2nd or later
170
                                                    segment of item */
170
                                                    segment of item */
171
  bitfield_t ogt : 2;                       /**< 0x0 - no OGT substream 
171
  bitfield_t ogt : 2;                       /**< 0x0 - no OGT substream
172
                                                 0x1 - sub-stream 0 available
172
                                                 0x1 - sub-stream 0 available
173
                                                 0x2 - sub-stream 0 & 1 
173
                                                 0x2 - sub-stream 0 & 1
174
                                                       available
174
                                                       available
175
                                                 0x3 - all OGT sub-substreams 
175
                                                 0x3 - all OGT sub-substreams
176
                                                       available */
176
                                                       available */
177
#else
177
#else
178
  bitfield_t ogt : 2;
178
  bitfield_t ogt : 2;
Lines 189-202 Link Here
189
                                  VCD, "SUPERVCD" or
189
                                  VCD, "SUPERVCD" or
190
                                  "HQ-VCD  " for SVCD */
190
                                  "HQ-VCD  " for SVCD */
191
  uint8_t version;           /**< 0x02 -- VCD2.0,
191
  uint8_t version;           /**< 0x02 -- VCD2.0,
192
                                  0x01 for SVCD and VCD1.x */ 
192
                                  0x01 for SVCD and VCD1.x */
193
  uint8_t sys_prof_tag;      /**< System Profile Tag, used
193
  uint8_t sys_prof_tag;      /**< System Profile Tag, used
194
                                  to define the set of
194
                                  to define the set of
195
                                  mandatory parts to be
195
                                  mandatory parts to be
196
                                  applied for compatibility;
196
                                  applied for compatibility;
197
                                  0x00 for "SUPERVCD",
197
                                  0x00 for "SUPERVCD",
198
                                  0x01 for "HQ-VCD  ",
198
                                  0x01 for "HQ-VCD  ",
199
                                  0x0n for VCDx.n */ 
199
                                  0x0n for VCDx.n */
200
  char album_desc[16];       /**< album identification/desc. */
200
  char album_desc[16];       /**< album identification/desc. */
201
  uint16_t vol_count;        /**< number of volumes in album */
201
  uint16_t vol_count;        /**< number of volumes in album */
202
  uint16_t vol_id;           /**< number id of this volume in album */
202
  uint16_t vol_id;           /**< number id of this volume in album */
Lines 215-222 Link Here
215
  uint16_t lot_entries;      /**< offsets in lot */
215
  uint16_t lot_entries;      /**< offsets in lot */
216
  uint16_t item_count;       /**< segments used for segmentitems */
216
  uint16_t item_count;       /**< segments used for segmentitems */
217
  InfoSpiContents_t spi_contents[MAX_SEGMENTS]; /**< The next 1980 bytes
217
  InfoSpiContents_t spi_contents[MAX_SEGMENTS]; /**< The next 1980 bytes
218
                                                   contain one byte for each 
218
                                                   contain one byte for each
219
                                                   possible segment play item. 
219
                                                   possible segment play item.
220
                                                   Each byte indicates
220
                                                   Each byte indicates
221
                                                   contents. */
221
                                                   contents. */
222
222
Lines 287-293 Link Here
287
  bitfield_t reserved : 6;
287
  bitfield_t reserved : 6;
288
  bool       CommandListFlag : 1;
288
  bool       CommandListFlag : 1;
289
  bool       SelectionAreaFlag : 1;
289
  bool       SelectionAreaFlag : 1;
290
#endif  
290
#endif
291
} GNUC_PACKED PsdSelectionListFlags_t;
291
} GNUC_PACKED PsdSelectionListFlags_t;
292
292
293
#define PsdSelectionListFlags_t_SIZEOF 1
293
#define PsdSelectionListFlags_t_SIZEOF 1
Lines 385-394 Link Here
385
                                             0x03 : NTSC video
385
                                             0x03 : NTSC video
386
                                             0x07 : PAL video */
386
                                             0x07 : PAL video */
387
  bool       reserved1 : 1;                  /**< Reserved, must be zero */
387
  bool       reserved1 : 1;                  /**< Reserved, must be zero */
388
  bitfield_t ogt : 2;                        /**< 0x0 - no OGT substream 
388
  bitfield_t ogt : 2;                        /**< 0x0 - no OGT substream
389
                                             0x1 - sub-stream 0 available
389
                                             0x1 - sub-stream 0 available
390
                                             0x2 - sub-stream 0 & 1 available
390
                                             0x2 - sub-stream 0 & 1 available
391
                                             0x3 - all OGT sub-substreams 
391
                                             0x3 - all OGT sub-substreams
392
                                                   available */
392
                                                   available */
393
#else
393
#else
394
  bitfield_t ogt : 2;
394
  bitfield_t ogt : 2;
Lines 408-414 Link Here
408
#define TRACKS_SVD_VERSION  0x01
408
#define TRACKS_SVD_VERSION  0x01
409
409
410
typedef struct {
410
typedef struct {
411
  char file_id[sizeof(TRACKS_SVD_FILE_ID)-1];  /**< == "TRACKSVD" with out 
411
  char file_id[sizeof(TRACKS_SVD_FILE_ID)-1];  /**< == "TRACKSVD" with out
412
                                                    final NULL byte */
412
                                                    final NULL byte */
413
  uint8_t version;  /**< == 0x01 */
413
  uint8_t version;  /**< == 0x01 */
414
  uint8_t reserved; /**< Reserved, must be zero */
414
  uint8_t reserved; /**< Reserved, must be zero */
Lines 454-460 Link Here
454
#define SEARCH_TIME_INTERVAL  0x01
454
#define SEARCH_TIME_INTERVAL  0x01
455
455
456
typedef struct {
456
typedef struct {
457
  char file_id[sizeof(SEARCH_FILE_ID)-1]; /**< == "SEARCHSV" without final 
457
  char file_id[sizeof(SEARCH_FILE_ID)-1]; /**< == "SEARCHSV" without final
458
                                               NULL byte */
458
                                               NULL byte */
459
  uint8_t version;  /**< = 0x01 */
459
  uint8_t version;  /**< = 0x01 */
460
  uint8_t reserved; /**< Reserved, must be zero */
460
  uint8_t reserved; /**< Reserved, must be zero */
Lines 467-473 Link Here
467
467
468
#define SearchDat_t_SIZEOF 13
468
#define SearchDat_t_SIZEOF 13
469
469
470
/* SPICONTX.SVD 
470
/* SPICONTX.SVD
471
 */
471
 */
472
472
473
#define SPICONTX_FILE_ID      "SPICONSV"
473
#define SPICONTX_FILE_ID      "SPICONSV"
Lines 499-505 Link Here
499
  uint8_t version;                          /**< = 0x02 */
499
  uint8_t version;                          /**< = 0x02 */
500
  uint8_t reserved;                         /**< Reserved, must be zero */
500
  uint8_t reserved;                         /**< Reserved, must be zero */
501
  uint16_t scan_points;                     /**< the number of scan points */
501
  uint16_t scan_points;                     /**< the number of scan points */
502
  msf_t points[EMPTY_ARRAY_SIZE];           /**< actual scan points 
502
  msf_t points[EMPTY_ARRAY_SIZE];           /**< actual scan points
503
                                               points[time(iframe)/0.5] */
503
                                               points[time(iframe)/0.5] */
504
} GNUC_PACKED ScandataDat_v2_t;
504
} GNUC_PACKED ScandataDat_v2_t;
505
505
Lines 519-529 Link Here
519
  uint8_t reserved;                         /**< Reserved, must be zero */
519
  uint8_t reserved;                         /**< Reserved, must be zero */
520
  uint16_t scandata_count;                  /**< number of 3-byte entries in
520
  uint16_t scandata_count;                  /**< number of 3-byte entries in
521
                                                 the table */
521
                                                 the table */
522
  uint16_t track_count;                     /**< number of MPEG tracks on 
522
  uint16_t track_count;                     /**< number of MPEG tracks on
523
                                               disc */
523
                                               disc */
524
  uint16_t spi_count;                       /**<  number of consecutively 
524
  uint16_t spi_count;                       /**<  number of consecutively
525
                                               recorded play item segments 
525
                                               recorded play item segments
526
                                               (as opposed to the number of 
526
                                               (as opposed to the number of
527
                                               segment play items). */
527
                                               segment play items). */
528
  msf_t cum_playtimes[EMPTY_ARRAY_SIZE];    /**<  cumulative playing
528
  msf_t cum_playtimes[EMPTY_ARRAY_SIZE];    /**<  cumulative playing
529
                                               time up to track
529
                                               time up to track
Lines 548-554 Link Here
548
                                     following scandata table
548
                                     following scandata table
549
                                     where the MPEG track
549
                                     where the MPEG track
550
                                     scan points start */
550
                                     scan points start */
551
  
551
552
  /* The scandata table starts here */
552
  /* The scandata table starts here */
553
  struct {
553
  struct {
554
    uint8_t track_num;   /* Track number as in TOC */
554
    uint8_t track_num;   /* Track number as in TOC */
Lines 569-576 Link Here
569
569
570
#endif /* __VCD_FILES_PRIVATE_H__ */
570
#endif /* __VCD_FILES_PRIVATE_H__ */
571
571
572
572
573
/* 
573
/*
574
 * Local variables:
574
 * Local variables:
575
 *  c-file-style: "gnu"
575
 *  c-file-style: "gnu"
576
 *  tab-width: 8
576
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/include/libvcd/inf.h (-53 / +53 lines)
Lines 21-27 Link Here
21
 \endverbatim
21
 \endverbatim
22
*/
22
*/
23
23
24
/* 
24
/*
25
   Things here refer to lower-level structures using a structure other
25
   Things here refer to lower-level structures using a structure other
26
   than vcdinfo_t. For higher-level structures via the vcdinfo_t, see
26
   than vcdinfo_t. For higher-level structures via the vcdinfo_t, see
27
   info.h
27
   info.h
Lines 31-37 Link Here
31
#define _VCD_INF_H
31
#define _VCD_INF_H
32
32
33
#include <libvcd/info.h>
33
#include <libvcd/info.h>
34
  
34
35
#ifdef __cplusplus
35
#ifdef __cplusplus
36
extern "C" {
36
extern "C" {
37
#endif /* __cplusplus */
37
#endif /* __cplusplus */
Lines 48-65 Link Here
48
    Time is in seconds unless it is -1 (unlimited).
48
    Time is in seconds unless it is -1 (unlimited).
49
  */
49
  */
50
  int vcdinf_get_autowait_time (const PsdPlayListDescriptor_t *d);
50
  int vcdinf_get_autowait_time (const PsdPlayListDescriptor_t *d);
51
  
51
52
  /*!
52
  /*!
53
    Return the base selection number. VCD_INVALID_BSN is returned if there
53
    Return the base selection number. VCD_INVALID_BSN is returned if there
54
    is an error.
54
    is an error.
55
  */
55
  */
56
  unsigned int vcdinf_get_bsn(const PsdSelectionListDescriptor_t *psd);
56
  unsigned int vcdinf_get_bsn(const PsdSelectionListDescriptor_t *psd);
57
  
57
58
  /*!  Return the starting LBA (logical block address) for sequence
58
  /*!  Return the starting LBA (logical block address) for sequence
59
    entry_num in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
59
    entry_num in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
60
    The first entry number is 0.
60
    The first entry number is 0.
61
  */
61
  */
62
  lba_t vcdinf_get_entry_lba(const EntriesVcd_t *entries, 
62
  lba_t vcdinf_get_entry_lba(const EntriesVcd_t *entries,
63
			     unsigned int entry_num);
63
			     unsigned int entry_num);
64
64
65
  const char * vcdinf_get_format_version_str (vcd_type_t vcd_type);
65
  const char * vcdinf_get_format_version_str (vcd_type_t vcd_type);
Lines 68-96 Link Here
68
    Return loop count. 0 is infinite loop.
68
    Return loop count. 0 is infinite loop.
69
  */
69
  */
70
  uint16_t vcdinf_get_loop_count (const PsdSelectionListDescriptor_t *psd);
70
  uint16_t vcdinf_get_loop_count (const PsdSelectionListDescriptor_t *psd);
71
  
71
72
  /*!
72
  /*!
73
    Return LOT offset
73
    Return LOT offset
74
  */
74
  */
75
  uint16_t vcdinf_get_lot_offset (const LotVcd_t *lot, unsigned int n);
75
  uint16_t vcdinf_get_lot_offset (const LotVcd_t *lot, unsigned int n);
76
76
77
  /*!
77
  /*!
78
    Return number of bytes in PSD. 
78
    Return number of bytes in PSD.
79
  */
79
  */
80
  uint32_t vcdinf_get_psd_size (const InfoVcd_t *info);
80
  uint32_t vcdinf_get_psd_size (const InfoVcd_t *info);
81
       
81
82
  /*!
82
  /*!
83
    Return the number of segments in the VCD. 
83
    Return the number of segments in the VCD.
84
  */
84
  */
85
  unsigned int vcdinf_get_num_entries(const EntriesVcd_t *entries);
85
  unsigned int vcdinf_get_num_entries(const EntriesVcd_t *entries);
86
86
87
  /*!
87
  /*!
88
    Return number of LIDs. 
88
    Return number of LIDs.
89
  */
89
  */
90
  lid_t vcdinf_get_num_LIDs (const InfoVcd_t *info);
90
  lid_t vcdinf_get_num_LIDs (const InfoVcd_t *info);
91
91
92
  /*!
92
  /*!
93
    Return the number of segments in the VCD. 
93
    Return the number of segments in the VCD.
94
  */
94
  */
95
  segnum_t vcdinf_get_num_segments(const InfoVcd_t *info);
95
  segnum_t vcdinf_get_num_segments(const InfoVcd_t *info);
96
96
Lines 104-128 Link Here
104
    Time is in 1/15-second units.
104
    Time is in 1/15-second units.
105
  */
105
  */
106
  uint16_t vcdinf_get_play_time (const PsdPlayListDescriptor_t *d);
106
  uint16_t vcdinf_get_play_time (const PsdPlayListDescriptor_t *d);
107
  
107
108
  /*!
108
  /*!
109
    Get timeout offset for PsdPlayListDescriptor *d. Return 
109
    Get timeout offset for PsdPlayListDescriptor *d. Return
110
    VCDINFO_INVALID_OFFSET if d is NULL;
110
    VCDINFO_INVALID_OFFSET if d is NULL;
111
    Time is in seconds unless it is -1 (unlimited).
111
    Time is in seconds unless it is -1 (unlimited).
112
  */
112
  */
113
  uint16_t vcdinf_get_timeout_offset (const PsdSelectionListDescriptor_t *d);
113
  uint16_t vcdinf_get_timeout_offset (const PsdSelectionListDescriptor_t *d);
114
  
114
115
  /*!
115
  /*!
116
    Get timeout wait value for PsdPlayListDescriptor *d.
116
    Get timeout wait value for PsdPlayListDescriptor *d.
117
    Time is in seconds unless it is -1 (unlimited).
117
    Time is in seconds unless it is -1 (unlimited).
118
  */
118
  */
119
  int vcdinf_get_timeout_time (const PsdSelectionListDescriptor_t *d);
119
  int vcdinf_get_timeout_time (const PsdSelectionListDescriptor_t *d);
120
  
120
121
  /*!
121
  /*!
122
    Return the track number for entry n in obj. The first track starts
122
    Return the track number for entry n in obj. The first track starts
123
    at 1. 
123
    at 1.
124
  */
124
  */
125
  track_t vcdinf_get_track(const EntriesVcd_t *entries, 
125
  track_t vcdinf_get_track(const EntriesVcd_t *entries,
126
			   const unsigned int entry_num);
126
			   const unsigned int entry_num);
127
127
128
  /*!
128
  /*!
Lines 130-136 Link Here
130
    This is a number between 1 and the volume count.
130
    This is a number between 1 and the volume count.
131
  */
131
  */
132
  unsigned int vcdinf_get_volume_num(const InfoVcd_t *info);
132
  unsigned int vcdinf_get_volume_num(const InfoVcd_t *info);
133
  
133
134
  /*!
134
  /*!
135
    Return the VCD volume count - the number of CD's in the collection.
135
    Return the VCD volume count - the number of CD's in the collection.
136
  */
136
  */
Lines 141-154 Link Here
141
    Time is in seconds unless it is -1 (unlimited).
141
    Time is in seconds unless it is -1 (unlimited).
142
  */
142
  */
143
  int vcdinf_get_wait_time (const PsdPlayListDescriptor_t *d);
143
  int vcdinf_get_wait_time (const PsdPlayListDescriptor_t *d);
144
  
144
145
  /*!
145
  /*!
146
    Return true if loop has a jump delay
146
    Return true if loop has a jump delay
147
  */
147
  */
148
  bool vcdinf_has_jump_delay (const PsdSelectionListDescriptor_t *psd);
148
  bool vcdinf_has_jump_delay (const PsdSelectionListDescriptor_t *psd);
149
149
150
  /*!
150
  /*!
151
    Comparison routine used in sorting. We compare LIDs and if those are 
151
    Comparison routine used in sorting. We compare LIDs and if those are
152
    equal, use the offset.
152
    equal, use the offset.
153
    Note: we assume an unassigned LID is 0 and this compares as a high value.
153
    Note: we assume an unassigned LID is 0 and this compares as a high value.
154
154
Lines 157-190 Link Here
157
  int vcdinf_lid_t_cmp (vcdinfo_offset_t *a, vcdinfo_offset_t *b);
157
  int vcdinf_lid_t_cmp (vcdinfo_offset_t *a, vcdinfo_offset_t *b);
158
158
159
  /**
159
  /**
160
     \brief  Get next offset for a given PSD selector descriptor.  
160
     \brief  Get next offset for a given PSD selector descriptor.
161
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no 
161
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no
162
     "next" entry or pld is NULL. Otherwise the LID offset is returned.
162
     "next" entry or pld is NULL. Otherwise the LID offset is returned.
163
  */
163
  */
164
  uint16_t vcdinf_pld_get_next_offset(const PsdPlayListDescriptor_t *pld);
164
  uint16_t vcdinf_pld_get_next_offset(const PsdPlayListDescriptor_t *pld);
165
  
165
166
  /*!
166
  /*!
167
    Get the LID from a given play-list descriptor. 
167
    Get the LID from a given play-list descriptor.
168
    VCDINFO_REJECTED_MASK is returned on error or pld is NULL. 
168
    VCDINFO_REJECTED_MASK is returned on error or pld is NULL.
169
  */
169
  */
170
  uint16_t vcdinf_pld_get_lid(const PsdPlayListDescriptor_t *pld);
170
  uint16_t vcdinf_pld_get_lid(const PsdPlayListDescriptor_t *pld);
171
  
171
172
  /*!
172
  /*!
173
    Return the playlist item i in d. 
173
    Return the playlist item i in d.
174
  */
174
  */
175
  uint16_t vcdinf_pld_get_play_item(const PsdPlayListDescriptor_t *pld, 
175
  uint16_t vcdinf_pld_get_play_item(const PsdPlayListDescriptor_t *pld,
176
				    unsigned int i);
176
				    unsigned int i);
177
177
178
  /**
178
  /**
179
     \brief Get prev offset for a given PSD selector descriptor. 
179
     \brief Get prev offset for a given PSD selector descriptor.
180
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no 
180
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no
181
     "prev" entry or pld is NULL. Otherwise the LID offset is returned.
181
     "prev" entry or pld is NULL. Otherwise the LID offset is returned.
182
  */
182
  */
183
  uint16_t vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor_t *pld);
183
  uint16_t vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor_t *pld);
184
  
184
185
  /**
185
  /**
186
     \brief Get return offset for a given PLD selector descriptor. 
186
     \brief Get return offset for a given PLD selector descriptor.
187
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no 
187
     \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no
188
     "return" entry or pld is NULL. Otherwise the LID offset is returned.
188
     "return" entry or pld is NULL. Otherwise the LID offset is returned.
189
  */
189
  */
190
  uint16_t vcdinf_pld_get_return_offset(const PsdPlayListDescriptor_t *pld);
190
  uint16_t vcdinf_pld_get_return_offset(const PsdPlayListDescriptor_t *pld);
Lines 193-252 Link Here
193
    Return number of items in LIDs. Return 0 if error or not found.
193
    Return number of items in LIDs. Return 0 if error or not found.
194
  */
194
  */
195
  int vcdinf_pld_get_noi (const PsdPlayListDescriptor_t *pld);
195
  int vcdinf_pld_get_noi (const PsdPlayListDescriptor_t *pld);
196
  
196
197
  /**
197
  /**
198
   * \brief Get next offset for a given PSD selector descriptor. 
198
   * \brief Get next offset for a given PSD selector descriptor.
199
   * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
199
   * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
200
   * NULL. Otherwise the LID offset is returned.
200
   * NULL. Otherwise the LID offset is returned.
201
   */
201
   */
202
  uint16_t vcdinf_psd_get_default_offset(const PsdSelectionListDescriptor_t *psd);
202
  uint16_t vcdinf_psd_get_default_offset(const PsdSelectionListDescriptor_t *psd);
203
203
204
  /*!
204
  /*!
205
    Get the item id for a given selection-list descriptor. 
205
    Get the item id for a given selection-list descriptor.
206
    VCDINFO_REJECTED_MASK is returned on error or if psd is NULL. 
206
    VCDINFO_REJECTED_MASK is returned on error or if psd is NULL.
207
  */
207
  */
208
  uint16_t vcdinf_psd_get_itemid(const PsdSelectionListDescriptor_t *psd);
208
  uint16_t vcdinf_psd_get_itemid(const PsdSelectionListDescriptor_t *psd);
209
209
210
  /*!
210
  /*!
211
    Get the LID from a given selection-list descriptor. 
211
    Get the LID from a given selection-list descriptor.
212
    VCDINFO_REJECTED_MASK is returned on error or psd is NULL. 
212
    VCDINFO_REJECTED_MASK is returned on error or psd is NULL.
213
  */
213
  */
214
  uint16_t vcdinf_psd_get_lid(const PsdSelectionListDescriptor_t *psd);
214
  uint16_t vcdinf_psd_get_lid(const PsdSelectionListDescriptor_t *psd);
215
  
215
216
  /*!
216
  /*!
217
    Get the LID rejected status for a given selection-list descriptor. 
217
    Get the LID rejected status for a given selection-list descriptor.
218
  true is also returned d is NULL. 
218
  true is also returned d is NULL.
219
  */
219
  */
220
  bool
220
  bool
221
  vcdinf_psd_get_lid_rejected(const PsdSelectionListDescriptor_t *psd);
221
  vcdinf_psd_get_lid_rejected(const PsdSelectionListDescriptor_t *psd);
222
  
222
223
  /**
223
  /**
224
     \brief Get "next" offset for a given PSD selector descriptor. 
224
     \brief Get "next" offset for a given PSD selector descriptor.
225
     \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no 
225
     \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no
226
     "next" entry or psd is NULL. Otherwise the LID offset is returned.
226
     "next" entry or psd is NULL. Otherwise the LID offset is returned.
227
  */
227
  */
228
  lid_t vcdinf_psd_get_next_offset(const PsdSelectionListDescriptor_t *psd);
228
  lid_t vcdinf_psd_get_next_offset(const PsdSelectionListDescriptor_t *psd);
229
  
229
230
  /*!
230
  /*!
231
    \brief Get offset entry_num for a given PSD selector descriptor. 
231
    \brief Get offset entry_num for a given PSD selector descriptor.
232
    \param d PSD selector containing the entry_num we query
232
    \param d PSD selector containing the entry_num we query
233
    \param entry_num entry number that we want the LID offset for.
233
    \param entry_num entry number that we want the LID offset for.
234
    \return VCDINFO_INVALID_OFFSET is returned if d on error or d is
234
    \return VCDINFO_INVALID_OFFSET is returned if d on error or d is
235
  NULL. Otherwise the LID offset is returned.
235
  NULL. Otherwise the LID offset is returned.
236
  */
236
  */
237
  uint16_t vcdinf_psd_get_offset(const PsdSelectionListDescriptor_t *d, 
237
  uint16_t vcdinf_psd_get_offset(const PsdSelectionListDescriptor_t *d,
238
				 unsigned int entry_num);
238
				 unsigned int entry_num);
239
  /**
239
  /**
240
     \brief Get "prev" offset for a given PSD selector descriptor. 
240
     \brief Get "prev" offset for a given PSD selector descriptor.
241
     \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no 
241
     \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no
242
     "prev"
242
     "prev"
243
     entry or psd is NULL. Otherwise the LID offset is returned.
243
     entry or psd is NULL. Otherwise the LID offset is returned.
244
  */
244
  */
245
  uint16_t vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor_t *psd);
245
  uint16_t vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor_t *psd);
246
  
246
247
  /**
247
  /**
248
   \brief Get "return" offset for a given PSD selector descriptor. 
248
   \brief Get "return" offset for a given PSD selector descriptor.
249
   \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no 
249
   \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no
250
   "return" entry or psd is NULL. Otherwise the LID offset is returned.
250
   "return" entry or psd is NULL. Otherwise the LID offset is returned.
251
  */
251
  */
252
  uint16_t vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor_t *psd);
252
  uint16_t vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor_t *psd);
(-)vcdimager-0.7.24.ORIG/include/libvcd/info.h (-211 / +214 lines)
Lines 20-28 Link Here
20
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
 \endverbatim
21
 \endverbatim
22
*/
22
*/
23
/* 
23
/*
24
   Things here refer to higher-level structures usually accessed via
24
   Things here refer to higher-level structures usually accessed via
25
   vcdinfo_t. For lower-level access which generally use 
25
   vcdinfo_t. For lower-level access which generally use
26
   structures other than vcdinfo_t, see inf.h
26
   structures other than vcdinfo_t, see inf.h
27
*/
27
*/
28
28
Lines 33-38 Link Here
33
#include <libvcd/version.h>
33
#include <libvcd/version.h>
34
#include <libvcd/types.h>
34
#include <libvcd/types.h>
35
#include <libvcd/files.h>
35
#include <libvcd/files.h>
36
37
/* We don't want to pull in cdio's config */
38
#define __CDIO_CONFIG_H__
36
#include <cdio/cdio.h>
39
#include <cdio/cdio.h>
37
#include <cdio/iso9660.h>
40
#include <cdio/iso9660.h>
38
#include <cdio/ds.h>
41
#include <cdio/ds.h>
Lines 44-50 Link Here
44
/*========== Move somewhere else? ================*/
47
/*========== Move somewhere else? ================*/
45
48
46
/*! maximum # characters in an album id. */
49
/*! maximum # characters in an album id. */
47
#define MAX_ALBUM_LEN 16   
50
#define MAX_ALBUM_LEN 16
48
51
49
/*! maximum # of selections allowed in a PBC selection list. */
52
/*! maximum # of selections allowed in a PBC selection list. */
50
#define MAX_PBC_SELECTIONS 99
53
#define MAX_PBC_SELECTIONS 99
Lines 67-75 Link Here
67
70
68
/*========== End move somewhere else? ================*/
71
/*========== End move somewhere else? ================*/
69
72
70
/*! 
73
/*!
71
  Portion of uint16_t which determines whether offset is
74
  Portion of uint16_t which determines whether offset is
72
  rejected or not. 
75
  rejected or not.
73
*/
76
*/
74
#define VCDINFO_REJECTED_MASK (0x8000)
77
#define VCDINFO_REJECTED_MASK (0x8000)
75
78
Lines 78-134 Link Here
78
*/
81
*/
79
#define VCDINFO_OFFSET_MASK (VCDINFO_REJECTED_MASK-1)
82
#define VCDINFO_OFFSET_MASK (VCDINFO_REJECTED_MASK-1)
80
83
81
/*! 
84
/*!
82
  Portion of uint16_t which contains the lid.
85
  Portion of uint16_t which contains the lid.
83
*/
86
*/
84
#define VCDINFO_LID_MASK    (VCDINFO_REJECTED_MASK-1)
87
#define VCDINFO_LID_MASK    (VCDINFO_REJECTED_MASK-1)
85
88
86
/*! 
89
/*!
87
  Constant for invalid track number
90
  Constant for invalid track number
88
*/
91
*/
89
#define VCDINFO_INVALID_TRACK   0xFF
92
#define VCDINFO_INVALID_TRACK   0xFF
90
93
91
/*! 
94
/*!
92
  Constant for invalid LID offset.
95
  Constant for invalid LID offset.
93
*/
96
*/
94
#define VCDINFO_INVALID_OFFSET  0xFFFF
97
#define VCDINFO_INVALID_OFFSET  0xFFFF
95
98
96
/*! 
99
/*!
97
  Constant for ending or "leadout" track.
100
  Constant for ending or "leadout" track.
98
*/
101
*/
99
#define VCDINFO_LEADOUT_TRACK  0xaa
102
#define VCDINFO_LEADOUT_TRACK  0xaa
100
103
101
/*! 
104
/*!
102
  Constant for invalid sequence entry.
105
  Constant for invalid sequence entry.
103
*/
106
*/
104
#define VCDINFO_INVALID_ENTRY  0xFFFF
107
#define VCDINFO_INVALID_ENTRY  0xFFFF
105
108
106
/*! 
109
/*!
107
  Constant for invalid LID. 
110
  Constant for invalid LID.
108
  FIXME: player needs these to be the same. 
111
  FIXME: player needs these to be the same.
109
  VCDimager code requres 0 for an UNINITIALIZED LID.
112
  VCDimager code requres 0 for an UNINITIALIZED LID.
110
  
113
111
*/
114
*/
112
#define VCDINFO_INVALID_LID  VCDINFO_INVALID_ENTRY
115
#define VCDINFO_INVALID_LID  VCDINFO_INVALID_ENTRY
113
#define VCDINFO_UNINIT_LID   0
116
#define VCDINFO_UNINIT_LID   0
114
117
115
/*! 
118
/*!
116
  Constant for invalid itemid
119
  Constant for invalid itemid
117
*/
120
*/
118
#define VCDINFO_INVALID_ITEMID  0xFFFF
121
#define VCDINFO_INVALID_ITEMID  0xFFFF
119
122
120
/*! 
123
/*!
121
  Constant for invalid audio type
124
  Constant for invalid audio type
122
*/
125
*/
123
#define VCDINFO_INVALID_AUDIO_TYPE  4
126
#define VCDINFO_INVALID_AUDIO_TYPE  4
124
127
125
/*! 
128
/*!
126
  Constant for invalid base selection number (BSN)
129
  Constant for invalid base selection number (BSN)
127
*/
130
*/
128
#define VCDINFO_INVALID_BSN  200
131
#define VCDINFO_INVALID_BSN  200
129
132
130
/*! The number of sectors allocated in a Video CD segment is a fixed: 150.
133
/*! The number of sectors allocated in a Video CD segment is a fixed: 150.
131
   
134
132
   NOTE: The actual number of sectors used is often less and can sometimes
135
   NOTE: The actual number of sectors used is often less and can sometimes
133
   be gleaned by looking at the correspoinding ISO 9660 file entry (or
136
   be gleaned by looking at the correspoinding ISO 9660 file entry (or
134
   by scanning the MPEG segment which may be slow).
137
   by scanning the MPEG segment which may be slow).
Lines 143-160 Link Here
143
  /** A list of all the different kinds of things a segment can represent.
146
  /** A list of all the different kinds of things a segment can represent.
144
      See enum in vcd_files_private.h */
147
      See enum in vcd_files_private.h */
145
  typedef enum {
148
  typedef enum {
146
    VCDINFO_FILES_VIDEO_NOSTREAM    = 0,   
149
    VCDINFO_FILES_VIDEO_NOSTREAM    = 0,
147
    VCDINFO_FILES_VIDEO_NTSC_STILL  = 1,   
150
    VCDINFO_FILES_VIDEO_NTSC_STILL  = 1,
148
    VCDINFO_FILES_VIDEO_NTSC_STILL2 = 2,   /**< NTCS lo+hires*/
151
    VCDINFO_FILES_VIDEO_NTSC_STILL2 = 2,   /**< NTCS lo+hires*/
149
    VCDINFO_FILES_VIDEO_NTSC_MOTION = 3,
152
    VCDINFO_FILES_VIDEO_NTSC_MOTION = 3,
150
    VCDINFO_FILES_VIDEO_PAL_STILL   = 5,    
153
    VCDINFO_FILES_VIDEO_PAL_STILL   = 5,
151
    VCDINFO_FILES_VIDEO_PAL_STILL2  = 6,   /**< PAL lo+hires*/
154
    VCDINFO_FILES_VIDEO_PAL_STILL2  = 6,   /**< PAL lo+hires*/
152
    VCDINFO_FILES_VIDEO_PAL_MOTION  = 7,
155
    VCDINFO_FILES_VIDEO_PAL_MOTION  = 7,
153
    VCDINFO_FILES_VIDEO_INVALID     = 8
156
    VCDINFO_FILES_VIDEO_INVALID     = 8
154
  } vcdinfo_video_segment_type_t;
157
  } vcdinfo_video_segment_type_t;
155
  
158
156
  /*!
159
  /*!
157
    Used in working with LOT - list of offsets and lid's 
160
    Used in working with LOT - list of offsets and lid's
158
  */
161
  */
159
  typedef struct {
162
  typedef struct {
160
    uint8_t type;
163
    uint8_t type;
Lines 163-171 Link Here
163
    bool in_lot;   /**< This offset is listed in LOT. */
166
    bool in_lot;   /**< This offset is listed in LOT. */
164
    bool ext;      /**< True if entry comes from offset_x_list. */
167
    bool ext;      /**< True if entry comes from offset_x_list. */
165
  } vcdinfo_offset_t;
168
  } vcdinfo_offset_t;
166
  
169
167
  /*!
170
  /*!
168
    The kind of entry associated with an selection-item id 
171
    The kind of entry associated with an selection-item id
169
    See corresponding enum item_type_t in lib/pbc.h. */
172
    See corresponding enum item_type_t in lib/pbc.h. */
170
  typedef enum {
173
  typedef enum {
171
    VCDINFO_ITEM_TYPE_TRACK,
174
    VCDINFO_ITEM_TYPE_TRACK,
Lines 175-195 Link Here
175
    VCDINFO_ITEM_TYPE_SPAREID2,
178
    VCDINFO_ITEM_TYPE_SPAREID2,
176
    VCDINFO_ITEM_TYPE_NOTFOUND
179
    VCDINFO_ITEM_TYPE_NOTFOUND
177
  } vcdinfo_item_enum_t;
180
  } vcdinfo_item_enum_t;
178
  
181
179
  typedef struct {
182
  typedef struct {
180
    uint16_t num;
183
    uint16_t num;
181
    vcdinfo_item_enum_t type;
184
    vcdinfo_item_enum_t type;
182
  } vcdinfo_itemid_t;
185
  } vcdinfo_itemid_t;
183
  
186
184
  typedef enum {
187
  typedef enum {
185
    VCDINFO_OPEN_ERROR,          /**< Error */
188
    VCDINFO_OPEN_ERROR,          /**< Error */
186
    VCDINFO_OPEN_VCD,            /**< Is a VCD of some sort */
189
    VCDINFO_OPEN_VCD,            /**< Is a VCD of some sort */
187
    VCDINFO_OPEN_OTHER           /**< Is not VCD, but something else */
190
    VCDINFO_OPEN_OTHER           /**< Is not VCD, but something else */
188
  } vcdinfo_open_return_t;
191
  } vcdinfo_open_return_t;
189
  
192
190
  typedef struct 
193
  typedef struct
191
  {
194
  {
192
    
195
193
    psd_descriptor_types descriptor_type;
196
    psd_descriptor_types descriptor_type;
194
    /* Only one of pld or psd is used below. Not all
197
    /* Only one of pld or psd is used below. Not all
195
       C compiler accept the anonymous unions commented out below. */
198
       C compiler accept the anonymous unions commented out below. */
Lines 197-275 Link Here
197
    PsdPlayListDescriptor_t *pld;
200
    PsdPlayListDescriptor_t *pld;
198
    PsdSelectionListDescriptor_t *psd;
201
    PsdSelectionListDescriptor_t *psd;
199
    /* }; */
202
    /* }; */
200
    
203
201
  } PsdListDescriptor_t;
204
  } PsdListDescriptor_t;
202
205
203
  /* For backwards compatibility. Don't use PsdListDescriptor. */
206
  /* For backwards compatibility. Don't use PsdListDescriptor. */
204
#define PsdListDescriptor PsdListDescriptor_t
207
#define PsdListDescriptor PsdListDescriptor_t
205
  
208
206
  /*!
209
  /*!
207
    Return the number of audio channels implied by "audio_type".
210
    Return the number of audio channels implied by "audio_type".
208
    0 is returned on error.
211
    0 is returned on error.
209
  */
212
  */
210
  unsigned int
213
  unsigned int
211
  vcdinfo_audio_type_num_channels(const vcdinfo_obj_t *p_vcdinfo, 
214
  vcdinfo_audio_type_num_channels(const vcdinfo_obj_t *p_vcdinfo,
212
				  unsigned int audio_type);
215
				  unsigned int audio_type);
213
  
216
214
  /*!
217
  /*!
215
    Return a string describing an audio type.
218
    Return a string describing an audio type.
216
  */
219
  */
217
  const char * vcdinfo_audio_type2str(const vcdinfo_obj_t *p_vcdinfo,
220
  const char * vcdinfo_audio_type2str(const vcdinfo_obj_t *p_vcdinfo,
218
				      unsigned int audio_type);
221
				      unsigned int audio_type);
219
  
222
220
  /*!
223
  /*!
221
    Note first i_seg is 0!
224
    Note first i_seg is 0!
222
  */
225
  */
223
  const char * 
226
  const char *
224
  vcdinfo_ogt2str(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
227
  vcdinfo_ogt2str(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
225
  
228
226
  /*!
229
  /*!
227
    Note first i_seg is 0!
230
    Note first i_seg is 0!
228
  */
231
  */
229
  const char * 
232
  const char *
230
  vcdinfo_video_type2str(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
233
  vcdinfo_video_type2str(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
231
  
234
232
  const char *
235
  const char *
233
  vcdinfo_pin2str (uint16_t itemid);
236
  vcdinfo_pin2str (uint16_t itemid);
234
  
237
235
  /*!
238
  /*!
236
    \brief Classify i_itemid into the kind of item it is: track #, entry #, 
239
    \brief Classify i_itemid into the kind of item it is: track #, entry #,
237
    segment #. 
240
    segment #.
238
    \param i_itemid is set to contain this classifcation an the converted 
241
    \param i_itemid is set to contain this classifcation an the converted
239
    entry number. 
242
    entry number.
240
    \param p_itemid returned value.
243
    \param p_itemid returned value.
241
  */
244
  */
242
  void
245
  void
243
  vcdinfo_classify_itemid (uint16_t i_itemid, 
246
  vcdinfo_classify_itemid (uint16_t i_itemid,
244
			   /*out*/ vcdinfo_itemid_t *p_itemid);
247
			   /*out*/ vcdinfo_itemid_t *p_itemid);
245
  
248
246
  /*!
249
  /*!
247
    Return a string containing the VCD album id, or NULL if there is 
250
    Return a string containing the VCD album id, or NULL if there is
248
    some problem in getting this. 
251
    some problem in getting this.
249
  */
252
  */
250
  const char *
253
  const char *
251
  vcdinfo_get_album_id(const vcdinfo_obj_t *p_vcdinfo);
254
  vcdinfo_get_album_id(const vcdinfo_obj_t *p_vcdinfo);
252
  
255
253
  /*!
256
  /*!
254
    Return the VCD application ID.
257
    Return the VCD application ID.
255
    NULL is returned if there is some problem in getting this. 
258
    NULL is returned if there is some problem in getting this.
256
  */
259
  */
257
  char *
260
  char *
258
  vcdinfo_get_application_id(vcdinfo_obj_t *p_vcdinfo);
261
  vcdinfo_get_application_id(vcdinfo_obj_t *p_vcdinfo);
259
  
262
260
  /*! Return the selection number of the area that a point is enclosed in.
263
  /*! Return the selection number of the area that a point is enclosed in.
261
     In short we return < 0 on an error of some kind.
264
     In short we return < 0 on an error of some kind.
262
     If the VCD contains no extended selection list return -1.
265
     If the VCD contains no extended selection list return -1.
263
     If we are not in an extended selection list LID, return -2.
266
     If we are not in an extended selection list LID, return -2.
264
     If there no area encloses the point return -3
267
     If there no area encloses the point return -3
265
268
266
     max_x, max_y are the  maximum values that x and y can take on. 
269
     max_x, max_y are the  maximum values that x and y can take on.
267
     They would be the largest coordinate in the screen coordinate space.
270
     They would be the largest coordinate in the screen coordinate space.
268
     For example they might be 352, 240 (for VCD) or 704, 480 for SVCD NTSC, 
271
     For example they might be 352, 240 (for VCD) or 704, 480 for SVCD NTSC,
269
     or 704, 576. 
272
     or 704, 576.
270
  */
273
  */
271
  int 
274
  int
272
  vcdinfo_get_area_selection(const vcdinfo_obj_t *p_vcdinfo, 
275
  vcdinfo_get_area_selection(const vcdinfo_obj_t *p_vcdinfo,
273
                             lid_t lid, int16_t x, int16_t y,
276
                             lid_t lid, int16_t x, int16_t y,
274
			     uint16_t max_x, uint16_t max_y);
277
			     uint16_t max_x, uint16_t max_y);
275
  /*!
278
  /*!
Lines 278-297 Link Here
278
  */
281
  */
279
  CdIo_t *
282
  CdIo_t *
280
  vcdinfo_get_cd_image (const vcdinfo_obj_t *p_vcdinfo);
283
  vcdinfo_get_cd_image (const vcdinfo_obj_t *p_vcdinfo);
281
  
284
282
  /*!
285
  /*!
283
    Return a string containing the default VCD device if none is specified.
286
    Return a string containing the default VCD device if none is specified.
284
    This might be something like "/dev/cdrom" on Linux or 
287
    This might be something like "/dev/cdrom" on Linux or
285
    "/vol/dev/aliases/cdrom0" on Solaris,  or maybe "VIDEOCD.CUE" for 
288
    "/vol/dev/aliases/cdrom0" on Solaris,  or maybe "VIDEOCD.CUE" for
286
    if bin/cue I/O routines are in effect. 
289
    if bin/cue I/O routines are in effect.
287
    
290
288
    Return NULL we can't get this information.
291
    Return NULL we can't get this information.
289
  */
292
  */
290
  char *
293
  char *
291
  vcdinfo_get_default_device (const vcdinfo_obj_t *p_vcdinfo);
294
  vcdinfo_get_default_device (const vcdinfo_obj_t *p_vcdinfo);
292
  
295
293
  /*!
296
  /*!
294
    \brief Get default LID offset. 
297
    \brief Get default LID offset.
295
298
296
    Return the LID offset associated with a the "default" entry of the
299
    Return the LID offset associated with a the "default" entry of the
297
    passed-in LID parameter. Note "default" entries are associated with
300
    passed-in LID parameter. Note "default" entries are associated with
Lines 303-331 Link Here
303
  */
306
  */
304
  uint16_t
307
  uint16_t
305
  vcdinfo_get_default_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
308
  vcdinfo_get_default_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
306
  
309
307
  /*!
310
  /*!
308
    Return number of sector units in of an entry. 0 is returned if
311
    Return number of sector units in of an entry. 0 is returned if
309
    i_entry is invalid.
312
    i_entry is invalid.
310
  */
313
  */
311
  uint32_t
314
  uint32_t
312
  vcdinfo_get_entry_sect_count (const vcdinfo_obj_t *p_vcdinfo, 
315
  vcdinfo_get_entry_sect_count (const vcdinfo_obj_t *p_vcdinfo,
313
				unsigned int i_entry);
316
				unsigned int i_entry);
314
  
317
315
  /*!  Return the starting LBA (logical block address) for sequence
318
  /*!  Return the starting LBA (logical block address) for sequence
316
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
319
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
317
    The first entry number is 0.
320
    The first entry number is 0.
318
  */
321
  */
319
  lba_t
322
  lba_t
320
  vcdinfo_get_entry_lba(const vcdinfo_obj_t *p_vcdinfo, unsigned int i_entry);
323
  vcdinfo_get_entry_lba(const vcdinfo_obj_t *p_vcdinfo, unsigned int i_entry);
321
  
324
322
  /*!  Return the starting LSN (logical sector number) for sequence
325
  /*!  Return the starting LSN (logical sector number) for sequence
323
    i_entry in obj.  VCDINFO_NULL_LSN is returned if there is no entry.
326
    i_entry in obj.  VCDINFO_NULL_LSN is returned if there is no entry.
324
    The first entry number is 0.
327
    The first entry number is 0.
325
  */
328
  */
326
  lsn_t
329
  lsn_t
327
  vcdinfo_get_entry_lsn(const vcdinfo_obj_t *p_vcdinfo, unsigned int i_entry);
330
  vcdinfo_get_entry_lsn(const vcdinfo_obj_t *p_vcdinfo, unsigned int i_entry);
328
  
331
329
  /*!  Return the starting MSF (minutes/secs/frames) for sequence
332
  /*!  Return the starting MSF (minutes/secs/frames) for sequence
330
    i_entry in obj.  NULL is returned if there is no entry.
333
    i_entry in obj.  NULL is returned if there is no entry.
331
    The first entry number is 0.
334
    The first entry number is 0.
Lines 338-359 Link Here
338
    The type is also set inside obj.
341
    The type is also set inside obj.
339
    The first entry number is 0.
342
    The first entry number is 0.
340
  */
343
  */
341
  vcd_type_t 
344
  vcd_type_t
342
  vcdinfo_get_format_version (const vcdinfo_obj_t *p_vcdinfo);
345
  vcdinfo_get_format_version (const vcdinfo_obj_t *p_vcdinfo);
343
  
346
344
  /*!
347
  /*!
345
    Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ... 
348
    Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ...
346
    for this object.
349
    for this object.
347
  */
350
  */
348
  const char * 
351
  const char *
349
  vcdinfo_get_format_version_str (const vcdinfo_obj_t *p_vcdinfo);
352
  vcdinfo_get_format_version_str (const vcdinfo_obj_t *p_vcdinfo);
350
  
353
351
  EntriesVcd_t * vcdinfo_get_entriesVcd (vcdinfo_obj_t *p_vcdinfo);
354
  EntriesVcd_t * vcdinfo_get_entriesVcd (vcdinfo_obj_t *p_vcdinfo);
352
  
355
353
  InfoVcd_t    * vcdinfo_get_infoVcd (vcdinfo_obj_t *p_vcdinfo);
356
  InfoVcd_t    * vcdinfo_get_infoVcd (vcdinfo_obj_t *p_vcdinfo);
354
357
355
  /*!
358
  /*!
356
    \brief Get default or multi-default LID. 
359
    \brief Get default or multi-default LID.
357
360
358
    Return the LID offset associated with a the "default" entry of the
361
    Return the LID offset associated with a the "default" entry of the
359
    passed-in LID parameter. Note "default" entries are associated
362
    passed-in LID parameter. Note "default" entries are associated
Lines 370-378 Link Here
370
  lid_t
373
  lid_t
371
  vcdinfo_get_multi_default_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
374
  vcdinfo_get_multi_default_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
372
				lsn_t lsn);
375
				lsn_t lsn);
373
  
376
374
  /*!
377
  /*!
375
    \brief Get default or multi-default LID offset. 
378
    \brief Get default or multi-default LID offset.
376
379
377
    Return the LID offset associated with a the "default" entry of the
380
    Return the LID offset associated with a the "default" entry of the
378
    passed-in LID parameter. Note "default" entries are associated
381
    passed-in LID parameter. Note "default" entries are associated
Lines 396-457 Link Here
396
    object.
399
    object.
397
  */
400
  */
398
  iso9660_pvd_t * vcdinfo_get_pvd (vcdinfo_obj_t *p_vcdinfo);
401
  iso9660_pvd_t * vcdinfo_get_pvd (vcdinfo_obj_t *p_vcdinfo);
399
  
402
400
  void * vcdinfo_get_scandata (vcdinfo_obj_t *p_vcdinfo);
403
  void * vcdinfo_get_scandata (vcdinfo_obj_t *p_vcdinfo);
401
404
402
  void * vcdinfo_get_searchDat (vcdinfo_obj_t *p_vcdinfo);
405
  void * vcdinfo_get_searchDat (vcdinfo_obj_t *p_vcdinfo);
403
  
406
404
  void * vcdinfo_get_tracksSVD (vcdinfo_obj_t *p_vcdinfo);
407
  void * vcdinfo_get_tracksSVD (vcdinfo_obj_t *p_vcdinfo);
405
  
408
406
  /*!
409
  /*!
407
    Get the LOT pointer. 
410
    Get the LOT pointer.
408
  */
411
  */
409
  LotVcd_t *
412
  LotVcd_t *
410
  vcdinfo_get_lot(const vcdinfo_obj_t *p_vcdinfo);
413
  vcdinfo_get_lot(const vcdinfo_obj_t *p_vcdinfo);
411
  
414
412
  /*!
415
  /*!
413
    Get the extended LOT pointer. 
416
    Get the extended LOT pointer.
414
  */
417
  */
415
  LotVcd_t *
418
  LotVcd_t *
416
  vcdinfo_get_lot_x(const vcdinfo_obj_t *p_vcdinfo);
419
  vcdinfo_get_lot_x(const vcdinfo_obj_t *p_vcdinfo);
417
420
418
  /*!
421
  /*!
419
    Return Number of LIDs. 
422
    Return Number of LIDs.
420
  */
423
  */
421
  lid_t
424
  lid_t
422
  vcdinfo_get_num_LIDs (const vcdinfo_obj_t *p_vcdinfo);
425
  vcdinfo_get_num_LIDs (const vcdinfo_obj_t *p_vcdinfo);
423
  
426
424
  /*!
427
  /*!
425
    Return the audio type for a given track. 
428
    Return the audio type for a given track.
426
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
429
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
427
  */
430
  */
428
  unsigned int
431
  unsigned int
429
  vcdinfo_get_num_audio_channels(unsigned int audio_type);
432
  vcdinfo_get_num_audio_channels(unsigned int audio_type);
430
  
433
431
  /*!
434
  /*!
432
    Return the number of entries in the VCD.
435
    Return the number of entries in the VCD.
433
  */
436
  */
434
  unsigned int
437
  unsigned int
435
  vcdinfo_get_num_entries(const vcdinfo_obj_t *p_vcdinfo);
438
  vcdinfo_get_num_entries(const vcdinfo_obj_t *p_vcdinfo);
436
  
439
437
  /*!
440
  /*!
438
    Return the number of segments in the VCD. 
441
    Return the number of segments in the VCD.
439
  */
442
  */
440
  segnum_t
443
  segnum_t
441
  vcdinfo_get_num_segments(const vcdinfo_obj_t *p_vcdinfo);
444
  vcdinfo_get_num_segments(const vcdinfo_obj_t *p_vcdinfo);
442
  
445
443
  /*!  
446
  /*!
444
    Return the highest track number in the current medium. 
447
    Return the highest track number in the current medium.
445
448
446
    Because we track start numbering at 0 (which is the ISO 9660 track
449
    Because we track start numbering at 0 (which is the ISO 9660 track
447
    containing Video CD naviagion and disk information), this is one
450
    containing Video CD naviagion and disk information), this is one
448
    less than the number of tracks. 
451
    less than the number of tracks.
449
452
450
    If there are no tracks, we return -1.
453
    If there are no tracks, we return -1.
451
  */
454
  */
452
  unsigned int
455
  unsigned int
453
  vcdinfo_get_num_tracks(const vcdinfo_obj_t *p_vcdinfo);
456
  vcdinfo_get_num_tracks(const vcdinfo_obj_t *p_vcdinfo);
454
  
457
455
  /*!
458
  /*!
456
    Get the VCD info list.
459
    Get the VCD info list.
457
  */
460
  */
Lines 467-486 Link Here
467
  */
470
  */
468
  unsigned int vcdinfo_get_offset_mult(const vcdinfo_obj_t *p_vcdinfo);
471
  unsigned int vcdinfo_get_offset_mult(const vcdinfo_obj_t *p_vcdinfo);
469
472
470
  /*! 
473
  /*!
471
    Get entry in offset list for the item that has offset. This entry 
474
    Get entry in offset list for the item that has offset. This entry
472
    has for example the LID. NULL is returned on error. 
475
    has for example the LID. NULL is returned on error.
473
  */
476
  */
474
  vcdinfo_offset_t *
477
  vcdinfo_offset_t *
475
  vcdinfo_get_offset_t (const vcdinfo_obj_t *p_vcdinfo, unsigned int offset);
478
  vcdinfo_get_offset_t (const vcdinfo_obj_t *p_vcdinfo, unsigned int offset);
476
  
479
477
  /*!
480
  /*!
478
    Return a string containing the VCD preparer id with trailing
481
    Return a string containing the VCD preparer id with trailing
479
    blanks removed, or NULL if there is some problem in getting this.
482
    blanks removed, or NULL if there is some problem in getting this.
480
  */
483
  */
481
  char *
484
  char *
482
  vcdinfo_get_preparer_id(const vcdinfo_obj_t *p_vcdinfo);
485
  vcdinfo_get_preparer_id(const vcdinfo_obj_t *p_vcdinfo);
483
  
486
484
  /*!
487
  /*!
485
    Get the PSD.
488
    Get the PSD.
486
  */
489
  */
Lines 495-671 Link Here
495
    Return number of bytes in PSD.
498
    Return number of bytes in PSD.
496
  */
499
  */
497
  uint32_t vcdinfo_get_psd_size (const vcdinfo_obj_t *p_vcdinfo);
500
  uint32_t vcdinfo_get_psd_size (const vcdinfo_obj_t *p_vcdinfo);
498
  
501
499
  /*!
502
  /*!
500
    Return number of bytes in the extended PSD.
503
    Return number of bytes in the extended PSD.
501
  */
504
  */
502
  uint32_t vcdinfo_get_psd_x_size (const vcdinfo_obj_t *p_vcdinfo);
505
  uint32_t vcdinfo_get_psd_x_size (const vcdinfo_obj_t *p_vcdinfo);
503
  
506
504
  /*!
507
  /*!
505
    Return a string containing the VCD publisher id with trailing
508
    Return a string containing the VCD publisher id with trailing
506
    blanks removed, or NULL if there is some problem in getting this.
509
    blanks removed, or NULL if there is some problem in getting this.
507
  */
510
  */
508
  char * vcdinfo_get_publisher_id(const vcdinfo_obj_t *p_vcdinfo);
511
  char * vcdinfo_get_publisher_id(const vcdinfo_obj_t *p_vcdinfo);
509
  
512
510
  /**
513
  /**
511
   \brief Get return offset for a given LID. 
514
   \brief Get return offset for a given LID.
512
   \return  VCDINFO_INVALID_OFFSET is returned on error or if LID has no 
515
   \return  VCDINFO_INVALID_OFFSET is returned on error or if LID has no
513
   "return" entry. Otherwise the LID offset is returned.
516
   "return" entry. Otherwise the LID offset is returned.
514
   */
517
   */
515
  lid_t
518
  lid_t
516
  vcdinfo_get_return_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
519
  vcdinfo_get_return_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
517
  
520
518
  /*!
521
  /*!
519
    Return the audio type for a given segment. 
522
    Return the audio type for a given segment.
520
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
523
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
521
  */
524
  */
522
  unsigned int 
525
  unsigned int
523
  vcdinfo_get_seg_audio_type(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
526
  vcdinfo_get_seg_audio_type(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
524
  
527
525
  /*!
528
  /*!
526
    Return true if this segment is supposed to continue to the next one,
529
    Return true if this segment is supposed to continue to the next one,
527
    (is part of an "item" or listing in the ISO 9660 filesystem).
530
    (is part of an "item" or listing in the ISO 9660 filesystem).
528
  */
531
  */
529
  bool vcdinfo_get_seg_continue(const vcdinfo_obj_t *p_vcdinfo, 
532
  bool vcdinfo_get_seg_continue(const vcdinfo_obj_t *p_vcdinfo,
530
				segnum_t i_seg);
533
				segnum_t i_seg);
531
534
532
  /*!  Return the starting LBA (logical block address) for segment
535
  /*!  Return the starting LBA (logical block address) for segment
533
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
536
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
534
    
537
535
    Note first i_seg is 0.
538
    Note first i_seg is 0.
536
  */
539
  */
537
  lba_t
540
  lba_t
538
  vcdinfo_get_seg_lba(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
541
  vcdinfo_get_seg_lba(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
539
  
542
540
  /*!  Return the starting LSN (logical sector number) for segment
543
  /*!  Return the starting LSN (logical sector number) for segment
541
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
544
    i_entry in obj.  VCDINFO_NULL_LBA is returned if there is no entry.
542
    
545
543
    Note first i_seg is 0.
546
    Note first i_seg is 0.
544
  */
547
  */
545
  lsn_t
548
  lsn_t
546
  vcdinfo_get_seg_lsn(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
549
  vcdinfo_get_seg_lsn(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
547
  
550
548
  /*!  Return the starting MSF (minutes/secs/frames) for segment
551
  /*!  Return the starting MSF (minutes/secs/frames) for segment
549
    i_entry in obj.  NULL is returned if there is no entry.
552
    i_entry in obj.  NULL is returned if there is no entry.
550
    
553
551
    Note first i_seg is 0.
554
    Note first i_seg is 0.
552
  */
555
  */
553
  const msf_t *
556
  const msf_t *
554
  vcdinfo_get_seg_msf(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
557
  vcdinfo_get_seg_msf(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
555
  
558
556
  /*! Return the x-y resolution for a given segment.
559
  /*! Return the x-y resolution for a given segment.
557
    Note first i_seg is 0.
560
    Note first i_seg is 0.
558
  */
561
  */
559
  void
562
  void
560
  vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg,
563
  vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg,
561
			     /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y);
564
			     /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y);
562
  
565
563
  /*!  
566
  /*!
564
    Return the number of sectors for segment
567
    Return the number of sectors for segment
565
    i_entry in obj.  0 is returned if there is no entry.
568
    i_entry in obj.  0 is returned if there is no entry.
566
    
569
567
    Use this routine to figure out the actual number of bytes a physical
570
    Use this routine to figure out the actual number of bytes a physical
568
    region of a disk or CD takes up for a segment.
571
    region of a disk or CD takes up for a segment.
569
572
570
    If an item has been broken up into a number of "continued" segments,
573
    If an item has been broken up into a number of "continued" segments,
571
    we will report the item size for the first segment and 0 for the
574
    we will report the item size for the first segment and 0 for the
572
    remaining ones. We may revisit this decision later. 
575
    remaining ones. We may revisit this decision later.
573
  */
576
  */
574
  uint32_t
577
  uint32_t
575
  vcdinfo_get_seg_sector_count(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
578
  vcdinfo_get_seg_sector_count(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
576
  
579
577
  /*!
580
  /*!
578
    Return a string containing the VCD system id with trailing
581
    Return a string containing the VCD system id with trailing
579
    blanks removed, or NULL if there is some problem in getting this.
582
    blanks removed, or NULL if there is some problem in getting this.
580
  */
583
  */
581
  char *
584
  char *
582
  vcdinfo_get_system_id(const vcdinfo_obj_t *p_vcdinfo);
585
  vcdinfo_get_system_id(const vcdinfo_obj_t *p_vcdinfo);
583
  
586
584
  /*!
587
  /*!
585
    Return the track number for entry n in obj. 
588
    Return the track number for entry n in obj.
586
589
587
    In contrast to libcdio we start numbering at 0 which is the
590
    In contrast to libcdio we start numbering at 0 which is the
588
    ISO9660 and metadata information for the Video CD. Thus track 
591
    ISO9660 and metadata information for the Video CD. Thus track
589
    1 is the first track the first complete MPEG track generally.
592
    1 is the first track the first complete MPEG track generally.
590
  */
593
  */
591
  track_t
594
  track_t
592
  vcdinfo_get_track(const vcdinfo_obj_t *p_vcdinfo, 
595
  vcdinfo_get_track(const vcdinfo_obj_t *p_vcdinfo,
593
		    const unsigned int i_entry);
596
		    const unsigned int i_entry);
594
  
597
595
  /*!
598
  /*!
596
    Return the audio type for a given track. 
599
    Return the audio type for a given track.
597
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
600
    VCDINFO_INVALID_AUDIO_TYPE is returned on error.
598
    
601
599
    Note: track 1 is usually the first track.
602
    Note: track 1 is usually the first track.
600
  */
603
  */
601
  unsigned int
604
  unsigned int
602
  vcdinfo_get_track_audio_type(const vcdinfo_obj_t *p_vcdinfo, 
605
  vcdinfo_get_track_audio_type(const vcdinfo_obj_t *p_vcdinfo,
603
			       track_t i_track);
606
			       track_t i_track);
604
  
607
605
  /*!  
608
  /*!
606
    Return the starting LBA (logical block address) for track number
609
    Return the starting LBA (logical block address) for track number
607
    i_track in obj.  
610
    i_track in obj.
608
    
611
609
    The IS0-9660 filesystem track has number 0. Tracks associated
612
    The IS0-9660 filesystem track has number 0. Tracks associated
610
    with playable entries numbers start at 1.
613
    with playable entries numbers start at 1.
611
    
614
612
    The "leadout" track is specified either by
615
    The "leadout" track is specified either by
613
    using i_track LEADOUT_TRACK or the total tracks+1.
616
    using i_track LEADOUT_TRACK or the total tracks+1.
614
    VCDINFO_NULL_LBA is returned on failure.
617
    VCDINFO_NULL_LBA is returned on failure.
615
  */
618
  */
616
  lba_t
619
  lba_t
617
  vcdinfo_get_track_lba(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
620
  vcdinfo_get_track_lba(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
618
  
621
619
  /*!  
622
  /*!
620
    Return the starting LSN (logical sector number) for track number
623
    Return the starting LSN (logical sector number) for track number
621
    i_track in obj.  
624
    i_track in obj.
622
    
625
623
    The IS0-9660 filesystem track has number 0. Tracks associated
626
    The IS0-9660 filesystem track has number 0. Tracks associated
624
    with playable entries numbers start at 1.
627
    with playable entries numbers start at 1.
625
    
628
626
    The "leadout" track is specified either by
629
    The "leadout" track is specified either by
627
    using i_track LEADOUT_TRACK or the total tracks+1.
630
    using i_track LEADOUT_TRACK or the total tracks+1.
628
    VCDINFO_NULL_LBA is returned on failure.
631
    VCDINFO_NULL_LBA is returned on failure.
629
  */
632
  */
630
  lsn_t
633
  lsn_t
631
  vcdinfo_get_track_lsn(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
634
  vcdinfo_get_track_lsn(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
632
  
635
633
  /*!  
636
  /*!
634
    Return the starting MSF (minutes/secs/frames) for track number
637
    Return the starting MSF (minutes/secs/frames) for track number
635
    i_track in obj.  
638
    i_track in obj.
636
    
639
637
    The IS0-9660 filesystem track has number 0. Tracks associated
640
    The IS0-9660 filesystem track has number 0. Tracks associated
638
    with playable entries numbers start at 1.
641
    with playable entries numbers start at 1.
639
    
642
640
    The "leadout" track is specified either by
643
    The "leadout" track is specified either by
641
    using i_track LEADOUT_TRACK or the total tracks+1.
644
    using i_track LEADOUT_TRACK or the total tracks+1.
642
    VCDINFO_NULL_LSN is returned on failure.
645
    VCDINFO_NULL_LSN is returned on failure.
643
  */
646
  */
644
647
645
  /*!  
648
  /*!
646
    Return the ending LSN for track number
649
    Return the ending LSN for track number
647
    i_track in cdio.  VCDINFO_NULL_LSN is returned on error.
650
    i_track in cdio.  VCDINFO_NULL_LSN is returned on error.
648
  */
651
  */
649
  lsn_t vcdinfo_get_track_last_lsn(const vcdinfo_obj_t *p_vcdinfo, 
652
  lsn_t vcdinfo_get_track_last_lsn(const vcdinfo_obj_t *p_vcdinfo,
650
				   track_t i_track);
653
				   track_t i_track);
651
654
652
  int
655
  int
653
  vcdinfo_get_track_msf(const vcdinfo_obj_t *p_vcdinfo, track_t i_track,
656
  vcdinfo_get_track_msf(const vcdinfo_obj_t *p_vcdinfo, track_t i_track,
654
			uint8_t *min, uint8_t *sec, uint8_t *frame);
657
			uint8_t *min, uint8_t *sec, uint8_t *frame);
655
  
658
656
  /*!
659
  /*!
657
    Return the size in sectors for track n. 
660
    Return the size in sectors for track n.
658
661
659
    The IS0-9660 filesystem track has number 1. Tracks associated
662
    The IS0-9660 filesystem track has number 1. Tracks associated
660
    with playable entries numbers start at 2.
663
    with playable entries numbers start at 2.
661
    
664
662
    FIXME: Whether we count the track pregap sectors is a bit haphazard.
665
    FIXME: Whether we count the track pregap sectors is a bit haphazard.
663
    We should add a parameter to indicate whether this is wanted or not.
666
    We should add a parameter to indicate whether this is wanted or not.
664
  */
667
  */
665
  unsigned int
668
  unsigned int
666
  vcdinfo_get_track_sect_count(const vcdinfo_obj_t *p_vcdinfo, 
669
  vcdinfo_get_track_sect_count(const vcdinfo_obj_t *p_vcdinfo,
667
			       const track_t i_track);
670
			       const track_t i_track);
668
  
671
669
  /*!
672
  /*!
670
    Return size in bytes for track number for entry n in obj.
673
    Return size in bytes for track number for entry n in obj.
671
674
Lines 677-885 Link Here
677
  */
680
  */
678
  unsigned int
681
  unsigned int
679
  vcdinfo_get_track_size(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
682
  vcdinfo_get_track_size(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
680
  
683
681
  /*!
684
  /*!
682
    \brief Get the kind of video stream segment of segment i_seg in obj.
685
    \brief Get the kind of video stream segment of segment i_seg in obj.
683
    \return VCDINFO_FILES_VIDEO_INVALID is returned if on error or 
686
    \return VCDINFO_FILES_VIDEO_INVALID is returned if on error or
684
    p_vcdinfo_obj is null. Otherwise the enumeration type.
687
    p_vcdinfo_obj is null. Otherwise the enumeration type.
685
    
688
686
    Note first i_seg is 0!
689
    Note first i_seg is 0!
687
  */
690
  */
688
  vcdinfo_video_segment_type_t
691
  vcdinfo_video_segment_type_t
689
  vcdinfo_get_video_type(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
692
  vcdinfo_get_video_type(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg);
690
  
693
691
  /*!
694
  /*!
692
    \brief Get the kind of VCD that obj refers to.
695
    \brief Get the kind of VCD that obj refers to.
693
  */
696
  */
694
  vcd_type_t
697
  vcd_type_t
695
  vcdinfo_get_VCD_type(const vcdinfo_obj_t *p_vcdinfo);
698
  vcdinfo_get_VCD_type(const vcdinfo_obj_t *p_vcdinfo);
696
  
699
697
  /*!
700
  /*!
698
    Return the VCD volume count - the number of CD's in the collection.
701
    Return the VCD volume count - the number of CD's in the collection.
699
    O is returned if there is some problem in getting this. 
702
    O is returned if there is some problem in getting this.
700
  */
703
  */
701
  unsigned int
704
  unsigned int
702
  vcdinfo_get_volume_count(const vcdinfo_obj_t *p_vcdinfo);
705
  vcdinfo_get_volume_count(const vcdinfo_obj_t *p_vcdinfo);
703
  
706
704
  /*!
707
  /*!
705
    Return the VCD ID.
708
    Return the VCD ID.
706
    NULL is returned if there is some problem in getting this. 
709
    NULL is returned if there is some problem in getting this.
707
  */
710
  */
708
  const char *
711
  const char *
709
  vcdinfo_get_volume_id(const vcdinfo_obj_t *p_vcdinfo);
712
  vcdinfo_get_volume_id(const vcdinfo_obj_t *p_vcdinfo);
710
  
713
711
  /*!
714
  /*!
712
    Return the VCD volumeset ID.
715
    Return the VCD volumeset ID.
713
    NULL is returned if there is some problem in getting this. 
716
    NULL is returned if there is some problem in getting this.
714
  */
717
  */
715
  const char *
718
  const char *
716
  vcdinfo_get_volumeset_id(const vcdinfo_obj_t *p_vcdinfo);
719
  vcdinfo_get_volumeset_id(const vcdinfo_obj_t *p_vcdinfo);
717
  
720
718
  /*!
721
  /*!
719
    Return the VCD volume num - the number of the CD in the collection.
722
    Return the VCD volume num - the number of the CD in the collection.
720
    This is a number between 1 and the volume count.
723
    This is a number between 1 and the volume count.
721
    O is returned if there is some problem in getting this. 
724
    O is returned if there is some problem in getting this.
722
  */
725
  */
723
  unsigned int
726
  unsigned int
724
  vcdinfo_get_volume_num(const vcdinfo_obj_t *p_vcdinfo);
727
  vcdinfo_get_volume_num(const vcdinfo_obj_t *p_vcdinfo);
725
  
728
726
  int vcdinfo_get_wait_time (uint16_t wtime);
729
  int vcdinfo_get_wait_time (uint16_t wtime);
727
730
728
  /*!
731
  /*!
729
    Return true if there is playback control. 
732
    Return true if there is playback control.
730
  */
733
  */
731
  bool vcdinfo_has_pbc (const vcdinfo_obj_t *p_vcdinfo);
734
  bool vcdinfo_has_pbc (const vcdinfo_obj_t *p_vcdinfo);
732
  
735
733
  /*! 
736
  /*!
734
    Return true if VCD has "extended attributes" (XA). Extended attributes
737
    Return true if VCD has "extended attributes" (XA). Extended attributes
735
    add meta-data attributes to a entries of file describing the file.
738
    add meta-data attributes to a entries of file describing the file.
736
    See also cdio_get_xa_attr_str() which returns a string similar to
739
    See also cdio_get_xa_attr_str() which returns a string similar to
737
    a string you might get on a Unix filesystem listing ("ls").
740
    a string you might get on a Unix filesystem listing ("ls").
738
  */
741
  */
739
  bool vcdinfo_has_xa(const vcdinfo_obj_t *p_vcdinfo);
742
  bool vcdinfo_has_xa(const vcdinfo_obj_t *p_vcdinfo);
740
  
743
741
  /*!
744
  /*!
742
    Add one to the MSF.
745
    Add one to the MSF.
743
  */
746
  */
744
  void vcdinfo_inc_msf (uint8_t *min, uint8_t *sec, int8_t *frame);
747
  void vcdinfo_inc_msf (uint8_t *min, uint8_t *sec, int8_t *frame);
745
  
748
746
  /*!
749
  /*!
747
    Convert minutes, seconds and frame (MSF components) into a
750
    Convert minutes, seconds and frame (MSF components) into a
748
    logical block address (or LBA). 
751
    logical block address (or LBA).
749
    See also msf_to_lba which uses msf_t as its single parameter.
752
    See also msf_to_lba which uses msf_t as its single parameter.
750
  */
753
  */
751
  void 
754
  void
752
  vcdinfo_lba2msf (lba_t lba, uint8_t *min, uint8_t *sec, uint8_t *frame);
755
  vcdinfo_lba2msf (lba_t lba, uint8_t *min, uint8_t *sec, uint8_t *frame);
753
  
756
754
  /*!
757
  /*!
755
    Get the item id for a given list ID. 
758
    Get the item id for a given list ID.
756
    VCDINFO_REJECTED_MASK is returned on error or if obj is NULL. 
759
    VCDINFO_REJECTED_MASK is returned on error or if obj is NULL.
757
  */
760
  */
758
  uint16_t
761
  uint16_t
759
  vcdinfo_lid_get_itemid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
762
  vcdinfo_lid_get_itemid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid);
760
  
763
761
  /*!
764
  /*!
762
    \brief Get offset i_entry for a given LID. 
765
    \brief Get offset i_entry for a given LID.
763
    \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
766
    \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
764
    is NULL. Otherwise the LID offset is returned.
767
    is NULL. Otherwise the LID offset is returned.
765
  */
768
  */
766
  uint16_t vcdinfo_lid_get_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
769
  uint16_t vcdinfo_lid_get_offset(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
767
				  unsigned int i_entry);
770
				  unsigned int i_entry);
768
  
771
769
  /*!
772
  /*!
770
    Get the PSD Selection List Descriptor for a given lid.
773
    Get the PSD Selection List Descriptor for a given lid.
771
    False is returned if not found.
774
    False is returned if not found.
772
  */
775
  */
773
  bool vcdinfo_lid_get_pxd(const vcdinfo_obj_t *p_vcdinfo, 
776
  bool vcdinfo_lid_get_pxd(const vcdinfo_obj_t *p_vcdinfo,
774
			   PsdListDescriptor_t *pxd, lid_t lid);
777
			   PsdListDescriptor_t *pxd, lid_t lid);
775
  
778
776
  /*!  Return the entry number closest and before the given LSN.
779
  /*!  Return the entry number closest and before the given LSN.
777
  */
780
  */
778
  unsigned int 
781
  unsigned int
779
  vcdinfo_lsn_get_entry(const vcdinfo_obj_t *p_vcdinfo, lsn_t lsn);
782
  vcdinfo_lsn_get_entry(const vcdinfo_obj_t *p_vcdinfo, lsn_t lsn);
780
  
783
781
  /*!
784
  /*!
782
    Convert minutes, seconds and frame (MSF components) into a
785
    Convert minutes, seconds and frame (MSF components) into a
783
    logical sector number (or LSN). 
786
    logical sector number (or LSN).
784
  */
787
  */
785
  lsn_t vcdinfo_msf2lsn (uint8_t min, uint8_t sec, int8_t frame);
788
  lsn_t vcdinfo_msf2lsn (uint8_t min, uint8_t sec, int8_t frame);
786
  
789
787
  const char *
790
  const char *
788
  vcdinfo_ofs2str (const vcdinfo_obj_t *p_vcdinfo, unsigned int offset, 
791
  vcdinfo_ofs2str (const vcdinfo_obj_t *p_vcdinfo, unsigned int offset,
789
		   bool ext);
792
		   bool ext);
790
  
793
791
  /*!
794
  /*!
792
    Calls recursive routine to populate obj->offset_list or obj->offset_x_list
795
    Calls recursive routine to populate obj->offset_list or obj->offset_x_list
793
    by going through LOT.
796
    by going through LOT.
794
    
797
795
    Returns false if there was some error.
798
    Returns false if there was some error.
796
  */
799
  */
797
  bool vcdinfo_visit_lot (vcdinfo_obj_t *p_vcdinfo, bool extended);
800
  bool vcdinfo_visit_lot (vcdinfo_obj_t *p_vcdinfo, bool extended);
798
  
801
799
  bool vcdinfo_read_psd (vcdinfo_obj_t *p_vcdinfo);
802
  bool vcdinfo_read_psd (vcdinfo_obj_t *p_vcdinfo);
800
  
803
801
  /*!
804
  /*!
802
    \fn vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
805
    \fn vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
803
                                     unsigned int selection);
806
                                     unsigned int selection);
804
    \brief Get the "default" lid of a selection for a given lid. 
807
    \brief Get the "default" lid of a selection for a given lid.
805
808
806
    Return the LID offset associated with a the selection number of the
809
    Return the LID offset associated with a the selection number of the
807
    passed-in LID parameter. 
810
    passed-in LID parameter.
808
811
809
    \return VCDINFO_INVALID_LID is returned if obj on error or obj
812
    \return VCDINFO_INVALID_LID is returned if obj on error or obj
810
    is NULL. Otherwise the LID offset is returned.
813
    is NULL. Otherwise the LID offset is returned.
811
  */
814
  */
812
  lid_t vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
815
  lid_t vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_vcdinfo, lid_t lid,
813
				  unsigned int selection);
816
				  unsigned int selection);
814
  
817
815
  /*!
818
  /*!
816
    \fn uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_vcdinfo, 
819
    \fn uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_vcdinfo,
817
                                              lid_t lid,
820
                                              lid_t lid,
818
                                              unsigned int selection);
821
                                              unsigned int selection);
819
    \brief Get offset of a selection for a given LID. 
822
    \brief Get offset of a selection for a given LID.
820
823
821
    Return the LID offset associated with a the selection number of the
824
    Return the LID offset associated with a the selection number of the
822
    passed-in LID parameter. 
825
    passed-in LID parameter.
823
826
824
    \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
827
    \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
825
    is NULL. Otherwise the LID offset is returned.
828
    is NULL. Otherwise the LID offset is returned.
826
  */
829
  */
827
  uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_vcdinfo, 
830
  uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_vcdinfo,
828
					lid_t lid, unsigned int selection);
831
					lid_t lid, unsigned int selection);
829
  
832
830
  /*!
833
  /*!
831
    Change trailing blanks in str to nulls.  Str has a maximum size of
834
    Change trailing blanks in str to nulls.  Str has a maximum size of
832
    n characters.
835
    n characters.
833
  */
836
  */
834
  const char * vcdinfo_strip_trail (const char str[], size_t n);
837
  const char * vcdinfo_strip_trail (const char str[], size_t n);
835
  
838
836
  /*!  Return the entry number for the given track.
839
  /*!  Return the entry number for the given track.
837
  */
840
  */
838
  unsigned int 
841
  unsigned int
839
  vcdinfo_track_get_entry(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
842
  vcdinfo_track_get_entry(const vcdinfo_obj_t *p_vcdinfo, track_t i_track);
840
  
843
841
  /*!
844
  /*!
842
    Initialize the vcdinfo structure "obj". Should be done before other
845
    Initialize the vcdinfo structure "obj". Should be done before other
843
    routines using obj are called.
846
    routines using obj are called.
844
  */
847
  */
845
  bool vcdinfo_init(vcdinfo_obj_t *p_vcdinfo);
848
  bool vcdinfo_init(vcdinfo_obj_t *p_vcdinfo);
846
  
849
847
  /*!
850
  /*!
848
    Set up vcdinfo structure "obj" for reading from a particular
851
    Set up vcdinfo structure "obj" for reading from a particular
849
    medium. This should be done before after initialization but before
852
    medium. This should be done before after initialization but before
850
    any routines that need to retrieve data.
853
    any routines that need to retrieve data.
851
    
854
852
    source_name is the device or file to use for inspection, and
855
    source_name is the device or file to use for inspection, and
853
    source_type indicates what driver to use or class of drivers in the
856
    source_type indicates what driver to use or class of drivers in the
854
    case of DRIVER_DEVICE.
857
    case of DRIVER_DEVICE.
855
    access_mode gives the CD access method for reading should the driver
858
    access_mode gives the CD access method for reading should the driver
856
    allow for more than one kind of access method (e.g. MMC versus ioctl
859
    allow for more than one kind of access method (e.g. MMC versus ioctl
857
    on GNU/Linux)
860
    on GNU/Linux)
858
    
861
859
    If source_name is NULL we'll fill in the appropriate default device
862
    If source_name is NULL we'll fill in the appropriate default device
860
    name for the given source_type. However if in addtion source_type is
863
    name for the given source_type. However if in addtion source_type is
861
    DRIVER_UNKNOWN, then we'll scan for a drive containing a VCD.
864
    DRIVER_UNKNOWN, then we'll scan for a drive containing a VCD.
862
    
865
863
    VCDINFO_OPEN_VCD is returned if everything went okay; 
866
    VCDINFO_OPEN_VCD is returned if everything went okay;
864
    VCDINFO_OPEN_ERROR if there was an error and VCDINFO_OPEN_OTHER if the
867
    VCDINFO_OPEN_ERROR if there was an error and VCDINFO_OPEN_OTHER if the
865
    medium is something other than a VCD.
868
    medium is something other than a VCD.
866
869
867
    Only if VCDINFO_OPEN_VCD is returned, the caller needs free the
870
    Only if VCDINFO_OPEN_VCD is returned, the caller needs free the
868
    vcdinfo_obj_t. 
871
    vcdinfo_obj_t.
869
 */
872
 */
870
  vcdinfo_open_return_t
873
  vcdinfo_open_return_t
871
  vcdinfo_open(vcdinfo_obj_t **p_obj, char *source_name[], 
874
  vcdinfo_open(vcdinfo_obj_t **p_obj, char *source_name[],
872
	       driver_id_t source_type, const char access_mode[]);
875
	       driver_id_t source_type, const char access_mode[]);
873
  
876
874
  
877
875
  /*!
878
  /*!
876
    Dispose of any resources associated with the vcdinfo structure.
879
    Dispose of any resources associated with the vcdinfo structure.
877
    Call this when "p_vcdinfo" it isn't needed anymore. 
880
    Call this when "p_vcdinfo" it isn't needed anymore.
878
    
881
879
    True is returned is everything went okay, and false if not.
882
    True is returned is everything went okay, and false if not.
880
  */
883
  */
881
  bool vcdinfo_close(vcdinfo_obj_t *p_vcdinfo);
884
  bool vcdinfo_close(vcdinfo_obj_t *p_vcdinfo);
882
  
885
883
  /*!
886
  /*!
884
    Return true if offset is "rejected". That is shouldn't be displayed
887
    Return true if offset is "rejected". That is shouldn't be displayed
885
    in a list of entries.
888
    in a list of entries.
Lines 895-899 Link Here
895
898
896
/** Deprecated */
899
/** Deprecated */
897
#define vcdinfo_msf2lba cdio_msf3_to_lba
900
#define vcdinfo_msf2lba cdio_msf3_to_lba
898
  
901
899
#endif /*_VCD_INFO_H*/
902
#endif /*_VCD_INFO_H*/
(-)vcdimager-0.7.24.ORIG/include/libvcd/logging.h (-9 / +9 lines)
Lines 18-28 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
/** \file logging.h 
21
/** \file logging.h
22
 *  \brief Header to control logging and level of detail of output.
22
 *  \brief Header to control logging and level of detail of output.
23
 *         
23
 *
24
 */
24
 */
25
25
26
#ifndef __VCD_LOGGING_H__
26
#ifndef __VCD_LOGGING_H__
27
#define __VCD_LOGGING_H__
27
#define __VCD_LOGGING_H__
28
28
Lines 37-43 Link Here
37
 */
37
 */
38
typedef enum {
38
typedef enum {
39
  VCD_LOG_DEBUG = 1, /**< Debug-level messages - helps debug what's up. */
39
  VCD_LOG_DEBUG = 1, /**< Debug-level messages - helps debug what's up. */
40
  VCD_LOG_INFO,      /**< Informational - indicates perhaps something of 
40
  VCD_LOG_INFO,      /**< Informational - indicates perhaps something of
41
                           interest. */
41
                           interest. */
42
  VCD_LOG_WARN,      /**< Warning conditions - something that looks funny. */
42
  VCD_LOG_WARN,      /**< Warning conditions - something that looks funny. */
43
  VCD_LOG_ERROR,     /**< Error conditions - may terminate program.  */
43
  VCD_LOG_ERROR,     /**< Error conditions - may terminate program.  */
Lines 45-51 Link Here
45
} vcd_log_level_t;
45
} vcd_log_level_t;
46
46
47
/**
47
/**
48
 * The place to save the preference concerning how much verbosity 
48
 * The place to save the preference concerning how much verbosity
49
 * is desired. This is used by the internal default log handler, but
49
 * is desired. This is used by the internal default log handler, but
50
 * it could be use by applications which provide their own log handler.
50
 * it could be use by applications which provide their own log handler.
51
 */
51
 */
Lines 62-68 Link Here
62
 * @param level   The log level.
62
 * @param level   The log level.
63
 * @param message The log message.
63
 * @param message The log message.
64
 */
64
 */
65
typedef void (*vcd_log_handler_t) (vcd_log_level_t level, 
65
typedef void (*vcd_log_handler_t) (vcd_log_level_t level,
66
                                   const char message[]);
66
                                   const char message[]);
67
67
68
/**
68
/**
Lines 92-98 Link Here
92
 */
92
 */
93
void
93
void
94
vcd_log (vcd_log_level_t level, const char format[], ...) GNUC_PRINTF(2, 3);
94
vcd_log (vcd_log_level_t level, const char format[], ...) GNUC_PRINTF(2, 3);
95
    
95
96
/**
96
/**
97
 * Handle a debugging message.
97
 * Handle a debugging message.
98
 *
98
 *
Lines 131-138 Link Here
131
131
132
#endif /* __VCD_LOGGING_H__ */
132
#endif /* __VCD_LOGGING_H__ */
133
133
134
134
135
/* 
135
/*
136
 * Local variables:
136
 * Local variables:
137
 *  c-file-style: "gnu"
137
 *  c-file-style: "gnu"
138
 *  tab-width: 8
138
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/include/libvcd/sector.h (-9 / +9 lines)
Lines 17-40 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef _VCD_SECTOR_H_
21
#ifndef _VCD_SECTOR_H_
22
#define _VCD_SECTOR_H_
22
#define _VCD_SECTOR_H_
23
23
24
#include <libvcd/types.h>
24
#include <libvcd/types.h>
25
25
26
/*!
26
/*!
27
   \file sector.h 
27
   \file sector.h
28
  
28
29
\verbatim 
29
\verbatim
30
30
31
  SVCD 1.0
31
  SVCD 1.0
32
  ~~~~~~~~
32
  ~~~~~~~~
33
 
33
34
   empty sector:  fn=0 cn=0 sm=%00100000 ci=0
34
   empty sector:  fn=0 cn=0 sm=%00100000 ci=0
35
   data sector:   fn=0 cn=0 sm=%x0001000 ci=0
35
   data sector:   fn=0 cn=0 sm=%x0001000 ci=0
36
   mpeg sector:   fn=1 cn=1 sm=%x11x001x ci=0x80
36
   mpeg sector:   fn=1 cn=1 sm=%x11x001x ci=0x80
37
  
37
38
  VCD 2.0
38
  VCD 2.0
39
  ~~~~~~~
39
  ~~~~~~~
40
40
Lines 49-55 Link Here
49
    lores still:  fn=1 cn=2  sm=%x11x001x ci=0x1f
49
    lores still:  fn=1 cn=2  sm=%x11x001x ci=0x1f
50
    hires still:  fn=1 cn=3  sm=%x11x001x ci=0x3f
50
    hires still:  fn=1 cn=3  sm=%x11x001x ci=0x3f
51
    audio sector: fn=1 cn=1  sm=%x11x010x ci=0x7f
51
    audio sector: fn=1 cn=1  sm=%x11x010x ci=0x7f
52
  
52
53
   /VCD/ *.VCD
53
   /VCD/ *.VCD
54
    data sector:  fn=0 cn=0  sm=%x000100x ci=0
54
    data sector:  fn=0 cn=0  sm=%x000100x ci=0
55
55
Lines 111-118 Link Here
111
111
112
#endif /* _VCD_SECTOR_H_ */
112
#endif /* _VCD_SECTOR_H_ */
113
113
114
114
115
/* 
115
/*
116
 * Local variables:
116
 * Local variables:
117
 *  c-file-style: "gnu"
117
 *  c-file-style: "gnu"
118
 *  tab-width: 8
118
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/include/libvcd/types.h (-16 / +18 lines)
Lines 17-54 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
/** \file types.h 
20
/** \file types.h
21
 *  \brief  Common type definitions specific to VCDs and used in vcdimager
21
 *  \brief  Common type definitions specific to VCDs and used in vcdimager
22
 */
22
 */
23
23
24
#ifndef __VCD_TYPES_H__
24
#ifndef __VCD_TYPES_H__
25
#define __VCD_TYPES_H__
25
#define __VCD_TYPES_H__
26
26
27
/* We don't want to pull in cdio's config */
28
#define __CDIO_CONFIG_H__
27
#include <cdio/types.h>
29
#include <cdio/types.h>
28
30
29
#ifdef __cplusplus
31
#ifdef __cplusplus
30
extern "C" {
32
extern "C" {
31
#endif /* __cplusplus */
33
#endif /* __cplusplus */
32
  
34
33
  /** Opaque types ... */
35
  /** Opaque types ... */
34
  
36
35
  /** These are defined fully in data_structures.c */
37
  /** These are defined fully in data_structures.c */
36
  typedef struct _VcdList VcdList;
38
  typedef struct _VcdList VcdList;
37
  typedef struct _VcdListNode VcdListNode;
39
  typedef struct _VcdListNode VcdListNode;
38
  
40
39
  /** These are defined fully in files_private.h */
41
  /** These are defined fully in files_private.h */
40
  typedef struct _InfoVcd_tag    InfoVcd_t;
42
  typedef struct _InfoVcd_tag    InfoVcd_t;
41
  typedef struct _EntriesVcd_tag EntriesVcd_t;
43
  typedef struct _EntriesVcd_tag EntriesVcd_t;
42
  typedef struct _LotVcd_tag     LotVcd_t;
44
  typedef struct _LotVcd_tag     LotVcd_t;
43
  
45
44
  typedef struct _PsdPlayListDescriptor_tag      PsdPlayListDescriptor_t;
46
  typedef struct _PsdPlayListDescriptor_tag      PsdPlayListDescriptor_t;
45
  typedef struct _PsdSelectionListDescriptor_tag PsdSelectionListDescriptor_t;
47
  typedef struct _PsdSelectionListDescriptor_tag PsdSelectionListDescriptor_t;
46
48
47
  /** Overall data structure representing a VideoCD object.
49
  /** Overall data structure representing a VideoCD object.
48
      Defined fully in info_private.h. 
50
      Defined fully in info_private.h.
49
   */
51
   */
50
  typedef struct _VcdObj VcdObj_t;
52
  typedef struct _VcdObj VcdObj_t;
51
  
53
52
  /** enum defining supported VideoCD types */
54
  /** enum defining supported VideoCD types */
53
  typedef enum
55
  typedef enum
54
    {
56
    {
Lines 60-72 Link Here
60
      VCD_TYPE_HQVCD
62
      VCD_TYPE_HQVCD
61
    }
63
    }
62
    vcd_type_t;
64
    vcd_type_t;
63
  
65
64
  /** The type of an playback control list ID (LID). */
66
  /** The type of an playback control list ID (LID). */
65
  typedef uint16_t lid_t;
67
  typedef uint16_t lid_t;
66
  
68
67
  /** The type of a segment number 0..1980 segment items possible. */
69
  /** The type of a segment number 0..1980 segment items possible. */
68
  typedef uint16_t segnum_t;
70
  typedef uint16_t segnum_t;
69
  
71
70
  /** (0,0) == upper left; (255,255) == lower right.
72
  /** (0,0) == upper left; (255,255) == lower right.
71
      Setting all to zero disables the area. */
73
      Setting all to zero disables the area. */
72
  PRAGMA_BEGIN_PACKED
74
  PRAGMA_BEGIN_PACKED
Lines 78-97 Link Here
78
    uint8_t y2; /**< lower right */
80
    uint8_t y2; /**< lower right */
79
  } GNUC_PACKED;
81
  } GNUC_PACKED;
80
  PRAGMA_END_PACKED
82
  PRAGMA_END_PACKED
81
  
83
82
#define struct_psd_area_t_SIZEOF 4
84
#define struct_psd_area_t_SIZEOF 4
83
  
85
84
#define PSD_OFS_DISABLED         0xffff
86
#define PSD_OFS_DISABLED         0xffff
85
#define PSD_OFS_MULTI_DEF        0xfffe
87
#define PSD_OFS_MULTI_DEF        0xfffe
86
#define PSD_OFS_MULTI_DEF_NO_NUM 0xfffd
88
#define PSD_OFS_MULTI_DEF_NO_NUM 0xfffd
87
  
89
88
#ifdef __cplusplus
90
#ifdef __cplusplus
89
}
91
}
90
#endif /* __cplusplus */
92
#endif /* __cplusplus */
91
93
92
#endif /* __VCD_TYPES_H__ */
94
#endif /* __VCD_TYPES_H__ */
93
95
94
/* 
96
/*
95
 * Local variables:
97
 * Local variables:
96
 *  c-file-style: "gnu"
98
 *  c-file-style: "gnu"
97
 *  tab-width: 8
99
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/include/libvcd/version.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/* $Id: version.h.in,v 1.4 2005/07/16 20:44:30 rocky Exp $ */
1
/* $Id: version.h.in,v 1.4 2005/07/16 20:44:30 rocky Exp $ */
2
/** \file version.h 
2
/** \file version.h
3
 *  \brief  A file simply containing the library version number.
3
 *  \brief  A file simply containing the library version number.
4
 */
4
 */
5
5
(-)vcdimager-0.7.24.ORIG/lib/bitvec.h (-10 / +10 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_BITVEC_H__
21
#ifndef __VCD_BITVEC_H__
22
#define __VCD_BITVEC_H__
22
#define __VCD_BITVEC_H__
23
23
Lines 41-55 Link Here
41
}
41
}
42
42
43
/*
43
/*
44
 * PEEK 
44
 * PEEK
45
 */
45
 */
46
46
47
#define vcd_bitvec_peek_bits16(bitvec, offset) \
47
#define vcd_bitvec_peek_bits16(bitvec, offset) \
48
 vcd_bitvec_peek_bits ((bitvec), (offset), 16)
48
 vcd_bitvec_peek_bits ((bitvec), (offset), 16)
49
49
50
static inline uint32_t 
50
static inline uint32_t
51
vcd_bitvec_peek_bits (const uint8_t bitvec[],
51
vcd_bitvec_peek_bits (const uint8_t bitvec[],
52
		      const unsigned offset, 
52
		      const unsigned offset,
53
		      const unsigned bits)
53
		      const unsigned bits)
54
{
54
{
55
  uint32_t result = 0;
55
  uint32_t result = 0;
Lines 87-98 Link Here
87
        if (_vcd_bit_set_p (bitvec[i >> 3], 7 - (i % 8)))
87
        if (_vcd_bit_set_p (bitvec[i >> 3], 7 - (i % 8)))
88
          result |= 0x1;
88
          result |= 0x1;
89
      }
89
      }
90
#endif  
90
#endif
91
91
92
  return result;
92
  return result;
93
}
93
}
94
94
95
static inline uint32_t 
95
static inline uint32_t
96
vcd_bitvec_peek_bits32 (const uint8_t bitvec[], unsigned offset)
96
vcd_bitvec_peek_bits32 (const uint8_t bitvec[], unsigned offset)
97
{
97
{
98
  if (offset % 8)
98
  if (offset % 8)
Lines 100-120 Link Here
100
100
101
  offset >>= 3;
101
  offset >>= 3;
102
102
103
  return (bitvec[offset] << 24 
103
  return (bitvec[offset] << 24
104
	  | bitvec[offset + 1] << 16
104
	  | bitvec[offset + 1] << 16
105
	  | bitvec[offset + 2] << 8
105
	  | bitvec[offset + 2] << 8
106
	  | bitvec[offset + 3]);
106
	  | bitvec[offset + 3]);
107
}
107
}
108
108
109
/* 
109
/*
110
 * READ
110
 * READ
111
 */
111
 */
112
112
113
static inline uint32_t 
113
static inline uint32_t
114
vcd_bitvec_read_bits (const uint8_t bitvec[], unsigned *offset, const unsigned bits)
114
vcd_bitvec_read_bits (const uint8_t bitvec[], unsigned *offset, const unsigned bits)
115
{
115
{
116
  const unsigned i = *offset;
116
  const unsigned i = *offset;
117
  
117
118
  *offset += bits;
118
  *offset += bits;
119
119
120
  return vcd_bitvec_peek_bits (bitvec, i, bits);
120
  return vcd_bitvec_peek_bits (bitvec, i, bits);
(-)vcdimager-0.7.24.ORIG/lib/data_structures.c (-20 / +20 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
23
# include "config.h"
23
# include "config.h"
24
#endif
24
#endif
Lines 62-82 Link Here
62
{
62
{
63
  CdioListNode_t **pp_node;
63
  CdioListNode_t **pp_node;
64
  bool changed = false;
64
  bool changed = false;
65
  
65
66
  for (pp_node = &(p_list->begin);
66
  for (pp_node = &(p_list->begin);
67
       (*pp_node) != NULL && (*pp_node)->next != NULL;
67
       (*pp_node) != NULL && (*pp_node)->next != NULL;
68
       pp_node = &((*pp_node)->next))
68
       pp_node = &((*pp_node)->next))
69
    {
69
    {
70
      CdioListNode_t *p_node = *pp_node;
70
      CdioListNode_t *p_node = *pp_node;
71
      
71
72
      if (cmp_func (p_node->data, p_node->next->data) <= 0)
72
      if (cmp_func (p_node->data, p_node->next->data) <= 0)
73
        continue; /* n <= n->next */
73
        continue; /* n <= n->next */
74
      
74
75
      /* exch n n->next */
75
      /* exch n n->next */
76
      *pp_node = p_node->next;
76
      *pp_node = p_node->next;
77
      p_node->next = p_node->next->next;
77
      p_node->next = p_node->next->next;
78
      (*pp_node)->next = p_node;
78
      (*pp_node)->next = p_node;
79
      
79
80
      changed = true;
80
      changed = true;
81
81
82
      if (p_node->next == NULL)
82
      if (p_node->next == NULL)
Lines 92-98 Link Here
92
92
93
  vcd_assert (list != NULL);
93
  vcd_assert (list != NULL);
94
  vcd_assert (cmp_func != 0);
94
  vcd_assert (cmp_func != 0);
95
  
95
96
  while (_bubble_sort_iteration (list, cmp_func));
96
  while (_bubble_sort_iteration (list, cmp_func));
97
}
97
}
98
98
Lines 118-124 Link Here
118
}
118
}
119
119
120
/*
120
/*
121
 * n-way tree based on list -- somewhat inefficent 
121
 * n-way tree based on list -- somewhat inefficent
122
 */
122
 */
123
123
124
struct _VcdTree
124
struct _VcdTree
Lines 150-156 Link Here
150
  new_tree->root->parent = NULL;
150
  new_tree->root->parent = NULL;
151
  new_tree->root->children = NULL;
151
  new_tree->root->children = NULL;
152
  new_tree->root->listnode = NULL;
152
  new_tree->root->listnode = NULL;
153
  
153
154
  return new_tree;
154
  return new_tree;
155
}
155
}
156
156
Lines 158-164 Link Here
158
_vcd_tree_destroy (VcdTree_t *tree, bool free_data)
158
_vcd_tree_destroy (VcdTree_t *tree, bool free_data)
159
{
159
{
160
  _vcd_tree_node_destroy (tree->root, free_data);
160
  _vcd_tree_node_destroy (tree->root, free_data);
161
  
161
162
  free (tree->root);
162
  free (tree->root);
163
  free (tree);
163
  free (tree);
164
}
164
}
Lines 167-173 Link Here
167
_vcd_tree_node_destroy (VcdTreeNode_t *p_node, bool free_data)
167
_vcd_tree_node_destroy (VcdTreeNode_t *p_node, bool free_data)
168
{
168
{
169
  VcdTreeNode_t *p_child, *nxt_child;
169
  VcdTreeNode_t *p_child, *nxt_child;
170
  
170
171
  vcd_assert (p_node != NULL);
171
  vcd_assert (p_node != NULL);
172
172
173
  p_child = _vcd_tree_node_first_child (p_node);
173
  p_child = _vcd_tree_node_first_child (p_node);
Lines 180-186 Link Here
180
  if (p_node->children)
180
  if (p_node->children)
181
    {
181
    {
182
      vcd_assert (_cdio_list_length (p_node->children) == 0);
182
      vcd_assert (_cdio_list_length (p_node->children) == 0);
183
      _cdio_list_free (p_node->children, true);
183
      _cdio_list_free (p_node->children, true, NULL);
184
      p_node->children = NULL;
184
      p_node->children = NULL;
185
    }
185
    }
186
186
Lines 188-194 Link Here
188
    free (_vcd_tree_node_set_data (p_node, NULL));
188
    free (_vcd_tree_node_set_data (p_node, NULL));
189
189
190
  if (p_node->parent)
190
  if (p_node->parent)
191
    _cdio_list_node_free (p_node->listnode, true);
191
    _cdio_list_node_free (p_node->listnode, true, NULL);
192
  else
192
  else
193
    _vcd_tree_node_set_data (p_node, NULL);
193
    _vcd_tree_node_set_data (p_node, NULL);
194
}
194
}
Lines 257-263 Link Here
257
}
257
}
258
258
259
void
259
void
260
_vcd_tree_node_sort_children (VcdTreeNode_t *p_node, 
260
_vcd_tree_node_sort_children (VcdTreeNode_t *p_node,
261
                              _vcd_tree_node_cmp_func cmp_func)
261
                              _vcd_tree_node_cmp_func cmp_func)
262
{
262
{
263
  vcd_assert (p_node != NULL);
263
  vcd_assert (p_node != NULL);
Lines 267-273 Link Here
267
}
267
}
268
268
269
void
269
void
270
_vcd_tree_node_traverse (VcdTreeNode_t *p_node, 
270
_vcd_tree_node_traverse (VcdTreeNode_t *p_node,
271
                         _vcd_tree_node_traversal_func trav_func,
271
                         _vcd_tree_node_traversal_func trav_func,
272
                         void *p_user_data) /* pre-order */
272
                         void *p_user_data) /* pre-order */
273
{
273
{
Lines 284-290 Link Here
284
}
284
}
285
285
286
void
286
void
287
_vcd_tree_node_traverse_bf (VcdTreeNode_t *p_node, 
287
_vcd_tree_node_traverse_bf (VcdTreeNode_t *p_node,
288
                            _vcd_tree_node_traversal_func trav_func,
288
                            _vcd_tree_node_traversal_func trav_func,
289
                            void *p_user_data) /* breath-first */
289
                            void *p_user_data) /* breath-first */
290
{
290
{
Lines 302-318 Link Here
302
      VcdTreeNode_t  *treenode = _cdio_list_node_data (lastnode);
302
      VcdTreeNode_t  *treenode = _cdio_list_node_data (lastnode);
303
      VcdTreeNode_t  *childnode;
303
      VcdTreeNode_t  *childnode;
304
304
305
      _cdio_list_node_free (lastnode, false);
305
      _cdio_list_node_free (lastnode, false, NULL);
306
306
307
      trav_func (treenode, p_user_data);
307
      trav_func (treenode, p_user_data);
308
      
308
309
      _VCD_CHILD_FOREACH (childnode, treenode)
309
      _VCD_CHILD_FOREACH (childnode, treenode)
310
        {
310
        {
311
          _cdio_list_prepend (queue, childnode);
311
          _cdio_list_prepend (queue, childnode);
312
        }
312
        }
313
    }
313
    }
314
314
315
  _cdio_list_free (queue, false);
315
  _cdio_list_free (queue, false, NULL);
316
}
316
}
317
317
318
VcdTreeNode_t *_vcd_tree_node_parent (VcdTreeNode_t *p_node)
318
VcdTreeNode_t *_vcd_tree_node_parent (VcdTreeNode_t *p_node)
Lines 332-339 Link Here
332
332
333
/* eof */
333
/* eof */
334
334
335
335
336
/* 
336
/*
337
 * Local variables:
337
 * Local variables:
338
 *  c-file-style: "gnu"
338
 *  c-file-style: "gnu"
339
 *  tab-width: 8
339
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/data_structures.h (-9 / +9 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_DATA_STRUCTURES_H__
21
#ifndef __VCD_DATA_STRUCTURES_H__
22
#define __VCD_DATA_STRUCTURES_H__
22
#define __VCD_DATA_STRUCTURES_H__
23
23
Lines 38-47 Link Here
38
#define _VCD_CHILD_FOREACH(child, parent) \
38
#define _VCD_CHILD_FOREACH(child, parent) \
39
 for (child = _vcd_tree_node_first_child (parent); child; child = _vcd_tree_node_next_sibling (child))
39
 for (child = _vcd_tree_node_first_child (parent); child; child = _vcd_tree_node_next_sibling (child))
40
40
41
typedef int (*_vcd_tree_node_cmp_func) (VcdTreeNode_t *p_node1, 
41
typedef int (*_vcd_tree_node_cmp_func) (VcdTreeNode_t *p_node1,
42
                                        VcdTreeNode_t *p_node2);
42
                                        VcdTreeNode_t *p_node2);
43
43
44
typedef void (*_vcd_tree_node_traversal_func) (VcdTreeNode_t *p_node, 
44
typedef void (*_vcd_tree_node_traversal_func) (VcdTreeNode_t *p_node,
45
                                               void *p_user_data);
45
                                               void *p_user_data);
46
46
47
VcdTree_t *_vcd_tree_new (void *p_root_data);
47
VcdTree_t *_vcd_tree_new (void *p_root_data);
Lines 59-65 Link Here
59
59
60
void *_vcd_tree_node_set_data (VcdTreeNode_t *p_node, void *p_new_data);
60
void *_vcd_tree_node_set_data (VcdTreeNode_t *p_node, void *p_new_data);
61
61
62
VcdTreeNode_t *_vcd_tree_node_append_child (VcdTreeNode_t *p_node, 
62
VcdTreeNode_t *_vcd_tree_node_append_child (VcdTreeNode_t *p_node,
63
                                            void *p_cdata);
63
                                            void *p_cdata);
64
64
65
VcdTreeNode_t *_vcd_tree_node_first_child (VcdTreeNode_t *p_node);
65
VcdTreeNode_t *_vcd_tree_node_first_child (VcdTreeNode_t *p_node);
Lines 72-89 Link Here
72
72
73
bool _vcd_tree_node_is_root (VcdTreeNode_t *p_node);
73
bool _vcd_tree_node_is_root (VcdTreeNode_t *p_node);
74
74
75
void _vcd_tree_node_traverse (VcdTreeNode_t *p_node, 
75
void _vcd_tree_node_traverse (VcdTreeNode_t *p_node,
76
                              _vcd_tree_node_traversal_func trav_func,
76
                              _vcd_tree_node_traversal_func trav_func,
77
                              void *user_data);
77
                              void *user_data);
78
78
79
void
79
void
80
_vcd_tree_node_traverse_bf (VcdTreeNode_t *p_node, 
80
_vcd_tree_node_traverse_bf (VcdTreeNode_t *p_node,
81
                            _vcd_tree_node_traversal_func trav_func,
81
                            _vcd_tree_node_traversal_func trav_func,
82
                            void *p_user_data);
82
                            void *p_user_data);
83
     
83
84
#endif /* __VCD_DATA_STRUCTURES_H__ */
84
#endif /* __VCD_DATA_STRUCTURES_H__ */
85
85
86
/* 
86
/*
87
 * Local variables:
87
 * Local variables:
88
 *  c-file-style: "gnu"
88
 *  c-file-style: "gnu"
89
 *  tab-width: 8
89
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/dict.h (-11 / +11 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_DICT_H__
21
#ifndef __VCD_DICT_H__
22
#define __VCD_DICT_H__
22
#define __VCD_DICT_H__
23
23
Lines 39-45 Link Here
39
};
39
};
40
40
41
static void
41
static void
42
_dict_insert (VcdObj_t *obj, const char key[], uint32_t sector, uint32_t length, 
42
_dict_insert (VcdObj_t *obj, const char key[], uint32_t sector, uint32_t length,
43
              uint8_t end_flags)
43
              uint8_t end_flags)
44
{
44
{
45
  struct _dict_t *_new_node;
45
  struct _dict_t *_new_node;
Lines 61-68 Link Here
61
  _cdio_list_prepend (obj->buffer_dict_list, _new_node);
61
  _cdio_list_prepend (obj->buffer_dict_list, _new_node);
62
}
62
}
63
63
64
static 
64
static
65
int _dict_key_cmp_t (struct _dict_t *a, char *b)
65
int _dict_key_cmp (struct _dict_t *a, char *b)
66
{
66
{
67
  vcd_assert (a != NULL);
67
  vcd_assert (a != NULL);
68
  vcd_assert (b != NULL);
68
  vcd_assert (b != NULL);
Lines 70-77 Link Here
70
  return !strcmp (a->key, b);
70
  return !strcmp (a->key, b);
71
}
71
}
72
72
73
static 
73
static
74
int _dict_sector_cmp_t (struct _dict_t *a, uint32_t *b)
74
int _dict_sector_cmp (struct _dict_t *a, uint32_t *b)
75
{
75
{
76
  vcd_assert (a != NULL);
76
  vcd_assert (a != NULL);
77
  vcd_assert (b != NULL);
77
  vcd_assert (b != NULL);
Lines 88-96 Link Here
88
  vcd_assert (key != NULL);
88
  vcd_assert (key != NULL);
89
89
90
  node = _cdio_list_find (obj->buffer_dict_list,
90
  node = _cdio_list_find (obj->buffer_dict_list,
91
			  (_cdio_list_iterfunc_t) _dict_key_cmp_t,
91
			  (_cdio_list_iterfunc_t) _dict_key_cmp,
92
			  (char *) key);
92
			  (char *) key);
93
  
93
94
  if (node)
94
  if (node)
95
    return _cdio_list_node_data (node);
95
    return _cdio_list_node_data (node);
96
96
Lines 105-112 Link Here
105
  vcd_assert (obj != NULL);
105
  vcd_assert (obj != NULL);
106
  vcd_assert (sector != SECTOR_NIL);
106
  vcd_assert (sector != SECTOR_NIL);
107
107
108
  node = _cdio_list_find (obj->buffer_dict_list, 
108
  node = _cdio_list_find (obj->buffer_dict_list,
109
			  (_cdio_list_iterfunc_t) _dict_sector_cmp_t, 
109
			  (_cdio_list_iterfunc_t) _dict_sector_cmp,
110
			  &sector);
110
			  &sector);
111
111
112
  if (node)
112
  if (node)
Lines 158-164 Link Here
158
      free (p->key);
158
      free (p->key);
159
      free (p->buf);
159
      free (p->buf);
160
160
161
      _cdio_list_node_free (node, true);
161
      _cdio_list_node_free (node, true, NULL);
162
    }
162
    }
163
}
163
}
164
164
(-)vcdimager-0.7.24.ORIG/lib/directory.c (-52 / +52 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 41-47 Link Here
41
41
42
/* tree data structure */
42
/* tree data structure */
43
43
44
typedef struct 
44
typedef struct
45
{
45
{
46
  bool is_dir;
46
  bool is_dir;
47
  char *name;
47
  char *name;
Lines 64-70 Link Here
64
/* important date to celebrate (for me at least =)
64
/* important date to celebrate (for me at least =)
65
   -- until user customization is implemented... */
65
   -- until user customization is implemented... */
66
static const time_t _vcd_time = 269222400L;
66
static const time_t _vcd_time = 269222400L;
67
                                       
67
68
/* implementation */
68
/* implementation */
69
69
70
static void
70
static void
Lines 96-117 Link Here
96
{
96
{
97
  data_t *d = DATAP(dirnode);
97
  data_t *d = DATAP(dirnode);
98
98
99
  if (d->is_dir) 
99
  if (d->is_dir)
100
    {
100
    {
101
      VcdDirNode_t *child;
101
      VcdDirNode_t *child;
102
      unsigned dirextent = d->extent;
102
      unsigned dirextent = d->extent;
103
      
103
104
      vcd_assert (d->size % ISO_BLOCKSIZE == 0);
104
      vcd_assert (d->size % ISO_BLOCKSIZE == 0);
105
      
105
106
      dirextent += d->size / ISO_BLOCKSIZE;
106
      dirextent += d->size / ISO_BLOCKSIZE;
107
      
107
108
      _VCD_CHILD_FOREACH (child, dirnode)
108
      _VCD_CHILD_FOREACH (child, dirnode)
109
        {
109
        {
110
          data_t *d = DATAP(child);
110
          data_t *d = DATAP(child);
111
          
111
112
          vcd_assert (d != NULL);
112
          vcd_assert (d != NULL);
113
          
113
114
          if (d->is_dir) 
114
          if (d->is_dir)
115
            {
115
            {
116
              d->extent = dirextent;
116
              d->extent = dirextent;
117
              dirextent += get_dirsizes (child);
117
              dirextent += get_dirsizes (child);
Lines 120-130 Link Here
120
    }
120
    }
121
}
121
}
122
122
123
static void 
123
static void
124
update_dirextents (VcdDirectory_t *dir, uint32_t extent)
124
update_dirextents (VcdDirectory_t *dir, uint32_t extent)
125
{
125
{
126
  data_t *dirdata = DATAP(_vcd_tree_root (dir));
126
  data_t *dirdata = DATAP(_vcd_tree_root (dir));
127
  
127
128
  dirdata->extent = extent;
128
  dirdata->extent = extent;
129
  _vcd_tree_node_traverse (_vcd_tree_root (dir),
129
  _vcd_tree_node_traverse (_vcd_tree_root (dir),
130
                           traverse_update_dirextents, NULL);
130
                           traverse_update_dirextents, NULL);
Lines 139-163 Link Here
139
    {
139
    {
140
      VcdDirNode_t *child;
140
      VcdDirNode_t *child;
141
      unsigned offset = 0;
141
      unsigned offset = 0;
142
      
142
143
      offset += iso9660_dir_calc_record_size (1, sizeof(iso9660_xa_t)); /* '.' */
143
      offset += iso9660_dir_calc_record_size (1, sizeof(iso9660_xa_t)); /* '.' */
144
      offset += iso9660_dir_calc_record_size (1, sizeof(iso9660_xa_t)); /* '..' */
144
      offset += iso9660_dir_calc_record_size (1, sizeof(iso9660_xa_t)); /* '..' */
145
      
145
146
      _VCD_CHILD_FOREACH (child, node)
146
      _VCD_CHILD_FOREACH (child, node)
147
        {
147
        {
148
          data_t *d = DATAP(child);
148
          data_t *d = DATAP(child);
149
          unsigned reclen;
149
          unsigned reclen;
150
          char *pathname = (d->is_dir 
150
          char *pathname = (d->is_dir
151
                            ? strdup (d->name)
151
                            ? strdup (d->name)
152
                            : iso9660_pathname_isofy (d->name, d->version));
152
                            : iso9660_pathname_isofy (d->name, d->version));
153
          
153
154
          vcd_assert (d != NULL);
154
          vcd_assert (d != NULL);
155
          
155
156
          reclen = iso9660_dir_calc_record_size (strlen (pathname), 
156
          reclen = iso9660_dir_calc_record_size (strlen (pathname),
157
                                                 sizeof (iso9660_xa_t));
157
                                                 sizeof (iso9660_xa_t));
158
158
159
          free (pathname);
159
          free (pathname);
160
          
160
161
          offset = _vcd_ofs_add (offset, reclen, ISO_BLOCKSIZE);
161
          offset = _vcd_ofs_add (offset, reclen, ISO_BLOCKSIZE);
162
        }
162
        }
163
163
Lines 167-173 Link Here
167
    }
167
    }
168
}
168
}
169
169
170
static void 
170
static void
171
update_sizes (VcdDirectory_t *dir)
171
update_sizes (VcdDirectory_t *dir)
172
{
172
{
173
  _vcd_tree_node_traverse (_vcd_tree_root(dir), traverse_update_sizes, NULL);
173
  _vcd_tree_node_traverse (_vcd_tree_root(dir), traverse_update_sizes, NULL);
Lines 214-220 Link Here
214
  _vcd_tree_destroy (dir, true);
214
  _vcd_tree_destroy (dir, true);
215
}
215
}
216
216
217
static VcdDirNode_t * 
217
static VcdDirNode_t *
218
lookup_child (VcdDirNode_t *node, const char name[])
218
lookup_child (VcdDirNode_t *node, const char name[])
219
{
219
{
220
  VcdDirNode_t *child;
220
  VcdDirNode_t *child;
Lines 222-232 Link Here
222
  _VCD_CHILD_FOREACH (child, node)
222
  _VCD_CHILD_FOREACH (child, node)
223
    {
223
    {
224
      data_t *d = DATAP(child);
224
      data_t *d = DATAP(child);
225
      
225
226
      if (!strcmp (d->name, name))
226
      if (!strcmp (d->name, name))
227
        return child;
227
        return child;
228
    }
228
    }
229
  
229
230
  return child; /* NULL */
230
  return child; /* NULL */
231
}
231
}
232
232
Lines 256-270 Link Here
256
256
257
  level = _vcd_strlenv (splitpath);
257
  level = _vcd_strlenv (splitpath);
258
258
259
  for (n = 0; n < level-1; n++) 
259
  for (n = 0; n < level-1; n++)
260
    if (!(pdir = lookup_child(pdir, splitpath[n]))) 
260
    if (!(pdir = lookup_child(pdir, splitpath[n])))
261
      {
261
      {
262
        vcd_error("mkdir: parent dir `%s' (level=%d) for `%s' missing!",
262
        vcd_error("mkdir: parent dir `%s' (level=%d) for `%s' missing!",
263
                  splitpath[n], n, pathname);
263
                  splitpath[n], n, pathname);
264
        vcd_assert_not_reached ();
264
        vcd_assert_not_reached ();
265
      }
265
      }
266
266
267
  if (lookup_child (pdir, splitpath[level-1])) 
267
  if (lookup_child (pdir, splitpath[level-1]))
268
    {
268
    {
269
      vcd_error ("mkdir: `%s' already exists", pathname);
269
      vcd_error ("mkdir: `%s' already exists", pathname);
270
      vcd_assert_not_reached ();
270
      vcd_assert_not_reached ();
Lines 283-296 Link Here
283
  }
283
  }
284
284
285
  _vcd_tree_node_sort_children (pdir, _iso_dir_cmp);
285
  _vcd_tree_node_sort_children (pdir, _iso_dir_cmp);
286
  
286
287
  _vcd_strfreev (splitpath);
287
  _vcd_strfreev (splitpath);
288
288
289
  return 0;
289
  return 0;
290
}
290
}
291
291
292
int
292
int
293
_vcd_directory_mkfile (VcdDirectory_t *dir, const char pathname[], 
293
_vcd_directory_mkfile (VcdDirectory_t *dir, const char pathname[],
294
                       uint32_t start, uint32_t size,
294
                       uint32_t start, uint32_t size,
295
                       bool form2_flag, uint8_t filenum)
295
                       bool form2_flag, uint8_t filenum)
296
{
296
{
Lines 310-328 Link Here
310
  while (!pdir)
310
  while (!pdir)
311
    {
311
    {
312
      pdir = _vcd_tree_root (dir);
312
      pdir = _vcd_tree_root (dir);
313
      
313
314
      for (n = 0; n < level-1; n++) 
314
      for (n = 0; n < level-1; n++)
315
        if (!(pdir = lookup_child (pdir, splitpath[n]))) 
315
        if (!(pdir = lookup_child (pdir, splitpath[n])))
316
          {
316
          {
317
            char *newdir = _vcd_strjoin (splitpath, n+1, "/");
317
            char *newdir = _vcd_strjoin (splitpath, n+1, "/");
318
318
319
            vcd_info ("autocreating directory `%s' for file `%s'",
319
            vcd_info ("autocreating directory `%s' for file `%s'",
320
                      newdir, pathname);
320
                      newdir, pathname);
321
            
321
322
            _vcd_directory_mkdir (dir, newdir);
322
            _vcd_directory_mkdir (dir, newdir);
323
            
323
324
            free (newdir);
324
            free (newdir);
325
        
325
326
            vcd_assert (pdir == NULL);
326
            vcd_assert (pdir == NULL);
327
327
328
            break;
328
            break;
Lines 340-351 Link Here
340
340
341
    }
341
    }
342
342
343
  if (lookup_child (pdir, splitpath[level-1])) 
343
  if (lookup_child (pdir, splitpath[level-1]))
344
    {
344
    {
345
      vcd_error ("mkfile: `%s' already exists", pathname);
345
      vcd_error ("mkfile: `%s' already exists", pathname);
346
      return -1;
346
      return -1;
347
    }
347
    }
348
  
348
349
  {
349
  {
350
    data_t *data = calloc(1, sizeof (data_t));
350
    data_t *data = calloc(1, sizeof (data_t));
351
351
Lines 385-396 Link Here
385
385
386
  uint32_t root_extent = EXTENT(_vcd_tree_node_root (node));
386
  uint32_t root_extent = EXTENT(_vcd_tree_node_root (node));
387
387
388
  uint32_t parent_extent = 
388
  uint32_t parent_extent =
389
    (!_vcd_tree_node_is_root (node))
389
    (!_vcd_tree_node_is_root (node))
390
    ? EXTENT(_vcd_tree_node_parent (node))
390
    ? EXTENT(_vcd_tree_node_parent (node))
391
    : EXTENT(node);
391
    : EXTENT(node);
392
392
393
  uint32_t parent_size = 
393
  uint32_t parent_size =
394
    (!_vcd_tree_node_is_root (node))
394
    (!_vcd_tree_node_is_root (node))
395
    ? SIZE(_vcd_tree_node_parent (node))
395
    ? SIZE(_vcd_tree_node_parent (node))
396
    : SIZE(node);
396
    : SIZE(node);
Lines 401-411 Link Here
401
401
402
  if (!_vcd_tree_node_is_root (node))
402
  if (!_vcd_tree_node_is_root (node))
403
    {
403
    {
404
      char *pathname = (d->is_dir 
404
      char *pathname = (d->is_dir
405
                        ? strdup (d->name)
405
                        ? strdup (d->name)
406
                        : iso9660_pathname_isofy (d->name, d->version));
406
                        : iso9660_pathname_isofy (d->name, d->version));
407
407
408
      iso9660_dir_add_entry_su (dirbufp, pathname, d->extent, d->size, 
408
      iso9660_dir_add_entry_su (dirbufp, pathname, d->extent, d->size,
409
                                d->is_dir ? ISO_DIRECTORY : ISO_FILE,
409
                                d->is_dir ? ISO_DIRECTORY : ISO_FILE,
410
                                &xa_su, sizeof (xa_su),
410
                                &xa_su, sizeof (xa_su),
411
                                &_vcd_time);
411
                                &_vcd_time);
Lines 414-426 Link Here
414
    }
414
    }
415
415
416
  /* if this is a directory, create the new directory node */
416
  /* if this is a directory, create the new directory node */
417
  if (d->is_dir) 
417
  if (d->is_dir)
418
    {
418
    {
419
      dirbufp = (char*)data + ISO_BLOCKSIZE * (d->extent - root_extent);
419
      dirbufp = (char*)data + ISO_BLOCKSIZE * (d->extent - root_extent);
420
420
421
      iso9660_dir_init_new_su (dirbufp, 
421
      iso9660_dir_init_new_su (dirbufp,
422
                               d->extent, d->size, &xa_su, sizeof (xa_su),
422
                               d->extent, d->size, &xa_su, sizeof (xa_su),
423
                               parent_extent, parent_size, &xa_su, 
423
                               parent_extent, parent_size, &xa_su,
424
                               sizeof (xa_su), &_vcd_time);
424
                               sizeof (xa_su), &_vcd_time);
425
    }
425
    }
426
}
426
}
Lines 433-443 Link Here
433
  update_sizes (dir); /* better call it one time more than one less */
433
  update_sizes (dir); /* better call it one time more than one less */
434
  update_dirextents (dir, extent);
434
  update_dirextents (dir, extent);
435
435
436
  _vcd_tree_node_traverse (_vcd_tree_root (dir), 
436
  _vcd_tree_node_traverse (_vcd_tree_root (dir),
437
                           traverse_vcd_directory_dump_entries, buf); 
437
                           traverse_vcd_directory_dump_entries, buf);
438
}
438
}
439
439
440
typedef struct 
440
typedef struct
441
{
441
{
442
  void *ptl;
442
  void *ptl;
443
  void *ptm;
443
  void *ptm;
Lines 454-463 Link Here
454
454
455
  vcd_assert (d->is_dir);
455
  vcd_assert (d->is_dir);
456
456
457
  id_l = iso9660_pathtable_l_add_entry (args->ptl, d->name, d->extent, 
457
  id_l = iso9660_pathtable_l_add_entry (args->ptl, d->name, d->extent,
458
                                        parent_id);
458
                                        parent_id);
459
  
459
460
  id_m = iso9660_pathtable_m_add_entry (args->ptm, d->name, d->extent, 
460
  id_m = iso9660_pathtable_m_add_entry (args->ptm, d->name, d->extent,
461
                                        parent_id);
461
                                        parent_id);
462
462
463
  vcd_assert (id_l == id_m);
463
  vcd_assert (id_l == id_m);
Lines 493-503 Link Here
493
  args.ptm = ptm;
493
  args.ptm = ptm;
494
494
495
  _vcd_tree_node_traverse_bf (_vcd_tree_root (dir),
495
  _vcd_tree_node_traverse_bf (_vcd_tree_root (dir),
496
                              traverse_vcd_directory_dump_pathtables, &args); 
496
                              traverse_vcd_directory_dump_pathtables, &args);
497
}
497
}
498
498
499
499
500
/* 
500
/*
501
 * Local variables:
501
 * Local variables:
502
 *  c-file-style: "gnu"
502
 *  c-file-style: "gnu"
503
 *  tab-width: 8
503
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/directory.h (-6 / +6 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef _DIRECTORY_H_
21
#ifndef _DIRECTORY_H_
22
#define _DIRECTORY_H_
22
#define _DIRECTORY_H_
23
23
Lines 39-53 Link Here
39
_vcd_directory_mkdir (VcdDirectory_t *p_dir, const char pathname[]);
39
_vcd_directory_mkdir (VcdDirectory_t *p_dir, const char pathname[]);
40
40
41
int
41
int
42
_vcd_directory_mkfile (VcdDirectory_t *dir, const char pathname[], 
42
_vcd_directory_mkfile (VcdDirectory_t *dir, const char pathname[],
43
                       uint32_t start, uint32_t size,
43
                       uint32_t start, uint32_t size,
44
                       bool form2_flag, uint8_t filenum);
44
                       bool form2_flag, uint8_t filenum);
45
45
46
uint32_t
46
uint32_t
47
_vcd_directory_get_size (VcdDirectory_t *p_dir);
47
_vcd_directory_get_size (VcdDirectory_t *p_dir);
48
48
49
void 
49
void
50
_vcd_directory_dump_entries (VcdDirectory_t *p_dir, void *p_buf, 
50
_vcd_directory_dump_entries (VcdDirectory_t *p_dir, void *p_buf,
51
                             uint32_t extent);
51
                             uint32_t extent);
52
52
53
void
53
void
Lines 55-62 Link Here
55
55
56
#endif /* _DIRECTORY_H_ */
56
#endif /* _DIRECTORY_H_ */
57
57
58
58
59
/* 
59
/*
60
 * Local variables:
60
 * Local variables:
61
 *  c-file-style: "gnu"
61
 *  c-file-style: "gnu"
62
 *  tab-width: 8
62
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/files.c (-82 / +84 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 27-32 Link Here
27
#include <stddef.h>
27
#include <stddef.h>
28
#include <math.h>
28
#include <math.h>
29
29
30
/* We don't want to pull in cdio's config */
31
#define __CDIO_CONFIG_H__
30
#include <cdio/cdio.h>
32
#include <cdio/cdio.h>
31
#include <cdio/bytesex.h>
33
#include <cdio/bytesex.h>
32
#include <cdio/util.h>
34
#include <cdio/util.h>
Lines 78-84 Link Here
78
static int
80
static int
79
_derive_ogt_type (const struct vcd_mpeg_stream_info *p_info, bool svcd)
81
_derive_ogt_type (const struct vcd_mpeg_stream_info *p_info, bool svcd)
80
{
82
{
81
  
83
82
  if (!svcd)
84
  if (!svcd)
83
    return 0;
85
    return 0;
84
86
Lines 93-99 Link Here
93
    return 0x1;
95
    return 0x1;
94
96
95
  vcd_debug ("OGT streams available: %d %d %d %d",
97
  vcd_debug ("OGT streams available: %d %d %d %d",
96
             p_info->ogt[0], p_info->ogt[1], 
98
             p_info->ogt[0], p_info->ogt[1],
97
             p_info->ogt[2], p_info->ogt[3]);
99
             p_info->ogt[2], p_info->ogt[3]);
98
100
99
  return 0x0;
101
  return 0x0;
Lines 112-118 Link Here
112
114
113
      if (p_info->ahdr[1].seen)
115
      if (p_info->ahdr[1].seen)
114
        return 2; /* 2 streams */
116
        return 2; /* 2 streams */
115
      
117
116
      return 1; /* just one stream */
118
      return 1; /* just one stream */
117
    }
119
    }
118
  else
120
  else
Lines 188-194 Link Here
188
      entries_vcd.version = ENTRIES_VERSION_HQVCD;
190
      entries_vcd.version = ENTRIES_VERSION_HQVCD;
189
      entries_vcd.sys_prof_tag = ENTRIES_SPTAG_HQVCD;
191
      entries_vcd.sys_prof_tag = ENTRIES_SPTAG_HQVCD;
190
      break;
192
      break;
191
      
193
192
    default:
194
    default:
193
      vcd_assert_not_reached ();
195
      vcd_assert_not_reached ();
194
      break;
196
      break;
Lines 205-211 Link Here
205
      lsect += obj->iso_size;
207
      lsect += obj->iso_size;
206
208
207
      entries_vcd.entry[idx].n = cdio_to_bcd8(track_idx);
209
      entries_vcd.entry[idx].n = cdio_to_bcd8(track_idx);
208
      cdio_lba_to_msf(cdio_lsn_to_lba(lsect), 
210
      cdio_lba_to_msf(cdio_lsn_to_lba(lsect),
209
                      &(entries_vcd.entry[idx].msf));
211
                      &(entries_vcd.entry[idx].msf));
210
212
211
      idx++;
213
      idx++;
Lines 242-248 Link Here
242
  bitset[_byte] |= (1 << _bit);
244
  bitset[_byte] |= (1 << _bit);
243
}
245
}
244
246
245
uint32_t 
247
uint32_t
246
get_psd_size (VcdObj_t *obj, bool extended)
248
get_psd_size (VcdObj_t *obj, bool extended)
247
{
249
{
248
  if (extended)
250
  if (extended)
Lines 250-256 Link Here
250
252
251
  if (!_vcd_pbc_available (obj))
253
  if (!_vcd_pbc_available (obj))
252
    return 0;
254
    return 0;
253
  
255
254
  if (extended)
256
  if (extended)
255
    return obj->psdx_size;
257
    return obj->psdx_size;
256
258
Lines 272-278 Link Here
272
      pbc_t *p_pbc = _cdio_list_node_data (node);
274
      pbc_t *p_pbc = _cdio_list_node_data (node);
273
      char *_buf = buf;
275
      char *_buf = buf;
274
      unsigned offset = (b_extended ? p_pbc->offset_ext : p_pbc->offset);
276
      unsigned offset = (b_extended ? p_pbc->offset_ext : p_pbc->offset);
275
      
277
276
      vcd_assert (offset % INFO_OFFSET_MULT == 0);
278
      vcd_assert (offset % INFO_OFFSET_MULT == 0);
277
279
278
      _vcd_pbc_node_write (p_obj, p_pbc, _buf + offset, b_extended);
280
      _vcd_pbc_node_write (p_obj, p_pbc, _buf + offset, b_extended);
Lines 299-305 Link Here
299
    {
301
    {
300
      pbc_t *p_pbc = _cdio_list_node_data (p_node);
302
      pbc_t *p_pbc = _cdio_list_node_data (p_node);
301
      unsigned int offset = b_extended ? p_pbc->offset_ext : p_pbc->offset;
303
      unsigned int offset = b_extended ? p_pbc->offset_ext : p_pbc->offset;
302
      
304
303
      vcd_assert (offset % INFO_OFFSET_MULT == 0);
305
      vcd_assert (offset % INFO_OFFSET_MULT == 0);
304
306
305
      if (p_pbc->rejected)
307
      if (p_pbc->rejected)
Lines 323-329 Link Here
323
325
324
  vcd_assert (sizeof (InfoVcd_t) == 2048);
326
  vcd_assert (sizeof (InfoVcd_t) == 2048);
325
  vcd_assert (_cdio_list_length (p_obj->mpeg_track_list) <= 98);
327
  vcd_assert (_cdio_list_length (p_obj->mpeg_track_list) <= 98);
326
  
328
327
  memset (&info_vcd, 0, sizeof (info_vcd));
329
  memset (&info_vcd, 0, sizeof (info_vcd));
328
330
329
  switch (p_obj->type)
331
  switch (p_obj->type)
Lines 357-371 Link Here
357
      info_vcd.version = INFO_VERSION_HQVCD;
359
      info_vcd.version = INFO_VERSION_HQVCD;
358
      info_vcd.sys_prof_tag = INFO_SPTAG_HQVCD;
360
      info_vcd.sys_prof_tag = INFO_SPTAG_HQVCD;
359
      break;
361
      break;
360
      
362
361
    default:
363
    default:
362
      vcd_assert_not_reached ();
364
      vcd_assert_not_reached ();
363
      break;
365
      break;
364
    }
366
    }
365
  
367
366
  iso9660_strncpy_pad (info_vcd.album_desc, 
368
  iso9660_strncpy_pad (info_vcd.album_desc,
367
                       p_obj->info_album_id,
369
                       p_obj->info_album_id,
368
                       sizeof(info_vcd.album_desc), ISO9660_DCHARS); 
370
                       sizeof(info_vcd.album_desc), ISO9660_DCHARS);
369
  /* fixme, maybe it's VCD_ACHARS? */
371
  /* fixme, maybe it's VCD_ACHARS? */
370
372
371
  info_vcd.vol_count = uint16_to_be (p_obj->info_volume_count);
373
  info_vcd.vol_count = uint16_to_be (p_obj->info_volume_count);
Lines 379-386 Link Here
379
      _CDIO_LIST_FOREACH (p_node, p_obj->mpeg_track_list)
381
      _CDIO_LIST_FOREACH (p_node, p_obj->mpeg_track_list)
380
        {
382
        {
381
          mpeg_track_t *track = _cdio_list_node_data (p_node);
383
          mpeg_track_t *track = _cdio_list_node_data (p_node);
382
          
384
383
          const struct vcd_mpeg_stream_vid_info *p_info = 
385
          const struct vcd_mpeg_stream_vid_info *p_info =
384
            &track->info->shdr[0];
386
            &track->info->shdr[0];
385
387
386
          if (vcd_mpeg_get_norm (p_info) == MPEG_NORM_PAL
388
          if (vcd_mpeg_get_norm (p_info) == MPEG_NORM_PAL
Lines 392-398 Link Here
392
                        "for track #%d -- are we creating a X(S)VCD?", n);
394
                        "for track #%d -- are we creating a X(S)VCD?", n);
393
              _set_bit(info_vcd.pal_flags, n);
395
              _set_bit(info_vcd.pal_flags, n);
394
            }
396
            }
395
        
397
396
          n++;
398
          n++;
397
        }
399
        }
398
    }
400
    }
Lines 406-420 Link Here
406
      if (_vcd_obj_has_cap_p (p_obj, _CAP_PBC_X)
408
      if (_vcd_obj_has_cap_p (p_obj, _CAP_PBC_X)
407
          &&_vcd_pbc_available (p_obj))
409
          &&_vcd_pbc_available (p_obj))
408
        info_vcd.flags.pbc_x = true;
410
        info_vcd.flags.pbc_x = true;
409
      
411
410
      info_vcd.psd_size = uint32_to_be (get_psd_size (p_obj, false));
412
      info_vcd.psd_size = uint32_to_be (get_psd_size (p_obj, false));
411
      info_vcd.offset_mult = _vcd_pbc_available (p_obj) ? INFO_OFFSET_MULT : 0;
413
      info_vcd.offset_mult = _vcd_pbc_available (p_obj) ? INFO_OFFSET_MULT : 0;
412
      info_vcd.lot_entries = uint16_to_be (_vcd_pbc_max_lid (p_obj));
414
      info_vcd.lot_entries = uint16_to_be (_vcd_pbc_max_lid (p_obj));
413
      
415
414
      if (_cdio_list_length (p_obj->mpeg_segment_list))
416
      if (_cdio_list_length (p_obj->mpeg_segment_list))
415
        {
417
        {
416
          unsigned segments = 0;
418
          unsigned segments = 0;
417
        
419
418
          if (!_vcd_pbc_available (p_obj))
420
          if (!_vcd_pbc_available (p_obj))
419
            vcd_warn ("segment items available, but no PBC items set!"
421
            vcd_warn ("segment items available, but no PBC items set!"
420
                      " SPIs will be unreachable");
422
                      " SPIs will be unreachable");
Lines 425-435 Link Here
425
              unsigned int idx;
427
              unsigned int idx;
426
              InfoSpiContents_t contents = { 0, };
428
              InfoSpiContents_t contents = { 0, };
427
429
428
              contents.video_type = 
430
              contents.video_type =
429
                _derive_vid_type (p_segment->info,
431
                _derive_vid_type (p_segment->info,
430
                                  _vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD));
432
                                  _vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD));
431
433
432
              contents.audio_type = 
434
              contents.audio_type =
433
                _derive_aud_type (p_segment->info,
435
                _derive_aud_type (p_segment->info,
434
                                  _vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD));
436
                                  _vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD));
435
437
Lines 446-452 Link Here
446
                  vcd_assert (segments + idx < MAX_SEGMENTS);
448
                  vcd_assert (segments + idx < MAX_SEGMENTS);
447
449
448
                  info_vcd.spi_contents[segments + idx] = contents;
450
                  info_vcd.spi_contents[segments + idx] = contents;
449
                
451
450
                  if (!contents.item_cont)
452
                  if (!contents.item_cont)
451
                    contents.item_cont = true;
453
                    contents.item_cont = true;
452
                }
454
                }
Lines 454-462 Link Here
454
              segments += idx;
456
              segments += idx;
455
            }
457
            }
456
458
457
          info_vcd.item_count = uint16_to_be (segments); 
459
          info_vcd.item_count = uint16_to_be (segments);
458
460
459
          cdio_lba_to_msf (cdio_lsn_to_lba(p_obj->mpeg_segment_start_extent), 
461
          cdio_lba_to_msf (cdio_lsn_to_lba(p_obj->mpeg_segment_start_extent),
460
                           &info_vcd.first_seg_addr);
462
                           &info_vcd.first_seg_addr);
461
        }
463
        }
462
    }
464
    }
Lines 473-479 Link Here
473
  double playtime;
475
  double playtime;
474
  int n;
476
  int n;
475
477
476
  memcpy (tracks_svd->file_id, TRACKS_SVD_FILE_ID, 
478
  memcpy (tracks_svd->file_id, TRACKS_SVD_FILE_ID,
477
          sizeof (TRACKS_SVD_FILE_ID)-1);
479
          sizeof (TRACKS_SVD_FILE_ID)-1);
478
  tracks_svd->version = TRACKS_SVD_VERSION;
480
  tracks_svd->version = TRACKS_SVD_VERSION;
479
  tracks_svd->tracks = _cdio_list_length (p_vcdobj->mpeg_track_list);
481
  tracks_svd->tracks = _cdio_list_length (p_vcdobj->mpeg_track_list);
Lines 487-495 Link Here
487
489
488
      playtime += track->info->playing_time;
490
      playtime += track->info->playing_time;
489
491
490
      tracks_svd->track[n].audio_info = track->info->ahdr[0].seen 
492
      tracks_svd->track[n].audio_info = track->info->ahdr[0].seen
491
        ? 0x2 : 0x0; /* fixme */
493
        ? 0x2 : 0x0; /* fixme */
492
      tracks_svd->track[n].audio_info |= track->info->ahdr[1].seen 
494
      tracks_svd->track[n].audio_info |= track->info->ahdr[1].seen
493
        ? 0x20 : 0x0; /* fixme */
495
        ? 0x20 : 0x0; /* fixme */
494
496
495
      tracks_svd->track[n].ogt_info = 0x0;
497
      tracks_svd->track[n].ogt_info = 0x0;
Lines 498-504 Link Here
498
          tracks_svd->track[n].ogt_info |= 1 << (i * 2); /* fixme */
500
          tracks_svd->track[n].ogt_info |= 1 << (i * 2); /* fixme */
499
501
500
      /* setting playtime */
502
      /* setting playtime */
501
      
503
502
      {
504
      {
503
        double i, f;
505
        double i, f;
504
506
Lines 506-520 Link Here
506
          playtime -= 6000.0;
508
          playtime -= 6000.0;
507
509
508
        f = modf(playtime, &i);
510
        f = modf(playtime, &i);
509
        
511
510
        cdio_lba_to_msf (i * 75, &tracks_svd->track[n].cum_playing_time);
512
        cdio_lba_to_msf (i * 75, &tracks_svd->track[n].cum_playing_time);
511
        tracks_svd->track[n].cum_playing_time.f = 
513
        tracks_svd->track[n].cum_playing_time.f =
512
          cdio_to_bcd8 (floor (f * 75.0));
514
          cdio_to_bcd8 (floor (f * 75.0));
513
      }
515
      }
514
      
516
515
      n++;
517
      n++;
516
    }  
518
    }
517
  
519
518
  memcpy (buf, &tracks_svd_buf, sizeof(tracks_svd_buf));
520
  memcpy (buf, &tracks_svd_buf, sizeof(tracks_svd_buf));
519
}
521
}
520
522
Lines 537-543 Link Here
537
539
538
  vcd_assert (sizeof (SVDTrackContent_t) == 1);
540
  vcd_assert (sizeof (SVDTrackContent_t) == 1);
539
541
540
  memcpy (tracks_svd1->file_id, TRACKS_SVD_FILE_ID, 
542
  memcpy (tracks_svd1->file_id, TRACKS_SVD_FILE_ID,
541
          sizeof (TRACKS_SVD_FILE_ID)-1);
543
          sizeof (TRACKS_SVD_FILE_ID)-1);
542
  tracks_svd1->version = TRACKS_SVD_VERSION;
544
  tracks_svd1->version = TRACKS_SVD_VERSION;
543
545
Lines 553-573 Link Here
553
      const double playtime = track->info->playing_time;
555
      const double playtime = track->info->playing_time;
554
556
555
      int _video;
557
      int _video;
556
     
558
557
      _video = tracks_svd2->contents[n].video =
559
      _video = tracks_svd2->contents[n].video =
558
        _derive_vid_type (track->info, true);
560
        _derive_vid_type (track->info, true);
559
561
560
      tracks_svd2->contents[n].audio =
562
      tracks_svd2->contents[n].audio =
561
        _derive_aud_type (track->info, true);
563
        _derive_aud_type (track->info, true);
562
564
563
      tracks_svd2->contents[n].ogt = 
565
      tracks_svd2->contents[n].ogt =
564
        _derive_ogt_type (track->info, true);
566
        _derive_ogt_type (track->info, true);
565
567
566
      if (_video != 0x3 && _video != 0x7)
568
      if (_video != 0x3 && _video != 0x7)
567
        vcd_warn("SVCD/TRACKS.SVCD: No MPEG motion video for track #%d?", n);
569
        vcd_warn("SVCD/TRACKS.SVCD: No MPEG motion video for track #%d?", n);
568
570
569
      /* setting playtime */
571
      /* setting playtime */
570
      
572
571
      {
573
      {
572
        double i, f;
574
        double i, f;
573
575
Lines 584-598 Link Here
584
        cdio_lba_to_msf (i * 75, &(tracks_svd1->playing_time[n]));
586
        cdio_lba_to_msf (i * 75, &(tracks_svd1->playing_time[n]));
585
        tracks_svd1->playing_time[n].f = cdio_to_bcd8 (floor (f * 75.0));
587
        tracks_svd1->playing_time[n].f = cdio_to_bcd8 (floor (f * 75.0));
586
      }
588
      }
587
      
589
588
      n++;
590
      n++;
589
    }  
591
    }
590
  
592
591
  memcpy (buf, &tracks_svd, sizeof(tracks_svd));
593
  memcpy (buf, &tracks_svd, sizeof(tracks_svd));
592
}
594
}
593
595
594
static double
596
static double
595
_get_cumulative_playing_time (const VcdObj_t *p_vcdobj, 
597
_get_cumulative_playing_time (const VcdObj_t *p_vcdobj,
596
                              unsigned int up_to_track_no)
598
                              unsigned int up_to_track_no)
597
{
599
{
598
  double result = 0;
600
  double result = 0;
Lines 608-636 Link Here
608
      result += track->info->playing_time;
610
      result += track->info->playing_time;
609
      up_to_track_no--;
611
      up_to_track_no--;
610
    }
612
    }
611
  
613
612
  if (up_to_track_no)
614
  if (up_to_track_no)
613
    vcd_warn ("internal error...");
615
    vcd_warn ("internal error...");
614
616
615
  return result;
617
  return result;
616
}
618
}
617
619
618
static unsigned 
620
static unsigned
619
_get_scanpoint_count (const VcdObj_t *p_vcdobj)
621
_get_scanpoint_count (const VcdObj_t *p_vcdobj)
620
{
622
{
621
  double total_playing_time;
623
  double total_playing_time;
622
624
623
  total_playing_time = 
625
  total_playing_time =
624
    _get_cumulative_playing_time (p_vcdobj, 
626
    _get_cumulative_playing_time (p_vcdobj,
625
                                  _cdio_list_length (p_vcdobj->mpeg_track_list));
627
                                  _cdio_list_length (p_vcdobj->mpeg_track_list));
626
628
627
  return ceil (total_playing_time * 2.0);
629
  return ceil (total_playing_time * 2.0);
628
}
630
}
629
631
630
uint32_t 
632
uint32_t
631
get_search_dat_size (const VcdObj_t *p_vcdobj)
633
get_search_dat_size (const VcdObj_t *p_vcdobj)
632
{
634
{
633
  return sizeof (SearchDat_t) 
635
  return sizeof (SearchDat_t)
634
    + (_get_scanpoint_count (p_vcdobj) * sizeof (msf_t));
636
    + (_get_scanpoint_count (p_vcdobj) * sizeof (msf_t));
635
}
637
}
636
638
Lines 648-663 Link Here
648
    {
650
    {
649
      mpeg_track_t *track = _cdio_list_node_data (p_node);
651
      mpeg_track_t *track = _cdio_list_node_data (p_node);
650
      CdioListNode_t *p_node2;
652
      CdioListNode_t *p_node2;
651
      
653
652
      _CDIO_LIST_FOREACH (p_node2, track->info->shdr[0].aps_list)
654
      _CDIO_LIST_FOREACH (p_node2, track->info->shdr[0].aps_list)
653
        {
655
        {
654
          struct aps_data *_data = calloc(1, sizeof (struct aps_data));
656
          struct aps_data *_data = calloc(1, sizeof (struct aps_data));
655
          
657
656
          *_data = *(struct aps_data *)_cdio_list_node_data (p_node2);
658
          *_data = *(struct aps_data *)_cdio_list_node_data (p_node2);
657
659
658
          _data->timestamp += _get_cumulative_playing_time (p_vcdobj, 
660
          _data->timestamp += _get_cumulative_playing_time (p_vcdobj,
659
                                                            i_track);
661
                                                            i_track);
660
          _data->packet_no += p_vcdobj->iso_size 
662
          _data->packet_no += p_vcdobj->iso_size
661
            + track->relative_start_extent;
663
            + track->relative_start_extent;
662
          _data->packet_no += p_vcdobj->track_front_margin;
664
          _data->packet_no += p_vcdobj->track_front_margin;
663
665
Lines 665-671 Link Here
665
        }
667
        }
666
      i_track++;
668
      i_track++;
667
    }
669
    }
668
  
670
669
  {
671
  {
670
    CdioListNode_t *aps_node = _cdio_list_begin (p_all_aps);
672
    CdioListNode_t *aps_node = _cdio_list_begin (p_all_aps);
671
    CdioListNode_t *n;
673
    CdioListNode_t *n;
Lines 686-692 Link Here
686
688
687
    for (t = 0; t < playing_time; t += 0.5)
689
    for (t = 0; t < playing_time; t += 0.5)
688
      {
690
      {
689
	for(n = _cdio_list_node_next (aps_node); n; 
691
	for(n = _cdio_list_node_next (aps_node); n;
690
            n = _cdio_list_node_next (n))
692
            n = _cdio_list_node_next (n))
691
	  {
693
	  {
692
	    _data = _cdio_list_node_data (n);
694
	    _data = _cdio_list_node_data (n);
Lines 697-718 Link Here
697
		aps_time = _data->timestamp;
699
		aps_time = _data->timestamp;
698
		aps_packet = _data->packet_no;
700
		aps_packet = _data->packet_no;
699
	      }
701
	      }
700
	    else 
702
	    else
701
	      break;
703
	      break;
702
	  }
704
	  }
703
705
704
        {
706
        {
705
          uint32_t *lsect = calloc(1, sizeof (uint32_t));
707
          uint32_t *lsect = calloc(1, sizeof (uint32_t));
706
          
708
707
          *lsect = aps_packet;
709
          *lsect = aps_packet;
708
          _cdio_list_append (p_scantable, lsect);
710
          _cdio_list_append (p_scantable, lsect);
709
        }
711
        }
710
        
712
711
      }
713
      }
712
714
713
  }
715
  }
714
716
715
  _cdio_list_free (p_all_aps, true);
717
  _cdio_list_free (p_all_aps, true, NULL);
716
718
717
  vcd_assert (scanpoints == _cdio_list_length (p_scantable));
719
  vcd_assert (scanpoints == _cdio_list_length (p_scantable));
718
720
Lines 733-745 Link Here
733
  memset (&search_dat, 0, sizeof (search_dat));
735
  memset (&search_dat, 0, sizeof (search_dat));
734
736
735
  memcpy (search_dat.file_id, SEARCH_FILE_ID, sizeof(search_dat.file_id));
737
  memcpy (search_dat.file_id, SEARCH_FILE_ID, sizeof(search_dat.file_id));
736
  
738
737
  search_dat.version = SEARCH_VERSION;
739
  search_dat.version = SEARCH_VERSION;
738
  search_dat.scan_points = uint16_to_be (_get_scanpoint_count (p_vcdobj));
740
  search_dat.scan_points = uint16_to_be (_get_scanpoint_count (p_vcdobj));
739
  search_dat.time_interval = SEARCH_TIME_INTERVAL;
741
  search_dat.time_interval = SEARCH_TIME_INTERVAL;
740
742
741
  memcpy (buf, &search_dat, sizeof (search_dat));
743
  memcpy (buf, &search_dat, sizeof (search_dat));
742
  
744
743
  p_scantable = _make_track_scantable (p_vcdobj);
745
  p_scantable = _make_track_scantable (p_vcdobj);
744
746
745
  n = 0;
747
  n = 0;
Lines 747-765 Link Here
747
    {
749
    {
748
      SearchDat_t *search_dat2 = buf;
750
      SearchDat_t *search_dat2 = buf;
749
      uint32_t sect = *(uint32_t *) _cdio_list_node_data (p_node);
751
      uint32_t sect = *(uint32_t *) _cdio_list_node_data (p_node);
750
          
752
751
      cdio_lba_to_msf(cdio_lsn_to_lba(sect), &(search_dat2->points[n]));
753
      cdio_lba_to_msf(cdio_lsn_to_lba(sect), &(search_dat2->points[n]));
752
      n++;
754
      n++;
753
    }
755
    }
754
756
755
  vcd_assert (n = _get_scanpoint_count (p_vcdobj));
757
  vcd_assert (n = _get_scanpoint_count (p_vcdobj));
756
758
757
  _cdio_list_free (p_scantable, true);
759
  _cdio_list_free (p_scantable, true, NULL);
758
}
760
}
759
761
760
static uint32_t 
762
static uint32_t
761
_get_scandata_count (const struct vcd_mpeg_stream_info *info)
763
_get_scandata_count (const struct vcd_mpeg_stream_info *info)
762
{ 
764
{
763
  return ceil (info->playing_time * 2.0);
765
  return ceil (info->playing_time * 2.0);
764
}
766
}
765
767
Lines 772-778 Link Here
772
  int aps_packet;
774
  int aps_packet;
773
  uint32_t *retval;
775
  uint32_t *retval;
774
  unsigned int i;
776
  unsigned int i;
775
  
777
776
  retval = calloc(1, _get_scandata_count (info) * sizeof (uint32_t));
778
  retval = calloc(1, _get_scandata_count (info) * sizeof (uint32_t));
777
779
778
  _data = _cdio_list_node_data (aps_node);
780
  _data = _cdio_list_node_data (aps_node);
Lines 791-797 Link Here
791
              aps_time = _data->timestamp;
793
              aps_time = _data->timestamp;
792
              aps_packet = _data->packet_no;
794
              aps_packet = _data->packet_no;
793
            }
795
            }
794
          else 
796
          else
795
            break;
797
            break;
796
        }
798
        }
797
799
Lines 807-813 Link Here
807
  return retval;
809
  return retval;
808
}
810
}
809
811
810
uint32_t 
812
uint32_t
811
get_scandata_dat_size (const VcdObj_t *p_vcdobj)
813
get_scandata_dat_size (const VcdObj_t *p_vcdobj)
812
{
814
{
813
  uint32_t retval = 0;
815
  uint32_t retval = 0;
Lines 833-839 Link Here
833
    _CDIO_LIST_FOREACH (node, p_vcdobj->mpeg_track_list)
835
    _CDIO_LIST_FOREACH (node, p_vcdobj->mpeg_track_list)
834
      {
836
      {
835
        const mpeg_track_t *track = _cdio_list_node_data (node);
837
        const mpeg_track_t *track = _cdio_list_node_data (node);
836
        
838
837
        retval += sizeof (msf_t) * _get_scandata_count (track->info);
839
        retval += sizeof (msf_t) * _get_scandata_count (track->info);
838
      }
840
      }
839
  }
841
  }
Lines 847-857 Link Here
847
  const unsigned tracks = _cdio_list_length (p_vcdobj->mpeg_track_list);
849
  const unsigned tracks = _cdio_list_length (p_vcdobj->mpeg_track_list);
848
850
849
  ScandataDat1_t *scandata_dat1 = (ScandataDat1_t *) buf;
851
  ScandataDat1_t *scandata_dat1 = (ScandataDat1_t *) buf;
850
  ScandataDat2_t *scandata_dat2 = 
852
  ScandataDat2_t *scandata_dat2 =
851
    (ScandataDat2_t *) &(scandata_dat1->cum_playtimes[tracks]);
853
    (ScandataDat2_t *) &(scandata_dat1->cum_playtimes[tracks]);
852
  ScandataDat3_t *scandata_dat3 =
854
  ScandataDat3_t *scandata_dat3 =
853
    (ScandataDat3_t *) &(scandata_dat2->spi_indexes[0]);
855
    (ScandataDat3_t *) &(scandata_dat2->spi_indexes[0]);
854
  ScandataDat4_t *scandata_dat4 = 
856
  ScandataDat4_t *scandata_dat4 =
855
    (ScandataDat4_t *) &(scandata_dat3->mpeg_track_offsets[tracks]);
857
    (ScandataDat4_t *) &(scandata_dat3->mpeg_track_offsets[tracks]);
856
858
857
  const uint16_t _begin_offset =
859
  const uint16_t _begin_offset =
Lines 867-875 Link Here
867
  /* memset (buf, 0, get_scandata_dat_size (p_vcdobj)); */
869
  /* memset (buf, 0, get_scandata_dat_size (p_vcdobj)); */
868
870
869
  /* struct 1 */
871
  /* struct 1 */
870
  memcpy (scandata_dat1->file_id, SCANDATA_FILE_ID, 
872
  memcpy (scandata_dat1->file_id, SCANDATA_FILE_ID,
871
          sizeof (scandata_dat1->file_id));
873
          sizeof (scandata_dat1->file_id));
872
  
874
873
  scandata_dat1->version = SCANDATA_VERSION_SVCD;
875
  scandata_dat1->version = SCANDATA_VERSION_SVCD;
874
  scandata_dat1->reserved = 0x00;
876
  scandata_dat1->reserved = 0x00;
875
  scandata_dat1->scandata_count = uint16_to_be (_get_scanpoint_count (p_vcdobj));
877
  scandata_dat1->scandata_count = uint16_to_be (_get_scanpoint_count (p_vcdobj));
Lines 941-947 Link Here
941
943
942
  /* struct 4 */
944
  /* struct 4 */
943
945
944
  
946
945
}
947
}
946
948
947
vcd_type_t
949
vcd_type_t
Lines 951-957 Link Here
951
  vcd_type_t _type = VCD_TYPE_INVALID;
953
  vcd_type_t _type = VCD_TYPE_INVALID;
952
954
953
  vcd_assert (info_buf != NULL);
955
  vcd_assert (info_buf != NULL);
954
  
956
955
  if (!memcmp (_info->ID, INFO_ID_VCD, sizeof (_info->ID)))
957
  if (!memcmp (_info->ID, INFO_ID_VCD, sizeof (_info->ID)))
956
    switch (_info->version)
958
    switch (_info->version)
957
      {
959
      {
Lines 985-991 Link Here
985
        break;
987
        break;
986
      }
988
      }
987
  else if (!memcmp (_info->ID, INFO_ID_SVCD, sizeof (_info->ID)))
989
  else if (!memcmp (_info->ID, INFO_ID_SVCD, sizeof (_info->ID)))
988
    switch (_info->version) 
990
    switch (_info->version)
989
      {
991
      {
990
      case INFO_VERSION_SVCD:
992
      case INFO_VERSION_SVCD:
991
        if (_info->sys_prof_tag != INFO_SPTAG_SVCD)
993
        if (_info->sys_prof_tag != INFO_SPTAG_SVCD)
Lines 993-999 Link Here
993
                    "-- assuming SVCD", _info->sys_prof_tag);
995
                    "-- assuming SVCD", _info->sys_prof_tag);
994
        _type = VCD_TYPE_SVCD;
996
        _type = VCD_TYPE_SVCD;
995
        break;
997
        break;
996
        
998
997
      default:
999
      default:
998
        vcd_warn ("INFO.SVD: unexpected version value %d seen "
1000
        vcd_warn ("INFO.SVD: unexpected version value %d seen "
999
                  " -- still assuming SVCD", _info->version);
1001
                  " -- still assuming SVCD", _info->version);
Lines 1001-1014 Link Here
1001
        break;
1003
        break;
1002
      }
1004
      }
1003
  else if (!memcmp (_info->ID, INFO_ID_HQVCD, sizeof (_info->ID)))
1005
  else if (!memcmp (_info->ID, INFO_ID_HQVCD, sizeof (_info->ID)))
1004
    switch (_info->version) 
1006
    switch (_info->version)
1005
      {
1007
      {
1006
      case INFO_VERSION_HQVCD:
1008
      case INFO_VERSION_HQVCD:
1007
  if (_info->sys_prof_tag != INFO_SPTAG_HQVCD)
1009
  if (_info->sys_prof_tag != INFO_SPTAG_HQVCD)
1008
          vcd_warn ("INFO.SVD: unexpected system profile tag value -- assuming hqvcd");
1010
          vcd_warn ("INFO.SVD: unexpected system profile tag value -- assuming hqvcd");
1009
        _type = VCD_TYPE_HQVCD;
1011
        _type = VCD_TYPE_HQVCD;
1010
        break;
1012
        break;
1011
        
1013
1012
      default:
1014
      default:
1013
        vcd_warn ("INFO.SVD: unexpected version value %d seen "
1015
        vcd_warn ("INFO.SVD: unexpected version value %d seen "
1014
                  "-- still assuming HQVCD", _info->version);
1016
                  "-- still assuming HQVCD", _info->version);
Lines 1017-1030 Link Here
1017
      }
1019
      }
1018
  else
1020
  else
1019
    vcd_warn ("INFO.SVD: signature not found");
1021
    vcd_warn ("INFO.SVD: signature not found");
1020
  
1022
1021
  return _type;
1023
  return _type;
1022
}
1024
}
1023
1025
1024
/* eof */
1026
/* eof */
1025
1027
1026
1028
1027
/* 
1029
/*
1028
 * Local variables:
1030
 * Local variables:
1029
 *  c-file-style: "gnu"
1031
 *  c-file-style: "gnu"
1030
 *  tab-width: 8
1032
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/image_bincue.c (-13 / +15 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 26-31 Link Here
26
#include <stdlib.h>
26
#include <stdlib.h>
27
#include <string.h>
27
#include <string.h>
28
28
29
/* We don't want to pull in cdio's config */
30
#define __CDIO_CONFIG_H__
29
#include <cdio/cdio.h>
31
#include <cdio/cdio.h>
30
#include <cdio/bytesex.h>
32
#include <cdio/bytesex.h>
31
#include <cdio/iso9660.h>
33
#include <cdio/iso9660.h>
Lines 72-78 Link Here
72
  if (!(_obj->cue_snk = vcd_data_sink_new_stdio (_obj->cue_fname)))
74
  if (!(_obj->cue_snk = vcd_data_sink_new_stdio (_obj->cue_fname)))
73
    vcd_error ("init failed");
75
    vcd_error ("init failed");
74
76
75
  _obj->init = true;  
77
  _obj->init = true;
76
}
78
}
77
79
78
static void
80
static void
Lines 94-100 Link Here
94
  CdioListNode_t *node;
96
  CdioListNode_t *node;
95
  int track_no, index_no;
97
  int track_no, index_no;
96
  const vcd_cue_t *_last_cue = 0;
98
  const vcd_cue_t *_last_cue = 0;
97
  
99
98
  _sink_init (_obj);
100
  _sink_init (_obj);
99
101
100
  vcd_data_sink_printf (_obj->cue_snk, "FILE \"%s\" BINARY\r\n",
102
  vcd_data_sink_printf (_obj->cue_snk, "FILE \"%s\" BINARY\r\n",
Lines 106-121 Link Here
106
    {
108
    {
107
      const vcd_cue_t *_cue = _cdio_list_node_data (node);
109
      const vcd_cue_t *_cue = _cdio_list_node_data (node);
108
      char *psz_msf;
110
      char *psz_msf;
109
      
111
110
      msf_t _msf = { 0, 0, 0 };
112
      msf_t _msf = { 0, 0, 0 };
111
      
113
112
      switch (_cue->type)
114
      switch (_cue->type)
113
	{
115
	{
114
	case VCD_CUE_TRACK_START:
116
	case VCD_CUE_TRACK_START:
115
	  track_no++;
117
	  track_no++;
116
	  index_no = 0;
118
	  index_no = 0;
117
119
118
	  vcd_data_sink_printf (_obj->cue_snk, 
120
	  vcd_data_sink_printf (_obj->cue_snk,
119
				"  TRACK %2.2d MODE2/%d\r\n"
121
				"  TRACK %2.2d MODE2/%d\r\n"
120
				"    FLAGS DCP\r\n",
122
				"    FLAGS DCP\r\n",
121
				track_no, (_obj->sector_2336_flag ? 2336 : 2352));
123
				track_no, (_obj->sector_2336_flag ? 2336 : 2352));
Lines 125-132 Link Here
125
	      cdio_lba_to_msf (_last_cue->lsn, &_msf);
127
	      cdio_lba_to_msf (_last_cue->lsn, &_msf);
126
	      psz_msf = cdio_msf_to_str(&_msf);
128
	      psz_msf = cdio_msf_to_str(&_msf);
127
129
128
	      vcd_data_sink_printf (_obj->cue_snk, 
130
	      vcd_data_sink_printf (_obj->cue_snk,
129
				    "    INDEX %2.2d %s\r\n", 
131
				    "    INDEX %2.2d %s\r\n",
130
				    index_no, psz_msf);
132
				    index_no, psz_msf);
131
	      free(psz_msf);
133
	      free(psz_msf);
132
	    }
134
	    }
Lines 136-142 Link Here
136
	  cdio_lba_to_msf (_cue->lsn, &_msf);
138
	  cdio_lba_to_msf (_cue->lsn, &_msf);
137
	  psz_msf = cdio_msf_to_str(&_msf);
139
	  psz_msf = cdio_msf_to_str(&_msf);
138
140
139
	  vcd_data_sink_printf (_obj->cue_snk, 
141
	  vcd_data_sink_printf (_obj->cue_snk,
140
				"    INDEX %2.2d %s\r\n",
142
				"    INDEX %2.2d %s\r\n",
141
				index_no, psz_msf);
143
				index_no, psz_msf);
142
	  free(psz_msf);
144
	  free(psz_msf);
Lines 155-166 Link Here
155
	  cdio_lba_to_msf (_cue->lsn, &_msf);
157
	  cdio_lba_to_msf (_cue->lsn, &_msf);
156
	  psz_msf = cdio_msf_to_str(&_msf);
158
	  psz_msf = cdio_msf_to_str(&_msf);
157
159
158
	  vcd_data_sink_printf (_obj->cue_snk, 
160
	  vcd_data_sink_printf (_obj->cue_snk,
159
				"    INDEX %2.2d %s\r\n",
161
				"    INDEX %2.2d %s\r\n",
160
				index_no, psz_msf);
162
				index_no, psz_msf);
161
	  free(psz_msf);
163
	  free(psz_msf);
162
	  break;
164
	  break;
163
	  
165
164
	case VCD_CUE_END:
166
	case VCD_CUE_END:
165
	  vcd_data_sink_close (_obj->cue_snk);
167
	  vcd_data_sink_close (_obj->cue_snk);
166
	  return 0;
168
	  return 0;
Lines 177-183 Link Here
177
179
178
  return -1;
180
  return -1;
179
}
181
}
180
 
182
181
static int
183
static int
182
_vcd_image_bincue_write (void *user_data, const void *data, lsn_t lsn)
184
_vcd_image_bincue_write (void *user_data, const void *data, lsn_t lsn)
183
{
185
{
Lines 190-196 Link Here
190
  offset *= _obj->sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW;
192
  offset *= _obj->sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW;
191
193
192
  vcd_data_sink_seek(_obj->bin_snk, offset);
194
  vcd_data_sink_seek(_obj->bin_snk, offset);
193
  
195
194
  if (_obj->sector_2336_flag)
196
  if (_obj->sector_2336_flag)
195
    vcd_data_sink_write(_obj->bin_snk, buf + 12 + 4, M2RAW_SECTOR_SIZE, 1);
197
    vcd_data_sink_write(_obj->bin_snk, buf + 12 + 4, M2RAW_SECTOR_SIZE, 1);
196
  else
198
  else
(-)vcdimager-0.7.24.ORIG/lib/image.c (-5 / +7 lines)
Lines 18-28 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
23
# include "config.h"
23
# include "config.h"
24
#endif
24
#endif
25
25
26
/* We don't want to pull in cdio's config */
27
#define __CDIO_CONFIG_H__
26
#include <cdio/cdio.h>
28
#include <cdio/cdio.h>
27
29
28
/* Public headers */
30
/* Public headers */
Lines 62-74 Link Here
62
vcd_image_sink_destroy (VcdImageSink_t *p_obj)
64
vcd_image_sink_destroy (VcdImageSink_t *p_obj)
63
{
65
{
64
  vcd_assert (p_obj != NULL);
66
  vcd_assert (p_obj != NULL);
65
  
67
66
  p_obj->op.free (p_obj->user_data);
68
  p_obj->op.free (p_obj->user_data);
67
  free (p_obj);
69
  free (p_obj);
68
}
70
}
69
71
70
int
72
int
71
vcd_image_sink_set_cuesheet (VcdImageSink_t *p_obj, 
73
vcd_image_sink_set_cuesheet (VcdImageSink_t *p_obj,
72
                             const CdioList_t *vcd_cue_list)
74
                             const CdioList_t *vcd_cue_list)
73
{
75
{
74
  vcd_assert (p_obj != NULL);
76
  vcd_assert (p_obj != NULL);
Lines 99-106 Link Here
99
  return obj->op.set_arg (obj->user_data, key, value);
101
  return obj->op.set_arg (obj->user_data, key, value);
100
}
102
}
101
103
102
104
103
/* 
105
/*
104
 * Local variables:
106
 * Local variables:
105
 *  c-file-style: "gnu"
107
 *  c-file-style: "gnu"
106
 *  tab-width: 8
108
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/image_cdrdao.c (-15 / +17 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 26-31 Link Here
26
#include <stdlib.h>
26
#include <stdlib.h>
27
#include <string.h>
27
#include <string.h>
28
28
29
/* We don't want to pull in cdio's config */
30
#define __CDIO_CONFIG_H__
29
/* Public headers */
31
/* Public headers */
30
#include <cdio/iso9660.h>
32
#include <cdio/iso9660.h>
31
#include <cdio/util.h>
33
#include <cdio/util.h>
Lines 85-91 Link Here
85
  const vcd_cue_t *_last_cue = 0;
87
  const vcd_cue_t *_last_cue = 0;
86
  unsigned last_track_lsn = 0;
88
  unsigned last_track_lsn = 0;
87
89
88
  vcd_data_sink_printf (toc_snk, 
90
  vcd_data_sink_printf (toc_snk,
89
			"// CDRDAO TOC\n"
91
			"// CDRDAO TOC\n"
90
			"//  generated by %s\n\n"
92
			"//  generated by %s\n\n"
91
			"CD_ROM_XA\n", vcd_version_string (false));
93
			"CD_ROM_XA\n", vcd_version_string (false));
Lines 103-109 Link Here
103
	*_cue2 = *_cue;
105
	*_cue2 = *_cue;
104
	_cdio_list_append (_obj->vcd_cue_list, _cue2);
106
	_cdio_list_append (_obj->vcd_cue_list, _cue2);
105
      }
107
      }
106
      
108
107
      switch (_cue->type)
109
      switch (_cue->type)
108
	{
110
	{
109
	case VCD_CUE_TRACK_START:
111
	case VCD_CUE_TRACK_START:
Lines 112-132 Link Here
112
114
113
	  last_track_lsn = _cue->lsn;
115
	  last_track_lsn = _cue->lsn;
114
116
115
	  vcd_data_sink_printf (toc_snk, 
117
	  vcd_data_sink_printf (toc_snk,
116
				"\n// Track %d\n"
118
				"\n// Track %d\n"
117
				"TRACK %s\n COPY\n",
119
				"TRACK %s\n COPY\n",
118
				track_no,
120
				track_no,
119
				(_obj->sector_2336_flag ? "MODE2_FORM_MIX" : "MODE2_RAW"));
121
				(_obj->sector_2336_flag ? "MODE2_FORM_MIX" : "MODE2_RAW"));
120
122
121
	  if (_last_cue && _last_cue->type == VCD_CUE_PREGAP_START)
123
	  if (_last_cue && _last_cue->type == VCD_CUE_PREGAP_START)
122
	    vcd_data_sink_printf (toc_snk, 
124
	    vcd_data_sink_printf (toc_snk,
123
				  " DATAFILE \"%s_%.2d_pregap.img\"\n"
125
				  " DATAFILE \"%s_%.2d_pregap.img\"\n"
124
				  " START\n",
126
				  " START\n",
125
				  _obj->img_base, track_no);
127
				  _obj->img_base, track_no);
126
128
127
	  index_no++;
129
	  index_no++;
128
130
129
	  vcd_data_sink_printf (toc_snk, 
131
	  vcd_data_sink_printf (toc_snk,
130
				" DATAFILE \"%s_%.2d.img\"\n",
132
				" DATAFILE \"%s_%.2d.img\"\n",
131
				_obj->img_base, track_no);
133
				_obj->img_base, track_no);
132
	  break;
134
	  break;
Lines 170-176 Link Here
170
172
171
  return -1;
173
  return -1;
172
}
174
}
173
 
175
174
static int
176
static int
175
_vcd_image_cdrdao_write (void *user_data, const void *data, lsn_t lsn)
177
_vcd_image_cdrdao_write (void *user_data, const void *data, lsn_t lsn)
176
{
178
{
Lines 189-196 Link Here
189
    _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
191
    _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
190
      {
192
      {
191
	const vcd_cue_t *_cue = _cdio_list_node_data (node);
193
	const vcd_cue_t *_cue = _cdio_list_node_data (node);
192
    
194
193
	switch (_cue->type) 
195
	switch (_cue->type)
194
	  {
196
	  {
195
	  case VCD_CUE_PREGAP_START:
197
	  case VCD_CUE_PREGAP_START:
196
	  case VCD_CUE_END:
198
	  case VCD_CUE_END:
Lines 203-209 Link Here
203
		_pregap = _lpregap;
205
		_pregap = _lpregap;
204
	      }
206
	      }
205
207
206
	    _last = _cue->lsn;  
208
	    _last = _cue->lsn;
207
	    _lpregap = (_cue->type == VCD_CUE_PREGAP_START);
209
	    _lpregap = (_cue->type == VCD_CUE_PREGAP_START);
208
210
209
	    if (_cue->type == VCD_CUE_TRACK_START)
211
	    if (_cue->type == VCD_CUE_TRACK_START)
Lines 230-238 Link Here
230
	snprintf (buf, sizeof (buf),
232
	snprintf (buf, sizeof (buf),
231
		  "%s_%.2d%s.img",
233
		  "%s_%.2d%s.img",
232
		  _obj->img_base,
234
		  _obj->img_base,
233
		  (_pregap ? in_track + 1 : in_track), 
235
		  (_pregap ? in_track + 1 : in_track),
234
		  (_pregap ? "_pregap" : ""));
236
		  (_pregap ? "_pregap" : ""));
235
	
237
236
	_obj->last_bin_snk = vcd_data_sink_new_stdio (buf);
238
	_obj->last_bin_snk = vcd_data_sink_new_stdio (buf);
237
	_obj->last_snk_idx = in_track;
239
	_obj->last_snk_idx = in_track;
238
	_obj->last_pause = _pregap;
240
	_obj->last_pause = _pregap;
Lines 245-256 Link Here
245
  offset *= _obj->sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW;
247
  offset *= _obj->sector_2336_flag ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE_RAW;
246
248
247
  vcd_data_sink_seek(_obj->last_bin_snk, offset);
249
  vcd_data_sink_seek(_obj->last_bin_snk, offset);
248
  
250
249
  if (_obj->sector_2336_flag)
251
  if (_obj->sector_2336_flag)
250
    vcd_data_sink_write(_obj->last_bin_snk, buf + 12 + 4, M2RAW_SECTOR_SIZE, 1);
252
    vcd_data_sink_write(_obj->last_bin_snk, buf + 12 + 4, M2RAW_SECTOR_SIZE, 1);
251
  else
253
  else
252
    vcd_data_sink_write(_obj->last_bin_snk, buf, CDIO_CD_FRAMESIZE_RAW, 1);
254
    vcd_data_sink_write(_obj->last_bin_snk, buf, CDIO_CD_FRAMESIZE_RAW, 1);
253
  
255
254
  return 0;
256
  return 0;
255
}
257
}
256
258
Lines 296-302 Link Here
296
vcd_image_sink_new_cdrdao (void)
298
vcd_image_sink_new_cdrdao (void)
297
{
299
{
298
  _img_cdrdao_snk_t *_data;
300
  _img_cdrdao_snk_t *_data;
299
  
301
300
  vcd_image_sink_funcs _funcs = {
302
  vcd_image_sink_funcs _funcs = {
301
    .set_cuesheet = _set_cuesheet,
303
    .set_cuesheet = _set_cuesheet,
302
    .write        = _vcd_image_cdrdao_write,
304
    .write        = _vcd_image_cdrdao_write,
(-)vcdimager-0.7.24.ORIG/lib/image_nrg.c (-15 / +17 lines)
Lines 22-28 Link Here
22
/*! This code implements low-level access functions for Nero's native
22
/*! This code implements low-level access functions for Nero's native
23
   CD-image format residing inside a disk file (*.nrg).
23
   CD-image format residing inside a disk file (*.nrg).
24
*/
24
*/
25
25
26
#ifdef HAVE_CONFIG_H
26
#ifdef HAVE_CONFIG_H
27
# include "config.h"
27
# include "config.h"
28
#endif
28
#endif
Lines 31-36 Link Here
31
#include <stdlib.h>
31
#include <stdlib.h>
32
#include <string.h>
32
#include <string.h>
33
33
34
/* We don't want to pull in cdio's config */
35
#define __CDIO_CONFIG_H__
34
#include <cdio/cdio.h>
36
#include <cdio/cdio.h>
35
#include <cdio/bytesex.h>
37
#include <cdio/bytesex.h>
36
#include <cdio/iso9660.h>
38
#include <cdio/iso9660.h>
Lines 57-63 Link Here
57
typedef struct {
59
typedef struct {
58
  uint32_t start      GNUC_PACKED;
60
  uint32_t start      GNUC_PACKED;
59
  uint32_t length     GNUC_PACKED;
61
  uint32_t length     GNUC_PACKED;
60
  uint32_t type       GNUC_PACKED; /* only 0x3 seen so far... 
62
  uint32_t type       GNUC_PACKED; /* only 0x3 seen so far...
61
                                      -> MIXED_MODE2 2336 blocksize */
63
                                      -> MIXED_MODE2 2336 blocksize */
62
  uint32_t start_lsn  GNUC_PACKED; /* does not include any pre-gaps! */
64
  uint32_t start_lsn  GNUC_PACKED; /* does not include any pre-gaps! */
63
  uint32_t _unknown   GNUC_PACKED; /* wtf is this for? -- always zero... */
65
  uint32_t _unknown   GNUC_PACKED; /* wtf is this for? -- always zero... */
Lines 77-83 Link Here
77
  uint8_t  track;                  /* binary or BCD?? */
79
  uint8_t  track;                  /* binary or BCD?? */
78
  uint8_t  index;                  /* makes 0->1 transitions */
80
  uint8_t  index;                  /* makes 0->1 transitions */
79
  uint8_t  _unknown2;              /* ?? */
81
  uint8_t  _unknown2;              /* ?? */
80
  uint32_t lsn        GNUC_PACKED; 
82
  uint32_t lsn        GNUC_PACKED;
81
} _cuex_array_t;
83
} _cuex_array_t;
82
84
83
typedef struct {
85
typedef struct {
Lines 124-130 Link Here
124
  if (!(_obj->nrg_snk = vcd_data_sink_new_stdio (_obj->nrg_fname)))
126
  if (!(_obj->nrg_snk = vcd_data_sink_new_stdio (_obj->nrg_fname)))
125
    vcd_error ("init failed");
127
    vcd_error ("init failed");
126
128
127
  _obj->init = true;  
129
  _obj->init = true;
128
}
130
}
129
131
130
132
Lines 157-163 Link Here
157
      vcd_cue_t *_cue2 = calloc(1, sizeof (vcd_cue_t));
159
      vcd_cue_t *_cue2 = calloc(1, sizeof (vcd_cue_t));
158
      *_cue2 = *_cue;
160
      *_cue2 = *_cue;
159
      _cdio_list_append (_obj->vcd_cue_list, _cue2);
161
      _cdio_list_append (_obj->vcd_cue_list, _cue2);
160
  
162
161
      if (_cue->type == VCD_CUE_TRACK_START)
163
      if (_cue->type == VCD_CUE_TRACK_START)
162
	num++;
164
	num++;
163
165
Lines 184-190 Link Here
184
  _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
186
  _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
185
    {
187
    {
186
      _cue = _cdio_list_node_data (node);
188
      _cue = _cdio_list_node_data (node);
187
      
189
188
      if (lsn < _cue->lsn)
190
      if (lsn < _cue->lsn)
189
	break;
191
	break;
190
192
Lines 202-208 Link Here
202
204
203
      _last = _cue;
205
      _last = _cue;
204
    }
206
    }
205
  
207
206
  vcd_assert (node != NULL);
208
  vcd_assert (node != NULL);
207
209
208
  switch (_last->type)
210
  switch (_last->type)
Lines 214-220 Link Here
214
    case VCD_CUE_PREGAP_START:
216
    case VCD_CUE_PREGAP_START:
215
      return -1;
217
      return -1;
216
      break;
218
      break;
217
    
219
218
    default:
220
    default:
219
    case VCD_CUE_END:
221
    case VCD_CUE_END:
220
      vcd_assert_not_reached ();
222
      vcd_assert_not_reached ();
Lines 242-251 Link Here
242
  _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
244
  _CDIO_LIST_FOREACH (node, _obj->vcd_cue_list)
243
    {
245
    {
244
      vcd_cue_t *_cue = _cdio_list_node_data (node);
246
      vcd_cue_t *_cue = _cdio_list_node_data (node);
245
      
247
246
      if (_cue->type == VCD_CUE_TRACK_START)
248
      if (_cue->type == VCD_CUE_TRACK_START)
247
	{
249
	{
248
	  vcd_cue_t *_cue2 = 
250
	  vcd_cue_t *_cue2 =
249
	    _cdio_list_node_data (_cdio_list_node_next (node));
251
	    _cdio_list_node_data (_cdio_list_node_next (node));
250
252
251
	  _etnf_array_t _etnf = { 0, };
253
	  _etnf_array_t _etnf = { 0, };
Lines 253-266 Link Here
253
	  _etnf.type = UINT32_TO_BE (0x3);
255
	  _etnf.type = UINT32_TO_BE (0x3);
254
	  _etnf.start_lsn = uint32_to_be (_map (_obj, _cue->lsn));
256
	  _etnf.start_lsn = uint32_to_be (_map (_obj, _cue->lsn));
255
	  _etnf.start = uint32_to_be (_map (_obj, _cue->lsn) * M2RAW_SECTOR_SIZE);
257
	  _etnf.start = uint32_to_be (_map (_obj, _cue->lsn) * M2RAW_SECTOR_SIZE);
256
	  
258
257
	  _etnf.length = uint32_to_be ((_cue2->lsn - _cue->lsn) * M2RAW_SECTOR_SIZE);
259
	  _etnf.length = uint32_to_be ((_cue2->lsn - _cue->lsn) * M2RAW_SECTOR_SIZE);
258
260
259
	  vcd_data_sink_write (_obj->nrg_snk, &_etnf, sizeof (_etnf_array_t), 1);
261
	  vcd_data_sink_write (_obj->nrg_snk, &_etnf, sizeof (_etnf_array_t), 1);
260
	}
262
	}
261
	
263
262
    }
264
    }
263
  
265
264
  {
266
  {
265
    uint32_t tracks = uint32_to_be (_obj->tracks);
267
    uint32_t tracks = uint32_to_be (_obj->tracks);
266
268
Lines 281-287 Link Here
281
283
282
  return 0;
284
  return 0;
283
}
285
}
284
 
286
285
static int
287
static int
286
_vcd_image_nrg_write (void *user_data, const void *data, lsn_t lsn)
288
_vcd_image_nrg_write (void *user_data, const void *data, lsn_t lsn)
287
{
289
{
Lines 302-308 Link Here
302
304
303
  if (_obj->cue_end_lsn - 1 == lsn)
305
  if (_obj->cue_end_lsn - 1 == lsn)
304
    {
306
    {
305
      vcd_debug ("ENDLSN reached! (%lu == %lu)", 
307
      vcd_debug ("ENDLSN reached! (%lu == %lu)",
306
		 (long unsigned int) lsn, (long unsigned int) _lsn);
308
		 (long unsigned int) lsn, (long unsigned int) _lsn);
307
      return _write_tail (_obj, (_lsn + 1) * M2RAW_SECTOR_SIZE);
309
      return _write_tail (_obj, (_lsn + 1) * M2RAW_SECTOR_SIZE);
308
    }
310
    }
(-)vcdimager-0.7.24.ORIG/lib/image_sink.h (-3 / +3 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_IMAGE_SINK_H__
21
#ifndef __VCD_IMAGE_SINK_H__
22
#define __VCD_IMAGE_SINK_H__
22
#define __VCD_IMAGE_SINK_H__
23
23
Lines 61-67 Link Here
61
vcd_image_sink_destroy (VcdImageSink_t *p_obj);
61
vcd_image_sink_destroy (VcdImageSink_t *p_obj);
62
62
63
int
63
int
64
vcd_image_sink_set_cuesheet (VcdImageSink_t *p_obj, 
64
vcd_image_sink_set_cuesheet (VcdImageSink_t *p_obj,
65
			     const CdioList_t *p_vcd_cue_list);
65
			     const CdioList_t *p_vcd_cue_list);
66
66
67
int
67
int
Lines 71-77 Link Here
71
  Set the arg "key" with "value" in the target device.
71
  Set the arg "key" with "value" in the target device.
72
*/
72
*/
73
int
73
int
74
vcd_image_sink_set_arg (VcdImageSink_t *p_obj, const char key[], 
74
vcd_image_sink_set_arg (VcdImageSink_t *p_obj, const char key[],
75
			const char value[]);
75
			const char value[]);
76
76
77
VcdImageSink_t * vcd_image_sink_new_nrg (void);
77
VcdImageSink_t * vcd_image_sink_new_nrg (void);
(-)vcdimager-0.7.24.ORIG/lib/inf.c (-62 / +64 lines)
Lines 18-30 Link Here
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* 
21
/*
22
   Things here refer to lower-level structures using a structure other
22
   Things here refer to lower-level structures using a structure other
23
   than vcdinfo_t. For higher-level structures via the vcdinfo_t, see
23
   than vcdinfo_t. For higher-level structures via the vcdinfo_t, see
24
   info.c
24
   info.c
25
*/
25
*/
26
26
27
27
28
#ifdef HAVE_CONFIG_H
28
#ifdef HAVE_CONFIG_H
29
# include "config.h"
29
# include "config.h"
30
#endif
30
#endif
Lines 49-54 Link Here
49
#include <unistd.h>
49
#include <unistd.h>
50
#endif
50
#endif
51
51
52
/* We don't want to pull in cdio's config */
53
#define __CDIO_CONFIG_H__
52
#include <cdio/cdio.h>
54
#include <cdio/cdio.h>
53
#include <cdio/bytesex.h>
55
#include <cdio/bytesex.h>
54
#include <cdio/util.h>
56
#include <cdio/util.h>
Lines 71-77 Link Here
71
{
73
{
72
  static char _buf[BUF_COUNT][BUF_SIZE];
74
  static char _buf[BUF_COUNT][BUF_SIZE];
73
  static int _num = -1;
75
  static int _num = -1;
74
  
76
75
  _num++;
77
  _num++;
76
  _num %= BUF_COUNT;
78
  _num %= BUF_COUNT;
77
79
Lines 85-91 Link Here
85
{
87
{
86
  char *buf;
88
  char *buf;
87
89
88
  if (!_area->x1  
90
  if (!_area->x1
89
      && !_area->y1
91
      && !_area->y1
90
      && !_area->x2
92
      && !_area->x2
91
      && !_area->y2)
93
      && !_area->y2)
Lines 96-108 Link Here
96
  snprintf (buf, BUF_SIZE, "[%3d,%3d] - [%3d,%3d]",
98
  snprintf (buf, BUF_SIZE, "[%3d,%3d] - [%3d,%3d]",
97
            _area->x1, _area->y1,
99
            _area->x1, _area->y1,
98
            _area->x2, _area->y2);
100
            _area->x2, _area->y2);
99
            
101
100
  return buf;
102
  return buf;
101
}
103
}
102
104
103
/*!
105
/*!
104
   Return a string containing the VCD album id, or NULL if there is 
106
   Return a string containing the VCD album id, or NULL if there is
105
   some problem in getting this. 
107
   some problem in getting this.
106
*/
108
*/
107
const char *
109
const char *
108
vcdinf_get_album_id(const InfoVcd_t *info)
110
vcdinf_get_album_id(const InfoVcd_t *info)
Lines 116-122 Link Here
116
  Time is in seconds unless it is -1 (unlimited).
118
  Time is in seconds unless it is -1 (unlimited).
117
*/
119
*/
118
int
120
int
119
vcdinf_get_autowait_time (const PsdPlayListDescriptor_t *d) 
121
vcdinf_get_autowait_time (const PsdPlayListDescriptor_t *d)
120
{
122
{
121
  return vcdinfo_get_wait_time (d->atime);
123
  return vcdinfo_get_wait_time (d->atime);
122
}
124
}
Lines 133-143 Link Here
133
}
135
}
134
136
135
/*!
137
/*!
136
   Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ... 
138
   Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ...
137
   for this object.
139
   for this object.
138
*/
140
*/
139
const char *
141
const char *
140
vcdinf_get_format_version_str (vcd_type_t vcd_type) 
142
vcdinf_get_format_version_str (vcd_type_t vcd_type)
141
{
143
{
142
  switch (vcd_type)
144
  switch (vcd_type)
143
    {
145
    {
Lines 168-174 Link Here
168
  Return loop count. 0 is infinite loop.
170
  Return loop count. 0 is infinite loop.
169
*/
171
*/
170
uint16_t
172
uint16_t
171
vcdinf_get_loop_count (const PsdSelectionListDescriptor_t *psd) 
173
vcdinf_get_loop_count (const PsdSelectionListDescriptor_t *psd)
172
{
174
{
173
  return 0x7f & psd->loop;
175
  return 0x7f & psd->loop;
174
}
176
}
Lines 177-183 Link Here
177
  Return LOT offset
179
  Return LOT offset
178
*/
180
*/
179
uint16_t
181
uint16_t
180
vcdinf_get_lot_offset (const LotVcd_t *lot, unsigned int n) 
182
vcdinf_get_lot_offset (const LotVcd_t *lot, unsigned int n)
181
{
183
{
182
  return uint16_from_be (lot->offset[n]);
184
  return uint16_from_be (lot->offset[n]);
183
}
185
}
Lines 193-199 Link Here
193
}
195
}
194
196
195
/*!
197
/*!
196
  Return the number of segments in the VCD. 
198
  Return the number of segments in the VCD.
197
*/
199
*/
198
segnum_t
200
segnum_t
199
vcdinf_get_num_segments(const InfoVcd_t *info)
201
vcdinf_get_num_segments(const InfoVcd_t *info)
Lines 203-212 Link Here
203
}
205
}
204
206
205
/*!
207
/*!
206
  Return number of LIDs. 
208
  Return number of LIDs.
207
*/
209
*/
208
lid_t
210
lid_t
209
vcdinf_get_num_LIDs (const InfoVcd_t *info) 
211
vcdinf_get_num_LIDs (const InfoVcd_t *info)
210
{
212
{
211
  if (NULL==info) return 0;
213
  if (NULL==info) return 0;
212
  /* Should probably use _vcd_pbc_max_lid instead? */
214
  /* Should probably use _vcd_pbc_max_lid instead? */
Lines 227-240 Link Here
227
  Time is in 1/15-second units.
229
  Time is in 1/15-second units.
228
*/
230
*/
229
uint16_t
231
uint16_t
230
vcdinf_get_play_time (const PsdPlayListDescriptor_t *d) 
232
vcdinf_get_play_time (const PsdPlayListDescriptor_t *d)
231
{
233
{
232
  if (NULL==d) return 0;
234
  if (NULL==d) return 0;
233
  return uint16_from_be (d->ptime);
235
  return uint16_from_be (d->ptime);
234
}
236
}
235
237
236
/*!
238
/*!
237
  Return number of bytes in PSD. 
239
  Return number of bytes in PSD.
238
*/
240
*/
239
uint32_t
241
uint32_t
240
vcdinf_get_psd_size (const InfoVcd_t *info)
242
vcdinf_get_psd_size (const InfoVcd_t *info)
Lines 283-290 Link Here
283
/*!
285
/*!
284
  Return the VCD volume count - the number of CD's in the collection.
286
  Return the VCD volume count - the number of CD's in the collection.
285
*/
287
*/
286
unsigned int 
288
unsigned int
287
vcdinf_get_volume_count(const InfoVcd_t *info) 
289
vcdinf_get_volume_count(const InfoVcd_t *info)
288
{
290
{
289
  if (NULL==info) return 0;
291
  if (NULL==info) return 0;
290
  return(uint16_from_be( info->vol_count));
292
  return(uint16_from_be( info->vol_count));
Lines 306-312 Link Here
306
  Time is in seconds unless it is -1 (unlimited).
308
  Time is in seconds unless it is -1 (unlimited).
307
*/
309
*/
308
int
310
int
309
vcdinf_get_wait_time (const PsdPlayListDescriptor_t *d) 
311
vcdinf_get_wait_time (const PsdPlayListDescriptor_t *d)
310
{
312
{
311
  return vcdinfo_get_wait_time (d->wtime);
313
  return vcdinfo_get_wait_time (d->wtime);
312
}
314
}
Lines 315-331 Link Here
315
  Return true if loop has a jump delay
317
  Return true if loop has a jump delay
316
*/
318
*/
317
bool
319
bool
318
vcdinf_has_jump_delay (const PsdSelectionListDescriptor_t *psd) 
320
vcdinf_has_jump_delay (const PsdSelectionListDescriptor_t *psd)
319
{
321
{
320
  if (NULL==psd) return false;
322
  if (NULL==psd) return false;
321
  return ((0x80 & psd->loop) != 0);
323
  return ((0x80 & psd->loop) != 0);
322
}
324
}
323
  
325
324
/*! 
326
/*!
325
  Comparison routine used in sorting. We compare LIDs and if those are 
327
  Comparison routine used in sorting. We compare LIDs and if those are
326
  equal, use the offset.
328
  equal, use the offset.
327
  Note: we assume an unassigned LID is 0 and this compares as a high value.
329
  Note: we assume an unassigned LID is 0 and this compares as a high value.
328
  
330
329
  NOTE: Consider making static.
331
  NOTE: Consider making static.
330
*/
332
*/
331
int
333
int
Lines 335-343 Link Here
335
    {
337
    {
336
      if (a->lid > b->lid) return +1;
338
      if (a->lid > b->lid) return +1;
337
      if (a->lid < b->lid) return -1;
339
      if (a->lid < b->lid) return -1;
338
      vcd_warn ("LID %d at offset %d has same nunber as LID of offset %d", 
340
      vcd_warn ("LID %d at offset %d has same nunber as LID of offset %d",
339
                a->lid, a->offset, b->offset);
341
                a->lid, a->offset, b->offset);
340
    } 
342
    }
341
  else if (a->lid) return -1;
343
  else if (a->lid) return -1;
342
  else if (b->lid) return +1;
344
  else if (b->lid) return +1;
343
345
Lines 345-369 Link Here
345
347
346
  if (a->offset > b->offset) return +1;
348
  if (a->offset > b->offset) return +1;
347
  if (a->offset < b->offset) return -1;
349
  if (a->offset < b->offset) return -1;
348
  
350
349
  /* LIDS and offsets are equal. */
351
  /* LIDS and offsets are equal. */
350
  return 0;
352
  return 0;
351
}
353
}
352
354
353
/* Get the LID from a given play-list descriptor. 
355
/* Get the LID from a given play-list descriptor.
354
   VCDINFO_REJECTED_MASK is returned d on error or pld is NULL. 
356
   VCDINFO_REJECTED_MASK is returned d on error or pld is NULL.
355
*/
357
*/
356
lid_t
358
lid_t
357
vcdinf_pld_get_lid(const PsdPlayListDescriptor_t *pld)
359
vcdinf_pld_get_lid(const PsdPlayListDescriptor_t *pld)
358
{
360
{
359
  return (pld != NULL) 
361
  return (pld != NULL)
360
    ? uint16_from_be (pld->lid) & VCDINFO_LID_MASK
362
    ? uint16_from_be (pld->lid) & VCDINFO_LID_MASK
361
    : VCDINFO_REJECTED_MASK;
363
    : VCDINFO_REJECTED_MASK;
362
}
364
}
363
365
364
/**
366
/**
365
 \fn vcdinfo_pld_get_next_offset(const PsdPlayListDescriptor *pld); 
367
 \fn vcdinfo_pld_get_next_offset(const PsdPlayListDescriptor *pld);
366
 \brief  Get next offset for a given PSD selector descriptor.  
368
 \brief  Get next offset for a given PSD selector descriptor.
367
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no "next"
369
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no "next"
368
 entry or pld is NULL. Otherwise the LID offset is returned.
370
 entry or pld is NULL. Otherwise the LID offset is returned.
369
 */
371
 */
Lines 377-383 Link Here
377
/*!
379
/*!
378
  Return number of items in LIDs. Return 0 if error or not found.
380
  Return number of items in LIDs. Return 0 if error or not found.
379
*/
381
*/
380
int 
382
int
381
vcdinf_pld_get_noi (const PsdPlayListDescriptor_t *pld)
383
vcdinf_pld_get_noi (const PsdPlayListDescriptor_t *pld)
382
{
384
{
383
  if ( NULL == pld ) return 0;
385
  if ( NULL == pld ) return 0;
Lines 385-391 Link Here
385
}
387
}
386
388
387
/*!
389
/*!
388
  Return the playlist item i in d. 
390
  Return the playlist item i in d.
389
*/
391
*/
390
uint16_t
392
uint16_t
391
vcdinf_pld_get_play_item(const PsdPlayListDescriptor_t *pld, unsigned int i)
393
vcdinf_pld_get_play_item(const PsdPlayListDescriptor_t *pld, unsigned int i)
Lines 396-428 Link Here
396
398
397
/**
399
/**
398
 \fn vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor *pld);
400
 \fn vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor *pld);
399
 \brief Get prev offset for a given PSD selector descriptor. 
401
 \brief Get prev offset for a given PSD selector descriptor.
400
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no "prev"
402
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no "prev"
401
 entry or pld is NULL. Otherwise the LID offset is returned.
403
 entry or pld is NULL. Otherwise the LID offset is returned.
402
 */
404
 */
403
uint16_t
405
uint16_t
404
vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor_t *pld)
406
vcdinf_pld_get_prev_offset(const PsdPlayListDescriptor_t *pld)
405
{
407
{
406
  return (pld != NULL) ? 
408
  return (pld != NULL) ?
407
    uint16_from_be (pld->prev_ofs) : VCDINFO_INVALID_OFFSET;
409
    uint16_from_be (pld->prev_ofs) : VCDINFO_INVALID_OFFSET;
408
}
410
}
409
411
410
/**
412
/**
411
 \fn vcdinf_pld_get_return_offset(const PsdPlayListDescriptor *pld);
413
 \fn vcdinf_pld_get_return_offset(const PsdPlayListDescriptor *pld);
412
 \brief Get return offset for a given PLD selector descriptor. 
414
 \brief Get return offset for a given PLD selector descriptor.
413
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no 
415
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no
414
 "return" entry or pld is NULL. Otherwise the LID offset is returned.
416
 "return" entry or pld is NULL. Otherwise the LID offset is returned.
415
 */
417
 */
416
uint16_t
418
uint16_t
417
vcdinf_pld_get_return_offset(const PsdPlayListDescriptor_t *pld)
419
vcdinf_pld_get_return_offset(const PsdPlayListDescriptor_t *pld)
418
{
420
{
419
  return (pld != NULL) ? 
421
  return (pld != NULL) ?
420
    uint16_from_be (pld->return_ofs) : VCDINFO_INVALID_OFFSET;
422
    uint16_from_be (pld->return_ofs) : VCDINFO_INVALID_OFFSET;
421
}
423
}
422
424
423
/**
425
/**
424
 * \fn vcdinfo_psd_get_default_offset(const PsdSelectionListDescriptor *psd);
426
 * \fn vcdinfo_psd_get_default_offset(const PsdSelectionListDescriptor *psd);
425
 * \brief Get next offset for a given PSD selector descriptor. 
427
 * \brief Get next offset for a given PSD selector descriptor.
426
 * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
428
 * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
427
 * NULL. Otherwise the LID offset is returned.
429
 * NULL. Otherwise the LID offset is returned.
428
 */
430
 */
Lines 434-441 Link Here
434
}
436
}
435
437
436
/*!
438
/*!
437
  Get the item id for a given selection-list descriptor. 
439
  Get the item id for a given selection-list descriptor.
438
  VCDINFO_REJECTED_MASK is returned on error or if psd is NULL. 
440
  VCDINFO_REJECTED_MASK is returned on error or if psd is NULL.
439
*/
441
*/
440
uint16_t
442
uint16_t
441
vcdinf_psd_get_itemid(const PsdSelectionListDescriptor_t *psd)
443
vcdinf_psd_get_itemid(const PsdSelectionListDescriptor_t *psd)
Lines 444-475 Link Here
444
}
446
}
445
447
446
/*!
448
/*!
447
  Get the LID from a given selection-list descriptor. 
449
  Get the LID from a given selection-list descriptor.
448
  VCDINFO_REJECTED_MASK is returned on error or psd is NULL. 
450
  VCDINFO_REJECTED_MASK is returned on error or psd is NULL.
449
*/
451
*/
450
lid_t
452
lid_t
451
vcdinf_psd_get_lid(const PsdSelectionListDescriptor_t *psd)
453
vcdinf_psd_get_lid(const PsdSelectionListDescriptor_t *psd)
452
{
454
{
453
  return (psd != NULL) 
455
  return (psd != NULL)
454
    ? uint16_from_be (psd->lid) & VCDINFO_LID_MASK
456
    ? uint16_from_be (psd->lid) & VCDINFO_LID_MASK
455
    : VCDINFO_REJECTED_MASK;
457
    : VCDINFO_REJECTED_MASK;
456
}
458
}
457
459
458
/*!
460
/*!
459
  Get the LID rejected status for a given PSD selector descriptor. 
461
  Get the LID rejected status for a given PSD selector descriptor.
460
  true is also returned d is NULL. 
462
  true is also returned d is NULL.
461
*/
463
*/
462
bool
464
bool
463
vcdinf_psd_get_lid_rejected(const PsdSelectionListDescriptor_t *psd)
465
vcdinf_psd_get_lid_rejected(const PsdSelectionListDescriptor_t *psd)
464
{
466
{
465
  return (psd != NULL) 
467
  return (psd != NULL)
466
    ? vcdinfo_is_rejected(uint16_from_be(psd->lid)) 
468
    ? vcdinfo_is_rejected(uint16_from_be(psd->lid))
467
    : true;
469
    : true;
468
}
470
}
469
471
470
/**
472
/**
471
 * \fn vcdinf_psd_get_next_offset(const PsdSelectionListDescriptor *psd);
473
 * \fn vcdinf_psd_get_next_offset(const PsdSelectionListDescriptor *psd);
472
 * \brief Get "next" offset for a given PSD selector descriptor. 
474
 * \brief Get "next" offset for a given PSD selector descriptor.
473
 * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
475
 * \return VCDINFO_INVALID_OFFSET is returned on error or if psd is
474
 * NULL. Otherwise the LID offset is returned.
476
 * NULL. Otherwise the LID offset is returned.
475
 */
477
 */
Lines 481-495 Link Here
481
}
483
}
482
484
483
/**
485
/**
484
 * \fn vcdinf_psd_get_offset(const PsdSelectionListDescriptor *d, 
486
 * \fn vcdinf_psd_get_offset(const PsdSelectionListDescriptor *d,
485
 *                           unsigned int entry_num);
487
 *                           unsigned int entry_num);
486
 * \brief Get offset entry_num for a given PSD selector descriptor. 
488
 * \brief Get offset entry_num for a given PSD selector descriptor.
487
 * \return VCDINFO_INVALID_OFFSET is returned if d on error or d is
489
 * \return VCDINFO_INVALID_OFFSET is returned if d on error or d is
488
 * NULL. Otherwise the LID offset is returned.
490
 * NULL. Otherwise the LID offset is returned.
489
 */
491
 */
490
uint16_t
492
uint16_t
491
vcdinf_psd_get_offset(const PsdSelectionListDescriptor_t *psd, 
493
vcdinf_psd_get_offset(const PsdSelectionListDescriptor_t *psd,
492
                      unsigned int entry_num) 
494
                      unsigned int entry_num)
493
{
495
{
494
  return (psd != NULL && entry_num < vcdinf_get_num_selections(psd))
496
  return (psd != NULL && entry_num < vcdinf_get_num_selections(psd))
495
    ? uint16_from_be (psd->ofs[entry_num]) : VCDINFO_INVALID_OFFSET;
497
    ? uint16_from_be (psd->ofs[entry_num]) : VCDINFO_INVALID_OFFSET;
Lines 497-528 Link Here
497
499
498
/**
500
/**
499
 \fn vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor *psd);
501
 \fn vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor *psd);
500
 \brief Get "prev" offset for a given PSD selector descriptor. 
502
 \brief Get "prev" offset for a given PSD selector descriptor.
501
 \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no "prev"
503
 \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no "prev"
502
 entry or psd is NULL. Otherwise the LID offset is returned.
504
 entry or psd is NULL. Otherwise the LID offset is returned.
503
 */
505
 */
504
uint16_t
506
uint16_t
505
vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor_t *psd)
507
vcdinf_psd_get_prev_offset(const PsdSelectionListDescriptor_t *psd)
506
{
508
{
507
  return (psd != NULL) ? 
509
  return (psd != NULL) ?
508
    uint16_from_be (psd->prev_ofs) : VCDINFO_INVALID_OFFSET;
510
    uint16_from_be (psd->prev_ofs) : VCDINFO_INVALID_OFFSET;
509
}
511
}
510
512
511
/**
513
/**
512
 * \fn vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor *psd);
514
 * \fn vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor *psd);
513
 * \brief Get return offset for a given PSD selector descriptor. 
515
 * \brief Get return offset for a given PSD selector descriptor.
514
 \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no 
516
 \return  VCDINFO_INVALID_OFFSET is returned on error or if psd has no
515
 "return" entry or psd is NULL. Otherwise the LID offset is returned.
517
 "return" entry or psd is NULL. Otherwise the LID offset is returned.
516
 */
518
 */
517
uint16_t
519
uint16_t
518
vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor_t *psd)
520
vcdinf_psd_get_return_offset(const PsdSelectionListDescriptor_t *psd)
519
{
521
{
520
  return (psd != NULL) ? 
522
  return (psd != NULL) ?
521
    uint16_from_be (psd->return_ofs) : VCDINFO_INVALID_OFFSET;
523
    uint16_from_be (psd->return_ofs) : VCDINFO_INVALID_OFFSET;
522
}
524
}
523
525
524
526
525
/* 
527
/*
526
 * Local variables:
528
 * Local variables:
527
 *  c-file-style: "gnu"
529
 *  c-file-style: "gnu"
528
 *  tab-width: 8
530
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/info.c (-269 / +269 lines)
Lines 17-29 Link Here
17
    along with this program; if not, write to the Free Foundation
17
    along with this program; if not, write to the Free Foundation
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
/* 
20
/*
21
   Things here refer to higher-level structures usually accessed via
21
   Things here refer to higher-level structures usually accessed via
22
   vcdinfo_t. For lower-level access which generally use 
22
   vcdinfo_t. For lower-level access which generally use
23
   structures other than vcdinfo_t, see inf.c
23
   structures other than vcdinfo_t, see inf.c
24
*/
24
*/
25
25
26
26
27
/* Private headers */
27
/* Private headers */
28
#include "info_private.h"
28
#include "info_private.h"
29
#include "vcd_assert.h"
29
#include "vcd_assert.h"
Lines 70-76 Link Here
70
{
70
{
71
  static char _buf[BUF_COUNT][BUF_SIZE];
71
  static char _buf[BUF_COUNT][BUF_SIZE];
72
  static int _num = -1;
72
  static int _num = -1;
73
  
73
74
  _num++;
74
  _num++;
75
  _num %= BUF_COUNT;
75
  _num %= BUF_COUNT;
76
76
Lines 79-91 Link Here
79
  return _buf[_num];
79
  return _buf[_num];
80
}
80
}
81
81
82
/* 
82
/*
83
   Initialize/allocate segment portion of vcdinfo_obj_t. 
83
   Initialize/allocate segment portion of vcdinfo_obj_t.
84
84
85
   Getting exact segments sizes is done in a rather complicated way. 
85
   Getting exact segments sizes is done in a rather complicated way.
86
   A simple approach would be to use the fixed size allocated on disk, 
86
   A simple approach would be to use the fixed size allocated on disk,
87
   but players have trouble with the internal fragmentation padding. 
87
   but players have trouble with the internal fragmentation padding.
88
   More accurate results are obtained by consulting with ISO 9660 
88
   More accurate results are obtained by consulting with ISO 9660
89
   information for the corresponding file entry.
89
   information for the corresponding file entry.
90
90
91
   Another approach to get segment sizes is to read/scan the
91
   Another approach to get segment sizes is to read/scan the
Lines 100-112 Link Here
100
  CdioList_t *entlist;
100
  CdioList_t *entlist;
101
  int i;
101
  int i;
102
  lsn_t last_lsn=0;
102
  lsn_t last_lsn=0;
103
  
103
104
  p_obj->first_segment_lsn = cdio_msf_to_lsn(&info->first_seg_addr);
104
  p_obj->first_segment_lsn = cdio_msf_to_lsn(&info->first_seg_addr);
105
  p_obj->seg_sizes         = calloc(1, num_segments * sizeof(uint32_t *));
105
  p_obj->seg_sizes         = calloc(1, num_segments * sizeof(uint32_t *));
106
106
107
  if (NULL == p_obj->seg_sizes || 0 == num_segments) return;
107
  if (NULL == p_obj->seg_sizes || 0 == num_segments) return;
108
108
109
  entlist = iso9660_fs_readdir(p_obj->img, "SEGMENT", true);
109
  entlist = iso9660_fs_readdir(p_obj->img, "SEGMENT");
110
110
111
  i=0;
111
  i=0;
112
  _CDIO_LIST_FOREACH (entnode, entlist) {
112
  _CDIO_LIST_FOREACH (entnode, entlist) {
Lines 118-131 Link Here
118
      p_obj->seg_sizes[i] = VCDINFO_SEGMENT_SECTOR_SIZE;
118
      p_obj->seg_sizes[i] = VCDINFO_SEGMENT_SECTOR_SIZE;
119
      i++;
119
      i++;
120
    }
120
    }
121
    
121
122
    /* Should have an entry in the ISO 9660 filesystem. Get and save 
122
    /* Should have an entry in the ISO 9660 filesystem. Get and save
123
       in statbuf.secsize this size.
123
       in statbuf.secsize this size.
124
    */
124
    */
125
    p_obj->seg_sizes[i] = statbuf->secsize;
125
    p_obj->seg_sizes[i] = statbuf->secsize;
126
126
127
    if (last_lsn >= statbuf->lsn) 
127
    if (last_lsn >= statbuf->lsn)
128
      vcd_warn ("Segments if ISO 9660 directory out of order lsn %ul >= %ul", 
128
      vcd_warn ("Segments if ISO 9660 directory out of order lsn %ul >= %ul",
129
                (unsigned int) last_lsn, (unsigned int) statbuf->lsn);
129
                (unsigned int) last_lsn, (unsigned int) statbuf->lsn);
130
    last_lsn = statbuf->lsn;
130
    last_lsn = statbuf->lsn;
131
131
Lines 137-157 Link Here
137
    i++;
137
    i++;
138
  }
138
  }
139
139
140
  if (i != num_segments) 
140
  if (i != num_segments)
141
    vcd_warn ("Number of segments found %d is not number of segments %d", 
141
    vcd_warn ("Number of segments found %d is not number of segments %d",
142
              i, num_segments);
142
              i, num_segments);
143
143
144
  _cdio_list_free (entlist, true);
144
  _cdio_list_free (entlist, true, NULL);
145
145
146
146
  
147
#if 0
147
#if 0
148
  /* Figure all of the segment sector sizes */
148
  /* Figure all of the segment sector sizes */
149
  for (i=0; i < num_segments; i++) {
149
  for (i=0; i < num_segments; i++) {
150
    
150
151
    p_obj->seg_sizes[i] = VCDINFO_SEGMENT_SECTOR_SIZE;
151
    p_obj->seg_sizes[i] = VCDINFO_SEGMENT_SECTOR_SIZE;
152
152
153
    if ( !info->spi_contents[i].item_cont ) {
153
    if ( !info->spi_contents[i].item_cont ) {
154
      /* Should have an entry in the ISO 9660 filesystem. Get and save 
154
      /* Should have an entry in the ISO 9660 filesystem. Get and save
155
         in statbuf.secsize this size.
155
         in statbuf.secsize this size.
156
       */
156
       */
157
      lsn_t lsn = vcdinfo_get_seg_lsn(p_obj, i);
157
      lsn_t lsn = vcdinfo_get_seg_lsn(p_obj, i);
Lines 173-180 Link Here
173
   0 is returned on error.
173
   0 is returned on error.
174
*/
174
*/
175
unsigned int
175
unsigned int
176
vcdinfo_audio_type_num_channels(const vcdinfo_obj_t *p_obj, 
176
vcdinfo_audio_type_num_channels(const vcdinfo_obj_t *p_obj,
177
                                 unsigned int audio_type) 
177
                                 unsigned int audio_type)
178
{
178
{
179
  const int audio_types[2][5] =
179
  const int audio_types[2][5] =
180
    {
180
    {
Lines 186-193 Link Here
186
        0},  /* error */
186
        0},  /* error */
187
187
188
      { /* SVCD, HQVCD */
188
      { /* SVCD, HQVCD */
189
        0,   /* no stream */ 
189
        0,   /* no stream */
190
        1,   /*  1 stream */ 
190
        1,   /*  1 stream */
191
        2,   /*  2 streams */
191
        2,   /*  2 streams */
192
        1,   /*  1 multi-channel stream (surround sound) */
192
        1,   /*  1 multi-channel stream (surround sound) */
193
        0}   /*  error */
193
        0}   /*  error */
Lines 197-203 Link Here
197
  if (audio_type > 4) {
197
  if (audio_type > 4) {
198
    return 0;
198
    return 0;
199
  }
199
  }
200
  
200
201
  /* Get first index entry into above audio_type array from vcd_type */
201
  /* Get first index entry into above audio_type array from vcd_type */
202
  switch (p_obj->vcd_type) {
202
  switch (p_obj->vcd_type) {
203
203
Lines 224-246 Link Here
224
/*!
224
/*!
225
  Return a string describing an audio type.
225
  Return a string describing an audio type.
226
*/
226
*/
227
const char * 
227
const char *
228
vcdinfo_audio_type2str(const vcdinfo_obj_t *p_obj, unsigned int audio_type)
228
vcdinfo_audio_type2str(const vcdinfo_obj_t *p_obj, unsigned int audio_type)
229
{
229
{
230
  const char *audio_types[3][5] =
230
  const char *audio_types[3][5] =
231
    {
231
    {
232
      /* INVALID, VCD 1.0, or VCD 1.1 */
232
      /* INVALID, VCD 1.0, or VCD 1.1 */
233
      { "unknown", "invalid", "", "", "" },  
233
      { "unknown", "invalid", "", "", "" },
234
      
234
235
      /*VCD 2.0 */
235
      /*VCD 2.0 */
236
      { "no audio", "single channel", "stereo", "dual channel", "error" }, 
236
      { "no audio", "single channel", "stereo", "dual channel", "error" },
237
      
237
238
      /* SVCD, HQVCD */
238
      /* SVCD, HQVCD */
239
      { "no stream", "1 stream", "2 streams", 
239
      { "no stream", "1 stream", "2 streams",
240
        "1 multi-channel stream (surround sound)", "error"}, 
240
        "1 multi-channel stream (surround sound)", "error"},
241
    };
241
    };
242
242
243
  unsigned int first_index = 0; 
243
  unsigned int first_index = 0;
244
244
245
  /* Get first index entry into above audio_type array from vcd_type */
245
  /* Get first index entry into above audio_type array from vcd_type */
246
  switch (p_obj->vcd_type) {
246
  switch (p_obj->vcd_type) {
Lines 261-280 Link Here
261
    /* We have an invalid entry. Set to handle below. */
261
    /* We have an invalid entry. Set to handle below. */
262
    audio_type=4;
262
    audio_type=4;
263
  }
263
  }
264
  
264
265
  /* We should also check that the second index is in range too. */
265
  /* We should also check that the second index is in range too. */
266
  if (audio_type > 3) {
266
  if (audio_type > 3) {
267
    first_index=0;
267
    first_index=0;
268
    audio_type=1;
268
    audio_type=1;
269
  }
269
  }
270
  
270
271
  return audio_types[first_index][audio_type];
271
  return audio_types[first_index][audio_type];
272
}
272
}
273
273
274
/*!
274
/*!
275
  Note first i_seg is 0!
275
  Note first i_seg is 0!
276
*/
276
*/
277
const char * 
277
const char *
278
vcdinfo_ogt2str(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
278
vcdinfo_ogt2str(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
279
{
279
{
280
  const InfoVcd_t *info = &(p_obj->info);
280
  const InfoVcd_t *info = &(p_obj->info);
Lines 285-296 Link Here
285
      "0 & 1 available",
285
      "0 & 1 available",
286
      "all 4 available"
286
      "all 4 available"
287
    };
287
    };
288
  
288
289
  return ogt_str[info->spi_contents[i_seg].ogt];
289
  return ogt_str[info->spi_contents[i_seg].ogt];
290
}
290
}
291
291
292
292
293
const char * 
293
const char *
294
vcdinfo_video_type2str(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
294
vcdinfo_video_type2str(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
295
{
295
{
296
  const char *video_types[] =
296
  const char *video_types[] =
Lines 305-327 Link Here
305
      "PAL motion"
305
      "PAL motion"
306
      "INVALID ENTRY"
306
      "INVALID ENTRY"
307
    };
307
    };
308
  
308
309
  return video_types[vcdinfo_get_video_type(p_obj, i_seg)];
309
  return video_types[vcdinfo_get_video_type(p_obj, i_seg)];
310
}
310
}
311
311
312
/*!
312
/*!
313
  \brief Classify i_itemid into the kind of item it is: track #, entry #, 
313
  \brief Classify i_itemid into the kind of item it is: track #, entry #,
314
  segment #. 
314
  segment #.
315
  \param itemid is set to contain this classification an the converted 
315
  \param itemid is set to contain this classification an the converted
316
  entry number. 
316
  entry number.
317
*/
317
*/
318
void
318
void
319
vcdinfo_classify_itemid (uint16_t i_itemid, 
319
vcdinfo_classify_itemid (uint16_t i_itemid,
320
                         /*out*/ vcdinfo_itemid_t *itemid)
320
                         /*out*/ vcdinfo_itemid_t *itemid)
321
{
321
{
322
322
323
  itemid->num = i_itemid;
323
  itemid->num = i_itemid;
324
  if (i_itemid < 2) 
324
  if (i_itemid < 2)
325
    itemid->type = VCDINFO_ITEM_TYPE_NOTFOUND;
325
    itemid->type = VCDINFO_ITEM_TYPE_NOTFOUND;
326
  else if (i_itemid < MIN_ENCODED_TRACK_NUM) {
326
  else if (i_itemid < MIN_ENCODED_TRACK_NUM) {
327
    itemid->type = VCDINFO_ITEM_TYPE_TRACK;
327
    itemid->type = VCDINFO_ITEM_TYPE_TRACK;
Lines 334-340 Link Here
334
  else if (i_itemid <= MAX_ENCODED_SEGMENT_NUM) {
334
  else if (i_itemid <= MAX_ENCODED_SEGMENT_NUM) {
335
    itemid->type = VCDINFO_ITEM_TYPE_SEGMENT;
335
    itemid->type = VCDINFO_ITEM_TYPE_SEGMENT;
336
    itemid->num -= (MIN_ENCODED_SEGMENT_NUM);
336
    itemid->num -= (MIN_ENCODED_SEGMENT_NUM);
337
  } else 
337
  } else
338
    itemid->type = VCDINFO_ITEM_TYPE_SPAREID2;
338
    itemid->type = VCDINFO_ITEM_TYPE_SPAREID2;
339
}
339
}
340
340
Lines 343-349 Link Here
343
{
343
{
344
  char *buf = _getbuf ();
344
  char *buf = _getbuf ();
345
  vcdinfo_itemid_t itemid;
345
  vcdinfo_itemid_t itemid;
346
  
346
347
  vcdinfo_classify_itemid(i_itemid, &itemid);
347
  vcdinfo_classify_itemid(i_itemid, &itemid);
348
  strcpy (buf, "??");
348
  strcpy (buf, "??");
349
349
Lines 352-358 Link Here
352
    snprintf (buf, BUF_SIZE, "play nothing (0x%4.4x)", itemid.num);
352
    snprintf (buf, BUF_SIZE, "play nothing (0x%4.4x)", itemid.num);
353
    break;
353
    break;
354
  case VCDINFO_ITEM_TYPE_TRACK:
354
  case VCDINFO_ITEM_TYPE_TRACK:
355
    snprintf (buf, BUF_SIZE, "SEQUENCE[%d] (0x%4.4x)", itemid.num-1, 
355
    snprintf (buf, BUF_SIZE, "SEQUENCE[%d] (0x%4.4x)", itemid.num-1,
356
              i_itemid);
356
              i_itemid);
357
    break;
357
    break;
358
  case VCDINFO_ITEM_TYPE_ENTRY:
358
  case VCDINFO_ITEM_TYPE_ENTRY:
Lines 373-380 Link Here
373
}
373
}
374
374
375
/*!
375
/*!
376
   Return a string containing the VCD album id, or NULL if there is 
376
   Return a string containing the VCD album id, or NULL if there is
377
   some problem in getting this. 
377
   some problem in getting this.
378
*/
378
*/
379
const char *
379
const char *
380
vcdinfo_get_album_id(const vcdinfo_obj_t *p_obj)
380
vcdinfo_get_album_id(const vcdinfo_obj_t *p_obj)
Lines 385-391 Link Here
385
385
386
/*!
386
/*!
387
  Return the VCD ID.
387
  Return the VCD ID.
388
  NULL is returned if there is some problem in getting this. 
388
  NULL is returned if there is some problem in getting this.
389
*/
389
*/
390
char *
390
char *
391
vcdinfo_get_application_id(vcdinfo_obj_t *p_obj)
391
vcdinfo_get_application_id(vcdinfo_obj_t *p_obj)
Lines 399-405 Link Here
399
  NULL if error.
399
  NULL if error.
400
*/
400
*/
401
CdIo_t *
401
CdIo_t *
402
vcdinfo_get_cd_image (const vcdinfo_obj_t *p_vcd_obj) 
402
vcdinfo_get_cd_image (const vcdinfo_obj_t *p_vcd_obj)
403
{
403
{
404
  if ( !p_vcd_obj ) return NULL;
404
  if ( !p_vcd_obj ) return NULL;
405
  return p_vcd_obj->img;
405
  return p_vcd_obj->img;
Lines 410-425 Link Here
410
  \fn vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_obj, lid_t lid,
410
  \fn vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_obj, lid_t lid,
411
                               unsigned int selection);
411
                               unsigned int selection);
412
412
413
  \brief Get offset of a selection for a given lid. 
413
  \brief Get offset of a selection for a given lid.
414
414
415
  Return the LID offset associated with a the selection number of the
415
  Return the LID offset associated with a the selection number of the
416
  passed-in LID parameter. 
416
  passed-in LID parameter.
417
417
418
  \return VCDINFO_INVALID_LID is returned if obj on error or obj
418
  \return VCDINFO_INVALID_LID is returned if obj on error or obj
419
  is NULL. Otherwise the LID offset is returned.
419
  is NULL. Otherwise the LID offset is returned.
420
*/
420
*/
421
lid_t vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_obj, lid_t lid,
421
lid_t vcdinfo_selection_get_lid(const vcdinfo_obj_t *p_obj, lid_t lid,
422
                                unsigned int selection) 
422
                                unsigned int selection)
423
{
423
{
424
  unsigned int offset;
424
  unsigned int offset;
425
425
Lines 431-437 Link Here
431
  case PSD_OFS_MULTI_DEF:
431
  case PSD_OFS_MULTI_DEF:
432
  case PSD_OFS_MULTI_DEF_NO_NUM:
432
  case PSD_OFS_MULTI_DEF_NO_NUM:
433
    return VCDINFO_INVALID_LID;
433
    return VCDINFO_INVALID_LID;
434
  default: 
434
  default:
435
    {
435
    {
436
      vcdinfo_offset_t *ofs = vcdinfo_get_offset_t(p_obj, offset);
436
      vcdinfo_offset_t *ofs = vcdinfo_get_offset_t(p_obj, offset);
437
      return ofs->lid;
437
      return ofs->lid;
Lines 443-459 Link Here
443
  \fn vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
443
  \fn vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
444
  unsigned int selection);
444
  unsigned int selection);
445
445
446
  \brief Get offset of a selection for a given lid. 
446
  \brief Get offset of a selection for a given lid.
447
447
448
  Return the LID offset associated with a the selection number of the
448
  Return the LID offset associated with a the selection number of the
449
  passed-in LID parameter. 
449
  passed-in LID parameter.
450
450
451
  \return VCDINFO_INVALID_OFFSET is returned if error, obj is NULL or
451
  \return VCDINFO_INVALID_OFFSET is returned if error, obj is NULL or
452
  the lid is not some type of selection list. Otherwise the LID offset
452
  the lid is not some type of selection list. Otherwise the LID offset
453
  is returned.
453
  is returned.
454
*/
454
*/
455
uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
455
uint16_t vcdinfo_selection_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
456
                                      unsigned int selection) 
456
                                      unsigned int selection)
457
{
457
{
458
  unsigned int bsn;
458
  unsigned int bsn;
459
459
Lines 462-472 Link Here
462
  if (pxd.descriptor_type != PSD_TYPE_SELECTION_LIST &&
462
  if (pxd.descriptor_type != PSD_TYPE_SELECTION_LIST &&
463
      pxd.descriptor_type != PSD_TYPE_EXT_SELECTION_LIST) {
463
      pxd.descriptor_type != PSD_TYPE_EXT_SELECTION_LIST) {
464
    vcd_warn( "Requesting selection of LID %i which not a selection list -"
464
    vcd_warn( "Requesting selection of LID %i which not a selection list -"
465
              " type is 0x%x", 
465
              " type is 0x%x",
466
              lid, pxd.descriptor_type );
466
              lid, pxd.descriptor_type );
467
    return VCDINFO_INVALID_OFFSET;
467
    return VCDINFO_INVALID_OFFSET;
468
  }
468
  }
469
  
469
470
  bsn=vcdinf_get_bsn(pxd.psd);
470
  bsn=vcdinf_get_bsn(pxd.psd);
471
471
472
  if ( (selection - bsn + 1) > 0) {
472
  if ( (selection - bsn + 1) > 0) {
Lines 479-497 Link Here
479
479
480
/**
480
/**
481
 \fn vcdinfo_get_default_offset(const vcdinfo_obj_t *p_obj, unsinged int lid);
481
 \fn vcdinfo_get_default_offset(const vcdinfo_obj_t *p_obj, unsinged int lid);
482
 \brief Get return offset for a given PLD selector descriptor. 
482
 \brief Get return offset for a given PLD selector descriptor.
483
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no 
483
 \return  VCDINFO_INVALID_OFFSET is returned on error or if pld has no
484
 "return" entry or pld is NULL. Otherwise the LID offset is returned.
484
 "return" entry or pld is NULL. Otherwise the LID offset is returned.
485
 */
485
 */
486
uint16_t
486
uint16_t
487
vcdinfo_get_default_offset(const vcdinfo_obj_t *p_obj, lid_t lid)
487
vcdinfo_get_default_offset(const vcdinfo_obj_t *p_obj, lid_t lid)
488
{
488
{
489
  if (p_obj) {
489
  if (p_obj) {
490
    
490
491
    PsdListDescriptor_t pxd;
491
    PsdListDescriptor_t pxd;
492
492
493
    vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
493
    vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
494
    
494
495
    switch (pxd.descriptor_type) {
495
    switch (pxd.descriptor_type) {
496
    case PSD_TYPE_EXT_SELECTION_LIST:
496
    case PSD_TYPE_EXT_SELECTION_LIST:
497
    case PSD_TYPE_SELECTION_LIST:
497
    case PSD_TYPE_SELECTION_LIST:
Lines 507-514 Link Here
507
}
507
}
508
508
509
/*!
509
/*!
510
  \brief Get default or multi-default LID. 
510
  \brief Get default or multi-default LID.
511
  
511
512
  Return the LID offset associated with a the "default" entry of the
512
  Return the LID offset associated with a the "default" entry of the
513
  passed-in LID parameter. Note "default" entries are associated
513
  passed-in LID parameter. Note "default" entries are associated
514
  with PSDs that are (extended) selection lists. If the "default"
514
  with PSDs that are (extended) selection lists. If the "default"
Lines 516-528 Link Here
516
  "default" LID. Otherwise this routine is exactly like
516
  "default" LID. Otherwise this routine is exactly like
517
  vcdinfo_get_default_lid with the exception of requiring an
517
  vcdinfo_get_default_lid with the exception of requiring an
518
  additional "entry_num" parameter.
518
  additional "entry_num" parameter.
519
  
519
520
  \return VCDINFO_INVALID_LID is returned on error, or if the LID
520
  \return VCDINFO_INVALID_LID is returned on error, or if the LID
521
  is not a selection list or no "default" entry. Otherwise the LID
521
  is not a selection list or no "default" entry. Otherwise the LID
522
  offset is returned.
522
  offset is returned.
523
*/
523
*/
524
lid_t
524
lid_t
525
vcdinfo_get_multi_default_lid(const vcdinfo_obj_t *p_obj, lid_t lid, 
525
vcdinfo_get_multi_default_lid(const vcdinfo_obj_t *p_obj, lid_t lid,
526
                              lsn_t lsn)
526
                              lsn_t lsn)
527
{
527
{
528
  unsigned int offset;
528
  unsigned int offset;
Lines 536-542 Link Here
536
  case PSD_OFS_MULTI_DEF:
536
  case PSD_OFS_MULTI_DEF:
537
  case PSD_OFS_MULTI_DEF_NO_NUM:
537
  case PSD_OFS_MULTI_DEF_NO_NUM:
538
    return VCDINFO_INVALID_LID;
538
    return VCDINFO_INVALID_LID;
539
  default: 
539
  default:
540
    {
540
    {
541
      vcdinfo_offset_t *ofs = vcdinfo_get_offset_t(p_obj, offset);
541
      vcdinfo_offset_t *ofs = vcdinfo_get_offset_t(p_obj, offset);
542
      return ofs->lid;
542
      return ofs->lid;
Lines 545-552 Link Here
545
}
545
}
546
546
547
/*!
547
/*!
548
  \brief Get default or multi-default LID offset. 
548
  \brief Get default or multi-default LID offset.
549
  
549
550
  Return the LID offset associated with a the "default" entry of the
550
  Return the LID offset associated with a the "default" entry of the
551
  passed-in LID parameter. Note "default" entries are associated
551
  passed-in LID parameter. Note "default" entries are associated
552
  with PSDs that are (extended) selection lists. If the "default"
552
  with PSDs that are (extended) selection lists. If the "default"
Lines 554-581 Link Here
554
  "default" offset. Otherwise this routine is exactly like
554
  "default" offset. Otherwise this routine is exactly like
555
  vcdinfo_get_default_offset with the exception of requiring an
555
  vcdinfo_get_default_offset with the exception of requiring an
556
  additional "entry_num" parameter.
556
  additional "entry_num" parameter.
557
  
557
558
  \return VCDINFO_INVALID_OFFSET is returned on error, or if the LID
558
  \return VCDINFO_INVALID_OFFSET is returned on error, or if the LID
559
  is not a selection list or no "default" entry. Otherwise the LID
559
  is not a selection list or no "default" entry. Otherwise the LID
560
  offset is returned.
560
  offset is returned.
561
*/
561
*/
562
uint16_t
562
uint16_t
563
vcdinfo_get_multi_default_offset(const vcdinfo_obj_t *p_obj, lid_t lid, 
563
vcdinfo_get_multi_default_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
564
                                 unsigned int entry_num)
564
                                 unsigned int entry_num)
565
{
565
{
566
  uint16_t offset=vcdinfo_get_default_offset(p_obj, lid);
566
  uint16_t offset=vcdinfo_get_default_offset(p_obj, lid);
567
567
568
  switch (offset) {
568
  switch (offset) {
569
  case PSD_OFS_MULTI_DEF:
569
  case PSD_OFS_MULTI_DEF:
570
  case PSD_OFS_MULTI_DEF_NO_NUM: 
570
  case PSD_OFS_MULTI_DEF_NO_NUM:
571
    {
571
    {
572
      /* Have some work todo... Figure the selection number. */
572
      /* Have some work todo... Figure the selection number. */
573
      PsdListDescriptor_t pxd;
573
      PsdListDescriptor_t pxd;
574
      
574
575
      vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
575
      vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
576
576
577
      switch (pxd.descriptor_type) {
577
      switch (pxd.descriptor_type) {
578
        
578
579
      case PSD_TYPE_SELECTION_LIST:
579
      case PSD_TYPE_SELECTION_LIST:
580
      case PSD_TYPE_EXT_SELECTION_LIST: {
580
      case PSD_TYPE_EXT_SELECTION_LIST: {
581
        vcdinfo_itemid_t selection_itemid;
581
        vcdinfo_itemid_t selection_itemid;
Lines 589-597 Link Here
589
          return VCDINFO_INVALID_OFFSET;
589
          return VCDINFO_INVALID_OFFSET;
590
        }
590
        }
591
591
592
        start_entry_num = vcdinfo_track_get_entry(p_obj, 
592
        start_entry_num = vcdinfo_track_get_entry(p_obj,
593
                                                  selection_itemid.num);
593
                                                  selection_itemid.num);
594
        return vcdinfo_selection_get_offset(p_obj, lid, 
594
        return vcdinfo_selection_get_offset(p_obj, lid,
595
                                            entry_num-start_entry_num);
595
                                            entry_num-start_entry_num);
596
      }
596
      }
597
      default: ;
597
      default: ;
Lines 627-638 Link Here
627
  The first entry number is 0.
627
  The first entry number is 0.
628
*/
628
*/
629
uint32_t
629
uint32_t
630
vcdinfo_get_entry_sect_count (const vcdinfo_obj_t *p_obj, 
630
vcdinfo_get_entry_sect_count (const vcdinfo_obj_t *p_obj,
631
                              unsigned int entry_num)
631
                              unsigned int entry_num)
632
{
632
{
633
  const EntriesVcd_t *entries = &(p_obj->entries);
633
  const EntriesVcd_t *entries = &(p_obj->entries);
634
  const unsigned int entry_count = vcdinf_get_num_entries(entries);
634
  const unsigned int entry_count = vcdinf_get_num_entries(entries);
635
  if (entry_num > entry_count) 
635
  if (entry_num > entry_count)
636
    return 0;
636
    return 0;
637
  else {
637
  else {
638
    const lsn_t this_lsn = vcdinfo_get_entry_lsn(p_obj, entry_num);
638
    const lsn_t this_lsn = vcdinfo_get_entry_lsn(p_obj, entry_num);
Lines 641-654 Link Here
641
      track_t track=vcdinfo_get_track(p_obj, entry_num);
641
      track_t track=vcdinfo_get_track(p_obj, entry_num);
642
      track_t next_track=vcdinfo_get_track(p_obj, entry_num+1);
642
      track_t next_track=vcdinfo_get_track(p_obj, entry_num+1);
643
      next_lsn = vcdinfo_get_entry_lsn(p_obj, entry_num+1);
643
      next_lsn = vcdinfo_get_entry_lsn(p_obj, entry_num+1);
644
      /* If we've changed tracks, don't include pregap sector between 
644
      /* If we've changed tracks, don't include pregap sector between
645
         tracks.
645
         tracks.
646
       */
646
       */
647
      if (track != next_track) next_lsn -= CDIO_PREGAP_SECTORS;
647
      if (track != next_track) next_lsn -= CDIO_PREGAP_SECTORS;
648
    } else {
648
    } else {
649
      /* entry_num == entry_count -1. Or the last entry.
649
      /* entry_num == entry_count -1. Or the last entry.
650
         This is really really ugly. There's probably a better
650
         This is really really ugly. There's probably a better
651
         way to do it. 
651
         way to do it.
652
         Below we get the track of the current entry and then the LBA of the
652
         Below we get the track of the current entry and then the LBA of the
653
         beginning of the following (leadout?) track.
653
         beginning of the following (leadout?) track.
654
654
Lines 663-669 Link Here
663
663
664
        /* Try to get the sector count from the ISO 9660 filesystem */
664
        /* Try to get the sector count from the ISO 9660 filesystem */
665
        statbuf = iso9660_find_fs_lsn(p_obj->img, lsn);
665
        statbuf = iso9660_find_fs_lsn(p_obj->img, lsn);
666
        
666
667
        if (NULL != statbuf) {
667
        if (NULL != statbuf) {
668
          next_lsn = lsn + statbuf->secsize;
668
          next_lsn = lsn + statbuf->secsize;
669
          free(statbuf);
669
          free(statbuf);
Lines 721-733 Link Here
721
  }
721
  }
722
}
722
}
723
723
724
EntriesVcd_t * 
724
EntriesVcd_t *
725
vcdinfo_get_entriesVcd (vcdinfo_obj_t *p_obj) 
725
vcdinfo_get_entriesVcd (vcdinfo_obj_t *p_obj)
726
{
726
{
727
  if (!p_obj) return NULL;
727
  if (!p_obj) return NULL;
728
  return &(p_obj->entries);
728
  return &(p_obj->entries);
729
}
729
}
730
  
730
731
/*!
731
/*!
732
   Get the VCD format (VCD 1.0 VCD 1.1, SVCD, ... for this object.
732
   Get the VCD format (VCD 1.0 VCD 1.1, SVCD, ... for this object.
733
   The type is also set inside obj.
733
   The type is also set inside obj.
Lines 739-765 Link Here
739
}
739
}
740
740
741
/*!
741
/*!
742
   Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ... 
742
   Return a string giving VCD format (VCD 1.0 VCD 1.1, SVCD, ...
743
   for this object.
743
   for this object.
744
*/
744
*/
745
const char *
745
const char *
746
vcdinfo_get_format_version_str (const vcdinfo_obj_t *p_obj) 
746
vcdinfo_get_format_version_str (const vcdinfo_obj_t *p_obj)
747
{
747
{
748
  if (!p_obj) return "*Uninitialized*";
748
  if (!p_obj) return "*Uninitialized*";
749
  return vcdinf_get_format_version_str(p_obj->vcd_type);
749
  return vcdinf_get_format_version_str(p_obj->vcd_type);
750
}
750
}
751
751
752
InfoVcd_t * 
752
InfoVcd_t *
753
vcdinfo_get_infoVcd (vcdinfo_obj_t *p_obj) 
753
vcdinfo_get_infoVcd (vcdinfo_obj_t *p_obj)
754
{
754
{
755
  if (!p_obj) return NULL;
755
  if (!p_obj) return NULL;
756
  return &(p_obj->info);
756
  return &(p_obj->info);
757
}
757
}
758
  
758
759
/*!  Return the entry number closest and before the given LSN.
759
/*!  Return the entry number closest and before the given LSN.
760
 */
760
 */
761
unsigned int 
761
unsigned int
762
vcdinfo_lsn_get_entry(const vcdinfo_obj_t *p_obj, lsn_t lsn) 
762
vcdinfo_lsn_get_entry(const vcdinfo_obj_t *p_obj, lsn_t lsn)
763
{
763
{
764
764
765
  /* Do a binary search to find the entry. */
765
  /* Do a binary search to find the entry. */
Lines 778-819 Link Here
778
  return (lsn == mid_lsn) ? mid : mid-1;
778
  return (lsn == mid_lsn) ? mid : mid-1;
779
}
779
}
780
780
781
  
781
782
/*!
782
/*!
783
   \brief Get ISO 9660 Primary Volume Descriptor (PVD) for a VCDinfo
783
   \brief Get ISO 9660 Primary Volume Descriptor (PVD) for a VCDinfo
784
   object.
784
   object.
785
*/
785
*/
786
iso9660_pvd_t * 
786
iso9660_pvd_t *
787
vcdinfo_get_pvd (vcdinfo_obj_t *p_obj) 
787
vcdinfo_get_pvd (vcdinfo_obj_t *p_obj)
788
{
788
{
789
  if (!p_obj) return NULL;
789
  if (!p_obj) return NULL;
790
  return &(p_obj->pvd);
790
  return &(p_obj->pvd);
791
}
791
}
792
  
792
793
void * 
793
void *
794
vcdinfo_get_scandata (vcdinfo_obj_t *p_obj) 
794
vcdinfo_get_scandata (vcdinfo_obj_t *p_obj)
795
{
795
{
796
  if (!p_obj) return NULL;
796
  if (!p_obj) return NULL;
797
  return p_obj->scandata_buf;
797
  return p_obj->scandata_buf;
798
}
798
}
799
  
799
800
void * 
800
void *
801
vcdinfo_get_searchDat (vcdinfo_obj_t *p_obj) 
801
vcdinfo_get_searchDat (vcdinfo_obj_t *p_obj)
802
{
802
{
803
  if (!p_obj) return NULL;
803
  if (!p_obj) return NULL;
804
  return p_obj->search_buf;
804
  return p_obj->search_buf;
805
}
805
}
806
  
806
807
void * 
807
void *
808
vcdinfo_get_tracksSVD (vcdinfo_obj_t *p_obj) 
808
vcdinfo_get_tracksSVD (vcdinfo_obj_t *p_obj)
809
{
809
{
810
  if (!p_obj) return NULL;
810
  if (!p_obj) return NULL;
811
  return p_obj->tracks_buf;
811
  return p_obj->tracks_buf;
812
}
812
}
813
  
813
814
/*!
814
/*!
815
  Get the itemid for a given list ID. 
815
  Get the itemid for a given list ID.
816
  VCDINFO_REJECTED_MASK is returned on error or if obj is NULL. 
816
  VCDINFO_REJECTED_MASK is returned on error or if obj is NULL.
817
*/
817
*/
818
uint16_t
818
uint16_t
819
vcdinfo_lid_get_itemid(const vcdinfo_obj_t *p_obj, lid_t lid)
819
vcdinfo_lid_get_itemid(const vcdinfo_obj_t *p_obj, lid_t lid)
Lines 840-846 Link Here
840
}
840
}
841
841
842
/*!
842
/*!
843
  Get the LOT pointer. 
843
  Get the LOT pointer.
844
*/
844
*/
845
LotVcd_t *
845
LotVcd_t *
846
vcdinfo_get_lot(const vcdinfo_obj_t *p_obj)
846
vcdinfo_get_lot(const vcdinfo_obj_t *p_obj)
Lines 850-856 Link Here
850
}
850
}
851
851
852
/*!
852
/*!
853
  Get the extended LOT pointer. 
853
  Get the extended LOT pointer.
854
*/
854
*/
855
LotVcd_t *
855
LotVcd_t *
856
vcdinfo_get_lot_x(const vcdinfo_obj_t *p_obj)
856
vcdinfo_get_lot_x(const vcdinfo_obj_t *p_obj)
Lines 858-866 Link Here
858
  if (!p_obj) return NULL;
858
  if (!p_obj) return NULL;
859
  return p_obj->lot_x;
859
  return p_obj->lot_x;
860
}
860
}
861
  
861
862
/*!
862
/*!
863
  Return number of LIDs. 
863
  Return number of LIDs.
864
*/
864
*/
865
lid_t
865
lid_t
866
vcdinfo_get_num_LIDs (const vcdinfo_obj_t *p_obj)
866
vcdinfo_get_num_LIDs (const vcdinfo_obj_t *p_obj)
Lines 892-906 Link Here
892
}
892
}
893
893
894
/*!
894
/*!
895
  \fn vcdinfo_get_offset_lid(const vcdinfo_obj_t *p_obj, 
895
  \fn vcdinfo_get_offset_lid(const vcdinfo_obj_t *p_obj,
896
                             unsigned int entry_num);
896
                             unsigned int entry_num);
897
  \brief Get offset entry_num for a given LID. 
897
  \brief Get offset entry_num for a given LID.
898
  \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
898
  \return VCDINFO_INVALID_OFFSET is returned if obj on error or obj
899
  is NULL. Otherwise the LID offset is returned.
899
  is NULL. Otherwise the LID offset is returned.
900
*/
900
*/
901
uint16_t
901
uint16_t
902
vcdinfo_lid_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
902
vcdinfo_lid_get_offset(const vcdinfo_obj_t *p_obj, lid_t lid,
903
                       unsigned int entry_num) 
903
                       unsigned int entry_num)
904
{
904
{
905
  PsdListDescriptor_t pxd;
905
  PsdListDescriptor_t pxd;
906
906
Lines 923-933 Link Here
923
923
924
}
924
}
925
925
926
/*! 
926
/*!
927
  NULL is returned on error. 
927
  NULL is returned on error.
928
*/
928
*/
929
static vcdinfo_offset_t *
929
static vcdinfo_offset_t *
930
_vcdinfo_get_offset_t (const vcdinfo_obj_t *p_obj, unsigned int offset, 
930
_vcdinfo_get_offset_t (const vcdinfo_obj_t *p_obj, unsigned int offset,
931
                       bool ext)
931
                       bool ext)
932
{
932
{
933
  CdioListNode_t *node;
933
  CdioListNode_t *node;
Lines 940-946 Link Here
940
    return NULL;
940
    return NULL;
941
  default: ;
941
  default: ;
942
  }
942
  }
943
  
943
944
  _CDIO_LIST_FOREACH (node, offset_list)
944
  _CDIO_LIST_FOREACH (node, offset_list)
945
    {
945
    {
946
      vcdinfo_offset_t *p_ofs = _cdio_list_node_data (node);
946
      vcdinfo_offset_t *p_ofs = _cdio_list_node_data (node);
Lines 974-994 Link Here
974
/*!
974
/*!
975
  Get the VCD info offset multiplier.
975
  Get the VCD info offset multiplier.
976
*/
976
*/
977
unsigned int vcdinfo_get_offset_mult(const vcdinfo_obj_t *p_obj) 
977
unsigned int vcdinfo_get_offset_mult(const vcdinfo_obj_t *p_obj)
978
{
978
{
979
  if (!p_obj) return 0xFFFF;
979
  if (!p_obj) return 0xFFFF;
980
  return p_obj->info.offset_mult;
980
  return p_obj->info.offset_mult;
981
}
981
}
982
982
983
/*! 
983
/*!
984
  Get entry in offset list for the item that has offset. This entry 
984
  Get entry in offset list for the item that has offset. This entry
985
  has for example the LID. NULL is returned on error. 
985
  has for example the LID. NULL is returned on error.
986
*/
986
*/
987
vcdinfo_offset_t *
987
vcdinfo_offset_t *
988
vcdinfo_get_offset_t (const vcdinfo_obj_t *p_obj, unsigned int offset)
988
vcdinfo_get_offset_t (const vcdinfo_obj_t *p_obj, unsigned int offset)
989
{
989
{
990
  vcdinfo_offset_t *off_p= _vcdinfo_get_offset_t (p_obj, offset, true);
990
  vcdinfo_offset_t *off_p= _vcdinfo_get_offset_t (p_obj, offset, true);
991
  if (NULL != off_p) 
991
  if (NULL != off_p)
992
    return off_p;
992
    return off_p;
993
  return _vcdinfo_get_offset_t (p_obj, offset, false);
993
  return _vcdinfo_get_offset_t (p_obj, offset, false);
994
}
994
}
Lines 1008-1014 Link Here
1008
  Get the PSD.
1008
  Get the PSD.
1009
*/
1009
*/
1010
uint8_t *
1010
uint8_t *
1011
vcdinfo_get_psd(const vcdinfo_obj_t *p_obj) 
1011
vcdinfo_get_psd(const vcdinfo_obj_t *p_obj)
1012
{
1012
{
1013
  if ( !p_obj ) return NULL;
1013
  if ( !p_obj ) return NULL;
1014
  return p_obj->psd;
1014
  return p_obj->psd;
Lines 1061-1067 Link Here
1061
*/
1061
*/
1062
static bool
1062
static bool
1063
_vcdinfo_lid_get_pxd(const vcdinfo_obj_t *p_obj, PsdListDescriptor_t *pxd,
1063
_vcdinfo_lid_get_pxd(const vcdinfo_obj_t *p_obj, PsdListDescriptor_t *pxd,
1064
                     uint16_t lid, bool ext) 
1064
                     uint16_t lid, bool ext)
1065
{
1065
{
1066
  CdioListNode_t *node;
1066
  CdioListNode_t *node;
1067
  unsigned mult = p_obj->info.offset_mult;
1067
  unsigned mult = p_obj->info.offset_mult;
Lines 1069-1075 Link Here
1069
  CdioList_t *offset_list = ext ? p_obj->offset_x_list : p_obj->offset_list;
1069
  CdioList_t *offset_list = ext ? p_obj->offset_x_list : p_obj->offset_list;
1070
1070
1071
  if (offset_list == NULL) return false;
1071
  if (offset_list == NULL) return false;
1072
  
1072
1073
  _CDIO_LIST_FOREACH (node, offset_list)
1073
  _CDIO_LIST_FOREACH (node, offset_list)
1074
    {
1074
    {
1075
      vcdinfo_offset_t *ofs = _cdio_list_node_data (node);
1075
      vcdinfo_offset_t *ofs = _cdio_list_node_data (node);
Lines 1089-1095 Link Here
1089
          }
1089
          }
1090
1090
1091
        case PSD_TYPE_EXT_SELECTION_LIST:
1091
        case PSD_TYPE_EXT_SELECTION_LIST:
1092
        case PSD_TYPE_SELECTION_LIST: 
1092
        case PSD_TYPE_SELECTION_LIST:
1093
          {
1093
          {
1094
            pxd->psd = (PsdSelectionListDescriptor_t *) (psd + _rofs);
1094
            pxd->psd = (PsdSelectionListDescriptor_t *) (psd + _rofs);
1095
            if (vcdinf_psd_get_lid(pxd->psd) == lid) {
1095
            if (vcdinf_psd_get_lid(pxd->psd) == lid) {
Lines 1118-1125 Link Here
1118
1118
1119
/**
1119
/**
1120
 \fn vcdinfo_get_return_offset(const vcdinfo_obj_t *p_obj);
1120
 \fn vcdinfo_get_return_offset(const vcdinfo_obj_t *p_obj);
1121
 \brief Get return offset for a given LID. 
1121
 \brief Get return offset for a given LID.
1122
 \return  VCDINFO_INVALID_OFFSET is returned on error or if LID has no 
1122
 \return  VCDINFO_INVALID_OFFSET is returned on error or if LID has no
1123
 "return" entry. Otherwise the LID offset is returned.
1123
 "return" entry. Otherwise the LID offset is returned.
1124
 */
1124
 */
1125
uint16_t
1125
uint16_t
Lines 1130-1136 Link Here
1130
    PsdListDescriptor_t pxd;
1130
    PsdListDescriptor_t pxd;
1131
1131
1132
    vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
1132
    vcdinfo_lid_get_pxd(p_obj, &pxd, lid);
1133
    
1133
1134
    switch (pxd.descriptor_type) {
1134
    switch (pxd.descriptor_type) {
1135
    case PSD_TYPE_PLAY_LIST:
1135
    case PSD_TYPE_PLAY_LIST:
1136
      return vcdinf_pld_get_return_offset(pxd.pld);
1136
      return vcdinf_pld_get_return_offset(pxd.pld);
Lines 1143-1154 Link Here
1143
      break;
1143
      break;
1144
    }
1144
    }
1145
  }
1145
  }
1146
  
1146
1147
  return VCDINFO_INVALID_OFFSET;
1147
  return VCDINFO_INVALID_OFFSET;
1148
}
1148
}
1149
1149
1150
/*!
1150
/*!
1151
   Return the audio type for a given segment. 
1151
   Return the audio type for a given segment.
1152
   VCDINFO_INVALID_AUDIO_TYPE is returned on error.
1152
   VCDINFO_INVALID_AUDIO_TYPE is returned on error.
1153
*/
1153
*/
1154
unsigned int
1154
unsigned int
Lines 1180-1186 Link Here
1180
*/
1180
*/
1181
lba_t
1181
lba_t
1182
vcdinfo_get_seg_lba(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1182
vcdinfo_get_seg_lba(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1183
{ 
1183
{
1184
  if (!p_obj) return VCDINFO_NULL_LBA;
1184
  if (!p_obj) return VCDINFO_NULL_LBA;
1185
  return cdio_lsn_to_lba(vcdinfo_get_seg_lsn(p_obj, i_seg));
1185
  return cdio_lsn_to_lba(vcdinfo_get_seg_lsn(p_obj, i_seg));
1186
}
1186
}
Lines 1192-1198 Link Here
1192
*/
1192
*/
1193
lsn_t
1193
lsn_t
1194
vcdinfo_get_seg_lsn(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1194
vcdinfo_get_seg_lsn(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1195
{ 
1195
{
1196
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1196
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1197
    return VCDINFO_NULL_LSN;
1197
    return VCDINFO_NULL_LSN;
1198
  return p_obj->first_segment_lsn + (VCDINFO_SEGMENT_SECTOR_SIZE * i_seg);
1198
  return p_obj->first_segment_lsn + (VCDINFO_SEGMENT_SECTOR_SIZE * i_seg);
Lines 1205-1211 Link Here
1205
*/
1205
*/
1206
const msf_t *
1206
const msf_t *
1207
vcdinfo_get_seg_msf(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1207
vcdinfo_get_seg_msf(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1208
{ 
1208
{
1209
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1209
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1210
    return NULL;
1210
    return NULL;
1211
  else {
1211
  else {
Lines 1223-1234 Link Here
1223
vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg,
1223
vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg,
1224
                           /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y)
1224
                           /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y)
1225
{
1225
{
1226
  vcdinfo_video_segment_type_t segtype 
1226
  vcdinfo_video_segment_type_t segtype
1227
    = vcdinfo_get_video_type(p_vcdinfo, i_seg);
1227
    = vcdinfo_get_video_type(p_vcdinfo, i_seg);
1228
  segnum_t i_segs = vcdinfo_get_num_segments(p_vcdinfo);
1228
  segnum_t i_segs = vcdinfo_get_num_segments(p_vcdinfo);
1229
  
1229
1230
  if (i_seg >= i_segs) return;
1230
  if (i_seg >= i_segs) return;
1231
      
1231
1232
  switch (segtype) {
1232
  switch (segtype) {
1233
  case VCDINFO_FILES_VIDEO_NTSC_STILL:
1233
  case VCDINFO_FILES_VIDEO_NTSC_STILL:
1234
    *max_x = 704;
1234
    *max_x = 704;
Lines 1272-1279 Link Here
1272
}
1272
}
1273
1273
1274
1274
1275
  
1275
1276
/*!  
1276
/*!
1277
  Return the number of sectors for segment
1277
  Return the number of sectors for segment
1278
  entry_num in obj.  0 is returned if there is no entry.
1278
  entry_num in obj.  0 is returned if there is no entry.
1279
1279
Lines 1282-1292 Link Here
1282
1282
1283
  If an item has been broken up into a number of "continued" segments,
1283
  If an item has been broken up into a number of "continued" segments,
1284
  we will report the item size for the first segment and 0 for the
1284
  we will report the item size for the first segment and 0 for the
1285
  remaining ones. We may revisit this decision later. 
1285
  remaining ones. We may revisit this decision later.
1286
*/
1286
*/
1287
uint32_t
1287
uint32_t
1288
vcdinfo_get_seg_sector_count(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1288
vcdinfo_get_seg_sector_count(const vcdinfo_obj_t *p_obj, segnum_t i_seg)
1289
{ 
1289
{
1290
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1290
  if (!p_obj || i_seg >= vcdinfo_get_num_segments(p_obj))
1291
    return 0;
1291
    return 0;
1292
  return p_obj->seg_sizes[i_seg];
1292
  return p_obj->seg_sizes[i_seg];
Lines 1304-1313 Link Here
1304
}
1304
}
1305
1305
1306
/*!
1306
/*!
1307
  Return the track number for entry n in obj. 
1307
  Return the track number for entry n in obj.
1308
  
1308
1309
  In contrast to libcdio we start numbering at 0 which is the
1309
  In contrast to libcdio we start numbering at 0 which is the
1310
  ISO9660 and metadata information for the Video CD. Thus track 
1310
  ISO9660 and metadata information for the Video CD. Thus track
1311
  1 is the first track the first complete MPEG track generally.
1311
  1 is the first track the first complete MPEG track generally.
1312
*/
1312
*/
1313
track_t
1313
track_t
Lines 1321-1327 Link Here
1321
}
1321
}
1322
1322
1323
/*!
1323
/*!
1324
   Return the audio type for a given track. 
1324
   Return the audio type for a given track.
1325
   VCDINFO_INVALID_AUDIO_TYPE is returned on error.
1325
   VCDINFO_INVALID_AUDIO_TYPE is returned on error.
1326
1326
1327
   Note: track 1 is usually the first track.
1327
   Note: track 1 is usually the first track.
Lines 1339-1351 Link Here
1339
  return(tracks2->contents[i_track-1].audio);
1339
  return(tracks2->contents[i_track-1].audio);
1340
}
1340
}
1341
1341
1342
/*!  
1342
/*!
1343
  Return the highest track number in the current medium. 
1343
  Return the highest track number in the current medium.
1344
  
1344
1345
  Because we track start numbering at 0 (which is the ISO 9660 track
1345
  Because we track start numbering at 0 (which is the ISO 9660 track
1346
  containing Video CD naviagion and disk information), this is one
1346
  containing Video CD naviagion and disk information), this is one
1347
  less than the number of tracks.
1347
  less than the number of tracks.
1348
  
1348
1349
    If there are no tracks, we return -1.
1349
    If there are no tracks, we return -1.
1350
*/
1350
*/
1351
unsigned int
1351
unsigned int
Lines 1357-1365 Link Here
1357
}
1357
}
1358
1358
1359
1359
1360
/*!  
1360
/*!
1361
  Return the starting LBA (logical block address) for track number
1361
  Return the starting LBA (logical block address) for track number
1362
  i_track in obj.  
1362
  i_track in obj.
1363
1363
1364
  The IS0-9660 filesystem track has number 0. Tracks associated
1364
  The IS0-9660 filesystem track has number 0. Tracks associated
1365
  with playable entries numbers start at 1.
1365
  with playable entries numbers start at 1.
Lines 1368-1387 Link Here
1368
  using i_track LEADOUT_TRACK or the total tracks+1.
1368
  using i_track LEADOUT_TRACK or the total tracks+1.
1369
  VCDINFO_NULL_LBA is returned on failure.
1369
  VCDINFO_NULL_LBA is returned on failure.
1370
*/
1370
*/
1371
lba_t 
1371
lba_t
1372
vcdinfo_get_track_lba(const vcdinfo_obj_t *p_obj, track_t i_track)
1372
vcdinfo_get_track_lba(const vcdinfo_obj_t *p_obj, track_t i_track)
1373
{
1373
{
1374
  if (!p_obj || !p_obj->img)
1374
  if (!p_obj || !p_obj->img)
1375
    return VCDINFO_NULL_LBA;
1375
    return VCDINFO_NULL_LBA;
1376
  
1376
1377
1377
1378
  /* CdIo tracks start at 1 rather than 0. */
1378
  /* CdIo tracks start at 1 rather than 0. */
1379
  return cdio_get_track_lba(p_obj->img, i_track+1);
1379
  return cdio_get_track_lba(p_obj->img, i_track+1);
1380
}
1380
}
1381
1381
1382
/*!  
1382
/*!
1383
  Return the starting LSN (logical sector number) for track number
1383
  Return the starting LSN (logical sector number) for track number
1384
  i_track in obj.  
1384
  i_track in obj.
1385
1385
1386
  The IS0-9660 filesystem track has number 0. Tracks associated
1386
  The IS0-9660 filesystem track has number 0. Tracks associated
1387
  with playable entries numbers start at 1.
1387
  with playable entries numbers start at 1.
Lines 1390-1396 Link Here
1390
  using i_track LEADOUT_TRACK or the total tracks+1.
1390
  using i_track LEADOUT_TRACK or the total tracks+1.
1391
  VCDINFO_NULL_LBA is returned on failure.
1391
  VCDINFO_NULL_LBA is returned on failure.
1392
*/
1392
*/
1393
lsn_t 
1393
lsn_t
1394
vcdinfo_get_track_lsn(const vcdinfo_obj_t *p_obj, track_t i_track)
1394
vcdinfo_get_track_lsn(const vcdinfo_obj_t *p_obj, track_t i_track)
1395
{
1395
{
1396
  if (!p_obj || !p_obj->img)
1396
  if (!p_obj || !p_obj->img)
Lines 1400-1406 Link Here
1400
  return cdio_get_track_lsn(p_obj->img, i_track+1);
1400
  return cdio_get_track_lsn(p_obj->img, i_track+1);
1401
}
1401
}
1402
1402
1403
/*!  
1403
/*!
1404
  Return the ending LSN for track number
1404
  Return the ending LSN for track number
1405
  i_track in cdio.  VCDINFO_NULL_LSN is returned on error.
1405
  i_track in cdio.  VCDINFO_NULL_LSN is returned on error.
1406
*/
1406
*/
Lines 1413-1421 Link Here
1413
  return cdio_get_track_last_lsn(p_obj->img, i_track+1);
1413
  return cdio_get_track_last_lsn(p_obj->img, i_track+1);
1414
}
1414
}
1415
1415
1416
/*!  
1416
/*!
1417
  Return the starting MSF (minutes/secs/frames) for track number
1417
  Return the starting MSF (minutes/secs/frames) for track number
1418
  i_track in obj.  
1418
  i_track in obj.
1419
1419
1420
  The IS0-9660 filesystem track has number 0. Tracks associated
1420
  The IS0-9660 filesystem track has number 0. Tracks associated
1421
  with playable entries numbers start at 1.
1421
  with playable entries numbers start at 1.
Lines 1432-1438 Link Here
1432
1432
1433
  if (!p_obj || !p_obj->img)
1433
  if (!p_obj || !p_obj->img)
1434
    return 1;
1434
    return 1;
1435
  
1435
1436
  /* CdIo tracks start at 1 rather than 0. */
1436
  /* CdIo tracks start at 1 rather than 0. */
1437
  if (cdio_get_track_msf(p_obj->img, i_track+1, &msf)) {
1437
  if (cdio_get_track_msf(p_obj->img, i_track+1, &msf)) {
1438
    *min   = cdio_from_bcd8(msf.m);
1438
    *min   = cdio_from_bcd8(msf.m);
Lines 1440-1451 Link Here
1440
    *frame = cdio_from_bcd8(msf.f);
1440
    *frame = cdio_from_bcd8(msf.f);
1441
    return 0;
1441
    return 0;
1442
  }
1442
  }
1443
  
1443
1444
  return 1;
1444
  return 1;
1445
}
1445
}
1446
1446
1447
/*!
1447
/*!
1448
  Return the size in sectors for track n. 
1448
  Return the size in sectors for track n.
1449
1449
1450
  The IS0-9660 filesystem track has number 0. Tracks associated
1450
  The IS0-9660 filesystem track has number 0. Tracks associated
1451
  with playable entries numbers start at 1.
1451
  with playable entries numbers start at 1.
Lines 1455-1470 Link Here
1455
1455
1456
*/
1456
*/
1457
unsigned int
1457
unsigned int
1458
vcdinfo_get_track_sect_count(const vcdinfo_obj_t *p_obj, 
1458
vcdinfo_get_track_sect_count(const vcdinfo_obj_t *p_obj,
1459
                             const track_t i_track)
1459
                             const track_t i_track)
1460
{
1460
{
1461
  if (!p_obj || VCDINFO_INVALID_TRACK == i_track) 
1461
  if (!p_obj || VCDINFO_INVALID_TRACK == i_track)
1462
    return 0;
1462
    return 0;
1463
  
1463
1464
  {
1464
  {
1465
    iso9660_stat_t *p_statbuf;
1465
    iso9660_stat_t *p_statbuf;
1466
    const lsn_t lsn = vcdinfo_get_track_lsn(p_obj, i_track);
1466
    const lsn_t lsn = vcdinfo_get_track_lsn(p_obj, i_track);
1467
    
1467
1468
    /* Try to get the sector count from the ISO 9660 filesystem */
1468
    /* Try to get the sector count from the ISO 9660 filesystem */
1469
    if (p_obj->has_xa && (p_statbuf = iso9660_find_fs_lsn(p_obj->img, lsn))) {
1469
    if (p_obj->has_xa && (p_statbuf = iso9660_find_fs_lsn(p_obj->img, lsn))) {
1470
      unsigned int secsize = p_statbuf->secsize;
1470
      unsigned int secsize = p_statbuf->secsize;
Lines 1491-1516 Link Here
1491
unsigned int
1491
unsigned int
1492
vcdinfo_get_track_size(const vcdinfo_obj_t *p_obj, track_t i_track)
1492
vcdinfo_get_track_size(const vcdinfo_obj_t *p_obj, track_t i_track)
1493
{
1493
{
1494
  if (NULL == p_obj || VCDINFO_INVALID_TRACK == i_track) 
1494
  if (NULL == p_obj || VCDINFO_INVALID_TRACK == i_track)
1495
    return 0;
1495
    return 0;
1496
  
1496
1497
  {
1497
  {
1498
    const lsn_t lsn = cdio_lba_to_lsn(vcdinfo_get_track_lba(p_obj, 
1498
    const lsn_t lsn = cdio_lba_to_lsn(vcdinfo_get_track_lba(p_obj,
1499
                                                            i_track));
1499
                                                            i_track));
1500
    
1500
1501
    /* Try to get the sector count from the ISO 9660 filesystem */
1501
    /* Try to get the sector count from the ISO 9660 filesystem */
1502
    if (p_obj->has_xa) {
1502
    if (p_obj->has_xa) {
1503
      iso9660_stat_t *p_statbuf;
1503
      iso9660_stat_t *p_statbuf;
1504
      p_statbuf = iso9660_find_fs_lsn(p_obj->img, lsn);
1504
      p_statbuf = iso9660_find_fs_lsn(p_obj->img, lsn);
1505
      return p_statbuf->size;
1505
      return p_statbuf->size;
1506
    } 
1506
    }
1507
#if 0
1507
#if 0
1508
    else {
1508
    else {
1509
      /* Failed on ISO 9660 filesystem. Use track information.  */
1509
      /* Failed on ISO 9660 filesystem. Use track information.  */
1510
      if (p_obj->img != NULL) 
1510
      if (p_obj->img != NULL)
1511
        return cdio_get_track_size(p_obj->img);
1511
        return cdio_get_track_size(p_obj->img);
1512
    }
1512
    }
1513
#endif 
1513
#endif
1514
  }
1514
  }
1515
  return 0;
1515
  return 0;
1516
}
1516
}
Lines 1536-1551 Link Here
1536
  \brief Get the kind of VCD that p_obj refers to.
1536
  \brief Get the kind of VCD that p_obj refers to.
1537
*/
1537
*/
1538
vcd_type_t
1538
vcd_type_t
1539
vcdinfo_get_VCD_type(const vcdinfo_obj_t *p_obj) 
1539
vcdinfo_get_VCD_type(const vcdinfo_obj_t *p_obj)
1540
{
1540
{
1541
  if (NULL == p_obj) return VCD_TYPE_INVALID;
1541
  if (NULL == p_obj) return VCD_TYPE_INVALID;
1542
  return p_obj->vcd_type;
1542
  return p_obj->vcd_type;
1543
}
1543
}
1544
1544
1545
  
1545
1546
/*!
1546
/*!
1547
  Return the VCD volume count - the number of CD's in the collection.
1547
  Return the VCD volume count - the number of CD's in the collection.
1548
  O is returned if there is some problem in getting this. 
1548
  O is returned if there is some problem in getting this.
1549
*/
1549
*/
1550
unsigned int
1550
unsigned int
1551
vcdinfo_get_volume_count(const vcdinfo_obj_t *p_obj)
1551
vcdinfo_get_volume_count(const vcdinfo_obj_t *p_obj)
Lines 1556-1562 Link Here
1556
1556
1557
/*!
1557
/*!
1558
  Return the VCD ID.
1558
  Return the VCD ID.
1559
  NULL is returned if there is some problem in getting this. 
1559
  NULL is returned if there is some problem in getting this.
1560
*/
1560
*/
1561
const char *
1561
const char *
1562
vcdinfo_get_volume_id(const vcdinfo_obj_t *p_obj)
1562
vcdinfo_get_volume_id(const vcdinfo_obj_t *p_obj)
Lines 1572-1578 Link Here
1572
1572
1573
/*!
1573
/*!
1574
  Return the VCD volumeset ID.
1574
  Return the VCD volumeset ID.
1575
  NULL is returned if there is some problem in getting this. 
1575
  NULL is returned if there is some problem in getting this.
1576
*/
1576
*/
1577
const char *
1577
const char *
1578
vcdinfo_get_volumeset_id(const vcdinfo_obj_t *p_obj)
1578
vcdinfo_get_volumeset_id(const vcdinfo_obj_t *p_obj)
Lines 1586-1592 Link Here
1586
/*!
1586
/*!
1587
  Return the VCD volume num - the number of the CD in the collection.
1587
  Return the VCD volume num - the number of the CD in the collection.
1588
  This is a number between 1 and the volume count.
1588
  This is a number between 1 and the volume count.
1589
  O is returned if there is some problem in getting this. 
1589
  O is returned if there is some problem in getting this.
1590
*/
1590
*/
1591
unsigned int
1591
unsigned int
1592
vcdinfo_get_volume_num(const vcdinfo_obj_t *p_obj)
1592
vcdinfo_get_volume_num(const vcdinfo_obj_t *p_obj)
Lines 1608-1629 Link Here
1608
}
1608
}
1609
1609
1610
/*!
1610
/*!
1611
  Return true is there is playback control. 
1611
  Return true is there is playback control.
1612
*/
1612
*/
1613
bool
1613
bool
1614
vcdinfo_has_pbc (const vcdinfo_obj_t *p_obj) 
1614
vcdinfo_has_pbc (const vcdinfo_obj_t *p_obj)
1615
{
1615
{
1616
  return (p_obj && p_obj->info.psd_size!=0);
1616
  return (p_obj && p_obj->info.psd_size!=0);
1617
}
1617
}
1618
  
1618
1619
/*! 
1619
/*!
1620
  Return true if VCD has "extended attributes" (XA). Extended attributes
1620
  Return true if VCD has "extended attributes" (XA). Extended attributes
1621
  add meta-data attributes to a entries of file describing the file.
1621
  add meta-data attributes to a entries of file describing the file.
1622
  See also cdio_get_xa_attr_str() which returns a string similar to
1622
  See also cdio_get_xa_attr_str() which returns a string similar to
1623
  a string you might get on a Unix filesystem listing ("ls").
1623
  a string you might get on a Unix filesystem listing ("ls").
1624
*/
1624
*/
1625
bool
1625
bool
1626
vcdinfo_has_xa(const vcdinfo_obj_t *p_obj) 
1626
vcdinfo_has_xa(const vcdinfo_obj_t *p_obj)
1627
{
1627
{
1628
  return p_obj->has_xa;
1628
  return p_obj->has_xa;
1629
}
1629
}
Lines 1665-1674 Link Here
1665
  ofs = _vcdinfo_get_offset_t(p_obj, offset, ext);
1665
  ofs = _vcdinfo_get_offset_t(p_obj, offset, ext);
1666
  if (ofs != NULL) {
1666
  if (ofs != NULL) {
1667
    if (ofs->lid)
1667
    if (ofs->lid)
1668
      snprintf (buf, BUF_SIZE, "LID[%d] @0x%4.4x", 
1668
      snprintf (buf, BUF_SIZE, "LID[%d] @0x%4.4x",
1669
                ofs->lid, ofs->offset);
1669
                ofs->lid, ofs->offset);
1670
    else 
1670
    else
1671
      snprintf (buf, BUF_SIZE, "PSD[?] @0x%4.4x", 
1671
      snprintf (buf, BUF_SIZE, "PSD[?] @0x%4.4x",
1672
                ofs->offset);
1672
                ofs->offset);
1673
  } else {
1673
  } else {
1674
    snprintf (buf, BUF_SIZE, "? @0x%4.4x", offset);
1674
    snprintf (buf, BUF_SIZE, "? @0x%4.4x", offset);
Lines 1692-1709 Link Here
1692
      free(p_obj->lot);
1692
      free(p_obj->lot);
1693
      p_obj->lot = calloc(1, ISO_BLOCKSIZE * LOT_VCD_SIZE);
1693
      p_obj->lot = calloc(1, ISO_BLOCKSIZE * LOT_VCD_SIZE);
1694
      free(p_obj->psd);
1694
      free(p_obj->psd);
1695
      p_obj->psd = calloc(1, ISO_BLOCKSIZE * _vcd_len2blocks (psd_size, 
1695
      p_obj->psd = calloc(1, ISO_BLOCKSIZE * _vcd_len2blocks (psd_size,
1696
                                                               ISO_BLOCKSIZE));
1696
                                                               ISO_BLOCKSIZE));
1697
      
1697
1698
      if (cdio_read_mode2_sectors (p_obj->img, (void *) p_obj->lot, LOT_VCD_SECTOR,
1698
      if (cdio_read_mode2_sectors (p_obj->img, (void *) p_obj->lot, LOT_VCD_SECTOR,
1699
                                   false, LOT_VCD_SIZE))
1699
                                   false, LOT_VCD_SIZE))
1700
        return false;
1700
        return false;
1701
          
1701
1702
      if (cdio_read_mode2_sectors (p_obj->img, (void *) p_obj->psd, PSD_VCD_SECTOR,
1702
      if (cdio_read_mode2_sectors (p_obj->img, (void *) p_obj->psd, PSD_VCD_SECTOR,
1703
                                   false, _vcd_len2blocks (psd_size, 
1703
                                   false, _vcd_len2blocks (psd_size,
1704
                                                           ISO_BLOCKSIZE)))
1704
                                                           ISO_BLOCKSIZE)))
1705
        return false;
1705
        return false;
1706
  
1706
1707
    } else {
1707
    } else {
1708
      return false;
1708
      return false;
1709
    }
1709
    }
Lines 1711-1726 Link Here
1711
}
1711
}
1712
1712
1713
/*!  Return the entry number for the given track.  */
1713
/*!  Return the entry number for the given track.  */
1714
unsigned int 
1714
unsigned int
1715
vcdinfo_track_get_entry(const vcdinfo_obj_t *p_obj, track_t i_track) 
1715
vcdinfo_track_get_entry(const vcdinfo_obj_t *p_obj, track_t i_track)
1716
{
1716
{
1717
  /* FIXME: Add structure to directly map track to first entry number. 
1717
  /* FIXME: Add structure to directly map track to first entry number.
1718
     Until then...
1718
     Until then...
1719
   */
1719
   */
1720
  lsn_t lsn= vcdinfo_get_track_lsn(p_obj, i_track);
1720
  lsn_t lsn= vcdinfo_get_track_lsn(p_obj, i_track);
1721
  return vcdinfo_lsn_get_entry(p_obj, lsn);
1721
  return vcdinfo_lsn_get_entry(p_obj, lsn);
1722
}
1722
}
1723
  
1723
1724
/*!
1724
/*!
1725
   Calls recursive routine to populate obj->offset_list or obj->offset_x_list
1725
   Calls recursive routine to populate obj->offset_list or obj->offset_x_list
1726
   by going through LOT.
1726
   by going through LOT.
Lines 1746-1756 Link Here
1746
  pbc_ctx.extended      = extended;
1746
  pbc_ctx.extended      = extended;
1747
1747
1748
  ret = vcdinf_visit_lot(&pbc_ctx);
1748
  ret = vcdinf_visit_lot(&pbc_ctx);
1749
  if (NULL != p_obj->offset_x_list) 
1749
  if (NULL != p_obj->offset_x_list)
1750
    _cdio_list_free(p_obj->offset_x_list, true);
1750
    _cdio_list_free(p_obj->offset_x_list, true, NULL);
1751
  p_obj->offset_x_list = pbc_ctx.offset_x_list;
1751
  p_obj->offset_x_list = pbc_ctx.offset_x_list;
1752
  if (NULL != p_obj->offset_list) 
1752
  if (NULL != p_obj->offset_list)
1753
    _cdio_list_free(p_obj->offset_list, true);
1753
    _cdio_list_free(p_obj->offset_list, true, NULL);
1754
  p_obj->offset_list = pbc_ctx.offset_list;
1754
  p_obj->offset_list = pbc_ctx.offset_list;
1755
  return ret;
1755
  return ret;
1756
}
1756
}
Lines 1792-1798 Link Here
1792
}
1792
}
1793
1793
1794
/*!
1794
/*!
1795
   Nulls/zeros vcdinfo_obj_t structures; The caller should have 
1795
   Nulls/zeros vcdinfo_obj_t structures; The caller should have
1796
   ensured that p_obj != NULL.
1796
   ensured that p_obj != NULL.
1797
   routines using p_obj are called.
1797
   routines using p_obj are called.
1798
*/
1798
*/
Lines 1811-1817 Link Here
1811
   Initialize the vcdinfo structure "obj". Should be done before other
1811
   Initialize the vcdinfo structure "obj". Should be done before other
1812
   routines using p_obj are called.
1812
   routines using p_obj are called.
1813
*/
1813
*/
1814
bool 
1814
bool
1815
vcdinfo_init(vcdinfo_obj_t *p_obj)
1815
vcdinfo_init(vcdinfo_obj_t *p_obj)
1816
{
1816
{
1817
  if (NULL == p_obj) return false;
1817
  if (NULL == p_obj) return false;
Lines 1823-1849 Link Here
1823
   Set up vcdinfo structure "p_obj" for reading from a particular
1823
   Set up vcdinfo structure "p_obj" for reading from a particular
1824
   medium. This should be done before after initialization but before
1824
   medium. This should be done before after initialization but before
1825
   any routines that need to retrieve data.
1825
   any routines that need to retrieve data.
1826
 
1826
1827
   source_name is the device or file to use for inspection, and
1827
   source_name is the device or file to use for inspection, and
1828
   source_type indicates what driver to use or class of drivers in the
1828
   source_type indicates what driver to use or class of drivers in the
1829
   case of DRIVER_DEVICE.
1829
   case of DRIVER_DEVICE.
1830
   access_mode gives the CD access method for reading should the driver
1830
   access_mode gives the CD access method for reading should the driver
1831
   allow for more than one kind of access method (e.g. MMC versus ioctl
1831
   allow for more than one kind of access method (e.g. MMC versus ioctl
1832
   on GNU/Linux)
1832
   on GNU/Linux)
1833
    
1833
1834
   If source_name is NULL we'll fill in the appropriate default device
1834
   If source_name is NULL we'll fill in the appropriate default device
1835
   name for the given source_type. However if in addtion source_type is
1835
   name for the given source_type. However if in addtion source_type is
1836
   DRIVER_UNKNOWN, then we'll scan for a drive containing a VCD.
1836
   DRIVER_UNKNOWN, then we'll scan for a drive containing a VCD.
1837
    
1837
1838
   VCDINFO_OPEN_VCD is returned if everything went okay; 
1838
   VCDINFO_OPEN_VCD is returned if everything went okay;
1839
   VCDINFO_OPEN_ERROR if there was an error and VCDINFO_OPEN_OTHER if the
1839
   VCDINFO_OPEN_ERROR if there was an error and VCDINFO_OPEN_OTHER if the
1840
   medium is something other than a VCD.
1840
   medium is something other than a VCD.
1841
1841
1842
   Only if VCDINFO_OPEN_VCD is returned, the caller needs free the
1842
   Only if VCDINFO_OPEN_VCD is returned, the caller needs free the
1843
   vcdinfo_obj_t. 
1843
   vcdinfo_obj_t.
1844
 */
1844
 */
1845
vcdinfo_open_return_t
1845
vcdinfo_open_return_t
1846
vcdinfo_open(vcdinfo_obj_t **pp_obj, char *source_name[], 
1846
vcdinfo_open(vcdinfo_obj_t **pp_obj, char *source_name[],
1847
             driver_id_t source_type, const char access_mode[])
1847
             driver_id_t source_type, const char access_mode[])
1848
{
1848
{
1849
  CdIo_t *p_cdio;
1849
  CdIo_t *p_cdio;
Lines 1856-1862 Link Here
1856
   */
1856
   */
1857
  if (NULL == *source_name && source_type == DRIVER_UNKNOWN) {
1857
  if (NULL == *source_name && source_type == DRIVER_UNKNOWN) {
1858
    char **cd_drives=NULL;
1858
    char **cd_drives=NULL;
1859
    cd_drives = cdio_get_devices_with_cap_ret(NULL, 
1859
    cd_drives = cdio_get_devices_with_cap_ret(NULL,
1860
                (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD
1860
                (CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD|CDIO_FS_ANAL_VIDEOCD
1861
                |CDIO_FS_UNKNOWN),
1861
                |CDIO_FS_UNKNOWN),
1862
                                              true, &source_type);
1862
                                              true, &source_type);
Lines 1873-1880 Link Here
1873
  }
1873
  }
1874
1874
1875
  *pp_obj = p_obj;
1875
  *pp_obj = p_obj;
1876
  
1876
1877
  if (access_mode != NULL) 
1877
  if (access_mode != NULL)
1878
    cdio_set_arg (p_cdio, "access-mode", access_mode);
1878
    cdio_set_arg (p_cdio, "access-mode", access_mode);
1879
1879
1880
  if (NULL == *source_name) {
1880
  if (NULL == *source_name) {
Lines 1883-1906 Link Here
1883
      goto err_return;
1883
      goto err_return;
1884
    }
1884
    }
1885
  }
1885
  }
1886
    
1886
1887
  memset (p_obj, 0, sizeof (vcdinfo_obj_t));
1887
  memset (p_obj, 0, sizeof (vcdinfo_obj_t));
1888
  p_obj->img = p_cdio;  /* Note we do this after the above wipeout! */
1888
  p_obj->img = p_cdio;  /* Note we do this after the above wipeout! */
1889
1889
1890
  if (!iso9660_fs_read_pvd(p_obj->img, &(p_obj->pvd))) {
1890
  if (!iso9660_fs_read_pvd(p_obj->img, &(p_obj->pvd))) {
1891
    goto err_return;
1891
    goto err_return;
1892
  }
1892
  }
1893
  
1893
1894
  /* Determine if VCD has XA attributes. */
1894
  /* Determine if VCD has XA attributes. */
1895
  {
1895
  {
1896
    
1896
1897
    iso9660_pvd_t const *pvd = &p_obj->pvd;
1897
    iso9660_pvd_t const *pvd = &p_obj->pvd;
1898
    
1898
1899
    p_obj->has_xa = !strncmp ((char *) pvd + ISO_XA_MARKER_OFFSET, 
1899
    p_obj->has_xa = !strncmp ((char *) pvd + ISO_XA_MARKER_OFFSET,
1900
                            ISO_XA_MARKER_STRING, 
1900
                            ISO_XA_MARKER_STRING,
1901
                           strlen (ISO_XA_MARKER_STRING));
1901
                           strlen (ISO_XA_MARKER_STRING));
1902
  }
1902
  }
1903
    
1903
1904
  if (!read_info(p_obj->img, &(p_obj->info), &(p_obj->vcd_type)))
1904
  if (!read_info(p_obj->img, &(p_obj->info), &(p_obj->vcd_type)))
1905
    goto other_return;
1905
    goto other_return;
1906
1906
Lines 1909-1915 Link Here
1909
1909
1910
  if (!read_entries(p_obj->img, &(p_obj->entries)))
1910
  if (!read_entries(p_obj->img, &(p_obj->entries)))
1911
    goto other_return;
1911
    goto other_return;
1912
  
1912
1913
  {
1913
  {
1914
    size_t len = strlen(*source_name)+1;
1914
    size_t len = strlen(*source_name)+1;
1915
    p_obj->source_name = (char *) malloc(len * sizeof(char));
1915
    p_obj->source_name = (char *) malloc(len * sizeof(char));
Lines 1918-1936 Link Here
1918
1918
1919
  if (p_obj->vcd_type == VCD_TYPE_SVCD || p_obj->vcd_type == VCD_TYPE_HQVCD) {
1919
  if (p_obj->vcd_type == VCD_TYPE_SVCD || p_obj->vcd_type == VCD_TYPE_HQVCD) {
1920
    statbuf = iso9660_fs_stat (p_obj->img, "MPEGAV");
1920
    statbuf = iso9660_fs_stat (p_obj->img, "MPEGAV");
1921
    
1921
1922
    if (NULL != statbuf) {
1922
    if (NULL != statbuf) {
1923
      vcd_warn ("non compliant /MPEGAV folder detected!");
1923
      vcd_warn ("non compliant /MPEGAV folder detected!");
1924
      free(statbuf);
1924
      free(statbuf);
1925
    }
1925
    }
1926
    
1926
1927
1927
1928
    statbuf = iso9660_fs_stat (p_obj->img, "SVCD/TRACKS.SVD;1");
1928
    statbuf = iso9660_fs_stat (p_obj->img, "SVCD/TRACKS.SVD;1");
1929
    if (NULL != statbuf) {
1929
    if (NULL != statbuf) {
1930
      lsn_t lsn = statbuf->lsn;
1930
      lsn_t lsn = statbuf->lsn;
1931
      if (statbuf->size != ISO_BLOCKSIZE)
1931
      if (statbuf->size != ISO_BLOCKSIZE)
1932
        vcd_warn ("TRACKS.SVD filesize != %d!", ISO_BLOCKSIZE);
1932
        vcd_warn ("TRACKS.SVD filesize != %d!", ISO_BLOCKSIZE);
1933
      
1933
1934
      p_obj->tracks_buf = calloc(1, ISO_BLOCKSIZE);
1934
      p_obj->tracks_buf = calloc(1, ISO_BLOCKSIZE);
1935
1935
1936
      free(statbuf);
1936
      free(statbuf);
Lines 1938-1949 Link Here
1938
        goto err_return;
1938
        goto err_return;
1939
    }
1939
    }
1940
  }
1940
  }
1941
      
1941
1942
  _init_segments (p_obj);
1942
  _init_segments (p_obj);
1943
1943
1944
  switch (p_obj->vcd_type) {
1944
  switch (p_obj->vcd_type) {
1945
  case VCD_TYPE_VCD2: {
1945
  case VCD_TYPE_VCD2: {
1946
    /* FIXME: Can reduce CD reads by using 
1946
    /* FIXME: Can reduce CD reads by using
1947
       iso9660_fs_readdir(img, "EXT", true) and then scanning for
1947
       iso9660_fs_readdir(img, "EXT", true) and then scanning for
1948
       the files listed below.
1948
       the files listed below.
1949
    */
1949
    */
Lines 1954-1961 Link Here
1954
1954
1955
      p_obj->psd_x       = calloc(1, ISO_BLOCKSIZE * secsize);
1955
      p_obj->psd_x       = calloc(1, ISO_BLOCKSIZE * secsize);
1956
      p_obj->psd_x_size  = statbuf->size;
1956
      p_obj->psd_x_size  = statbuf->size;
1957
      
1957
1958
      vcd_debug ("found /EXT/PSD_X.VCD at sector %lu", 
1958
      vcd_debug ("found /EXT/PSD_X.VCD at sector %lu",
1959
                 (long unsigned int) lsn);
1959
                 (long unsigned int) lsn);
1960
1960
1961
      free(statbuf);
1961
      free(statbuf);
Lines 1968-1990 Link Here
1968
      lsn_t lsn        = statbuf->lsn;
1968
      lsn_t lsn        = statbuf->lsn;
1969
      uint32_t secsize = statbuf->secsize;
1969
      uint32_t secsize = statbuf->secsize;
1970
      p_obj->lot_x       = calloc(1, ISO_BLOCKSIZE * secsize);
1970
      p_obj->lot_x       = calloc(1, ISO_BLOCKSIZE * secsize);
1971
      
1971
1972
      vcd_debug ("found /EXT/LOT_X.VCD at sector %lu", 
1972
      vcd_debug ("found /EXT/LOT_X.VCD at sector %lu",
1973
                 (unsigned long int) lsn);
1973
                 (unsigned long int) lsn);
1974
        
1974
1975
      if (statbuf->size != LOT_VCD_SIZE * ISO_BLOCKSIZE)
1975
      if (statbuf->size != LOT_VCD_SIZE * ISO_BLOCKSIZE)
1976
        vcd_warn ("LOT_X.VCD size != 65535");
1976
        vcd_warn ("LOT_X.VCD size != 65535");
1977
1977
1978
      free(statbuf);
1978
      free(statbuf);
1979
      if (cdio_read_mode2_sectors (p_cdio, p_obj->lot_x, lsn, false, secsize))
1979
      if (cdio_read_mode2_sectors (p_cdio, p_obj->lot_x, lsn, false, secsize))
1980
        goto err_return;
1980
        goto err_return;
1981
      
1981
1982
    }
1982
    }
1983
    break;
1983
    break;
1984
  }
1984
  }
1985
  case VCD_TYPE_SVCD: 
1985
  case VCD_TYPE_SVCD:
1986
  case VCD_TYPE_HQVCD: {
1986
  case VCD_TYPE_HQVCD: {
1987
    /* FIXME: Can reduce CD reads by using 
1987
    /* FIXME: Can reduce CD reads by using
1988
       iso9660_fs_readdir(p_cdio, "SVCD", true) and then scanning for
1988
       iso9660_fs_readdir(p_cdio, "SVCD", true) and then scanning for
1989
       the files listed below.
1989
       the files listed below.
1990
    */
1990
    */
Lines 1993-2008 Link Here
1993
      vcd_warn ("non compliant /MPEGAV folder detected!");
1993
      vcd_warn ("non compliant /MPEGAV folder detected!");
1994
      free(statbuf);
1994
      free(statbuf);
1995
    }
1995
    }
1996
    
1996
1997
    statbuf = iso9660_fs_stat (p_cdio, "SVCD/TRACKS.SVD;1");
1997
    statbuf = iso9660_fs_stat (p_cdio, "SVCD/TRACKS.SVD;1");
1998
    if (NULL == statbuf)
1998
    if (NULL == statbuf)
1999
      vcd_warn ("mandatory /SVCD/TRACKS.SVD not found!");
1999
      vcd_warn ("mandatory /SVCD/TRACKS.SVD not found!");
2000
    else {
2000
    else {
2001
      vcd_debug ("found TRACKS.SVD signature at sector %lu", 
2001
      vcd_debug ("found TRACKS.SVD signature at sector %lu",
2002
                 (unsigned long int) statbuf->lsn);
2002
                 (unsigned long int) statbuf->lsn);
2003
      free(statbuf);
2003
      free(statbuf);
2004
    }
2004
    }
2005
    
2005
2006
    statbuf = iso9660_fs_stat (p_cdio, "SVCD/SEARCH.DAT;1");
2006
    statbuf = iso9660_fs_stat (p_cdio, "SVCD/SEARCH.DAT;1");
2007
    if (NULL == statbuf)
2007
    if (NULL == statbuf)
2008
      vcd_warn ("mandatory /SVCD/SEARCH.DAT not found!");
2008
      vcd_warn ("mandatory /SVCD/SEARCH.DAT not found!");
Lines 2013-2024 Link Here
2013
      uint32_t size;
2013
      uint32_t size;
2014
2014
2015
      vcd_debug ("found SEARCH.DAT at sector %lu", (unsigned long int) lsn);
2015
      vcd_debug ("found SEARCH.DAT at sector %lu", (unsigned long int) lsn);
2016
      
2016
2017
      p_obj->search_buf = calloc(1, ISO_BLOCKSIZE * secsize);
2017
      p_obj->search_buf = calloc(1, ISO_BLOCKSIZE * secsize);
2018
      
2018
2019
      if (cdio_read_mode2_sectors (p_cdio, p_obj->search_buf, lsn, false, secsize))
2019
      if (cdio_read_mode2_sectors (p_cdio, p_obj->search_buf, lsn, false, secsize))
2020
        goto err_return;
2020
        goto err_return;
2021
      
2021
2022
      size = (3 * uint16_from_be (((SearchDat_t *)p_obj->search_buf)->scan_points))
2022
      size = (3 * uint16_from_be (((SearchDat_t *)p_obj->search_buf)->scan_points))
2023
        + sizeof (SearchDat_t);
2023
        + sizeof (SearchDat_t);
2024
2024
Lines 2026-2037 Link Here
2026
      if (size > stat_size) {
2026
      if (size > stat_size) {
2027
        vcd_warn ("number of scanpoints leads to bigger size than "
2027
        vcd_warn ("number of scanpoints leads to bigger size than "
2028
                  "file size of SEARCH.DAT! -- rereading");
2028
                  "file size of SEARCH.DAT! -- rereading");
2029
        
2029
2030
        free (p_obj->search_buf);
2030
        free (p_obj->search_buf);
2031
        p_obj->search_buf = calloc(1, ISO_BLOCKSIZE 
2031
        p_obj->search_buf = calloc(1, ISO_BLOCKSIZE
2032
                                       * _vcd_len2blocks(size, ISO_BLOCKSIZE));
2032
                                       * _vcd_len2blocks(size, ISO_BLOCKSIZE));
2033
        
2033
2034
        if (cdio_read_mode2_sectors (p_cdio, p_obj->search_buf, lsn, false, 
2034
        if (cdio_read_mode2_sectors (p_cdio, p_obj->search_buf, lsn, false,
2035
                                     secsize))
2035
                                     secsize))
2036
          goto err_return;
2036
          goto err_return;
2037
      }
2037
      }
Lines 2048-2058 Link Here
2048
    uint32_t secsize   = statbuf->secsize;
2048
    uint32_t secsize   = statbuf->secsize;
2049
2049
2050
    vcd_debug ("found /EXT/SCANDATA.DAT at sector %u", (unsigned int) lsn);
2050
    vcd_debug ("found /EXT/SCANDATA.DAT at sector %u", (unsigned int) lsn);
2051
    
2051
2052
    p_obj->scandata_buf = calloc(1, ISO_BLOCKSIZE * secsize);
2052
    p_obj->scandata_buf = calloc(1, ISO_BLOCKSIZE * secsize);
2053
2053
2054
    free(statbuf);
2054
    free(statbuf);
2055
    if (cdio_read_mode2_sectors (p_cdio, p_obj->scandata_buf, lsn, false, 
2055
    if (cdio_read_mode2_sectors (p_cdio, p_obj->scandata_buf, lsn, false,
2056
                                 secsize))
2056
                                 secsize))
2057
      return VCDINFO_OPEN_ERROR;
2057
      return VCDINFO_OPEN_ERROR;
2058
  }
2058
  }
Lines 2067-2089 Link Here
2067
  free(p_obj);
2067
  free(p_obj);
2068
  return VCDINFO_OPEN_ERROR;
2068
  return VCDINFO_OPEN_ERROR;
2069
2069
2070
  
2070
2071
}
2071
}
2072
2072
2073
/*!
2073
/*!
2074
 Dispose of any resources associated with vcdinfo structure "p_obj".
2074
 Dispose of any resources associated with vcdinfo structure "p_obj".
2075
 Call this when "p_obj" it isn't needed anymore. 
2075
 Call this when "p_obj" it isn't needed anymore.
2076
2076
2077
 True is returned is everything went okay, and false if not.
2077
 True is returned is everything went okay, and false if not.
2078
*/
2078
*/
2079
bool 
2079
bool
2080
vcdinfo_close(vcdinfo_obj_t *p_obj)
2080
vcdinfo_close(vcdinfo_obj_t *p_obj)
2081
{
2081
{
2082
  if (p_obj != NULL) {
2082
  if (p_obj != NULL) {
2083
    if (p_obj->offset_list != NULL) 
2083
    if (p_obj->offset_list != NULL)
2084
      _cdio_list_free(p_obj->offset_list, true);
2084
      _cdio_list_free(p_obj->offset_list, true, NULL);
2085
    if (p_obj->offset_x_list != NULL) 
2085
    if (p_obj->offset_x_list != NULL)
2086
      _cdio_list_free(p_obj->offset_x_list, true);
2086
      _cdio_list_free(p_obj->offset_x_list, true, NULL);
2087
    free(p_obj->seg_sizes);
2087
    free(p_obj->seg_sizes);
2088
    free(p_obj->lot);
2088
    free(p_obj->lot);
2089
    free(p_obj->lot_x);
2089
    free(p_obj->lot_x);
Lines 2097-2103 Link Here
2097
    if (p_obj->img != NULL) cdio_destroy (p_obj->img);
2097
    if (p_obj->img != NULL) cdio_destroy (p_obj->img);
2098
    _vcdinfo_zero(p_obj);
2098
    _vcdinfo_zero(p_obj);
2099
  }
2099
  }
2100
  
2100
2101
  free(p_obj);
2101
  free(p_obj);
2102
  return(true);
2102
  return(true);
2103
}
2103
}
Lines 2108-2120 Link Here
2108
   If we are not in an extended selection list LID, return -2.
2108
   If we are not in an extended selection list LID, return -2.
2109
   If there no area encloses the point return -3
2109
   If there no area encloses the point return -3
2110
2110
2111
   max_x, max_y are the  maximum values that x and y can take on. 
2111
   max_x, max_y are the  maximum values that x and y can take on.
2112
   They would be the largest coordinate in the screen coordinate space.
2112
   They would be the largest coordinate in the screen coordinate space.
2113
   For example they might be 352, 240 (for VCD) or 704, 480 for SVCD NTSC, 
2113
   For example they might be 352, 240 (for VCD) or 704, 480 for SVCD NTSC,
2114
   or 704, 576. 
2114
   or 704, 576.
2115
 */
2115
 */
2116
int 
2116
int
2117
vcdinfo_get_area_selection(const vcdinfo_obj_t *p_vcdinfo, 
2117
vcdinfo_get_area_selection(const vcdinfo_obj_t *p_vcdinfo,
2118
                           lid_t lid, int16_t x, int16_t y,
2118
                           lid_t lid, int16_t x, int16_t y,
2119
                           uint16_t max_x, uint16_t max_y)
2119
                           uint16_t max_x, uint16_t max_y)
2120
{
2120
{
Lines 2123-2143 Link Here
2123
  if (! vcdinfo_lid_get_pxd(p_vcdinfo, &pxd, lid) )
2123
  if (! vcdinfo_lid_get_pxd(p_vcdinfo, &pxd, lid) )
2124
    return -1;
2124
    return -1;
2125
  if  (pxd.descriptor_type != PSD_TYPE_EXT_SELECTION_LIST &&
2125
  if  (pxd.descriptor_type != PSD_TYPE_EXT_SELECTION_LIST &&
2126
       !pxd.psd->flags.SelectionAreaFlag) 
2126
       !pxd.psd->flags.SelectionAreaFlag)
2127
    return -2;
2127
    return -2;
2128
  {
2128
  {
2129
    const PsdSelectionListDescriptorExtended_t *d2 = 
2129
    const PsdSelectionListDescriptorExtended_t *d2 =
2130
                  (const void *) &(pxd.psd->ofs[pxd.psd->nos]);
2130
                  (const void *) &(pxd.psd->ofs[pxd.psd->nos]);
2131
    const int32_t scaled_x = x * 255 / max_x;
2131
    const int32_t scaled_x = x * 255 / max_x;
2132
    const int32_t scaled_y = y * 255 / max_y;
2132
    const int32_t scaled_y = y * 255 / max_y;
2133
    const int n = vcdinf_get_num_selections(pxd.psd);
2133
    const int n = vcdinf_get_num_selections(pxd.psd);
2134
    int i;
2134
    int i;
2135
    vcd_debug("max x %d, max y %d, scaled x: %d, scaled y %d", 
2135
    vcd_debug("max x %d, max y %d, scaled x: %d, scaled y %d",
2136
              max_x, max_y, (int) scaled_x, (int) scaled_y);
2136
              max_x, max_y, (int) scaled_x, (int) scaled_y);
2137
    for (i = 0; i < n; i++) {
2137
    for (i = 0; i < n; i++) {
2138
      vcd_debug("x1: %d, y1 %d, x2: %d, y2 %d",
2138
      vcd_debug("x1: %d, y1 %d, x2: %d, y2 %d",
2139
             d2->area[i].x1, d2->area[i].y1, d2->area[i].y2, d2->area[i].y2 );
2139
             d2->area[i].x1, d2->area[i].y1, d2->area[i].y2, d2->area[i].y2 );
2140
      if (d2->area[i].x1 <= scaled_x && 
2140
      if (d2->area[i].x1 <= scaled_x &&
2141
          d2->area[i].y1 <= scaled_y &&
2141
          d2->area[i].y1 <= scaled_y &&
2142
          d2->area[i].x2 >= scaled_x &&
2142
          d2->area[i].x2 >= scaled_x &&
2143
          d2->area[i].y2 >= scaled_y ) {
2143
          d2->area[i].y2 >= scaled_y ) {
Lines 2146-2156 Link Here
2146
    }
2146
    }
2147
  }
2147
  }
2148
  return -3;
2148
  return -3;
2149
  
2149
2150
}
2150
}
2151
2151
2152
2152
2153
/* 
2153
/*
2154
 * Local variables:
2154
 * Local variables:
2155
 *  c-file-style: "gnu"
2155
 *  c-file-style: "gnu"
2156
 *  tab-width: 8
2156
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/info_private.c (-18 / +20 lines)
Lines 17-27 Link Here
17
    along with this program; if not, write to the Free Foundation
17
    along with this program; if not, write to the Free Foundation
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Software, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
/* 
20
/*
21
   Like vcdinfo but exposes more of the internal structure. It is probably
21
   Like vcdinfo but exposes more of the internal structure. It is probably
22
   better to use vcdinfo, when possible.
22
   better to use vcdinfo, when possible.
23
*/
23
*/
24
24
25
#ifdef HAVE_CONFIG_H
25
#ifdef HAVE_CONFIG_H
26
# include "config.h"
26
# include "config.h"
27
#endif
27
#endif
Lines 46-51 Link Here
46
#include <unistd.h>
46
#include <unistd.h>
47
#endif
47
#endif
48
48
49
/* We don't want to pull in cdio's config */
50
#define __CDIO_CONFIG_H__
49
#include <cdio/cdio.h>
51
#include <cdio/cdio.h>
50
#include <cdio/bytesex.h>
52
#include <cdio/bytesex.h>
51
#include <cdio/util.h>
53
#include <cdio/util.h>
Lines 78-87 Link Here
78
    CdioListNode_t *node;
80
    CdioListNode_t *node;
79
    CdioList_t *unused_lids = _cdio_list_new();
81
    CdioList_t *unused_lids = _cdio_list_new();
80
    CdioListNode_t *next_unused_node = _cdio_list_begin(unused_lids);
82
    CdioListNode_t *next_unused_node = _cdio_list_begin(unused_lids);
81
    
83
82
    unsigned int last_lid=0;
84
    unsigned int last_lid=0;
83
    CdioList_t *offset_list = extended ? obj->offset_x_list : obj->offset_list;
85
    CdioList_t *offset_list = extended ? obj->offset_x_list : obj->offset_list;
84
    
86
85
    lid_t max_seen_lid=0;
87
    lid_t max_seen_lid=0;
86
88
87
    _CDIO_LIST_FOREACH (node, offset_list)
89
    _CDIO_LIST_FOREACH (node, offset_list)
Lines 110-116 Link Here
110
          if (last_lid > max_seen_lid) max_seen_lid=last_lid;
112
          if (last_lid > max_seen_lid) max_seen_lid=last_lid;
111
        }
113
        }
112
      }
114
      }
113
    _cdio_list_free(unused_lids, true);
115
    _cdio_list_free(unused_lids, true, NULL);
114
  }
116
  }
115
}
117
}
116
118
Lines 135-141 Link Here
135
    if ((tmp = vcdinf_get_lot_offset(lot, n)) != PSD_OFS_DISABLED)
137
    if ((tmp = vcdinf_get_lot_offset(lot, n)) != PSD_OFS_DISABLED)
136
      ret &= vcdinf_visit_pbc (obj, n + 1, tmp, true);
138
      ret &= vcdinf_visit_pbc (obj, n + 1, tmp, true);
137
139
138
  _vcd_list_sort (obj->extended ? obj->offset_x_list : obj->offset_list, 
140
  _vcd_list_sort (obj->extended ? obj->offset_x_list : obj->offset_list,
139
                  (_cdio_list_cmp_func_t) vcdinf_lid_t_cmp);
141
                  (_cdio_list_cmp_func_t) vcdinf_lid_t_cmp);
140
142
141
  /* Now really complete the offset table with LIDs.  This routine
143
  /* Now really complete the offset table with LIDs.  This routine
Lines 152-158 Link Here
152
   Returns false if there was some error.
154
   Returns false if there was some error.
153
*/
155
*/
154
bool
156
bool
155
vcdinf_visit_pbc (struct _vcdinf_pbc_ctx *obj, lid_t lid, unsigned int offset, 
157
vcdinf_visit_pbc (struct _vcdinf_pbc_ctx *obj, lid_t lid, unsigned int offset,
156
                  bool in_lot)
158
                  bool in_lot)
157
{
159
{
158
  CdioListNode_t *node;
160
  CdioListNode_t *node;
Lines 194-200 Link Here
194
196
195
  if (obj->extended) {
197
  if (obj->extended) {
196
    offset_list = obj->offset_x_list;
198
    offset_list = obj->offset_x_list;
197
  } else 
199
  } else
198
    offset_list = obj->offset_list;
200
    offset_list = obj->offset_list;
199
201
200
  _CDIO_LIST_FOREACH (node, offset_list)
202
  _CDIO_LIST_FOREACH (node, offset_list)
Lines 213-219 Link Here
213
             */
215
             */
214
            ofs->lid = lid;
216
            ofs->lid = lid;
215
          }
217
          }
216
          
218
217
          ofs->ext = obj->extended;
219
          ofs->ext = obj->extended;
218
220
219
          return true; /* already been there... */
221
          return true; /* already been there... */
Lines 238-251 Link Here
238
240
239
        if (!ofs->lid)
241
        if (!ofs->lid)
240
          ofs->lid = lid;
242
          ofs->lid = lid;
241
        else 
243
        else
242
          if (ofs->lid != lid)
244
          if (ofs->lid != lid)
243
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
245
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
244
                      ofs->lid, lid);
246
                      ofs->lid, lid);
245
247
246
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_prev_offset(d), false);
248
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_prev_offset(d), false);
247
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_next_offset(d), false);
249
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_next_offset(d), false);
248
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_return_offset(d), 
250
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_pld_get_return_offset(d),
249
                                 false);
251
                                 false);
250
      }
252
      }
251
      break;
253
      break;
Lines 261-282 Link Here
261
263
262
        if (!ofs->lid)
264
        if (!ofs->lid)
263
          ofs->lid = uint16_from_be (d->lid) & 0x7fff;
265
          ofs->lid = uint16_from_be (d->lid) & 0x7fff;
264
        else 
266
        else
265
          if (ofs->lid != (uint16_from_be (d->lid) & 0x7fff))
267
          if (ofs->lid != (uint16_from_be (d->lid) & 0x7fff))
266
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
268
            vcd_warn ("LOT entry assigned LID %d, but descriptor has LID %d",
267
                      ofs->lid, uint16_from_be (d->lid) & 0x7fff);
269
                      ofs->lid, uint16_from_be (d->lid) & 0x7fff);
268
270
269
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_prev_offset(d), false);
271
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_prev_offset(d), false);
270
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_next_offset(d), false);
272
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_next_offset(d), false);
271
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_return_offset(d), 
273
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_return_offset(d),
272
                                 false);
274
                                 false);
273
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_default_offset(d), 
275
        ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_default_offset(d),
274
                                 false);
276
                                 false);
275
        ret &= vcdinf_visit_pbc (obj, 0, uint16_from_be (d->timeout_ofs), 
277
        ret &= vcdinf_visit_pbc (obj, 0, uint16_from_be (d->timeout_ofs),
276
                                 false);
278
                                 false);
277
279
278
        for (idx = 0; idx < vcdinf_get_num_selections(d); idx++)
280
        for (idx = 0; idx < vcdinf_get_num_selections(d); idx++)
279
          ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_offset(d, idx), 
281
          ret &= vcdinf_visit_pbc (obj, 0, vcdinf_psd_get_offset(d, idx),
280
                                   false);
282
                                   false);
281
      }
283
      }
282
      break;
284
      break;
Lines 317-324 Link Here
317
    : NULL;
319
    : NULL;
318
}
320
}
319
321
320
322
321
/* 
323
/*
322
 * Local variables:
324
 * Local variables:
323
 *  c-file-style: "gnu"
325
 *  c-file-style: "gnu"
324
 *  tab-width: 8
326
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/info_private.h (-15 / +17 lines)
Lines 25-30 Link Here
25
25
26
#ifndef _VCD_INFO_PRIVATE_H
26
#ifndef _VCD_INFO_PRIVATE_H
27
#define _VCD_INFO_PRIVATE_H
27
#define _VCD_INFO_PRIVATE_H
28
/* We don't want to pull in cdio's config */
29
#define __CDIO_CONFIG_H__
28
30
29
#ifdef HAVE_CONFIG_H
31
#ifdef HAVE_CONFIG_H
30
# include "config.h"
32
# include "config.h"
Lines 42-60 Link Here
42
44
43
  struct _VcdInfo {
45
  struct _VcdInfo {
44
    vcd_type_t vcd_type;
46
    vcd_type_t vcd_type;
45
    
47
46
    CdIo_t *img;
48
    CdIo_t *img;
47
    
49
48
    iso9660_pvd_t pvd;
50
    iso9660_pvd_t pvd;
49
    
51
50
    InfoVcd_t info;
52
    InfoVcd_t info;
51
    EntriesVcd_t entries;
53
    EntriesVcd_t entries;
52
    
54
53
    CdioList_t *offset_list;
55
    CdioList_t *offset_list;
54
    CdioList_t *offset_x_list;
56
    CdioList_t *offset_x_list;
55
    uint32_t *seg_sizes; 
57
    uint32_t *seg_sizes;
56
    lsn_t   first_segment_lsn;
58
    lsn_t   first_segment_lsn;
57
    
59
58
    LotVcd_t *lot;
60
    LotVcd_t *lot;
59
    LotVcd_t *lot_x;
61
    LotVcd_t *lot_x;
60
    uint8_t *psd;
62
    uint8_t *psd;
Lines 63-82 Link Here
63
    bool extended;
65
    bool extended;
64
66
65
    bool has_xa;           /* True if has extended attributes (XA) */
67
    bool has_xa;           /* True if has extended attributes (XA) */
66
    
68
67
    void *tracks_buf;
69
    void *tracks_buf;
68
    void *search_buf;
70
    void *search_buf;
69
    void *scandata_buf;
71
    void *scandata_buf;
70
    
72
71
    char *source_name; /* VCD device or file currently open */
73
    char *source_name; /* VCD device or file currently open */
72
    
74
73
  };
75
  };
74
  
76
75
  /*!  Return the starting MSF (minutes/secs/frames) for sequence
77
  /*!  Return the starting MSF (minutes/secs/frames) for sequence
76
    entry_num in obj.  NULL is returned if there is no entry.
78
    entry_num in obj.  NULL is returned if there is no entry.
77
    The first entry number is 0.
79
    The first entry number is 0.
78
  */
80
  */
79
  const msf_t * vcdinf_get_entry_msf(const EntriesVcd_t *entries, 
81
  const msf_t * vcdinf_get_entry_msf(const EntriesVcd_t *entries,
80
				     unsigned int entry_num);
82
				     unsigned int entry_num);
81
83
82
  struct _vcdinf_pbc_ctx {
84
  struct _vcdinf_pbc_ctx {
Lines 85-91 Link Here
85
    unsigned offset_mult;
87
    unsigned offset_mult;
86
    CdioList_t *offset_x_list;
88
    CdioList_t *offset_x_list;
87
    CdioList_t *offset_list;
89
    CdioList_t *offset_list;
88
    
90
89
    LotVcd_t *lot;
91
    LotVcd_t *lot;
90
    LotVcd_t *lot_x;
92
    LotVcd_t *lot_x;
91
    uint8_t *psd;
93
    uint8_t *psd;
Lines 101-114 Link Here
101
     Returns false if there was some error.
103
     Returns false if there was some error.
102
  */
104
  */
103
  bool vcdinf_visit_lot (struct _vcdinf_pbc_ctx *obj);
105
  bool vcdinf_visit_lot (struct _vcdinf_pbc_ctx *obj);
104
  
106
105
  /*! 
107
  /*!
106
     Recursive routine to populate obj->offset_list or obj->offset_x_list
108
     Recursive routine to populate obj->offset_list or obj->offset_x_list
107
     by reading playback control entries referred to via lid.
109
     by reading playback control entries referred to via lid.
108
110
109
     Returns false if there was some error.
111
     Returns false if there was some error.
110
  */
112
  */
111
  bool vcdinf_visit_pbc (struct _vcdinf_pbc_ctx *obj, lid_t lid, 
113
  bool vcdinf_visit_pbc (struct _vcdinf_pbc_ctx *obj, lid_t lid,
112
			 unsigned int offset, bool in_lot);
114
			 unsigned int offset, bool in_lot);
113
115
114
#ifdef __cplusplus
116
#ifdef __cplusplus
(-)vcdimager-0.7.24.ORIG/lib/logging.c (-5 / +5 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
23
# include "config.h"
23
# include "config.h"
24
#endif
24
#endif
Lines 101-107 Link Here
101
    vcd_assert_not_reached ();
101
    vcd_assert_not_reached ();
102
102
103
  in_recursion = 1;
103
  in_recursion = 1;
104
  
104
105
  vsnprintf(buf, sizeof(buf)-1, format, args);
105
  vsnprintf(buf, sizeof(buf)-1, format, args);
106
106
107
  _handler(level, buf);
107
  _handler(level, buf);
Lines 126-132 Link Here
126
  va_start (args, format); \
126
  va_start (args, format); \
127
  vcd_logv (VCD_LOG_ ## LEVEL, format, args); \
127
  vcd_logv (VCD_LOG_ ## LEVEL, format, args); \
128
  va_end (args); \
128
  va_end (args); \
129
} 
129
}
130
130
131
VCD_LOG_TEMPLATE(debug, DEBUG)
131
VCD_LOG_TEMPLATE(debug, DEBUG)
132
VCD_LOG_TEMPLATE(info, INFO)
132
VCD_LOG_TEMPLATE(info, INFO)
Lines 135-142 Link Here
135
135
136
#undef VCD_LOG_TEMPLATE
136
#undef VCD_LOG_TEMPLATE
137
137
138
138
139
/* 
139
/*
140
 * Local variables:
140
 * Local variables:
141
 *  c-file-style: "gnu"
141
 *  c-file-style: "gnu"
142
 *  tab-width: 8
142
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/mpeg.c (-73 / +72 lines)
Lines 17-23 Link Here
17
  along with this program; if not, write to the Free Software
17
  along with this program; if not, write to the Free Software
18
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 79-87 Link Here
79
};
79
};
80
80
81
static const double frame_rates[16] =  {
81
static const double frame_rates[16] =  {
82
  0.0, 24000.0/1001, 24.0, 25.0, 
82
  0.0, 24000.0/1001, 24.0, 25.0,
83
  30000.0/1001, 30.0,  50.0, 60000.0/1001, 
83
  30000.0/1001, 30.0,  50.0, 60000.0/1001,
84
  60.0, 0.0, 
84
  60.0, 0.0,
85
};
85
};
86
86
87
#ifdef DEBUG
87
#ifdef DEBUG
Lines 98-104 Link Here
98
  return (code & MPEG_START_CODE_MASK) == MPEG_START_CODE_PATTERN;
98
  return (code & MPEG_START_CODE_MASK) == MPEG_START_CODE_PATTERN;
99
}
99
}
100
100
101
static inline int 
101
static inline int
102
_vid_streamid_idx (uint8_t streamid)
102
_vid_streamid_idx (uint8_t streamid)
103
{
103
{
104
  switch (streamid | MPEG_START_CODE_PATTERN)
104
  switch (streamid | MPEG_START_CODE_PATTERN)
Lines 119-129 Link Here
119
      vcd_assert_not_reached ();
119
      vcd_assert_not_reached ();
120
      break;
120
      break;
121
    }
121
    }
122
  
122
123
  return -1;
123
  return -1;
124
}
124
}
125
125
126
static inline int 
126
static inline int
127
_aud_streamid_idx (uint8_t streamid)
127
_aud_streamid_idx (uint8_t streamid)
128
{
128
{
129
  switch (streamid | MPEG_START_CODE_PATTERN)
129
  switch (streamid | MPEG_START_CODE_PATTERN)
Lines 144-150 Link Here
144
      vcd_assert_not_reached ();
144
      vcd_assert_not_reached ();
145
      break;
145
      break;
146
    }
146
    }
147
  
147
148
  return -1;
148
  return -1;
149
}
149
}
150
150
Lines 160-166 Link Here
160
160
161
  _retval <<= 15;
161
  _retval <<= 15;
162
  _retval |= vcd_bitvec_read_bits (buf, offset, 15);
162
  _retval |= vcd_bitvec_read_bits (buf, offset, 15);
163
      
163
164
  MARKER (buf, offset);
164
  MARKER (buf, offset);
165
165
166
  _retval <<= 15;
166
  _retval <<= 15;
Lines 172-178 Link Here
172
}
172
}
173
173
174
static void
174
static void
175
_parse_sequence_header (uint8_t streamid, const uint8_t *buf, 
175
_parse_sequence_header (uint8_t streamid, const uint8_t *buf,
176
			VcdMpegStreamCtx *state)
176
			VcdMpegStreamCtx *state)
177
{
177
{
178
  unsigned offset = 0;
178
  unsigned offset = 0;
Lines 180-187 Link Here
180
  const uint8_t *data = buf;
180
  const uint8_t *data = buf;
181
  const int vid_idx = _vid_streamid_idx (streamid);
181
  const int vid_idx = _vid_streamid_idx (streamid);
182
182
183
  const double aspect_ratios[16] = 
183
  const double aspect_ratios[16] =
184
    { 
184
    {
185
      0.0000, 1.0000, 0.6735, 0.7031,
185
      0.0000, 1.0000, 0.6735, 0.7031,
186
      0.7615, 0.8055, 0.8437, 0.8935,
186
      0.7615, 0.8055, 0.8437, 0.8935,
187
      0.9375, 0.9815, 1.0255, 1.0695,
187
      0.9375, 0.9815, 1.0255, 1.0695,
Lines 190-196 Link Here
190
190
191
  if (state->stream.shdr[vid_idx].seen) /* we have it already */
191
  if (state->stream.shdr[vid_idx].seen) /* we have it already */
192
    return;
192
    return;
193
  
193
194
  hsize = vcd_bitvec_read_bits (data, &offset, 12);
194
  hsize = vcd_bitvec_read_bits (data, &offset, 12);
195
195
196
  vsize = vcd_bitvec_read_bits (data, &offset, 12);
196
  vsize = vcd_bitvec_read_bits (data, &offset, 12);
Lines 216-248 Link Here
216
216
217
  if (vcd_bitvec_read_bits (data, &offset, 1))
217
  if (vcd_bitvec_read_bits (data, &offset, 1))
218
    offset += 64 << 3;
218
    offset += 64 << 3;
219
  
219
220
  state->stream.shdr[vid_idx].hsize = hsize;
220
  state->stream.shdr[vid_idx].hsize = hsize;
221
  state->stream.shdr[vid_idx].vsize = vsize;
221
  state->stream.shdr[vid_idx].vsize = vsize;
222
  state->stream.shdr[vid_idx].aratio = aspect_ratios[aratio];
222
  state->stream.shdr[vid_idx].aratio = aspect_ratios[aratio];
223
  state->stream.shdr[vid_idx].frate = frame_rates[frate];
223
  state->stream.shdr[vid_idx].frate = frame_rates[frate];
224
  state->stream.shdr[vid_idx].bitrate = 400 * brate;
224
  state->stream.shdr[vid_idx].bitrate = 400 * brate;
225
  state->stream.shdr[vid_idx].vbvsize = bufsize * 16 * 1024; 
225
  state->stream.shdr[vid_idx].vbvsize = bufsize * 16 * 1024;
226
  state->stream.shdr[vid_idx].constrained_flag = (constr != 0);
226
  state->stream.shdr[vid_idx].constrained_flag = (constr != 0);
227
227
228
  state->stream.shdr[vid_idx].seen = true;
228
  state->stream.shdr[vid_idx].seen = true;
229
}
229
}
230
230
231
static void
231
static void
232
_parse_gop_header (uint8_t streamid, const uint8_t *buf, 
232
_parse_gop_header (uint8_t streamid, const uint8_t *buf,
233
		   VcdMpegStreamCtx *state)
233
		   VcdMpegStreamCtx *state)
234
{
234
{
235
  const uint8_t *data = buf;
235
  const uint8_t *data = buf;
236
  unsigned offset = 0;
236
  unsigned offset = 0;
237
  
237
238
  bool drop_flag; 
239
  /* bool close_gop; */
238
  /* bool close_gop; */
240
  /* bool broken_link; */
239
  /* bool broken_link; */
241
240
242
  unsigned hour, minute, second, frame;
241
  unsigned hour, minute, second, frame;
243
242
244
  drop_flag = vcd_bitvec_read_bits(data, &offset, 1) != 0;
243
  /* drop_flag = vcd_bitvec_read_bits(data, &offset, 1) != 0; */
245
  
244
246
  hour = vcd_bitvec_read_bits(data, &offset, 5);
245
  hour = vcd_bitvec_read_bits(data, &offset, 5);
247
246
248
  minute = vcd_bitvec_read_bits(data, &offset, 6);
247
  minute = vcd_bitvec_read_bits(data, &offset, 6);
Lines 281-287 Link Here
281
                "if it is not enabled already!");
280
                "if it is not enabled already!");
282
      state->stream.scan_data_warnings++;
281
      state->stream.scan_data_warnings++;
283
      return;
282
      return;
284
    }      
283
    }
285
284
286
  if (msf->m == 0xff
285
  if (msf->m == 0xff
287
      && msf->s == 0xff
286
      && msf->s == 0xff
Lines 302-308 Link Here
302
    }
301
    }
303
302
304
  if ((msf->m >> 4) > 9
303
  if ((msf->m >> 4) > 9
305
      || ((0x80 ^ msf->s) >> 4) > 9      
304
      || ((0x80 ^ msf->s) >> 4) > 9
306
      || ((0x80 ^ msf->f) >> 4) > 9
305
      || ((0x80 ^ msf->f) >> 4) > 9
307
      || (msf->m & 0xf) > 9
306
      || (msf->m & 0xf) > 9
308
      || (msf->s & 0xf) > 9
307
      || (msf->s & 0xf) > 9
Lines 319-325 Link Here
319
}
318
}
320
319
321
static void
320
static void
322
_parse_user_data (uint8_t streamid, const void *buf, unsigned len, 
321
_parse_user_data (uint8_t streamid, const void *buf, unsigned len,
323
                  unsigned offset,
322
                  unsigned offset,
324
                  VcdMpegStreamCtx *state)
323
                  VcdMpegStreamCtx *state)
325
{
324
{
Lines 357-363 Link Here
357
          {
356
          {
358
            struct vcd_mpeg_scan_data_t *usdi = (void *) udg;
357
            struct vcd_mpeg_scan_data_t *usdi = (void *) udg;
359
            vcd_assert (sizeof (struct vcd_mpeg_scan_data_t) == 14);
358
            vcd_assert (sizeof (struct vcd_mpeg_scan_data_t) == 14);
360
            
359
361
            if (GNUC_UNLIKELY (usdi->len != 14))
360
            if (GNUC_UNLIKELY (usdi->len != 14))
362
              {
361
              {
363
                vcd_warn ("invalid user scan data length (%d != 14)", usdi->len);
362
                vcd_warn ("invalid user scan data length (%d != 14)", usdi->len);
Lines 369-375 Link Here
369
            _check_scan_data ("next_I_offset    ", &usdi->next_ofs, state);
368
            _check_scan_data ("next_I_offset    ", &usdi->next_ofs, state);
370
            _check_scan_data ("backward_I_offset", &usdi->back_ofs, state);
369
            _check_scan_data ("backward_I_offset", &usdi->back_ofs, state);
371
            _check_scan_data ("forward_I_offset ", &usdi->forw_ofs, state);
370
            _check_scan_data ("forward_I_offset ", &usdi->forw_ofs, state);
372
          
371
373
            state->packet.scan_data_ptr = usdi;
372
            state->packet.scan_data_ptr = usdi;
374
            state->stream.scan_data++;
373
            state->stream.scan_data++;
375
          }
374
          }
Lines 390-396 Link Here
390
      vcd_assert (udg->len >= 2);
389
      vcd_assert (udg->len >= 2);
391
      udg = (void *) &udg->data[udg->len - 2];
390
      udg = (void *) &udg->data[udg->len - 2];
392
    }
391
    }
393
  
392
394
  vcd_assert (pos <= len);
393
  vcd_assert (pos <= len);
395
}
394
}
396
395
Lines 424-430 Link Here
424
        case 2: /* %10 */
423
        case 2: /* %10 */
425
          _has_pts = true;
424
          _has_pts = true;
426
          break;
425
          break;
427
          
426
428
        case 3: /* %11 */
427
        case 3: /* %11 */
429
          _has_dts = _has_pts = true;
428
          _has_dts = _has_pts = true;
430
          break;
429
          break;
Lines 435-441 Link Here
435
        }
434
        }
436
435
437
      pos2++; /* ESCR_flag */
436
      pos2++; /* ESCR_flag */
438
      
437
439
      pos2++; /* */
438
      pos2++; /* */
440
      pos2++; /* */
439
      pos2++; /* */
441
      pos2++; /* */
440
      pos2++; /* */
Lines 473-479 Link Here
473
      pes_mpeg_ver = MPEG_VERS_MPEG1;
472
      pes_mpeg_ver = MPEG_VERS_MPEG1;
474
473
475
      /* get rid of stuffing bytes */
474
      /* get rid of stuffing bytes */
476
      while (((pos2 + 8) < (len << 3)) 
475
      while (((pos2 + 8) < (len << 3))
477
             && vcd_bitvec_peek_bits (buf, pos2, 8) == 0xff)
476
             && vcd_bitvec_peek_bits (buf, pos2, 8) == 0xff)
478
        pos2 += 8;
477
        pos2 += 8;
479
478
Lines 485-491 Link Here
485
          pos2 += 13; /* STD_buffer_size */
484
          pos2 += 13; /* STD_buffer_size */
486
        }
485
        }
487
486
488
      switch (vcd_bitvec_peek_bits (buf, pos2, 4)) 
487
      switch (vcd_bitvec_peek_bits (buf, pos2, 4))
489
        {
488
        {
490
        case 0x2: /* %0010 */
489
        case 0x2: /* %0010 */
491
          pos2 += 4;
490
          pos2 += 4;
Lines 515-521 Link Here
515
          vcd_assert (vcd_bitvec_peek_bits (buf, pos2, 8) == 0xff);
514
          vcd_assert (vcd_bitvec_peek_bits (buf, pos2, 8) == 0xff);
516
          vcd_warn ("Unexpected stuffing byte noticed in ISO11172 PES header!");
515
          vcd_warn ("Unexpected stuffing byte noticed in ISO11172 PES header!");
517
          pos2 += 8;
516
          pos2 += 8;
518
          break; 
517
          break;
519
518
520
        default:
519
        default:
521
          vcd_error ("Error in ISO11172 PES header");
520
          vcd_error ("Error in ISO11172 PES header");
Lines 528-534 Link Here
528
  if (_has_pts)
527
  if (_has_pts)
529
    {
528
    {
530
      double pts2;
529
      double pts2;
531
      
530
532
      pts2 = (double) pts / 90000.0;
531
      pts2 = (double) pts / 90000.0;
533
532
534
      if (!state->stream.seen_pts)
533
      if (!state->stream.seen_pts)
Lines 611-617 Link Here
611
      {
610
      {
612
        const int bits = vcd_bitvec_read_bits (buf, &bitpos, 4);
611
        const int bits = vcd_bitvec_read_bits (buf, &bitpos, 4);
613
612
614
        const unsigned bit_rates[4][16] = { 
613
        const unsigned bit_rates[4][16] = {
615
          {0, },
614
          {0, },
616
          {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0},
615
          {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0},
617
          {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0},
616
          {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0},
Lines 639-653 Link Here
639
          state->stream.ahdr[aud_idx].sampfreq = 0;
638
          state->stream.ahdr[aud_idx].sampfreq = 0;
640
          break;
639
          break;
641
        }
640
        }
642
      
641
643
      bitpos++; /* padding_bit */
642
      bitpos++; /* padding_bit */
644
643
645
      bitpos++; /* private_bit */
644
      bitpos++; /* private_bit */
646
645
647
      state->stream.ahdr[aud_idx].mode = 1 + vcd_bitvec_read_bits (buf, &bitpos, 2); /* mode */
646
      state->stream.ahdr[aud_idx].mode = 1 + vcd_bitvec_read_bits (buf, &bitpos, 2); /* mode */
648
      
647
649
      state->stream.ahdr[aud_idx].seen = true;
648
      state->stream.ahdr[aud_idx].seen = true;
650
      
649
651
      /* we got the info, let's jump outta here */
650
      /* we got the info, let's jump outta here */
652
      break;
651
      break;
653
    }
652
    }
Lines 671-677 Link Here
671
  /* if only pts extraction was needed, we are done here... */
670
  /* if only pts extraction was needed, we are done here... */
672
  if (only_pts)
671
  if (only_pts)
673
    return;
672
    return;
674
  
673
675
  while (pos + 4 <= len)
674
  while (pos + 4 <= len)
676
    {
675
    {
677
      uint32_t code = vcd_bitvec_peek_bits32 (buf, pos << 3);
676
      uint32_t code = vcd_bitvec_peek_bits32 (buf, pos << 3);
Lines 686-696 Link Here
686
	{
685
	{
687
	case MPEG_PICTURE_CODE:
686
	case MPEG_PICTURE_CODE:
688
	  pos += 4;
687
	  pos += 4;
689
	  
688
690
          if (vcd_bitvec_peek_bits (buf, (pos << 3) + 10, 3) == 1)
689
          if (vcd_bitvec_peek_bits (buf, (pos << 3) + 10, 3) == 1)
691
            ipicture_header_pos = pos;
690
            ipicture_header_pos = pos;
692
	  break;
691
	  break;
693
	  
692
694
	case MPEG_SEQUENCE_CODE:
693
	case MPEG_SEQUENCE_CODE:
695
	  pos += 4;
694
	  pos += 4;
696
	  sequence_header_pos = pos;
695
	  sequence_header_pos = pos;
Lines 723-729 Link Here
723
  /* decide whether this packet qualifies as access point */
722
  /* decide whether this packet qualifies as access point */
724
  state->packet.aps = APS_NONE; /* paranoia */
723
  state->packet.aps = APS_NONE; /* paranoia */
725
724
726
  if (state->packet.has_pts 
725
  if (state->packet.has_pts
727
      && ipicture_header_pos != -1)
726
      && ipicture_header_pos != -1)
728
    {
727
    {
729
      enum aps_t _aps_type = APS_NONE;
728
      enum aps_t _aps_type = APS_NONE;
Lines 736-742 Link Here
736
              && sequence_header_pos < gop_header_pos
735
              && sequence_header_pos < gop_header_pos
737
              && gop_header_pos < ipicture_header_pos)
736
              && gop_header_pos < ipicture_header_pos)
738
            _aps_type = (sequence_header_pos - 4 == pes_header) ? APS_ASGI : APS_SGI;
737
            _aps_type = (sequence_header_pos - 4 == pes_header) ? APS_ASGI : APS_SGI;
739
          else if (gop_header_pos != 1 
738
          else if (gop_header_pos != 1
740
                   && gop_header_pos < ipicture_header_pos)
739
                   && gop_header_pos < ipicture_header_pos)
741
            _aps_type = APS_GI;
740
            _aps_type = APS_GI;
742
          else
741
          else
Lines 748-754 Link Here
748
          break;
747
          break;
749
        }
748
        }
750
749
751
      if (_aps_type) 
750
      if (_aps_type)
752
        {
751
        {
753
          const double pts2 = state->packet.pts;
752
          const double pts2 = state->packet.pts;
754
753
Lines 775-782 Link Here
775
  switch (code)
774
  switch (code)
776
    {
775
    {
777
    case MPEG_VIDEO_E0_CODE:
776
    case MPEG_VIDEO_E0_CODE:
778
    case MPEG_VIDEO_E1_CODE: 
777
    case MPEG_VIDEO_E1_CODE:
779
    case MPEG_VIDEO_E2_CODE: 
778
    case MPEG_VIDEO_E2_CODE:
780
      state->packet.video[_vid_streamid_idx (streamid)] = true;
779
      state->packet.video[_vid_streamid_idx (streamid)] = true;
781
      break;
780
      break;
782
781
Lines 790-803 Link Here
790
      state->packet.padding = true;
789
      state->packet.padding = true;
791
      break;
790
      break;
792
791
793
    case MPEG_SYSTEM_HEADER_CODE: 
792
    case MPEG_SYSTEM_HEADER_CODE:
794
      state->packet.system_header = true;
793
      state->packet.system_header = true;
795
      break;
794
      break;
796
    }
795
    }
797
}
796
}
798
797
799
static void
798
static void
800
_analyze_system_header (const uint8_t *buf, int len, 
799
_analyze_system_header (const uint8_t *buf, int len,
801
                        VcdMpegStreamCtx *state)
800
                        VcdMpegStreamCtx *state)
802
{
801
{
803
  unsigned bitpos = 0;
802
  unsigned bitpos = 0;
Lines 808-814 Link Here
808
807
809
  MARKER (buf, &bitpos);
808
  MARKER (buf, &bitpos);
810
809
811
  bitpos += 6; /* audio_bound */ 
810
  bitpos += 6; /* audio_bound */
812
811
813
  bitpos++; /* fixed_flag */
812
  bitpos++; /* fixed_flag */
814
  bitpos++; /* CSPS_flag */
813
  bitpos++; /* CSPS_flag */
Lines 817-828 Link Here
817
816
818
  MARKER (buf, &bitpos);
817
  MARKER (buf, &bitpos);
819
818
820
  bitpos += 5; /* video_bound */ 
819
  bitpos += 5; /* video_bound */
821
820
822
  bitpos += 1; /* packet_rate_restriction_flag -- only ISO 13818-1 */
821
  bitpos += 1; /* packet_rate_restriction_flag -- only ISO 13818-1 */
823
  bitpos += 7; /* reserved */
822
  bitpos += 7; /* reserved */
824
823
825
  while (vcd_bitvec_peek_bits (buf, bitpos, 1) == 1 
824
  while (vcd_bitvec_peek_bits (buf, bitpos, 1) == 1
826
         && bitpos <= (len << 3))
825
         && bitpos <= (len << 3))
827
    {
826
    {
828
      const uint8_t stream_id = vcd_bitvec_read_bits (buf, &bitpos, 8);
827
      const uint8_t stream_id = vcd_bitvec_read_bits (buf, &bitpos, 8);
Lines 839-845 Link Here
839
}
838
}
840
839
841
static void
840
static void
842
_analyze_private_1_stream (const uint8_t *buf, int len, 
841
_analyze_private_1_stream (const uint8_t *buf, int len,
843
                           VcdMpegStreamCtx *state)
842
                           VcdMpegStreamCtx *state)
844
{
843
{
845
  unsigned bitpos = _analyze_pes_header (buf, len, state);
844
  unsigned bitpos = _analyze_pes_header (buf, len, state);
Lines 851-857 Link Here
851
850
852
  private_data_id = vcd_bitvec_read_bits (buf, &bitpos, 8);
851
  private_data_id = vcd_bitvec_read_bits (buf, &bitpos, 8);
853
852
854
  switch (private_data_id) 
853
  switch (private_data_id)
855
    {
854
    {
856
      uint8_t sub_stream_id;
855
      uint8_t sub_stream_id;
857
856
Lines 901-907 Link Here
901
900
902
  vcd_assert (buf != NULL);
901
  vcd_assert (buf != NULL);
903
  vcd_assert (ctx != NULL);
902
  vcd_assert (ctx != NULL);
904
  
903
905
  /* clear packet info */
904
  /* clear packet info */
906
  memset (&(ctx->packet), 0, sizeof (ctx->packet));
905
  memset (&(ctx->packet), 0, sizeof (ctx->packet));
907
906
Lines 922-928 Link Here
922
921
923
      vcd_warn ("mpeg scan: pack header code (0x%8.8x) expected, "
922
      vcd_warn ("mpeg scan: pack header code (0x%8.8x) expected, "
924
                "but 0x%8.8x found (buflen = %d)",
923
                "but 0x%8.8x found (buflen = %d)",
925
                (unsigned int) MPEG_PACK_HEADER_CODE, 
924
                (unsigned int) MPEG_PACK_HEADER_CODE,
926
                (unsigned int) _code, buflen);
925
                (unsigned int) _code, buflen);
927
926
928
      ctx->stream.packets--;
927
      ctx->stream.packets--;
Lines 974-980 Link Here
974
	  uint16_t size;
973
	  uint16_t size;
975
          int bits;
974
          int bits;
976
          unsigned bitpos;
975
          unsigned bitpos;
977
          
976
978
	case MPEG_PACK_HEADER_CODE:
977
	case MPEG_PACK_HEADER_CODE:
979
	  if (pos)
978
	  if (pos)
980
	    return pos;
979
	    return pos;
Lines 1031-1039 Link Here
1031
              _scr += vcd_bitvec_read_bits (buf, &bitpos, 9); /* SCR ext */
1030
              _scr += vcd_bitvec_read_bits (buf, &bitpos, 9); /* SCR ext */
1032
1031
1033
              MARKER (buf, &bitpos);
1032
              MARKER (buf, &bitpos);
1034
              
1033
1035
              _muxrate = vcd_bitvec_read_bits (buf, &bitpos, 22);
1034
              _muxrate = vcd_bitvec_read_bits (buf, &bitpos, 22);
1036
              
1035
1037
              MARKER (buf, &bitpos);
1036
              MARKER (buf, &bitpos);
1038
              MARKER (buf, &bitpos);
1037
              MARKER (buf, &bitpos);
1039
1038
Lines 1051-1057 Link Here
1051
            }
1050
            }
1052
          else
1051
          else
1053
            {
1052
            {
1054
              vcd_warn ("packet not recognized as either version 1 or 2 (%d)" 
1053
              vcd_warn ("packet not recognized as either version 1 or 2 (%d)"
1055
                        " -- assuming v1", bits);
1054
                        " -- assuming v1", bits);
1056
            }
1055
            }
1057
1056
Lines 1069-1078 Link Here
1069
	  pos += 4;
1068
	  pos += 4;
1070
	  size = vcd_bitvec_peek_bits16 (buf, pos << 3);
1069
	  size = vcd_bitvec_peek_bits16 (buf, pos << 3);
1071
	  pos += 2;
1070
	  pos += 2;
1072
	  
1071
1073
	  if (pos + size > buflen)	  
1072
	  if (pos + size > buflen)
1074
            {
1073
            {
1075
              vcd_warn ("packet length beyond buffer" 
1074
              vcd_warn ("packet length beyond buffer"
1076
                        " (pos = %d + size = %d > buflen = %d) "
1075
                        " (pos = %d + size = %d > buflen = %d) "
1077
                        "-- stream may be truncated or packet length > 2324 bytes!",
1076
                        "-- stream may be truncated or packet length > 2324 bytes!",
1078
                        pos, size, buflen);
1077
                        pos, size, buflen);
Lines 1084-1096 Link Here
1084
1083
1085
	  switch (code)
1084
	  switch (code)
1086
	    {
1085
	    {
1087
	    case MPEG_SYSTEM_HEADER_CODE: 
1086
	    case MPEG_SYSTEM_HEADER_CODE:
1088
              _analyze_system_header (buf + pos, size, ctx);
1087
              _analyze_system_header (buf + pos, size, ctx);
1089
              break;
1088
              break;
1090
1089
1091
	    case MPEG_VIDEO_E0_CODE:
1090
	    case MPEG_VIDEO_E0_CODE:
1092
	    case MPEG_VIDEO_E1_CODE: 
1091
	    case MPEG_VIDEO_E1_CODE:
1093
	    case MPEG_VIDEO_E2_CODE: 
1092
	    case MPEG_VIDEO_E2_CODE:
1094
              _analyze_video_pes (code & 0xff, buf + pos, size, !parse_pes, ctx);
1093
              _analyze_video_pes (code & 0xff, buf + pos, size, !parse_pes, ctx);
1095
              break;
1094
              break;
1096
1095
Lines 1107-1113 Link Here
1107
1106
1108
	  pos += size;
1107
	  pos += size;
1109
	  break;
1108
	  break;
1110
	  
1109
1111
	case MPEG_PROGRAM_END_CODE:
1110
	case MPEG_PROGRAM_END_CODE:
1112
	  ctx->packet.pem = true;
1111
	  ctx->packet.pem = true;
1113
	  pos += 4;
1112
	  pos += 4;
Lines 1130-1140 Link Here
1130
  return buflen;
1129
  return buflen;
1131
}
1130
}
1132
1131
1133
mpeg_norm_t 
1132
mpeg_norm_t
1134
vcd_mpeg_get_norm (const struct vcd_mpeg_stream_vid_info *_info)
1133
vcd_mpeg_get_norm (const struct vcd_mpeg_stream_vid_info *_info)
1135
{
1134
{
1136
  int i;
1135
  int i;
1137
        
1136
1138
  for (i = 0; norm_table[i].norm != MPEG_NORM_OTHER;i++)
1137
  for (i = 0; norm_table[i].norm != MPEG_NORM_OTHER;i++)
1139
    if (norm_table[i].hsize == _info->hsize
1138
    if (norm_table[i].hsize == _info->hsize
1140
        && norm_table[i].vsize == _info->vsize
1139
        && norm_table[i].vsize == _info->vsize
Lines 1147-1175 Link Here
1147
enum vcd_mpeg_packet_type
1146
enum vcd_mpeg_packet_type
1148
vcd_mpeg_packet_get_type (const struct vcd_mpeg_packet_info *_info)
1147
vcd_mpeg_packet_get_type (const struct vcd_mpeg_packet_info *_info)
1149
{
1148
{
1150
  if (_info->video[0] 
1149
  if (_info->video[0]
1151
      || _info->video[1]
1150
      || _info->video[1]
1152
      || _info->video[2])
1151
      || _info->video[2])
1153
    return PKT_TYPE_VIDEO;
1152
    return PKT_TYPE_VIDEO;
1154
  else if (_info->audio[0] 
1153
  else if (_info->audio[0]
1155
           || _info->audio[1]
1154
           || _info->audio[1]
1156
           || _info->audio[2])
1155
           || _info->audio[2])
1157
    return PKT_TYPE_AUDIO;
1156
    return PKT_TYPE_AUDIO;
1158
  else if (_info->zero)
1157
  else if (_info->zero)
1159
    return PKT_TYPE_ZERO;
1158
    return PKT_TYPE_ZERO;
1160
  else if (_info->ogt[0] 
1159
  else if (_info->ogt[0]
1161
           || _info->ogt[1] 
1160
           || _info->ogt[1]
1162
           || _info->ogt[2]
1161
           || _info->ogt[2]
1163
           || _info->ogt[3])
1162
           || _info->ogt[3])
1164
    return PKT_TYPE_OGT; 
1163
    return PKT_TYPE_OGT;
1165
  else if (_info->system_header || _info->padding)
1164
  else if (_info->system_header || _info->padding)
1166
    return PKT_TYPE_EMPTY;
1165
    return PKT_TYPE_EMPTY;
1167
1166
1168
  return PKT_TYPE_INVALID;
1167
  return PKT_TYPE_INVALID;
1169
}
1168
}
1170
1169
1171
1170
1172
/* 
1171
/*
1173
 * Local variables:
1172
 * Local variables:
1174
 *  c-file-style: "gnu"
1173
 *  c-file-style: "gnu"
1175
 *  tab-width: 8
1174
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/mpeg.h (-5 / +5 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_MPEG_H__
21
#ifndef __VCD_MPEG_H__
22
#define __VCD_MPEG_H__
22
#define __VCD_MPEG_H__
23
23
Lines 105-111 Link Here
105
105
106
      CdioList_t *aps_list; /* filled up by vcd_mpeg_source */
106
      CdioList_t *aps_list; /* filled up by vcd_mpeg_source */
107
      double last_aps_pts; /* temp, see ->packet */
107
      double last_aps_pts; /* temp, see ->packet */
108
      
108
109
    } shdr[3];
109
    } shdr[3];
110
110
111
    struct vcd_mpeg_stream_aud_info {
111
    struct vcd_mpeg_stream_aud_info {
Lines 147-153 Link Here
147
  MPEG_NORM_NTSC_S
147
  MPEG_NORM_NTSC_S
148
} mpeg_norm_t;
148
} mpeg_norm_t;
149
149
150
mpeg_norm_t 
150
mpeg_norm_t
151
vcd_mpeg_get_norm (const struct vcd_mpeg_stream_vid_info *_info);
151
vcd_mpeg_get_norm (const struct vcd_mpeg_stream_vid_info *_info);
152
152
153
enum vcd_mpeg_packet_type {
153
enum vcd_mpeg_packet_type {
Lines 184-191 Link Here
184
184
185
#endif /* __VCD_MPEG_H__ */
185
#endif /* __VCD_MPEG_H__ */
186
186
187
187
188
/* 
188
/*
189
 * Local variables:
189
 * Local variables:
190
 *  c-file-style: "gnu"
190
 *  c-file-style: "gnu"
191
 *  tab-width: 8
191
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/mpeg_stream.c (-24 / +24 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 46-52 Link Here
46
  VcdDataSource_t *data_source;
46
  VcdDataSource_t *data_source;
47
47
48
  bool scanned;
48
  bool scanned;
49
  
49
50
  /* _get_packet cache */
50
  /* _get_packet cache */
51
  unsigned _read_pkt_pos;
51
  unsigned _read_pkt_pos;
52
  unsigned _read_pkt_no;
52
  unsigned _read_pkt_no;
Lines 62-68 Link Here
62
vcd_mpeg_source_new (VcdDataSource_t *mpeg_file)
62
vcd_mpeg_source_new (VcdDataSource_t *mpeg_file)
63
{
63
{
64
  VcdMpegSource_t *new_obj;
64
  VcdMpegSource_t *new_obj;
65
  
65
66
  vcd_assert (mpeg_file != NULL);
66
  vcd_assert (mpeg_file != NULL);
67
67
68
  new_obj = calloc(1, sizeof (VcdMpegSource_t));
68
  new_obj = calloc(1, sizeof (VcdMpegSource_t));
Lines 84-90 Link Here
84
84
85
  for (i = 0; i < 3; i++)
85
  for (i = 0; i < 3; i++)
86
    if (obj->info.shdr[i].aps_list)
86
    if (obj->info.shdr[i].aps_list)
87
      _cdio_list_free (obj->info.shdr[i].aps_list, true);
87
      _cdio_list_free (obj->info.shdr[i].aps_list, true, NULL);
88
88
89
  free (obj);
89
  free (obj);
90
}
90
}
Lines 104-110 Link Here
104
{
104
{
105
  vcd_assert (obj != NULL);
105
  vcd_assert (obj != NULL);
106
  vcd_assert (!obj->scanned);
106
  vcd_assert (!obj->scanned);
107
  
107
108
  return obj->info.packets * 2324;
108
  return obj->info.packets * 2324;
109
}
109
}
110
110
Lines 132-138 Link Here
132
  vcd_assert (!obj->scanned);
132
  vcd_assert (!obj->scanned);
133
133
134
  memset (&state, 0, sizeof (state));
134
  memset (&state, 0, sizeof (state));
135
  
135
136
  if (fix_scan_info)
136
  if (fix_scan_info)
137
    state.stream.scan_data_warnings = VCD_MPEG_SCAN_DATA_WARNS + 1;
137
    state.stream.scan_data_warnings = VCD_MPEG_SCAN_DATA_WARNS + 1;
138
138
Lines 190-203 Link Here
190
        case APS_ASGI:
190
        case APS_ASGI:
191
          {
191
          {
192
            struct aps_data *_data = calloc(1, sizeof (struct aps_data));
192
            struct aps_data *_data = calloc(1, sizeof (struct aps_data));
193
            
193
194
            _data->packet_no = pno;
194
            _data->packet_no = pno;
195
            _data->timestamp = state.packet.aps_pts;
195
            _data->timestamp = state.packet.aps_pts;
196
196
197
            if (!state.stream.shdr[state.packet.aps_idx].aps_list)
197
            if (!state.stream.shdr[state.packet.aps_idx].aps_list)
198
              state.stream.shdr[state.packet.aps_idx].aps_list = 
198
              state.stream.shdr[state.packet.aps_idx].aps_list =
199
                _cdio_list_new ();
199
                _cdio_list_new ();
200
            
200
201
            _cdio_list_append (state.stream.shdr[state.packet.aps_idx].aps_list, _data);
201
            _cdio_list_append (state.stream.shdr[state.packet.aps_idx].aps_list, _data);
202
          }
202
          }
203
          break;
203
          break;
Lines 240-246 Link Here
240
  obj->info.playing_time = obj->info.max_pts - obj->info.min_pts;
240
  obj->info.playing_time = obj->info.max_pts - obj->info.min_pts;
241
241
242
  if (obj->info.min_pts)
242
  if (obj->info.min_pts)
243
    vcd_debug ("pts start offset %f (max pts = %f)", 
243
    vcd_debug ("pts start offset %f (max pts = %f)",
244
               obj->info.min_pts, obj->info.max_pts);
244
               obj->info.min_pts, obj->info.max_pts);
245
245
246
  vcd_debug ("playing time %f", obj->info.playing_time);
246
  vcd_debug ("playing time %f", obj->info.playing_time);
Lines 256-263 Link Here
256
        _CDIO_LIST_FOREACH (n, obj->info.shdr[i].aps_list)
256
        _CDIO_LIST_FOREACH (n, obj->info.shdr[i].aps_list)
257
        {
257
        {
258
          struct aps_data *_data = _cdio_list_node_data (n);
258
          struct aps_data *_data = _cdio_list_node_data (n);
259
          
259
260
          _data->timestamp -= obj->info.min_pts; 
260
          _data->timestamp -= obj->info.min_pts;
261
        }
261
        }
262
  }
262
  }
263
263
Lines 296-302 Link Here
296
296
297
      if (_aps->packet_no >= packet_no)
297
      if (_aps->packet_no >= packet_no)
298
        break;
298
        break;
299
      
299
300
      _laps = _aps;
300
      _laps = _aps;
301
    }
301
    }
302
302
Lines 308-314 Link Here
308
  return retval;
308
  return retval;
309
}
309
}
310
310
311
static void 
311
static void
312
_set_scan_msf (msf_t *_msf, long lsn)
312
_set_scan_msf (msf_t *_msf, long lsn)
313
{
313
{
314
  if (lsn == -1)
314
  if (lsn == -1)
Lines 322-328 Link Here
322
  _msf->f |= 0x80;
322
  _msf->f |= 0x80;
323
}
323
}
324
324
325
static void 
325
static void
326
_fix_scan_info (struct vcd_mpeg_scan_data_t *scan_data_ptr,
326
_fix_scan_info (struct vcd_mpeg_scan_data_t *scan_data_ptr,
327
                unsigned packet_no, double pts, CdioList_t *aps_list)
327
                unsigned packet_no, double pts, CdioList_t *aps_list)
328
{
328
{
Lines 338-344 Link Here
338
      else if (_aps->packet_no < packet_no)
338
      else if (_aps->packet_no < packet_no)
339
        {
339
        {
340
          _prev = _aps->packet_no;
340
          _prev = _aps->packet_no;
341
          
341
342
          if (pts - _aps->timestamp < 10 && _back == -1)
342
          if (pts - _aps->timestamp < 10 && _back == -1)
343
            _back = _aps->packet_no;
343
            _back = _aps->packet_no;
344
        }
344
        }
Lines 366-372 Link Here
366
366
367
int
367
int
368
vcd_mpeg_source_get_packet (VcdMpegSource_t *obj, unsigned long packet_no,
368
vcd_mpeg_source_get_packet (VcdMpegSource_t *obj, unsigned long packet_no,
369
			    void *packet_buf, 
369
			    void *packet_buf,
370
                            struct vcd_mpeg_packet_info *flags,
370
                            struct vcd_mpeg_packet_info *flags,
371
                            bool fix_scan_info)
371
                            bool fix_scan_info)
372
{
372
{
Lines 408-414 Link Here
408
      char buf[2324] = { 0, };
408
      char buf[2324] = { 0, };
409
      int read_len = MIN (sizeof (buf), (length - pos));
409
      int read_len = MIN (sizeof (buf), (length - pos));
410
      int pkt_len;
410
      int pkt_len;
411
      
411
412
      vcd_data_source_read (obj->data_source, buf, read_len, 1);
412
      vcd_data_source_read (obj->data_source, buf, read_len, 1);
413
413
414
      pkt_len = vcd_mpeg_parse_packet (buf, read_len,
414
      pkt_len = vcd_mpeg_parse_packet (buf, read_len,
Lines 418-424 Link Here
418
418
419
      if (pno == packet_no)
419
      if (pno == packet_no)
420
	{
420
	{
421
          /* optimized for sequential access, 
421
          /* optimized for sequential access,
422
             thus save pointer to next mpeg pack */
422
             thus save pointer to next mpeg pack */
423
	  obj->_read_pkt_pos = pos + pkt_len;
423
	  obj->_read_pkt_pos = pos + pkt_len;
424
	  obj->_read_pkt_no = pno + 1;
424
	  obj->_read_pkt_no = pno + 1;
Lines 434-449 Link Here
434
                vid_idx = 2;
434
                vid_idx = 2;
435
              else if (state.packet.video[1])
435
              else if (state.packet.video[1])
436
                vid_idx = 1;
436
                vid_idx = 1;
437
              else 
437
              else
438
                vid_idx = 0;
438
                vid_idx = 0;
439
439
440
              if (state.packet.has_pts)
440
              if (state.packet.has_pts)
441
                _pts = state.packet.pts - obj->info.min_pts;
441
                _pts = state.packet.pts - obj->info.min_pts;
442
              else
442
              else
443
                _pts = _approx_pts (obj->info.shdr[vid_idx].aps_list, 
443
                _pts = _approx_pts (obj->info.shdr[vid_idx].aps_list,
444
                                    packet_no);
444
                                    packet_no);
445
445
446
              _fix_scan_info (state.packet.scan_data_ptr, packet_no, 
446
              _fix_scan_info (state.packet.scan_data_ptr, packet_no,
447
                              _pts, obj->info.shdr[vid_idx].aps_list);
447
                              _pts, obj->info.shdr[vid_idx].aps_list);
448
            }
448
            }
449
449
Lines 481-488 Link Here
481
  vcd_data_source_close (p_vcdmpegsource->data_source);
481
  vcd_data_source_close (p_vcdmpegsource->data_source);
482
}
482
}
483
483
484
484
485
/* 
485
/*
486
 * Local variables:
486
 * Local variables:
487
 *  c-file-style: "gnu"
487
 *  c-file-style: "gnu"
488
 *  tab-width: 8
488
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/mpeg_stream.h (-6 / +6 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_MPEG_STREAM__
21
#ifndef __VCD_MPEG_STREAM__
22
#define __VCD_MPEG_STREAM__
22
#define __VCD_MPEG_STREAM__
23
23
Lines 84-97 Link Here
84
                                   void *user_data);
84
                                   void *user_data);
85
85
86
void
86
void
87
vcd_mpeg_source_scan (VcdMpegSource_t *obj, bool strict_aps, 
87
vcd_mpeg_source_scan (VcdMpegSource_t *obj, bool strict_aps,
88
                      bool fix_scan_info, vcd_mpeg_prog_cb_t callback, 
88
                      bool fix_scan_info, vcd_mpeg_prog_cb_t callback,
89
                      void *user_data);
89
                      void *user_data);
90
90
91
/* gets the packet at given position */
91
/* gets the packet at given position */
92
int
92
int
93
vcd_mpeg_source_get_packet (VcdMpegSource_t *obj, unsigned long packet_no,
93
vcd_mpeg_source_get_packet (VcdMpegSource_t *obj, unsigned long packet_no,
94
			    void *packet_buf, 
94
			    void *packet_buf,
95
                            struct vcd_mpeg_packet_info *flags,
95
                            struct vcd_mpeg_packet_info *flags,
96
                            bool fix_scan_info);
96
                            bool fix_scan_info);
97
97
Lines 108-115 Link Here
108
vcd_mpeg_source_destroy (VcdMpegSource_t *obj, bool destroy_file_obj);
108
vcd_mpeg_source_destroy (VcdMpegSource_t *obj, bool destroy_file_obj);
109
109
110
#endif /* __VCD_MPEG_STREAM__ */
110
#endif /* __VCD_MPEG_STREAM__ */
111
111
112
/* 
112
/*
113
 * Local variables:
113
 * Local variables:
114
 *  c-file-style: "gnu"
114
 *  c-file-style: "gnu"
115
 *  tab-width: 8
115
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/obj.h (-7 / +7 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_OBJ_H__
21
#ifndef __VCD_OBJ_H__
22
#define __VCD_OBJ_H__
22
#define __VCD_OBJ_H__
23
23
Lines 62-68 Link Here
62
62
63
/* work in progress -- fixme rename all occurences */
63
/* work in progress -- fixme rename all occurences */
64
#define mpeg_track_t mpeg_sequence_t
64
#define mpeg_track_t mpeg_sequence_t
65
#define mpeg_track_list mpeg_sequence_list 
65
#define mpeg_track_list mpeg_sequence_list
66
66
67
typedef struct {
67
typedef struct {
68
  VcdMpegSource_t *source;
68
  VcdMpegSource_t *source;
Lines 86-92 Link Here
86
  char *iso_pathname;
86
  char *iso_pathname;
87
  VcdDataSource_t *file;
87
  VcdDataSource_t *file;
88
  bool raw_flag;
88
  bool raw_flag;
89
  
89
90
  uint32_t size;
90
  uint32_t size;
91
  uint32_t start_extent;
91
  uint32_t start_extent;
92
  uint32_t sectors;
92
  uint32_t sectors;
Lines 140-147 Link Here
140
  unsigned psdx_size;
140
  unsigned psdx_size;
141
141
142
  /* custom files */
142
  /* custom files */
143
  unsigned ext_file_start_extent; 
143
  unsigned ext_file_start_extent;
144
  unsigned custom_file_start_extent; 
144
  unsigned custom_file_start_extent;
145
  CdioList_t *custom_file_list; /* custom_file_t */
145
  CdioList_t *custom_file_list; /* custom_file_t */
146
  CdioList_t *custom_dir_list; /* char */
146
  CdioList_t *custom_dir_list; /* char */
147
147
Lines 192-199 Link Here
192
192
193
#endif /* __VCD_OBJ_H__ */
193
#endif /* __VCD_OBJ_H__ */
194
194
195
195
196
/* 
196
/*
197
 * Local variables:
197
 * Local variables:
198
 *  c-file-style: "gnu"
198
 *  c-file-style: "gnu"
199
 *  tab-width: 8
199
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/pbc.c (-46 / +48 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 26-31 Link Here
26
#include <stddef.h>
26
#include <stddef.h>
27
#include <math.h>
27
#include <math.h>
28
28
29
/* We don't want to pull in cdio's config */
30
#define __CDIO_CONFIG_H__
29
#include <cdio/cdio.h>
31
#include <cdio/cdio.h>
30
#include <cdio/bytesex.h>
32
#include <cdio/bytesex.h>
31
#include <cdio/util.h>
33
#include <cdio/util.h>
Lines 116-122 Link Here
116
_set_area_helper (pbc_area_t *dest, const pbc_area_t *src, const char sel_id[])
118
_set_area_helper (pbc_area_t *dest, const pbc_area_t *src, const char sel_id[])
117
{
119
{
118
  memset (dest, 0, sizeof (pbc_area_t));
120
  memset (dest, 0, sizeof (pbc_area_t));
119
  
121
120
  if (src)
122
  if (src)
121
    {
123
    {
122
      if (src->x1 || src->x2 || src->y1 || src->y2) /* not disabled */
124
      if (src->x1 || src->x2 || src->y1 || src->y2) /* not disabled */
Lines 129-135 Link Here
129
	    vcd_error ("selection '%s': area y1 >= y2 (%d >= %d)",
131
	    vcd_error ("selection '%s': area y1 >= y2 (%d >= %d)",
130
		       sel_id, src->y1, src->y2);
132
		       sel_id, src->y1, src->y2);
131
	}
133
	}
132
  
134
133
      *dest = *src;
135
      *dest = *src;
134
    }
136
    }
135
}
137
}
Lines 151-157 Link Here
151
	return ITEM_TYPE_ENTRY;
153
	return ITEM_TYPE_ENTRY;
152
      else if (id <= MAX_ENCODED_SEGMENT_NUM)
154
      else if (id <= MAX_ENCODED_SEGMENT_NUM)
153
	return ITEM_TYPE_SEGMENT;
155
	return ITEM_TYPE_SEGMENT;
154
      else 
156
      else
155
	vcd_assert_not_reached ();
157
	vcd_assert_not_reached ();
156
    }
158
    }
157
  else if (_vcd_pbc_lid_lookup (obj, item_id))
159
  else if (_vcd_pbc_lid_lookup (obj, item_id))
Lines 194-200 Link Here
194
196
195
      /* default entry point */
197
      /* default entry point */
196
198
197
      if (_sequence->default_entry_id 
199
      if (_sequence->default_entry_id
198
	  && !strcmp (item_id, _sequence->default_entry_id))
200
	  && !strcmp (item_id, _sequence->default_entry_id))
199
	return n + 100;
201
	return n + 100;
200
      n++;
202
      n++;
Lines 254-260 Link Here
254
_vcd_pbc_max_lid (const VcdObj_t *obj)
256
_vcd_pbc_max_lid (const VcdObj_t *obj)
255
{
257
{
256
  uint16_t retval = 0;
258
  uint16_t retval = 0;
257
  
259
258
  if (_vcd_pbc_available (obj))
260
  if (_vcd_pbc_available (obj))
259
    retval = _cdio_list_length (obj->pbc_list);
261
    retval = _cdio_list_length (obj->pbc_list);
260
262
Lines 286-292 Link Here
286
      if (extended || _vcd_obj_has_cap_p (obj, _CAP_4C_SVCD))
288
      if (extended || _vcd_obj_has_cap_p (obj, _CAP_4C_SVCD))
287
	retval += __cd_offsetof (PsdSelectionListDescriptorExtended_t, area[n]);
289
	retval += __cd_offsetof (PsdSelectionListDescriptorExtended_t, area[n]);
288
      break;
290
      break;
289
      
291
290
    case PBC_END:
292
    case PBC_END:
291
      retval = sizeof (PsdEndListDescriptor_t);
293
      retval = sizeof (PsdEndListDescriptor_t);
292
      break;
294
      break;
Lines 299-305 Link Here
299
  return retval;
301
  return retval;
300
}
302
}
301
303
302
static uint16_t 
304
static uint16_t
303
_lookup_psd_offset (const VcdObj_t *obj, const char item_id[], bool extended)
305
_lookup_psd_offset (const VcdObj_t *obj, const char item_id[], bool extended)
304
{
306
{
305
  CdioListNode_t *node;
307
  CdioListNode_t *node;
Lines 317-328 Link Here
317
319
318
      if (!p_pbc->id || strcmp (item_id, p_pbc->id))
320
      if (!p_pbc->id || strcmp (item_id, p_pbc->id))
319
	continue;
321
	continue;
320
	
322
321
      return (extended ? p_pbc->offset_ext : p_pbc->offset) / INFO_OFFSET_MULT;
323
      return (extended ? p_pbc->offset_ext : p_pbc->offset) / INFO_OFFSET_MULT;
322
    }
324
    }
323
325
324
  vcd_error ("PSD: referenced PSD '%s' not found", item_id);
326
  vcd_error ("PSD: referenced PSD '%s' not found", item_id);
325
	    
327
326
  /* not found */
328
  /* not found */
327
  return PSD_OFS_DISABLED;
329
  return PSD_OFS_DISABLED;
328
}
330
}
Lines 370-376 Link Here
370
    case PBC_PLAYLIST:
372
    case PBC_PLAYLIST:
371
      {
373
      {
372
	CdioListNode_t *node;
374
	CdioListNode_t *node;
373
	
375
374
	_vcd_pbc_mark_id (obj, p_pbc->prev_id);
376
	_vcd_pbc_mark_id (obj, p_pbc->prev_id);
375
	_vcd_pbc_mark_id (obj, p_pbc->next_id);
377
	_vcd_pbc_mark_id (obj, p_pbc->next_id);
376
	_vcd_pbc_mark_id (obj, p_pbc->retn_id);
378
	_vcd_pbc_mark_id (obj, p_pbc->retn_id);
Lines 391-397 Link Here
391
	_vcd_pbc_mark_id (obj, p_pbc->prev_id);
393
	_vcd_pbc_mark_id (obj, p_pbc->prev_id);
392
	_vcd_pbc_mark_id (obj, p_pbc->next_id);
394
	_vcd_pbc_mark_id (obj, p_pbc->next_id);
393
	_vcd_pbc_mark_id (obj, p_pbc->retn_id);
395
	_vcd_pbc_mark_id (obj, p_pbc->retn_id);
394
	
396
395
	if (p_pbc->selection_type == _SEL_NORMAL)
397
	if (p_pbc->selection_type == _SEL_NORMAL)
396
	  _vcd_pbc_mark_id (obj, p_pbc->default_id);
398
	  _vcd_pbc_mark_id (obj, p_pbc->default_id);
397
399
Lines 405-411 Link Here
405
407
406
	    _vcd_pbc_mark_id (obj, _id);
408
	    _vcd_pbc_mark_id (obj, _id);
407
	  }
409
	  }
408
      }      
410
      }
409
      break;
411
      break;
410
412
411
    case PBC_END:
413
    case PBC_END:
Lines 506-528 Link Here
506
	_PsdPlayListDescriptor *_md = buf;
508
	_PsdPlayListDescriptor *_md = buf;
507
	CdioListNode_t *node;
509
	CdioListNode_t *node;
508
	int n;
510
	int n;
509
	
511
510
	_md->type = PSD_TYPE_PLAY_LIST;
512
	_md->type = PSD_TYPE_PLAY_LIST;
511
	_md->noi = _cdio_list_length (p_pbc->item_id_list);
513
	_md->noi = _cdio_list_length (p_pbc->item_id_list);
512
	
514
513
	vcd_assert (p_pbc->lid < 0x8000);
515
	vcd_assert (p_pbc->lid < 0x8000);
514
	_md->lid = uint16_to_be (p_pbc->lid | (p_pbc->rejected ? 0x8000 : 0));
516
	_md->lid = uint16_to_be (p_pbc->lid | (p_pbc->rejected ? 0x8000 : 0));
515
	
517
516
	_md->prev_ofs = 
518
	_md->prev_ofs =
517
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->prev_id, extended));
519
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->prev_id, extended));
518
	_md->next_ofs = 
520
	_md->next_ofs =
519
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->next_id, extended));
521
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->next_id, extended));
520
	_md->return_ofs =
522
	_md->return_ofs =
521
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->retn_id, extended));
523
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->retn_id, extended));
522
	_md->ptime = uint16_to_be (rint (p_pbc->playing_time * 15.0));
524
	_md->ptime = uint16_to_be (rint (p_pbc->playing_time * 15.0));
523
	_md->wtime = _wtime (p_pbc->wait_time);
525
	_md->wtime = _wtime (p_pbc->wait_time);
524
	_md->atime = _wtime (p_pbc->auto_pause_time);
526
	_md->atime = _wtime (p_pbc->auto_pause_time);
525
	
527
526
	n = 0;
528
	n = 0;
527
	_CDIO_LIST_FOREACH (node, p_pbc->item_id_list)
529
	_CDIO_LIST_FOREACH (node, p_pbc->item_id_list)
528
	  {
530
	  {
Lines 535-546 Link Here
535
537
536
		if (!_pin)
538
		if (!_pin)
537
		  vcd_error ("PSD: referenced play item '%s' not found", _id);
539
		  vcd_error ("PSD: referenced play item '%s' not found", _id);
538
		
540
539
		_md->itemid[n] = uint16_to_be (_pin); 
541
		_md->itemid[n] = uint16_to_be (_pin);
540
	      }
542
	      }
541
	    else
543
	    else
542
	      _md->itemid[n] = 0; /* play nothing */
544
	      _md->itemid[n] = 0; /* play nothing */
543
	      
545
544
	    n++;
546
	    n++;
545
	  }
547
	  }
546
      }
548
      }
Lines 585-593 Link Here
585
	vcd_assert (p_pbc->lid < 0x8000);
587
	vcd_assert (p_pbc->lid < 0x8000);
586
	_md->lid = uint16_to_be (p_pbc->lid | (p_pbc->rejected ? 0x8000 : 0));
588
	_md->lid = uint16_to_be (p_pbc->lid | (p_pbc->rejected ? 0x8000 : 0));
587
589
588
	_md->prev_ofs = 
590
	_md->prev_ofs =
589
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->prev_id, extended));
591
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->prev_id, extended));
590
	_md->next_ofs = 
592
	_md->next_ofs =
591
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->next_id, extended));
593
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->next_id, extended));
592
	_md->return_ofs =
594
	_md->return_ofs =
593
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->retn_id, extended));
595
	  uint16_to_be (_lookup_psd_offset (obj, p_pbc->retn_id, extended));
Lines 598-604 Link Here
598
	    _md->default_ofs =
600
	    _md->default_ofs =
599
	      uint16_to_be (_lookup_psd_offset (obj, p_pbc->default_id, extended));
601
	      uint16_to_be (_lookup_psd_offset (obj, p_pbc->default_id, extended));
600
	    break;
602
	    break;
601
	    
603
602
	  case _SEL_MULTI_DEF:
604
	  case _SEL_MULTI_DEF:
603
	    _md->default_ofs = uint16_to_be (PSD_OFS_MULTI_DEF);
605
	    _md->default_ofs = uint16_to_be (PSD_OFS_MULTI_DEF);
604
	    if (p_pbc->default_id)
606
	    if (p_pbc->default_id)
Lines 612-618 Link Here
612
	      vcd_warn ("ignoring default target '%s' for multi default (w/o num) selection '%s'",
614
	      vcd_warn ("ignoring default target '%s' for multi default (w/o num) selection '%s'",
613
			p_pbc->default_id, p_pbc->id);
615
			p_pbc->default_id, p_pbc->id);
614
	    break;
616
	    break;
615
	    
617
616
	  default:
618
	  default:
617
	    vcd_assert_not_reached ();
619
	    vcd_assert_not_reached ();
618
	    break;
620
	    break;
Lines 626-632 Link Here
626
	  vcd_warn ("loop count %d > 127", p_pbc->loop_count);
628
	  vcd_warn ("loop count %d > 127", p_pbc->loop_count);
627
629
628
	_md->loop = (p_pbc->loop_count > 0x7f) ? 0x7f : p_pbc->loop_count;
630
	_md->loop = (p_pbc->loop_count > 0x7f) ? 0x7f : p_pbc->loop_count;
629
	
631
630
	if (p_pbc->jump_delayed)
632
	if (p_pbc->jump_delayed)
631
	  _md->loop |= 0x80;
633
	  _md->loop |= 0x80;
632
634
Lines 643-649 Link Here
643
	if (p_pbc->item_id)
645
	if (p_pbc->item_id)
644
	  {
646
	  {
645
	    const uint16_t _pin = _vcd_pbc_pin_lookup (obj, p_pbc->item_id);
647
	    const uint16_t _pin = _vcd_pbc_pin_lookup (obj, p_pbc->item_id);
646
	    
648
647
	    if (!_pin)
649
	    if (!_pin)
648
	      vcd_error ("PSD: referenced play item '%s' not found", p_pbc->item_id);
650
	      vcd_error ("PSD: referenced play item '%s' not found", p_pbc->item_id);
649
651
Lines 657-663 Link Here
657
	  {
659
	  {
658
	  case _SEL_NORMAL:
660
	  case _SEL_NORMAL:
659
	    break;
661
	    break;
660
	    
662
661
	  case _SEL_MULTI_DEF:
663
	  case _SEL_MULTI_DEF:
662
	  case _SEL_MULTI_DEF_NO_NUM:
664
	  case _SEL_MULTI_DEF_NO_NUM:
663
	    if (p_pbc->jump_delayed)
665
	    if (p_pbc->jump_delayed)
Lines 678-684 Link Here
678
	      if ((_seq = _vcd_obj_get_sequence_by_id ((VcdObj_t *) obj, p_pbc->item_id))
680
	      if ((_seq = _vcd_obj_get_sequence_by_id ((VcdObj_t *) obj, p_pbc->item_id))
679
		  || (_seq = _vcd_obj_get_sequence_by_entry_id ((VcdObj_t *) obj, p_pbc->item_id)))
681
		  || (_seq = _vcd_obj_get_sequence_by_entry_id ((VcdObj_t *) obj, p_pbc->item_id)))
680
		{
682
		{
681
		  const unsigned _entries = 
683
		  const unsigned _entries =
682
		    _cdio_list_length (_seq->entry_list) + 1;
684
		    _cdio_list_length (_seq->entry_list) + 1;
683
685
684
		  if (_nos != _entries)
686
		  if (_nos != _entries)
Lines 691-700 Link Here
691
			   " is requried to be sequence or entry point"
693
			   " is requried to be sequence or entry point"
692
			   " item for multi default selecton",
694
			   " item for multi default selecton",
693
			   p_pbc->id, p_pbc->item_id);
695
			   p_pbc->id, p_pbc->item_id);
694
	    }	    
696
	    }
695
697
696
	    break;
698
	    break;
697
	    
699
698
	  default:
700
	  default:
699
	    vcd_assert_not_reached ();
701
	    vcd_assert_not_reached ();
700
	    break;
702
	    break;
Lines 709-718 Link Here
709
	  _CDIO_LIST_FOREACH (node, p_pbc->select_id_list)
711
	  _CDIO_LIST_FOREACH (node, p_pbc->select_id_list)
710
	    {
712
	    {
711
	      const char *_id = _cdio_list_node_data (node);
713
	      const char *_id = _cdio_list_node_data (node);
712
	    
714
713
	      _md->ofs[idx] = 
715
	      _md->ofs[idx] =
714
		uint16_to_be (_lookup_psd_offset (obj, _id, extended));
716
		uint16_to_be (_lookup_psd_offset (obj, _id, extended));
715
	    
717
716
	      idx++;
718
	      idx++;
717
	    }
719
	    }
718
	}
720
	}
Lines 722-728 Link Here
722
	    PsdSelectionListDescriptorExtended_t *_md2;
724
	    PsdSelectionListDescriptorExtended_t *_md2;
723
	    CdioListNode_t *node;
725
	    CdioListNode_t *node;
724
	    int n;
726
	    int n;
725
	    
727
726
	    /* append extended selection areas */
728
	    /* append extended selection areas */
727
729
728
	    _md2 = (void *) &_md->ofs[_nos];
730
	    _md2 = (void *) &_md->ofs[_nos];
Lines 748-754 Link Here
748
	  }
750
	  }
749
      }
751
      }
750
      break;
752
      break;
751
      
753
752
    case PBC_END:
754
    case PBC_END:
753
      {
755
      {
754
	PsdEndListDescriptor_t *_md = buf;
756
	PsdEndListDescriptor_t *_md = buf;
Lines 769-775 Link Here
769
			    " but next volume is 0", p_pbc->id);
771
			    " but next volume is 0", p_pbc->id);
770
772
771
		if (!_pin)
773
		if (!_pin)
772
		  vcd_error ("PSD: referenced play item '%s' not found", 
774
		  vcd_error ("PSD: referenced play item '%s' not found",
773
			     p_pbc->item_id);
775
			     p_pbc->item_id);
774
776
775
		_md->change_pic = uint16_to_be (_pin);
777
		_md->change_pic = uint16_to_be (_pin);
Lines 781-792 Link Here
781
783
782
		if (!_segment)
784
		if (!_segment)
783
		  vcd_warn ("PSD: endlist '%s': referenced play item '%s'"
785
		  vcd_warn ("PSD: endlist '%s': referenced play item '%s'"
784
			    " is not a segment play item", 
786
			    " is not a segment play item",
785
			    p_pbc->id, p_pbc->image_id);
787
			    p_pbc->id, p_pbc->image_id);
786
		else if (_segment->info->shdr[0].seen
788
		else if (_segment->info->shdr[0].seen
787
			 || !(_segment->info->shdr[1].seen || _segment->info->shdr[2].seen))
789
			 || !(_segment->info->shdr[1].seen || _segment->info->shdr[2].seen))
788
		  vcd_warn ("PSD: endlist '%s': referenced play item '%s'"
790
		  vcd_warn ("PSD: endlist '%s': referenced play item '%s'"
789
			    " should be a still picture", 
791
			    " should be a still picture",
790
			    p_pbc->id, p_pbc->image_id);
792
			    p_pbc->id, p_pbc->image_id);
791
	      }
793
	      }
792
	  }
794
	  }
Lines 819-825 Link Here
819
      p_pbc->select_id_list = _cdio_list_new ();
821
      p_pbc->select_id_list = _cdio_list_new ();
820
      p_pbc->select_area_list = _cdio_list_new ();
822
      p_pbc->select_area_list = _cdio_list_new ();
821
      break;
823
      break;
822
      
824
823
    case PBC_END:
825
    case PBC_END:
824
      break;
826
      break;
825
827
Lines 848-861 Link Here
848
  switch (p_pbc->type)
850
  switch (p_pbc->type)
849
    {
851
    {
850
    case PBC_PLAYLIST:
852
    case PBC_PLAYLIST:
851
      _cdio_list_free (p_pbc->item_id_list, false);
853
      _cdio_list_free (p_pbc->item_id_list, false, NULL);
852
      break;
854
      break;
853
855
854
    case PBC_SELECTION:
856
    case PBC_SELECTION:
855
      _cdio_list_free (p_pbc->select_id_list, true);
857
      _cdio_list_free (p_pbc->select_id_list, true, NULL);
856
      _cdio_list_free (p_pbc->select_area_list, true);
858
      _cdio_list_free (p_pbc->select_area_list, true, NULL);
857
      break;
859
      break;
858
      
860
859
    case PBC_END:
861
    case PBC_END:
860
      break;
862
      break;
861
863
Lines 865-871 Link Here
865
    }
867
    }
866
}
868
}
867
869
868
/* 
870
/*
869
 */
871
 */
870
872
871
bool
873
bool
(-)vcdimager-0.7.24.ORIG/lib/pbc.h (-2 / +2 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_PBC_H__
21
#ifndef __VCD_PBC_H__
22
#define __VCD_PBC_H__
22
#define __VCD_PBC_H__
23
23
Lines 135-141 Link Here
135
uint16_t
135
uint16_t
136
_vcd_pbc_pin_lookup (const VcdObj_t *p_obj, const char item_id[]);
136
_vcd_pbc_pin_lookup (const VcdObj_t *p_obj, const char item_id[]);
137
137
138
unsigned 
138
unsigned
139
_vcd_pbc_list_calc_size (const pbc_t *_pbc, bool b_extended);
139
_vcd_pbc_list_calc_size (const pbc_t *_pbc, bool b_extended);
140
140
141
bool
141
bool
(-)vcdimager-0.7.24.ORIG/lib/salloc.c (-5 / +5 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 159-168 Link Here
159
{
159
{
160
  uint32_t i;
160
  uint32_t i;
161
161
162
  for (i = 0; i < size; i++) 
162
  for (i = 0; i < size; i++)
163
    {
163
    {
164
      vcd_assert (_vcd_salloc_is_set (bitmap, sec + i));
164
      vcd_assert (_vcd_salloc_is_set (bitmap, sec + i));
165
      
165
166
      _vcd_salloc_unset (bitmap, sec + i);
166
      _vcd_salloc_unset (bitmap, sec + i);
167
    }
167
    }
168
}
168
}
Lines 201-209 Link Here
201
201
202
  return (bitmap->len - 1) * 8 + n;
202
  return (bitmap->len - 1) * 8 + n;
203
}
203
}
204
205
204
206
/* 
205
206
/*
207
 * Local variables:
207
 * Local variables:
208
 *  c-file-style: "gnu"
208
 *  c-file-style: "gnu"
209
 *  tab-width: 8
209
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/salloc.h (-3 / +3 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* sector allocation management */
21
/* sector allocation management */
22
22
23
#ifndef _SALLOC_H_
23
#ifndef _SALLOC_H_
Lines 46-53 Link Here
46
46
47
#endif /* _SALLOC_H_ */
47
#endif /* _SALLOC_H_ */
48
48
49
49
50
/* 
50
/*
51
 * Local variables:
51
 * Local variables:
52
 *  c-file-style: "gnu"
52
 *  c-file-style: "gnu"
53
 *  tab-width: 8
53
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/sector.c (-27 / +27 lines)
Lines 17-23 Link Here
17
    along with this program; see the file COPYING.  If not, write to
17
    along with this program; see the file COPYING.  If not, write to
18
    the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
18
    the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19
    MA 02111-1307, USA.  */
19
    MA 02111-1307, USA.  */
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 48-54 Link Here
48
build_address (void *buf, sectortype_t sectortype, uint32_t address)
48
build_address (void *buf, sectortype_t sectortype, uint32_t address)
49
{
49
{
50
  raw_cd_sector_t *sector = buf;
50
  raw_cd_sector_t *sector = buf;
51
  
51
52
  vcd_assert (sizeof(raw_cd_sector_t) == CDIO_CD_FRAMESIZE_RAW-DATA_LEN);
52
  vcd_assert (sizeof(raw_cd_sector_t) == CDIO_CD_FRAMESIZE_RAW-DATA_LEN);
53
53
54
  cdio_lba_to_msf(address, &(sector->msf));
54
  cdio_lba_to_msf(address, &(sector->msf));
Lines 94-102 Link Here
94
  uint8_t *dp;
94
  uint8_t *dp;
95
  uint8_t *Q;
95
  uint8_t *Q;
96
  int i, j;
96
  int i, j;
97
        
97
98
  Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
98
  Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;
99
  
99
100
  dps = inout;
100
  dps = inout;
101
  for (j = 0; j < 26; j++) {
101
  for (j = 0; j < 26; j++) {
102
    uint16_t a, b;
102
    uint16_t a, b;
Lines 104-126 Link Here
104
    a = b = 0;
104
    a = b = 0;
105
    dp = dps;
105
    dp = dps;
106
    for (i = 0; i < 43; i++) {
106
    for (i = 0; i < 43; i++) {
107
      
107
108
      /* LSB */
108
      /* LSB */
109
      a ^= L2sq[i][*dp++];
109
      a ^= L2sq[i][*dp++];
110
      
110
111
      /* MSB */
111
      /* MSB */
112
      b ^= L2sq[i][*dp];
112
      b ^= L2sq[i][*dp];
113
      
113
114
      dp += 2*44-1;
114
      dp += 2*44-1;
115
      if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {
115
      if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {
116
        dp -= (4 + L2_RAW + 4 + 8 + L2_P);
116
        dp -= (4 + L2_RAW + 4 + 8 + L2_P);
117
      } 
117
      }
118
    }
118
    }
119
    Q[0]      = a >> 8;
119
    Q[0]      = a >> 8;
120
    Q[26*2]   = a;
120
    Q[26*2]   = a;
121
    Q[1]      = b >> 8;
121
    Q[1]      = b >> 8;
122
    Q[26*2+1] = b;
122
    Q[26*2+1] = b;
123
    
123
124
    Q += 2;
124
    Q += 2;
125
    dps += 2*43;
125
    dps += 2*43;
126
  }
126
  }
Lines 132-161 Link Here
132
  uint8_t *dp;
132
  uint8_t *dp;
133
  unsigned char *P;
133
  unsigned char *P;
134
  int i, j;
134
  int i, j;
135
  
135
136
  P = inout + 4 + L2_RAW + 4 + 8;
136
  P = inout + 4 + L2_RAW + 4 + 8;
137
  
137
138
  for (j = 0; j < 43; j++) {
138
  for (j = 0; j < 43; j++) {
139
    uint16_t a;
139
    uint16_t a;
140
    uint16_t b;
140
    uint16_t b;
141
    
141
142
    a = b = 0;
142
    a = b = 0;
143
    dp = inout;
143
    dp = inout;
144
    for (i = 19; i < 43; i++) {
144
    for (i = 19; i < 43; i++) {
145
      
145
146
      /* LSB */
146
      /* LSB */
147
      a ^= L2sq[i][*dp++];
147
      a ^= L2sq[i][*dp++];
148
      
148
149
      /* MSB */
149
      /* MSB */
150
      b ^= L2sq[i][*dp];
150
      b ^= L2sq[i][*dp];
151
      
151
152
      dp += 2*43 -1;
152
      dp += 2*43 -1;
153
    }
153
    }
154
    P[0]      = a >> 8;
154
    P[0]      = a >> 8;
155
    P[43*2]   = a;
155
    P[43*2]   = a;
156
    P[1]      = b >> 8;
156
    P[1]      = b >> 8;
157
    P[43*2+1] = b;
157
    P[43*2+1] = b;
158
    
158
159
    P += 2;
159
    P += 2;
160
    inout += 2;
160
    inout += 2;
161
  }
161
  }
Lines 174-180 Link Here
174
  vcd_assert (sizeof (mode2_form2_sector_t) == CDIO_CD_FRAMESIZE_RAW);
174
  vcd_assert (sizeof (mode2_form2_sector_t) == CDIO_CD_FRAMESIZE_RAW);
175
  vcd_assert (sizeof (mode0_sector_t) == CDIO_CD_FRAMESIZE_RAW);
175
  vcd_assert (sizeof (mode0_sector_t) == CDIO_CD_FRAMESIZE_RAW);
176
  vcd_assert (sizeof (raw_cd_sector_t) == SYNC_LEN+HEADER_LEN);
176
  vcd_assert (sizeof (raw_cd_sector_t) == SYNC_LEN+HEADER_LEN);
177
  
177
178
  memset (raw_sector, 0, SYNC_LEN+HEADER_LEN);
178
  memset (raw_sector, 0, SYNC_LEN+HEADER_LEN);
179
  memcpy (raw_sector->sync, sync_pattern, sizeof (sync_pattern));
179
  memcpy (raw_sector->sync, sync_pattern, sizeof (sync_pattern));
180
180
Lines 223-246 Link Here
223
  vcd_assert (extent != SECTOR_NIL);
223
  vcd_assert (extent != SECTOR_NIL);
224
224
225
  memset (raw_sector, 0, CDIO_CD_FRAMESIZE_RAW);
225
  memset (raw_sector, 0, CDIO_CD_FRAMESIZE_RAW);
226
  
226
227
  subhdr[0] = subhdr[4] = fnum;
227
  subhdr[0] = subhdr[4] = fnum;
228
  subhdr[1] = subhdr[5] = cnum;
228
  subhdr[1] = subhdr[5] = cnum;
229
  subhdr[2] = subhdr[6] = sm;
229
  subhdr[2] = subhdr[6] = sm;
230
  subhdr[3] = subhdr[7] = ci;
230
  subhdr[3] = subhdr[7] = ci;
231
231
232
  if (sm & SM_FORM2) 
232
  if (sm & SM_FORM2)
233
    {
233
    {
234
      memcpy ((char*)raw_sector+CDIO_CD_XA_SYNC_HEADER, data, 
234
      memcpy ((char*)raw_sector+CDIO_CD_XA_SYNC_HEADER, data,
235
              M2F2_SECTOR_SIZE);
235
              M2F2_SECTOR_SIZE);
236
      do_encode_L2 (raw_sector, MODE_2_FORM_2, extent+CDIO_PREGAP_SECTORS);
236
      do_encode_L2 (raw_sector, MODE_2_FORM_2, extent+CDIO_PREGAP_SECTORS);
237
    } 
237
    }
238
  else 
238
  else
239
    {
239
    {
240
      memcpy ((char*)raw_sector+CDIO_CD_XA_SYNC_HEADER, data, 
240
      memcpy ((char*)raw_sector+CDIO_CD_XA_SYNC_HEADER, data,
241
              CDIO_CD_FRAMESIZE);
241
              CDIO_CD_FRAMESIZE);
242
      do_encode_L2 (raw_sector, MODE_2_FORM_1, extent+CDIO_PREGAP_SECTORS);
242
      do_encode_L2 (raw_sector, MODE_2_FORM_1, extent+CDIO_PREGAP_SECTORS);
243
    } 
243
    }
244
}
244
}
245
245
246
void
246
void
Lines 249-263 Link Here
249
  vcd_assert (raw_sector != NULL);
249
  vcd_assert (raw_sector != NULL);
250
  vcd_assert (data != NULL);
250
  vcd_assert (data != NULL);
251
  vcd_assert (extent != SECTOR_NIL);
251
  vcd_assert (extent != SECTOR_NIL);
252
  
252
253
  memset (raw_sector, 0, CDIO_CD_FRAMESIZE_RAW);
253
  memset (raw_sector, 0, CDIO_CD_FRAMESIZE_RAW);
254
254
255
  memcpy ((char*)raw_sector+12+4, data, M2RAW_SECTOR_SIZE);
255
  memcpy ((char*)raw_sector+12+4, data, M2RAW_SECTOR_SIZE);
256
  do_encode_L2 (raw_sector, MODE_2, extent+CDIO_PREGAP_SECTORS);
256
  do_encode_L2 (raw_sector, MODE_2, extent+CDIO_PREGAP_SECTORS);
257
}
257
}
258
258
259
259
260
/* 
260
/*
261
 * Local variables:
261
 * Local variables:
262
 *  c-file-style: "gnu"
262
 *  c-file-style: "gnu"
263
 *  tab-width: 8
263
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/sector_private.h (-7 / +7 lines)
Lines 18-32 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifndef __VCD_CD_SECTOR_PRIVATE_H__
22
#ifndef __VCD_CD_SECTOR_PRIVATE_H__
23
#define __VCD_CD_SECTOR_PRIVATE_H__
23
#define __VCD_CD_SECTOR_PRIVATE_H__
24
24
25
#define RS_L12_BITS 8 
25
#define RS_L12_BITS 8
26
26
27
#define L2_RAW (1024*2) 
27
#define L2_RAW (1024*2)
28
#define L2_Q   (26*2*2) 
28
#define L2_Q   (26*2*2)
29
#define L2_P   (43*2*2) 
29
#define L2_P   (43*2*2)
30
30
31
typedef enum {
31
typedef enum {
32
  MODE_0,
32
  MODE_0,
Lines 1338-1345 Link Here
1338
1338
1339
#endif /* __VCD_CD_SECTOR_PRIVATE_H__ */
1339
#endif /* __VCD_CD_SECTOR_PRIVATE_H__ */
1340
1340
1341
1341
1342
/* 
1342
/*
1343
 * Local variables:
1343
 * Local variables:
1344
 *  c-file-style: "gnu"
1344
 *  c-file-style: "gnu"
1345
 *  tab-width: 8
1345
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/stream.c (-12 / +12 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 42-48 Link Here
42
42
43
static const char _rcsid[] = "$Id: stream.c,v 1.5 2005/06/07 23:29:23 rocky Exp $";
43
static const char _rcsid[] = "$Id: stream.c,v 1.5 2005/06/07 23:29:23 rocky Exp $";
44
44
45
/* 
45
/*
46
 * DataSource implementations
46
 * DataSource implementations
47
 */
47
 */
48
48
Lines 68-74 Link Here
68
  }
68
  }
69
}
69
}
70
70
71
VcdDataSink* 
71
VcdDataSink*
72
vcd_data_sink_new(void *user_data, const vcd_data_sink_io_functions *funcs)
72
vcd_data_sink_new(void *user_data, const vcd_data_sink_io_functions *funcs)
73
{
73
{
74
  VcdDataSink *new_obj;
74
  VcdDataSink *new_obj;
Lines 103-109 Link Here
103
  long written;
103
  long written;
104
104
105
  vcd_assert (obj != NULL);
105
  vcd_assert (obj != NULL);
106
  
106
107
  _vcd_data_sink_open_if_necessary(obj);
107
  _vcd_data_sink_open_if_necessary(obj);
108
108
109
  written = obj->op.write(obj->user_data, ptr, size*nmemb);
109
  written = obj->op.write(obj->user_data, ptr, size*nmemb);
Lines 126-132 Link Here
126
126
127
  if (len < 0 || len > (sizeof (buf) - 1))
127
  if (len < 0 || len > (sizeof (buf) - 1))
128
    vcd_error ("vsnprintf() returned %d", len);
128
    vcd_error ("vsnprintf() returned %d", len);
129
  
129
130
  retval = vcd_data_sink_write (obj, buf, 1, len);
130
  retval = vcd_data_sink_write (obj, buf, 1, len);
131
131
132
  va_end (args);
132
  va_end (args);
Lines 156-162 Link Here
156
  obj->op.free(obj->user_data);
156
  obj->op.free(obj->user_data);
157
}
157
}
158
158
159
/* 
159
/*
160
 * DataSource implementations
160
 * DataSource implementations
161
 */
161
 */
162
162
Lines 194-200 Link Here
194
194
195
  if (p_obj->position != offset) {
195
  if (p_obj->position != offset) {
196
#ifdef STREAM_DEBUG
196
#ifdef STREAM_DEBUG
197
    vcd_warn("had to reposition DataSource from %ld to %ld!", p_obj->position, 
197
    vcd_warn("had to reposition DataSource from %ld to %ld!", p_obj->position,
198
             offset);
198
             offset);
199
#endif
199
#endif
200
    p_obj->position = offset;
200
    p_obj->position = offset;
Lines 205-211 Link Here
205
}
205
}
206
206
207
VcdDataSource_t *
207
VcdDataSource_t *
208
vcd_data_source_new(void *p_user_data, 
208
vcd_data_source_new(void *p_user_data,
209
                    const vcd_data_source_io_functions *funcs)
209
                    const vcd_data_source_io_functions *funcs)
210
{
210
{
211
  VcdDataSource_t *new_obj;
211
  VcdDataSource_t *new_obj;
Lines 218-225 Link Here
218
  return new_obj;
218
  return new_obj;
219
}
219
}
220
220
221
/** 
221
/**
222
    read size*nmemb bytes from obj into ptr 
222
    read size*nmemb bytes from obj into ptr
223
*/
223
*/
224
long
224
long
225
vcd_data_source_read(VcdDataSource_t* obj, void *ptr, long size, long nmemb)
225
vcd_data_source_read(VcdDataSource_t* obj, void *ptr, long size, long nmemb)
Lines 271-278 Link Here
271
  p_obj->op.free(p_obj->user_data);
271
  p_obj->op.free(p_obj->user_data);
272
}
272
}
273
273
274
274
275
/* 
275
/*
276
 * Local variables:
276
 * Local variables:
277
 *  c-file-style: "gnu"
277
 *  c-file-style: "gnu"
278
 *  tab-width: 8
278
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/stream.h (-11 / +11 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
21
22
#ifndef __VCD_STREAM_H__
22
#ifndef __VCD_STREAM_H__
23
#define __VCD_STREAM_H__
23
#define __VCD_STREAM_H__
Lines 58-68 Link Here
58
  vcd_data_free_t free;
58
  vcd_data_free_t free;
59
} vcd_data_sink_io_functions;
59
} vcd_data_sink_io_functions;
60
60
61
VcdDataSink* 
61
VcdDataSink*
62
vcd_data_sink_new(void *p_user_data, const vcd_data_sink_io_functions *funcs);
62
vcd_data_sink_new(void *p_user_data, const vcd_data_sink_io_functions *funcs);
63
63
64
long
64
long
65
vcd_data_sink_write(VcdDataSink* p_obj, const void *ptr, long size, 
65
vcd_data_sink_write(VcdDataSink* p_obj, const void *ptr, long size,
66
                    long nmemb);
66
                    long nmemb);
67
67
68
long
68
long
Lines 83-104 Link Here
83
83
84
typedef struct {
84
typedef struct {
85
  vcd_data_open_t open;
85
  vcd_data_open_t open;
86
  vcd_data_seek_t seek; 
86
  vcd_data_seek_t seek;
87
  vcd_data_stat_t stat; 
87
  vcd_data_stat_t stat;
88
  vcd_data_read_t read;
88
  vcd_data_read_t read;
89
  vcd_data_close_t close;
89
  vcd_data_close_t close;
90
  vcd_data_free_t free;
90
  vcd_data_free_t free;
91
} vcd_data_source_io_functions;
91
} vcd_data_source_io_functions;
92
92
93
VcdDataSource_t *
93
VcdDataSource_t *
94
vcd_data_source_new(void *p_user_data, 
94
vcd_data_source_new(void *p_user_data,
95
                    const vcd_data_source_io_functions *funcs);
95
                    const vcd_data_source_io_functions *funcs);
96
96
97
/** 
97
/**
98
    read size*nmemb bytes from obj into ptr 
98
    read size*nmemb bytes from obj into ptr
99
*/
99
*/
100
long
100
long
101
vcd_data_source_read(VcdDataSource_t *p_obj, /*out*/ void *ptr, long int size, 
101
vcd_data_source_read(VcdDataSource_t *p_obj, /*out*/ void *ptr, long int size,
102
                     long int nmemb);
102
                     long int nmemb);
103
103
104
long
104
long
Lines 119-126 Link Here
119
119
120
#endif /* __VCD_STREAM_H__ */
120
#endif /* __VCD_STREAM_H__ */
121
121
122
122
123
/* 
123
/*
124
 * Local variables:
124
 * Local variables:
125
 *  c-file-style: "gnu"
125
 *  c-file-style: "gnu"
126
 *  tab-width: 8
126
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/stream_stdio.c (-14 / +14 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 25-31 Link Here
25
#include <stdio.h>
25
#include <stdio.h>
26
#include <stdlib.h>
26
#include <stdlib.h>
27
#include <string.h>
27
#include <string.h>
28
#include <unistd.h> 
28
#include <unistd.h>
29
#include <sys/stat.h>
29
#include <sys/stat.h>
30
#include <errno.h>
30
#include <errno.h>
31
31
Lines 49-58 Link Here
49
} _UserData;
49
} _UserData;
50
50
51
static int
51
static int
52
_stdio_open_source (void *user_data) 
52
_stdio_open_source (void *user_data)
53
{
53
{
54
  _UserData *const ud = user_data;
54
  _UserData *const ud = user_data;
55
  
55
56
  if ((ud->fd = fopen (ud->pathname, "rb")))
56
  if ((ud->fd = fopen (ud->pathname, "rb")))
57
    {
57
    {
58
      ud->fd_buf = calloc(1, VCD_STREAM_STDIO_BUFSIZE);
58
      ud->fd_buf = calloc(1, VCD_STREAM_STDIO_BUFSIZE);
Lines 63-69 Link Here
63
}
63
}
64
64
65
static int
65
static int
66
_stdio_open_sink (void *user_data) 
66
_stdio_open_sink (void *user_data)
67
{
67
{
68
  _UserData *const ud = user_data;
68
  _UserData *const ud = user_data;
69
69
Lines 72-78 Link Here
72
      ud->fd_buf = calloc(1, VCD_STREAM_STDIO_BUFSIZE);
72
      ud->fd_buf = calloc(1, VCD_STREAM_STDIO_BUFSIZE);
73
      setvbuf (ud->fd, ud->fd_buf, _IOFBF, VCD_STREAM_STDIO_BUFSIZE);
73
      setvbuf (ud->fd, ud->fd_buf, _IOFBF, VCD_STREAM_STDIO_BUFSIZE);
74
    }
74
    }
75
  
75
76
  return (ud->fd == NULL);
76
  return (ud->fd == NULL);
77
}
77
}
78
78
Lines 83-89 Link Here
83
83
84
  if (fclose (ud->fd))
84
  if (fclose (ud->fd))
85
    vcd_error ("fclose (): %s", strerror (errno));
85
    vcd_error ("fclose (): %s", strerror (errno));
86
 
86
87
  ud->fd = NULL;
87
  ud->fd = NULL;
88
88
89
  free (ud->fd_buf);
89
  free (ud->fd_buf);
Lines 101-107 Link Here
101
    free(ud->pathname);
101
    free(ud->pathname);
102
102
103
  if (ud->fd) /* should be NULL anyway... */
103
  if (ud->fd) /* should be NULL anyway... */
104
    _stdio_close(user_data); 
104
    _stdio_close(user_data);
105
105
106
  free(ud);
106
  free(ud);
107
}
107
}
Lines 159-165 Link Here
159
  long written;
159
  long written;
160
160
161
  written = fwrite(buf, 1, count, ud->fd);
161
  written = fwrite(buf, 1, count, ud->fd);
162
  
162
163
  if (written != count)
163
  if (written != count)
164
    vcd_error ("fwrite (): %s", strerror (errno));
164
    vcd_error ("fwrite (): %s", strerror (errno));
165
165
Lines 173-180 Link Here
173
  vcd_data_source_io_functions funcs = { 0, };
173
  vcd_data_source_io_functions funcs = { 0, };
174
  _UserData *ud = NULL;
174
  _UserData *ud = NULL;
175
  struct stat statbuf;
175
  struct stat statbuf;
176
  
176
177
  if (stat (pathname, &statbuf) == -1) 
177
  if (stat (pathname, &statbuf) == -1)
178
    {
178
    {
179
      vcd_error ("could not stat() file `%s': %s", pathname, strerror (errno));
179
      vcd_error ("could not stat() file `%s': %s", pathname, strerror (errno));
180
      return NULL;
180
      return NULL;
Lines 206-212 Link Here
206
  _UserData *ud = NULL;
206
  _UserData *ud = NULL;
207
  struct stat statbuf;
207
  struct stat statbuf;
208
208
209
  if (stat (pathname, &statbuf) != -1) 
209
  if (stat (pathname, &statbuf) != -1)
210
    vcd_warn ("file `%s' exist already, will get overwritten!", pathname);
210
    vcd_warn ("file `%s' exist already, will get overwritten!", pathname);
211
211
212
  ud = calloc(1, sizeof (_UserData));
212
  ud = calloc(1, sizeof (_UserData));
Lines 226-233 Link Here
226
  return new_obj;
226
  return new_obj;
227
}
227
}
228
228
229
229
230
/* 
230
/*
231
 * Local variables:
231
 * Local variables:
232
 *  c-file-style: "gnu"
232
 *  c-file-style: "gnu"
233
 *  tab-width: 8
233
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/stream_stdio.h (-3 / +3 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
21
22
#ifndef __VCD_STREAM_STDIO_H__
22
#ifndef __VCD_STREAM_STDIO_H__
23
#define __VCD_STREAM_STDIO_H__
23
#define __VCD_STREAM_STDIO_H__
Lines 33-40 Link Here
33
33
34
#endif /* __VCD_STREAM_STDIO_H__ */
34
#endif /* __VCD_STREAM_STDIO_H__ */
35
35
36
36
37
/* 
37
/*
38
 * Local variables:
38
 * Local variables:
39
 *  c-file-style: "gnu"
39
 *  c-file-style: "gnu"
40
 *  tab-width: 8
40
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/util.c (-9 / +9 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 51-57 Link Here
51
_vcd_strfreev(char **strv)
51
_vcd_strfreev(char **strv)
52
{
52
{
53
  int n;
53
  int n;
54
  
54
55
  vcd_assert (strv != NULL);
55
  vcd_assert (strv != NULL);
56
56
57
  for(n = 0; strv[n]; n++)
57
  for(n = 0; strv[n]; n++)
Lines 86-92 Link Here
86
        strcat (new_str, delim);
86
        strcat (new_str, delim);
87
      strcat (new_str, strv[n]);
87
      strcat (new_str, strv[n]);
88
    }
88
    }
89
  
89
90
  return new_str;
90
  return new_str;
91
}
91
}
92
92
Lines 107-120 Link Here
107
107
108
  n = 1;
108
  n = 1;
109
  p = _str;
109
  p = _str;
110
  while(*p) 
110
  while(*p)
111
    if (*(p++) == delim)
111
    if (*(p++) == delim)
112
      n++;
112
      n++;
113
113
114
  strv = calloc(1, sizeof (char *) * (n+1));
114
  strv = calloc(1, sizeof (char *) * (n+1));
115
  
115
116
  n = 0;
116
  n = 0;
117
  while((p = strtok(n ? NULL : _str, _delim)) != NULL) 
117
  while((p = strtok(n ? NULL : _str, _delim)) != NULL)
118
    strv[n++] = strdup(p);
118
    strv[n++] = strdup(p);
119
119
120
  free(_str);
120
  free(_str);
Lines 132-138 Link Here
132
      new_mem = malloc(count);
132
      new_mem = malloc(count);
133
      memcpy (new_mem, mem, count);
133
      memcpy (new_mem, mem, count);
134
    }
134
    }
135
  
135
136
  return new_mem;
136
  return new_mem;
137
}
137
}
138
138
Lines 157-164 Link Here
157
  return new_str;
157
  return new_str;
158
}
158
}
159
159
160
160
161
/* 
161
/*
162
 * Local variables:
162
 * Local variables:
163
 *  c-file-style: "gnu"
163
 *  c-file-style: "gnu"
164
 *  tab-width: 8
164
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/util.h (-5 / +5 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_UTIL_H__
21
#ifndef __VCD_UTIL_H__
22
#define __VCD_UTIL_H__
22
#define __VCD_UTIL_H__
23
23
Lines 37-49 Link Here
37
}
37
}
38
38
39
/* round up to next block boundary */
39
/* round up to next block boundary */
40
static inline unsigned 
40
static inline unsigned
41
_vcd_ceil2block (unsigned offset, int blocksize)
41
_vcd_ceil2block (unsigned offset, int blocksize)
42
{
42
{
43
  return _vcd_len2blocks (offset, blocksize) * blocksize;
43
  return _vcd_len2blocks (offset, blocksize) * blocksize;
44
}
44
}
45
45
46
static inline unsigned 
46
static inline unsigned
47
_vcd_ofs_add (unsigned offset, unsigned length, int blocksize)
47
_vcd_ofs_add (unsigned offset, unsigned length, int blocksize)
48
{
48
{
49
  if (blocksize - (offset % blocksize) < length)
49
  if (blocksize - (offset % blocksize) < length)
Lines 80-87 Link Here
80
80
81
#endif /* __VCD_UTIL_H__ */
81
#endif /* __VCD_UTIL_H__ */
82
82
83
83
84
/* 
84
/*
85
 * Local variables:
85
 * Local variables:
86
 *  c-file-style: "gnu"
86
 *  c-file-style: "gnu"
87
 *  tab-width: 8
87
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/vcd_assert.h (-2 / +2 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifndef __VCD_ASSERT_H__
21
#ifndef __VCD_ASSERT_H__
22
#define __VCD_ASSERT_H__
22
#define __VCD_ASSERT_H__
23
23
Lines 31-37 Link Here
31
   if (GNUC_UNLIKELY (!(expr))) vcd_log (VCD_LOG_ASSERT, \
31
   if (GNUC_UNLIKELY (!(expr))) vcd_log (VCD_LOG_ASSERT, \
32
     "file %s: line %d (%s): assertion failed: (%s)", \
32
     "file %s: line %d (%s): assertion failed: (%s)", \
33
     __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
33
     __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
34
 } 
34
 }
35
35
36
#define vcd_assert_not_reached() \
36
#define vcd_assert_not_reached() \
37
 { \
37
 { \
(-)vcdimager-0.7.24.ORIG/lib/vcd.c (-201 / +202 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 28-33 Link Here
28
#include <ctype.h>
28
#include <ctype.h>
29
#include <math.h>
29
#include <math.h>
30
30
31
#define _VCD_INFO_PRIVATE_H
32
/* We don't want to pull in cdio's config */
33
#define __CDIO_CONFIG_H__
31
#include <cdio/cdio.h>
34
#include <cdio/cdio.h>
32
#include <cdio/util.h>
35
#include <cdio/util.h>
33
#include <cdio/iso9660.h>
36
#include <cdio/iso9660.h>
Lines 92-98 Link Here
92
      CdioListNode_t *node2;
95
      CdioListNode_t *node2;
93
96
94
      /* default entry point */
97
      /* default entry point */
95
      if (_sequence->default_entry_id 
98
      if (_sequence->default_entry_id
96
          && !strcmp (entry_id, _sequence->default_entry_id))
99
          && !strcmp (entry_id, _sequence->default_entry_id))
97
        return _sequence;
100
        return _sequence;
98
101
Lines 101-107 Link Here
101
	{
104
	{
102
	  entry_t *_entry = _cdio_list_node_data (node2);
105
	  entry_t *_entry = _cdio_list_node_data (node2);
103
106
104
	  if (_entry->id 
107
	  if (_entry->id
105
              && !strcmp (entry_id, _entry->id))
108
              && !strcmp (entry_id, _entry->id))
106
	    return _sequence;
109
	    return _sequence;
107
	}
110
	}
Lines 240-256 Link Here
240
243
241
/*
244
/*
242
 * public methods
245
 * public methods
243
 */ 
246
 */
244
247
245
VcdObj_t *
248
VcdObj_t *
246
vcd_obj_new (vcd_type_t vcd_type)
249
vcd_obj_new (vcd_type_t vcd_type)
247
{
250
{
248
  VcdObj_t *p_new_obj = NULL;
251
  VcdObj_t *p_new_obj = NULL;
249
  static bool _first = true;
252
  static bool _first = true;
250
  
253
251
  if (_first)
254
  if (_first)
252
    {
255
    {
253
#if defined(_DEVELOPMENT_)      
256
#if defined(_DEVELOPMENT_)
254
      vcd_warn ("initializing libvcd %s [%s]", VERSION, HOST_ARCH);
257
      vcd_warn ("initializing libvcd %s [%s]", VERSION, HOST_ARCH);
255
      vcd_warn (" ");
258
      vcd_warn (" ");
256
      vcd_warn (" this is the Beta development branch!");
259
      vcd_warn (" this is the Beta development branch!");
Lines 297-305 Link Here
297
  /* gap's defined by IEC-10149 / ECMA-130 */
300
  /* gap's defined by IEC-10149 / ECMA-130 */
298
301
299
  /* pre-gap's for tracks but the first one */
302
  /* pre-gap's for tracks but the first one */
300
  p_new_obj->track_pregap = CDIO_PREGAP_SECTORS; 
303
  p_new_obj->track_pregap = CDIO_PREGAP_SECTORS;
301
  /* post-gap after last track */
304
  /* post-gap after last track */
302
  p_new_obj->leadout_pregap = CDIO_POSTGAP_SECTORS; 
305
  p_new_obj->leadout_pregap = CDIO_POSTGAP_SECTORS;
303
306
304
  if (_vcd_obj_has_cap_p (p_new_obj, _CAP_TRACK_MARGINS))
307
  if (_vcd_obj_has_cap_p (p_new_obj, _CAP_TRACK_MARGINS))
305
    {
308
    {
Lines 315-321 Link Here
315
  return p_new_obj;
318
  return p_new_obj;
316
}
319
}
317
320
318
int 
321
int
319
vcd_obj_remove_item (VcdObj_t *p_vcdobj, const char id[])
322
vcd_obj_remove_item (VcdObj_t *p_vcdobj, const char id[])
320
{
323
{
321
  vcd_warn ("vcd_obj_remove_item('%s') not implemented yet!", id);
324
  vcd_warn ("vcd_obj_remove_item('%s') not implemented yet!", id);
Lines 333-339 Link Here
333
  vcd_assert (track_id >= 0);
336
  vcd_assert (track_id >= 0);
334
337
335
  node = _vcd_list_at (p_vcdobj->mpeg_sequence_list, track_id);
338
  node = _vcd_list_at (p_vcdobj->mpeg_sequence_list, track_id);
336
  
339
337
  vcd_assert (node != NULL);
340
  vcd_assert (node != NULL);
338
341
339
  track = (mpeg_sequence_t *) _cdio_list_node_data (node);
342
  track = (mpeg_sequence_t *) _cdio_list_node_data (node);
Lines 341-365 Link Here
341
  vcd_mpeg_source_destroy (track->source, true);
344
  vcd_mpeg_source_destroy (track->source, true);
342
345
343
  length = track->info ? track->info->packets : 0;
346
  length = track->info ? track->info->packets : 0;
344
  length += p_vcdobj->track_pregap + p_vcdobj->track_front_margin 
347
  length += p_vcdobj->track_pregap + p_vcdobj->track_front_margin
345
    + 0 + p_vcdobj->track_rear_margin;
348
    + 0 + p_vcdobj->track_rear_margin;
346
349
347
  /* fixup offsets */
350
  /* fixup offsets */
348
  {
351
  {
349
    CdioListNode_t *node2 = node;
352
    CdioListNode_t *node2 = node;
350
    while ((node2 = _cdio_list_node_next (node2)) != NULL)
353
    while ((node2 = _cdio_list_node_next (node2)) != NULL)
351
      ((mpeg_sequence_t *) _cdio_list_node_data (node))->relative_start_extent 
354
      ((mpeg_sequence_t *) _cdio_list_node_data (node))->relative_start_extent
352
        -= length;
355
        -= length;
353
  }
356
  }
354
357
355
  p_vcdobj->relative_end_extent -= length;
358
  p_vcdobj->relative_end_extent -= length;
356
359
357
  /* shift up */
360
  /* shift up */
358
  _cdio_list_node_free (node, true);
361
  _cdio_list_node_free (node, true, NULL);
359
}
362
}
360
363
361
int
364
int
362
vcd_obj_append_segment_play_item (VcdObj_t *p_vcdobj, 
365
vcd_obj_append_segment_play_item (VcdObj_t *p_vcdobj,
363
                                  VcdMpegSource_t *p_mpeg_source,
366
                                  VcdMpegSource_t *p_mpeg_source,
364
                                  const char item_id[])
367
                                  const char item_id[])
365
{
368
{
Lines 386-392 Link Here
386
      return -1;
389
      return -1;
387
    }
390
    }
388
391
389
  vcd_info ("scanning mpeg segment item #%d for scanpoints...", 
392
  vcd_info ("scanning mpeg segment item #%d for scanpoints...",
390
            _cdio_list_length (p_vcdobj->mpeg_segment_list));
393
            _cdio_list_length (p_vcdobj->mpeg_segment_list));
391
394
392
  vcd_mpeg_source_scan (p_mpeg_source, !p_vcdobj->relaxed_aps,
395
  vcd_mpeg_source_scan (p_mpeg_source, !p_vcdobj->relaxed_aps,
Lines 405-411 Link Here
405
  segment->source = p_mpeg_source;
408
  segment->source = p_mpeg_source;
406
409
407
  segment->id = strdup (item_id);
410
  segment->id = strdup (item_id);
408
 
411
409
  segment->info = vcd_mpeg_source_get_info (p_mpeg_source);
412
  segment->info = vcd_mpeg_source_get_info (p_mpeg_source);
410
  segment->segment_count = _vcd_len2blocks (segment->info->packets, 150);
413
  segment->segment_count = _vcd_len2blocks (segment->info->packets, 150);
411
414
Lines 421-427 Link Here
421
}
424
}
422
425
423
int
426
int
424
vcd_obj_append_sequence_play_item (VcdObj_t *p_vcdobj, 
427
vcd_obj_append_sequence_play_item (VcdObj_t *p_vcdobj,
425
                                   VcdMpegSource_t *p_mpeg_source,
428
                                   VcdMpegSource_t *p_mpeg_source,
426
                                   const char item_id[],
429
                                   const char item_id[],
427
                                   const char default_entry_id[])
430
                                   const char default_entry_id[])
Lines 464-470 Link Here
464
467
465
  if (default_entry_id)
468
  if (default_entry_id)
466
    sequence->default_entry_id = strdup (default_entry_id);
469
    sequence->default_entry_id = strdup (default_entry_id);
467
  
470
468
  sequence->info = vcd_mpeg_source_get_info (p_mpeg_source);
471
  sequence->info = vcd_mpeg_source_get_info (p_mpeg_source);
469
  length = sequence->info->packets;
472
  length = sequence->info->packets;
470
473
Lines 474-480 Link Here
474
  p_vcdobj->relative_end_extent += p_vcdobj->track_pregap;
477
  p_vcdobj->relative_end_extent += p_vcdobj->track_pregap;
475
  sequence->relative_start_extent = p_vcdobj->relative_end_extent;
478
  sequence->relative_start_extent = p_vcdobj->relative_end_extent;
476
479
477
  p_vcdobj->relative_end_extent += p_vcdobj->track_front_margin + length 
480
  p_vcdobj->relative_end_extent += p_vcdobj->track_front_margin + length
478
    + p_vcdobj->track_rear_margin;
481
    + p_vcdobj->track_rear_margin;
479
482
480
  /* sanity checks */
483
  /* sanity checks */
Lines 511-523 Link Here
511
              vcd_warn ("audio stream #%d not supported by this VCD type", i);
514
              vcd_warn ("audio stream #%d not supported by this VCD type", i);
512
515
513
            if (sequence->info->ahdr[i].sampfreq != 44100)
516
            if (sequence->info->ahdr[i].sampfreq != 44100)
514
              vcd_warn ("audio stream #%d has sampling frequency %d Hz (should be 44100 Hz)", 
517
              vcd_warn ("audio stream #%d has sampling frequency %d Hz (should be 44100 Hz)",
515
                        i, sequence->info->ahdr[i].sampfreq);
518
                        i, sequence->info->ahdr[i].sampfreq);
516
519
517
            if (sequence->info->ahdr[i].layer != 2)
520
            if (sequence->info->ahdr[i].layer != 2)
518
              vcd_warn ("audio stream #%d is not layer II", i);
521
              vcd_warn ("audio stream #%d is not layer II", i);
519
522
520
            if (_vcd_obj_has_cap_p (p_vcdobj, _CAP_MPEG1) 
523
            if (_vcd_obj_has_cap_p (p_vcdobj, _CAP_MPEG1)
521
                && sequence->info->ahdr[i].bitrate != 224*1024)
524
                && sequence->info->ahdr[i].bitrate != 224*1024)
522
              vcd_warn ("audio stream #%d has bitrate %d kbps (should be 224 kbps for this vcd type)",
525
              vcd_warn ("audio stream #%d has bitrate %d kbps (should be 224 kbps for this vcd type)",
523
                        i, sequence->info->ahdr[i].bitrate);
526
                        i, sequence->info->ahdr[i].bitrate);
Lines 528-534 Link Here
528
          }
531
          }
529
      }
532
      }
530
  }
533
  }
531
    
534
532
  /* vcd_debug ("track# %d's detected playing time: %.2f seconds",  */
535
  /* vcd_debug ("track# %d's detected playing time: %.2f seconds",  */
533
  /*            track_no, sequence->info->playing_time); */
536
  /*            track_no, sequence->info->playing_time); */
534
537
Lines 549-556 Link Here
549
  return 0;
552
  return 0;
550
}
553
}
551
554
552
int 
555
int
553
vcd_obj_add_sequence_pause (VcdObj_t *obj, const char sequence_id[], 
556
vcd_obj_add_sequence_pause (VcdObj_t *obj, const char sequence_id[],
554
                            double pause_time, const char pause_id[])
557
                            double pause_time, const char pause_id[])
555
{
558
{
556
  mpeg_sequence_t *p_sequence;
559
  mpeg_sequence_t *p_sequence;
Lines 560-566 Link Here
560
  if (sequence_id)
563
  if (sequence_id)
561
    p_sequence = _vcd_obj_get_sequence_by_id (obj, sequence_id);
564
    p_sequence = _vcd_obj_get_sequence_by_id (obj, sequence_id);
562
  else
565
  else
563
    p_sequence = 
566
    p_sequence =
564
      _cdio_list_node_data (_cdio_list_end (obj->mpeg_sequence_list));
567
      _cdio_list_node_data (_cdio_list_end (obj->mpeg_sequence_list));
565
568
566
  if (!p_sequence)
569
  if (!p_sequence)
Lines 582-588 Link Here
582
    _cdio_list_append (p_sequence->pause_list, _pause);
585
    _cdio_list_append (p_sequence->pause_list, _pause);
583
  }
586
  }
584
587
585
  _vcd_list_sort (p_sequence->pause_list, 
588
  _vcd_list_sort (p_sequence->pause_list,
586
                  (_cdio_list_cmp_func_t) _pause_cmp);
589
                  (_cdio_list_cmp_func_t) _pause_cmp);
587
590
588
  vcd_debug ("added autopause point at %f", pause_time);
591
  vcd_debug ("added autopause point at %f", pause_time);
Lines 590-597 Link Here
590
  return 0;
593
  return 0;
591
}
594
}
592
595
593
int 
596
int
594
vcd_obj_add_segment_pause (VcdObj_t *p_obj, const char segment_id[], 
597
vcd_obj_add_segment_pause (VcdObj_t *p_obj, const char segment_id[],
595
                            double pause_time, const char pause_id[])
598
                            double pause_time, const char pause_id[])
596
{
599
{
597
  mpeg_segment_t *_segment;
600
  mpeg_segment_t *_segment;
Lines 622-628 Link Here
622
    _cdio_list_append (_segment->pause_list, _pause);
625
    _cdio_list_append (_segment->pause_list, _pause);
623
  }
626
  }
624
627
625
  _vcd_list_sort (_segment->pause_list, 
628
  _vcd_list_sort (_segment->pause_list,
626
                  (_cdio_list_cmp_func_t) _pause_cmp);
629
                  (_cdio_list_cmp_func_t) _pause_cmp);
627
630
628
  vcd_debug ("added autopause point at %f", pause_time);
631
  vcd_debug ("added autopause point at %f", pause_time);
Lines 642-649 Link Here
642
  return 0;
645
  return 0;
643
}
646
}
644
647
645
int 
648
int
646
vcd_obj_add_sequence_entry (VcdObj_t *p_obj, const char sequence_id[], 
649
vcd_obj_add_sequence_entry (VcdObj_t *p_obj, const char sequence_id[],
647
                            double entry_time, const char entry_id[])
650
                            double entry_time, const char entry_id[])
648
{
651
{
649
  mpeg_sequence_t *p_sequence;
652
  mpeg_sequence_t *p_sequence;
Lines 684-696 Link Here
684
    _cdio_list_append (p_sequence->entry_list, _entry);
687
    _cdio_list_append (p_sequence->entry_list, _entry);
685
  }
688
  }
686
689
687
  _vcd_list_sort (p_sequence->entry_list, 
690
  _vcd_list_sort (p_sequence->entry_list,
688
                  (_cdio_list_cmp_func_t) _entry_cmp);
691
                  (_cdio_list_cmp_func_t) _entry_cmp);
689
692
690
  return 0;
693
  return 0;
691
}
694
}
692
695
693
void 
696
void
694
vcd_obj_destroy (VcdObj_t *p_obj)
697
vcd_obj_destroy (VcdObj_t *p_obj)
695
{
698
{
696
  CdioListNode_t *p_node;
699
  CdioListNode_t *p_node;
Lines 704-736 Link Here
704
  _CDIO_LIST_FOREACH (p_node, p_obj->custom_file_list)
707
  _CDIO_LIST_FOREACH (p_node, p_obj->custom_file_list)
705
    {
708
    {
706
      custom_file_t *p = _cdio_list_node_data (p_node);
709
      custom_file_t *p = _cdio_list_node_data (p_node);
707
    
710
708
      free (p->iso_pathname);
711
      free (p->iso_pathname);
709
    }
712
    }
710
713
711
  _cdio_list_free (p_obj->custom_file_list, true);
714
  _cdio_list_free (p_obj->custom_file_list, true, NULL);
712
715
713
  _cdio_list_free (p_obj->custom_dir_list, true);
716
  _cdio_list_free (p_obj->custom_dir_list, true, NULL);
714
717
715
  while (_cdio_list_length (p_obj->mpeg_sequence_list))
718
  while (_cdio_list_length (p_obj->mpeg_sequence_list))
716
    _vcd_obj_remove_mpeg_track (p_obj, 0);
719
    _vcd_obj_remove_mpeg_track (p_obj, 0);
717
  _cdio_list_free (p_obj->mpeg_sequence_list, true);
720
  _cdio_list_free (p_obj->mpeg_sequence_list, true, NULL);
718
721
719
  free (p_obj);
722
  free (p_obj);
720
}
723
}
721
724
722
int 
725
int
723
vcd_obj_set_param_uint (VcdObj_t *p_obj, vcd_parm_t param, unsigned arg)
726
vcd_obj_set_param_uint (VcdObj_t *p_obj, vcd_parm_t param, unsigned arg)
724
{
727
{
725
  vcd_assert (p_obj != NULL);
728
  vcd_assert (p_obj != NULL);
726
729
727
  switch (param) 
730
  switch (param)
728
    {
731
    {
729
    case VCD_PARM_VOLUME_COUNT:
732
    case VCD_PARM_VOLUME_COUNT:
730
      p_obj->info_volume_count = arg;
733
      p_obj->info_volume_count = arg;
731
      if (!IN (p_obj->info_volume_count, 1, 65535))
734
      if (!IN (p_obj->info_volume_count, 1, 65535))
732
        {
735
        {
733
          p_obj->info_volume_count = 
736
          p_obj->info_volume_count =
734
            CLAMP (p_obj->info_volume_count, 1, 65535);
737
            CLAMP (p_obj->info_volume_count, 1, 65535);
735
          vcd_warn ("volume count out of range, clamping to range");
738
          vcd_warn ("volume count out of range, clamping to range");
736
        }
739
        }
Lines 741-747 Link Here
741
      p_obj->info_volume_number = arg;
744
      p_obj->info_volume_number = arg;
742
      if (!IN (p_obj->info_volume_number, 0, 65534))
745
      if (!IN (p_obj->info_volume_number, 0, 65534))
743
        {
746
        {
744
          p_obj->info_volume_number = 
747
          p_obj->info_volume_number =
745
            CLAMP (p_obj->info_volume_number, 0, 65534);
748
            CLAMP (p_obj->info_volume_number, 0, 65534);
746
          vcd_warn ("volume number out of range, clamping to range");
749
          vcd_warn ("volume number out of range, clamping to range");
747
        }
750
        }
Lines 767-773 Link Here
767
        }
770
        }
768
      if (p_obj->leadout_pregap < CDIO_PREGAP_SECTORS)
771
      if (p_obj->leadout_pregap < CDIO_PREGAP_SECTORS)
769
        vcd_warn ("track leadout pregap set below %d sectors; "
772
        vcd_warn ("track leadout pregap set below %d sectors; "
770
                  "created (S)VCD may be non-working", 
773
                  "created (S)VCD may be non-working",
771
                  CDIO_PREGAP_SECTORS);
774
                  CDIO_PREGAP_SECTORS);
772
775
773
      vcd_debug ("changed leadout pregap to %u", p_obj->leadout_pregap);
776
      vcd_debug ("changed leadout pregap to %u", p_obj->leadout_pregap);
Lines 782-788 Link Here
782
        }
785
        }
783
      if (p_obj->track_pregap < CDIO_PREGAP_SECTORS)
786
      if (p_obj->track_pregap < CDIO_PREGAP_SECTORS)
784
        vcd_warn ("track pre gap set below %d sectors; "
787
        vcd_warn ("track pre gap set below %d sectors; "
785
                  "created (S)VCD may be non-working", 
788
                  "created (S)VCD may be non-working",
786
                  CDIO_PREGAP_SECTORS);
789
                  CDIO_PREGAP_SECTORS);
787
      vcd_debug ("changed track pregap to %u", p_obj->track_pregap);
790
      vcd_debug ("changed track pregap to %u", p_obj->track_pregap);
788
      break;
791
      break;
Lines 791-801 Link Here
791
      p_obj->track_front_margin = arg;
794
      p_obj->track_front_margin = arg;
792
      if (!IN (p_obj->track_front_margin, 0, CDIO_PREGAP_SECTORS))
795
      if (!IN (p_obj->track_front_margin, 0, CDIO_PREGAP_SECTORS))
793
        {
796
        {
794
          p_obj->track_front_margin = CLAMP (p_obj->track_front_margin, 0, 
797
          p_obj->track_front_margin = CLAMP (p_obj->track_front_margin, 0,
795
                                           CDIO_PREGAP_SECTORS);
798
                                           CDIO_PREGAP_SECTORS);
796
          vcd_warn ("front margin out of range, clamping to allowed range");
799
          vcd_warn ("front margin out of range, clamping to allowed range");
797
        }
800
        }
798
      if (_vcd_obj_has_cap_p (p_obj, _CAP_TRACK_MARGINS) 
801
      if (_vcd_obj_has_cap_p (p_obj, _CAP_TRACK_MARGINS)
799
          && p_obj->track_front_margin < 15)
802
          && p_obj->track_front_margin < 15)
800
        vcd_warn ("front margin set smaller than recommended (%d < 15 sectors) for disc type used",
803
        vcd_warn ("front margin set smaller than recommended (%d < 15 sectors) for disc type used",
801
                  p_obj->track_front_margin);
804
                  p_obj->track_front_margin);
Lines 807-817 Link Here
807
      p_obj->track_rear_margin = arg;
810
      p_obj->track_rear_margin = arg;
808
      if (!IN (p_obj->track_rear_margin, 0, CDIO_POSTGAP_SECTORS))
811
      if (!IN (p_obj->track_rear_margin, 0, CDIO_POSTGAP_SECTORS))
809
        {
812
        {
810
          p_obj->track_rear_margin = CLAMP (p_obj->track_rear_margin, 0, 
813
          p_obj->track_rear_margin = CLAMP (p_obj->track_rear_margin, 0,
811
                                            CDIO_POSTGAP_SECTORS);
814
                                            CDIO_POSTGAP_SECTORS);
812
          vcd_warn ("rear margin out of range, clamping to allowed range");
815
          vcd_warn ("rear margin out of range, clamping to allowed range");
813
        }
816
        }
814
      if (_vcd_obj_has_cap_p (p_obj, _CAP_TRACK_MARGINS) 
817
      if (_vcd_obj_has_cap_p (p_obj, _CAP_TRACK_MARGINS)
815
          && p_obj->track_rear_margin < 15)
818
          && p_obj->track_rear_margin < 15)
816
        vcd_warn ("rear margin set smaller than recommended (%d < 15 sectors) for disc type used",
819
        vcd_warn ("rear margin set smaller than recommended (%d < 15 sectors) for disc type used",
817
                 p_obj->track_rear_margin);
820
                 p_obj->track_rear_margin);
Lines 826-838 Link Here
826
  return 0;
829
  return 0;
827
}
830
}
828
831
829
int 
832
int
830
vcd_obj_set_param_str (VcdObj_t *p_obj, vcd_parm_t param, const char *arg)
833
vcd_obj_set_param_str (VcdObj_t *p_obj, vcd_parm_t param, const char *arg)
831
{
834
{
832
  vcd_assert (p_obj != NULL);
835
  vcd_assert (p_obj != NULL);
833
  vcd_assert (arg != NULL);
836
  vcd_assert (arg != NULL);
834
837
835
  switch (param) 
838
  switch (param)
836
    {
839
    {
837
    case VCD_PARM_VOLUME_ID:
840
    case VCD_PARM_VOLUME_ID:
838
      free (p_obj->iso_volume_label);
841
      free (p_obj->iso_volume_label);
Lines 877-883 Link Here
877
        }
880
        }
878
      vcd_debug ("changed application id to `%s'", p_obj->iso_application_id);
881
      vcd_debug ("changed application id to `%s'", p_obj->iso_application_id);
879
      break;
882
      break;
880
      
883
881
    case VCD_PARM_ALBUM_ID:
884
    case VCD_PARM_ALBUM_ID:
882
      free (p_obj->info_album_id);
885
      free (p_obj->info_album_id);
883
      p_obj->info_album_id = strdup (arg);
886
      p_obj->info_album_id = strdup (arg);
Lines 897-908 Link Here
897
  return 0;
900
  return 0;
898
}
901
}
899
902
900
int 
903
int
901
vcd_obj_set_param_bool (VcdObj_t *p_obj, vcd_parm_t param, bool arg)
904
vcd_obj_set_param_bool (VcdObj_t *p_obj, vcd_parm_t param, bool arg)
902
{
905
{
903
  vcd_assert (p_obj != NULL);
906
  vcd_assert (p_obj != NULL);
904
907
905
  switch (param) 
908
  switch (param)
906
    {
909
    {
907
    case VCD_PARM_RELAXED_APS:
910
    case VCD_PARM_RELAXED_APS:
908
      p_obj->relaxed_aps = arg ? true : false;
911
      p_obj->relaxed_aps = arg ? true : false;
Lines 911-923 Link Here
911
914
912
    case VCD_PARM_NEXT_VOL_LID2:
915
    case VCD_PARM_NEXT_VOL_LID2:
913
      p_obj->info_use_lid2 = arg ? true : false;
916
      p_obj->info_use_lid2 = arg ? true : false;
914
      vcd_debug ("changing 'next volume use lid 2' to %d", 
917
      vcd_debug ("changing 'next volume use lid 2' to %d",
915
                 p_obj->info_use_lid2);
918
                 p_obj->info_use_lid2);
916
      break;
919
      break;
917
920
918
    case VCD_PARM_NEXT_VOL_SEQ2:
921
    case VCD_PARM_NEXT_VOL_SEQ2:
919
      p_obj->info_use_seq2 = arg ? true : false;
922
      p_obj->info_use_seq2 = arg ? true : false;
920
      vcd_debug ("changing 'next volume use sequence 2' to %d", 
923
      vcd_debug ("changing 'next volume use sequence 2' to %d",
921
                 p_obj->info_use_seq2);
924
                 p_obj->info_use_seq2);
922
      break;
925
      break;
923
926
Lines 925-931 Link Here
925
      if (p_obj->type == VCD_TYPE_SVCD)
928
      if (p_obj->type == VCD_TYPE_SVCD)
926
        {
929
        {
927
          if ((p_obj->svcd_vcd3_mpegav = arg ? true : false))
930
          if ((p_obj->svcd_vcd3_mpegav = arg ? true : false))
928
            vcd_warn ("!! enabling deprecated VCD3.0 MPEGAV folder --" 
931
            vcd_warn ("!! enabling deprecated VCD3.0 MPEGAV folder --"
929
                      " SVCD will not be IEC62107 compliant !!");
932
                      " SVCD will not be IEC62107 compliant !!");
930
        }
933
        }
931
      else
934
      else
Lines 936-942 Link Here
936
      if (p_obj->type == VCD_TYPE_SVCD)
939
      if (p_obj->type == VCD_TYPE_SVCD)
937
        {
940
        {
938
          if ((p_obj->svcd_vcd3_entrysvd = arg ? true : false))
941
          if ((p_obj->svcd_vcd3_entrysvd = arg ? true : false))
939
            vcd_warn ("!! enabling deprecated VCD3.0 ENTRYSVD signature --" 
942
            vcd_warn ("!! enabling deprecated VCD3.0 ENTRYSVD signature --"
940
                      " SVCD will not be IEC62107 compliant !!");
943
                      " SVCD will not be IEC62107 compliant !!");
941
        }
944
        }
942
      else
945
      else
Lines 947-953 Link Here
947
      if (p_obj->type == VCD_TYPE_SVCD)
950
      if (p_obj->type == VCD_TYPE_SVCD)
948
        {
951
        {
949
          if ((p_obj->svcd_vcd3_tracksvd = arg ? true : false))
952
          if ((p_obj->svcd_vcd3_tracksvd = arg ? true : false))
950
            vcd_warn ("!! enabling deprecated VCD3.0 TRACK.SVD format --" 
953
            vcd_warn ("!! enabling deprecated VCD3.0 TRACK.SVD format --"
951
                      " SVCD will not be IEC62107 compliant !!");
954
                      " SVCD will not be IEC62107 compliant !!");
952
        }
955
        }
953
      else
956
      else
Lines 958-964 Link Here
958
      if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
961
      if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
959
        {
962
        {
960
          p_obj->update_scan_offsets = arg ? true : false;
963
          p_obj->update_scan_offsets = arg ? true : false;
961
          vcd_debug ("changing 'update scan offsets' to %d", 
964
          vcd_debug ("changing 'update scan offsets' to %d",
962
                     p_obj->update_scan_offsets);
965
                     p_obj->update_scan_offsets);
963
        }
966
        }
964
      else
967
      else
Lines 968-974 Link Here
968
    case VCD_PARM_LEADOUT_PAUSE:
971
    case VCD_PARM_LEADOUT_PAUSE:
969
      vcd_warn ("use of 'leadout pause' is deprecated and may be removed in later releases;"
972
      vcd_warn ("use of 'leadout pause' is deprecated and may be removed in later releases;"
970
                " use 'leadout pregap' instead");
973
                " use 'leadout pregap' instead");
971
      vcd_obj_set_param_uint (p_obj, VCD_PARM_LEADOUT_PREGAP, 
974
      vcd_obj_set_param_uint (p_obj, VCD_PARM_LEADOUT_PREGAP,
972
                              (arg ? CDIO_PREGAP_SECTORS : 0));
975
                              (arg ? CDIO_PREGAP_SECTORS : 0));
973
      break;
976
      break;
974
977
Lines 989-998 Link Here
989
  vcd_assert (iso_pathname != NULL);
992
  vcd_assert (iso_pathname != NULL);
990
993
991
  _iso_pathname = _vcd_strdup_upper (iso_pathname);
994
  _iso_pathname = _vcd_strdup_upper (iso_pathname);
992
    
995
993
  if (!iso9660_dirname_valid_p (_iso_pathname))
996
  if (!iso9660_dirname_valid_p (_iso_pathname))
994
    {
997
    {
995
      vcd_error("pathname `%s' is not a valid iso pathname", 
998
      vcd_error("pathname `%s' is not a valid iso pathname",
996
                _iso_pathname);
999
                _iso_pathname);
997
      free (_iso_pathname);
1000
      free (_iso_pathname);
998
      return 1;
1001
      return 1;
Lines 1000-1006 Link Here
1000
1003
1001
  _cdio_list_append (p_obj->custom_dir_list, _iso_pathname);
1004
  _cdio_list_append (p_obj->custom_dir_list, _iso_pathname);
1002
1005
1003
  _vcd_list_sort (p_obj->custom_dir_list, 
1006
  _vcd_list_sort (p_obj->custom_dir_list,
1004
                  (_cdio_list_cmp_func_t) strcmp);
1007
                  (_cdio_list_cmp_func_t) strcmp);
1005
1008
1006
  return 0;
1009
  return 0;
Lines 1011-1017 Link Here
1011
                  VcdDataSource_t *file, bool raw_flag)
1014
                  VcdDataSource_t *file, bool raw_flag)
1012
{
1015
{
1013
  uint32_t size = 0, sectors = 0;
1016
  uint32_t size = 0, sectors = 0;
1014
 
1017
1015
  vcd_assert (p_obj != NULL);
1018
  vcd_assert (p_obj != NULL);
1016
  vcd_assert (file != NULL);
1019
  vcd_assert (file != NULL);
1017
  vcd_assert (iso_pathname != NULL);
1020
  vcd_assert (iso_pathname != NULL);
Lines 1035-1041 Link Here
1035
1038
1036
      if (size % M2RAW_SECTOR_SIZE)
1039
      if (size % M2RAW_SECTOR_SIZE)
1037
        {
1040
        {
1038
          vcd_error("raw mode2 file must have size multiple of %d \n", 
1041
          vcd_error("raw mode2 file must have size multiple of %d \n",
1039
                    M2RAW_SECTOR_SIZE);
1042
                    M2RAW_SECTOR_SIZE);
1040
          return 1;
1043
          return 1;
1041
        }
1044
        }
Lines 1046-1066 Link Here
1046
  {
1049
  {
1047
    custom_file_t *p;
1050
    custom_file_t *p;
1048
    char *_iso_pathname = _vcd_strdup_upper (iso_pathname);
1051
    char *_iso_pathname = _vcd_strdup_upper (iso_pathname);
1049
    
1052
1050
    if (!iso9660_pathname_valid_p (_iso_pathname))
1053
    if (!iso9660_pathname_valid_p (_iso_pathname))
1051
      {
1054
      {
1052
        vcd_error("pathname `%s' is not a valid iso pathname", 
1055
        vcd_error("pathname `%s' is not a valid iso pathname",
1053
                  _iso_pathname);
1056
                  _iso_pathname);
1054
        free (_iso_pathname);
1057
        free (_iso_pathname);
1055
        return 1;
1058
        return 1;
1056
      }
1059
      }
1057
1060
1058
    p = calloc(1, sizeof (custom_file_t));
1061
    p = calloc(1, sizeof (custom_file_t));
1059
    
1062
1060
    p->file = file;
1063
    p->file = file;
1061
    p->iso_pathname = _iso_pathname;
1064
    p->iso_pathname = _iso_pathname;
1062
    p->raw_flag = raw_flag;
1065
    p->raw_flag = raw_flag;
1063
  
1066
1064
    p->size = size;
1067
    p->size = size;
1065
    p->start_extent = 0;
1068
    p->start_extent = 0;
1066
    p->sectors = sectors;
1069
    p->sectors = sectors;
Lines 1077-1084 Link Here
1077
  int n;
1080
  int n;
1078
  CdioListNode_t *p_node;
1081
  CdioListNode_t *p_node;
1079
1082
1080
  uint32_t dir_secs = SECTOR_NIL;
1081
1082
  _dict_clean (p_obj);
1083
  _dict_clean (p_obj);
1083
1084
1084
  /* pre-alloc 16 blocks of ISO9660 required silence */
1085
  /* pre-alloc 16 blocks of ISO9660 required silence */
Lines 1086-1092 Link Here
1086
    vcd_assert_not_reached ();
1087
    vcd_assert_not_reached ();
1087
1088
1088
  /* keep karaoke sectors blank -- well... guess I'm too paranoid :) */
1089
  /* keep karaoke sectors blank -- well... guess I'm too paranoid :) */
1089
  if (_vcd_salloc (p_obj->iso_bitmap, 75, 75) == SECTOR_NIL) 
1090
  if (_vcd_salloc (p_obj->iso_bitmap, 75, 75) == SECTOR_NIL)
1090
    vcd_assert_not_reached ();
1091
    vcd_assert_not_reached ();
1091
1092
1092
  /* pre-alloc descriptors, PVD */
1093
  /* pre-alloc descriptors, PVD */
Lines 1095-1104 Link Here
1095
  _dict_insert (p_obj, "evd", ISO_EVD_SECTOR, 1, SM_EOR|SM_EOF);  /* EOR+EOF */
1096
  _dict_insert (p_obj, "evd", ISO_EVD_SECTOR, 1, SM_EOR|SM_EOF);  /* EOR+EOF */
1096
1097
1097
  /* reserve for iso directory */
1098
  /* reserve for iso directory */
1098
  dir_secs = _vcd_salloc (p_obj->iso_bitmap, 18, 75-18);
1099
  _vcd_salloc (p_obj->iso_bitmap, 18, 75-18);
1099
1100
1100
  /* VCD information area */
1101
  /* VCD information area */
1101
  
1102
1102
  _dict_insert (p_obj, "info", INFO_VCD_SECTOR, 1, SM_EOF);       /* INFO.VCD */           /* EOF */
1103
  _dict_insert (p_obj, "info", INFO_VCD_SECTOR, 1, SM_EOF);       /* INFO.VCD */           /* EOF */
1103
  _dict_insert (p_obj, "entries", ENTRIES_VCD_SECTOR, 1, SM_EOF); /* ENTRIES.VCD */        /* EOF */
1104
  _dict_insert (p_obj, "entries", ENTRIES_VCD_SECTOR, 1, SM_EOF); /* ENTRIES.VCD */        /* EOF */
1104
1105
Lines 1107-1120 Link Here
1107
  if (_vcd_pbc_available (p_obj))
1108
  if (_vcd_pbc_available (p_obj))
1108
    {
1109
    {
1109
      _dict_insert (p_obj, "lot", LOT_VCD_SECTOR, LOT_VCD_SIZE, SM_EOF); /* LOT.VCD */            /* EOF */
1110
      _dict_insert (p_obj, "lot", LOT_VCD_SECTOR, LOT_VCD_SIZE, SM_EOF); /* LOT.VCD */            /* EOF */
1110
      _dict_insert (p_obj, "psd", PSD_VCD_SECTOR, 
1111
      _dict_insert (p_obj, "psd", PSD_VCD_SECTOR,
1111
                    _vcd_len2blocks (get_psd_size (p_obj, false), ISO_BLOCKSIZE), SM_EOF); /* PSD.VCD */ /* EOF */
1112
                    _vcd_len2blocks (get_psd_size (p_obj, false), ISO_BLOCKSIZE), SM_EOF); /* PSD.VCD */ /* EOF */
1112
    }
1113
    }
1113
1114
1114
  if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
1115
  if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
1115
    {
1116
    {
1116
      _dict_insert (p_obj, "tracks", SECTOR_NIL, 1, SM_EOF);   /* TRACKS.SVD */
1117
      _dict_insert (p_obj, "tracks", SECTOR_NIL, 1, SM_EOF);   /* TRACKS.SVD */
1117
      _dict_insert (p_obj, "search", SECTOR_NIL, 
1118
      _dict_insert (p_obj, "search", SECTOR_NIL,
1118
                    _vcd_len2blocks (get_search_dat_size (p_obj), ISO_BLOCKSIZE), SM_EOF); /* SEARCH.DAT */
1119
                    _vcd_len2blocks (get_search_dat_size (p_obj), ISO_BLOCKSIZE), SM_EOF); /* SEARCH.DAT */
1119
1120
1120
      vcd_assert (_dict_get_bykey (p_obj, "tracks")->sector > INFO_VCD_SECTOR);
1121
      vcd_assert (_dict_get_bykey (p_obj, "tracks")->sector > INFO_VCD_SECTOR);
Lines 1123-1135 Link Here
1123
1124
1124
  /* done with primary information area */
1125
  /* done with primary information area */
1125
1126
1126
  p_obj->mpeg_segment_start_extent = 
1127
  p_obj->mpeg_segment_start_extent =
1127
    _vcd_len2blocks (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1, 75) * 75;
1128
    _vcd_len2blocks (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1, 75) * 75;
1128
1129
1129
  /* salloc up to end of vcd sector */
1130
  /* salloc up to end of vcd sector */
1130
  for(n = 0;n < p_obj->mpeg_segment_start_extent;n++) 
1131
  for(n = 0;n < p_obj->mpeg_segment_start_extent;n++)
1131
    _vcd_salloc (p_obj->iso_bitmap, n, 1);
1132
    _vcd_salloc (p_obj->iso_bitmap, n, 1);
1132
  
1133
1133
  vcd_assert (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1 == p_obj->mpeg_segment_start_extent);
1134
  vcd_assert (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1 == p_obj->mpeg_segment_start_extent);
1134
1135
1135
  /* insert segments */
1136
  /* insert segments */
Lines 1137-1150 Link Here
1137
  _CDIO_LIST_FOREACH (p_node, p_obj->mpeg_segment_list)
1138
  _CDIO_LIST_FOREACH (p_node, p_obj->mpeg_segment_list)
1138
    {
1139
    {
1139
      mpeg_segment_t *_segment = _cdio_list_node_data (p_node);
1140
      mpeg_segment_t *_segment = _cdio_list_node_data (p_node);
1140
      
1141
1141
      _segment->start_extent = 
1142
      _segment->start_extent =
1142
        _vcd_salloc (p_obj->iso_bitmap, SECTOR_NIL, 
1143
        _vcd_salloc (p_obj->iso_bitmap, SECTOR_NIL,
1143
                     _segment->segment_count * VCDINFO_SEGMENT_SECTOR_SIZE);
1144
                     _segment->segment_count * VCDINFO_SEGMENT_SECTOR_SIZE);
1144
1145
1145
      vcd_assert (_segment->start_extent % 75 == 0);
1146
      vcd_assert (_segment->start_extent % 75 == 0);
1146
      vcd_assert (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1 
1147
      vcd_assert (_vcd_salloc_get_highest (p_obj->iso_bitmap) + 1
1147
                  == _segment->start_extent 
1148
                  == _segment->start_extent
1148
                  + _segment->segment_count * VCDINFO_SEGMENT_SECTOR_SIZE);
1149
                  + _segment->segment_count * VCDINFO_SEGMENT_SECTOR_SIZE);
1149
    }
1150
    }
1150
1151
Lines 1156-1162 Link Here
1156
1157
1157
  if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
1158
  if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD))
1158
    {
1159
    {
1159
      _dict_insert (p_obj, "scandata", SECTOR_NIL, 
1160
      _dict_insert (p_obj, "scandata", SECTOR_NIL,
1160
                    _vcd_len2blocks (get_scandata_dat_size (p_obj),
1161
                    _vcd_len2blocks (get_scandata_dat_size (p_obj),
1161
                                     ISO_BLOCKSIZE),
1162
                                     ISO_BLOCKSIZE),
1162
                    SM_EOF);
1163
                    SM_EOF);
Lines 1166-1174 Link Here
1166
      &&_vcd_pbc_available (p_obj))
1167
      &&_vcd_pbc_available (p_obj))
1167
    {
1168
    {
1168
      _dict_insert (p_obj, "lot_x", SECTOR_NIL, LOT_VCD_SIZE, SM_EOF);
1169
      _dict_insert (p_obj, "lot_x", SECTOR_NIL, LOT_VCD_SIZE, SM_EOF);
1169
      
1170
1170
      _dict_insert (p_obj, "psd_x", SECTOR_NIL,
1171
      _dict_insert (p_obj, "psd_x", SECTOR_NIL,
1171
                    _vcd_len2blocks (get_psd_size (p_obj, true), 
1172
                    _vcd_len2blocks (get_psd_size (p_obj, true),
1172
                                     ISO_BLOCKSIZE), SM_EOF);
1173
                                     ISO_BLOCKSIZE), SM_EOF);
1173
    }
1174
    }
1174
1175
Lines 1181-1187 Link Here
1181
  _CDIO_LIST_FOREACH (p_node, p_obj->custom_file_list)
1182
  _CDIO_LIST_FOREACH (p_node, p_obj->custom_file_list)
1182
    {
1183
    {
1183
      custom_file_t *p = _cdio_list_node_data (p_node);
1184
      custom_file_t *p = _cdio_list_node_data (p_node);
1184
      
1185
1185
      if (p->sectors)
1186
      if (p->sectors)
1186
        {
1187
        {
1187
          p->start_extent =
1188
          p->start_extent =
Lines 1198-1205 Link Here
1198
  p_obj->iso_size =
1199
  p_obj->iso_size =
1199
    MAX (MIN_ISO_SIZE, _vcd_salloc_get_highest (p_obj->iso_bitmap) + 1);
1200
    MAX (MIN_ISO_SIZE, _vcd_salloc_get_highest (p_obj->iso_bitmap) + 1);
1200
1201
1201
  vcd_debug ("iso9660: highest alloced sector is %lu (using %d as isosize)", 
1202
  vcd_debug ("iso9660: highest alloced sector is %lu (using %d as isosize)",
1202
             (unsigned long int) _vcd_salloc_get_highest (p_obj->iso_bitmap), 
1203
             (unsigned long int) _vcd_salloc_get_highest (p_obj->iso_bitmap),
1203
             p_obj->iso_size);
1204
             p_obj->iso_size);
1204
1205
1205
  /* after this point the ISO9660's size is frozen */
1206
  /* after this point the ISO9660's size is frozen */
Lines 1229-1249 Link Here
1229
    if (_cdio_list_length (p_obj->mpeg_segment_list))
1230
    if (_cdio_list_length (p_obj->mpeg_segment_list))
1230
      _vcd_directory_mkdir (p_obj->dir, "SEGMENT");
1231
      _vcd_directory_mkdir (p_obj->dir, "SEGMENT");
1231
1232
1232
    _vcd_directory_mkfile (p_obj->dir, "VCD/ENTRIES.VCD", 
1233
    _vcd_directory_mkfile (p_obj->dir, "VCD/ENTRIES.VCD",
1233
                           _dict_get_bykey (p_obj, "entries")->sector, 
1234
                           _dict_get_bykey (p_obj, "entries")->sector,
1234
                           ISO_BLOCKSIZE, false, 0);    
1235
                           ISO_BLOCKSIZE, false, 0);
1235
    _vcd_directory_mkfile (p_obj->dir, "VCD/INFO.VCD",
1236
    _vcd_directory_mkfile (p_obj->dir, "VCD/INFO.VCD",
1236
                           _dict_get_bykey (p_obj, "info")->sector, 
1237
                           _dict_get_bykey (p_obj, "info")->sector,
1237
                           ISO_BLOCKSIZE, false, 0);
1238
                           ISO_BLOCKSIZE, false, 0);
1238
1239
1239
    /* only for vcd2.0 */
1240
    /* only for vcd2.0 */
1240
    if (_vcd_pbc_available (p_obj))
1241
    if (_vcd_pbc_available (p_obj))
1241
      {
1242
      {
1242
        _vcd_directory_mkfile (p_obj->dir, "VCD/LOT.VCD", 
1243
        _vcd_directory_mkfile (p_obj->dir, "VCD/LOT.VCD",
1243
                               _dict_get_bykey (p_obj, "lot")->sector, 
1244
                               _dict_get_bykey (p_obj, "lot")->sector,
1244
                               ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 0);
1245
                               ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 0);
1245
        _vcd_directory_mkfile (p_obj->dir, "VCD/PSD.VCD", 
1246
        _vcd_directory_mkfile (p_obj->dir, "VCD/PSD.VCD",
1246
                               _dict_get_bykey (p_obj, "psd")->sector, 
1247
                               _dict_get_bykey (p_obj, "psd")->sector,
1247
                               get_psd_size (p_obj, false), false, 0);
1248
                               get_psd_size (p_obj, false), false, 0);
1248
      }
1249
      }
1249
    break;
1250
    break;
Lines 1267-1293 Link Here
1267
    _vcd_directory_mkdir (p_obj->dir, "SVCD");
1268
    _vcd_directory_mkdir (p_obj->dir, "SVCD");
1268
1269
1269
    _vcd_directory_mkfile (p_obj->dir, "SVCD/ENTRIES.SVD",
1270
    _vcd_directory_mkfile (p_obj->dir, "SVCD/ENTRIES.SVD",
1270
                           _dict_get_bykey (p_obj, "entries")->sector, 
1271
                           _dict_get_bykey (p_obj, "entries")->sector,
1271
                           ISO_BLOCKSIZE, false, 0);    
1272
                           ISO_BLOCKSIZE, false, 0);
1272
    _vcd_directory_mkfile (p_obj->dir, "SVCD/INFO.SVD",
1273
    _vcd_directory_mkfile (p_obj->dir, "SVCD/INFO.SVD",
1273
                           _dict_get_bykey (p_obj, "info")->sector, 
1274
                           _dict_get_bykey (p_obj, "info")->sector,
1274
                           ISO_BLOCKSIZE, false, 0);
1275
                           ISO_BLOCKSIZE, false, 0);
1275
1276
1276
    if (_vcd_pbc_available (p_obj))
1277
    if (_vcd_pbc_available (p_obj))
1277
      {
1278
      {
1278
        _vcd_directory_mkfile (p_obj->dir, "SVCD/LOT.SVD",
1279
        _vcd_directory_mkfile (p_obj->dir, "SVCD/LOT.SVD",
1279
                               _dict_get_bykey (p_obj, "lot")->sector, 
1280
                               _dict_get_bykey (p_obj, "lot")->sector,
1280
                               ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 0);
1281
                               ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 0);
1281
        _vcd_directory_mkfile (p_obj->dir, "SVCD/PSD.SVD", 
1282
        _vcd_directory_mkfile (p_obj->dir, "SVCD/PSD.SVD",
1282
                               _dict_get_bykey (p_obj, "psd")->sector, 
1283
                               _dict_get_bykey (p_obj, "psd")->sector,
1283
                               get_psd_size (p_obj, false), false, 0);
1284
                               get_psd_size (p_obj, false), false, 0);
1284
      }
1285
      }
1285
1286
1286
    _vcd_directory_mkfile (p_obj->dir, "SVCD/SEARCH.DAT", 
1287
    _vcd_directory_mkfile (p_obj->dir, "SVCD/SEARCH.DAT",
1287
                           _dict_get_bykey (p_obj, "search")->sector, 
1288
                           _dict_get_bykey (p_obj, "search")->sector,
1288
                           get_search_dat_size (p_obj), false, 0);
1289
                           get_search_dat_size (p_obj), false, 0);
1289
    _vcd_directory_mkfile (p_obj->dir, "SVCD/TRACKS.SVD",
1290
    _vcd_directory_mkfile (p_obj->dir, "SVCD/TRACKS.SVD",
1290
                           _dict_get_bykey (p_obj, "tracks")->sector, 
1291
                           _dict_get_bykey (p_obj, "tracks")->sector,
1291
                           ISO_BLOCKSIZE, false, 0);
1292
                           ISO_BLOCKSIZE, false, 0);
1292
    break;
1293
    break;
1293
1294
Lines 1306-1312 Link Here
1306
      const char *fmt = NULL;
1307
      const char *fmt = NULL;
1307
      uint8_t fnum = 0;
1308
      uint8_t fnum = 0;
1308
1309
1309
      switch (p_obj->type) 
1310
      switch (p_obj->type)
1310
        {
1311
        {
1311
        case VCD_TYPE_VCD2:
1312
        case VCD_TYPE_VCD2:
1312
          fmt = "SEGMENT/ITEM%4.4d.DAT";
1313
          fmt = "SEGMENT/ITEM%4.4d.DAT";
Lines 1320-1329 Link Here
1320
        default:
1321
        default:
1321
          vcd_assert_not_reached ();
1322
          vcd_assert_not_reached ();
1322
        }
1323
        }
1323
      
1324
1324
      snprintf (segment_pathname, sizeof (segment_pathname), fmt, n);
1325
      snprintf (segment_pathname, sizeof (segment_pathname), fmt, n);
1325
        
1326
1326
      _vcd_directory_mkfile (p_obj->dir, segment_pathname, 
1327
      _vcd_directory_mkfile (p_obj->dir, segment_pathname,
1327
                             segment->start_extent,
1328
                             segment->start_extent,
1328
                             segment->info->packets * ISO_BLOCKSIZE,
1329
                             segment->info->packets * ISO_BLOCKSIZE,
1329
                             true, fnum);
1330
                             true, fnum);
Lines 1340-1351 Link Here
1340
    {
1341
    {
1341
      /* psd_x -- extended PSD */
1342
      /* psd_x -- extended PSD */
1342
      _vcd_directory_mkfile (p_obj->dir, "EXT/PSD_X.VCD",
1343
      _vcd_directory_mkfile (p_obj->dir, "EXT/PSD_X.VCD",
1343
                             _dict_get_bykey (p_obj, "psd_x")->sector, 
1344
                             _dict_get_bykey (p_obj, "psd_x")->sector,
1344
                             get_psd_size (p_obj, true), false, 1);
1345
                             get_psd_size (p_obj, true), false, 1);
1345
1346
1346
      /* lot_x -- extended LOT */
1347
      /* lot_x -- extended LOT */
1347
      _vcd_directory_mkfile (p_obj->dir, "EXT/LOT_X.VCD",
1348
      _vcd_directory_mkfile (p_obj->dir, "EXT/LOT_X.VCD",
1348
                             _dict_get_bykey (p_obj, "lot_x")->sector, 
1349
                             _dict_get_bykey (p_obj, "lot_x")->sector,
1349
                             ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 1);
1350
                             ISO_BLOCKSIZE*LOT_VCD_SIZE, false, 1);
1350
1351
1351
      vcd_assert (p_obj->type == VCD_TYPE_VCD2);
1352
      vcd_assert (p_obj->type == VCD_TYPE_VCD2);
Lines 1355-1361 Link Here
1355
    {
1356
    {
1356
      /* scandata.dat -- scanpoints */
1357
      /* scandata.dat -- scanpoints */
1357
      _vcd_directory_mkfile (p_obj->dir, "EXT/SCANDATA.DAT",
1358
      _vcd_directory_mkfile (p_obj->dir, "EXT/SCANDATA.DAT",
1358
                             _dict_get_bykey (p_obj, "scandata")->sector, 
1359
                             _dict_get_bykey (p_obj, "scandata")->sector,
1359
                             get_scandata_dat_size (p_obj), false, 0);
1360
                             get_scandata_dat_size (p_obj), false, 0);
1360
    }
1361
    }
1361
1362
Lines 1371-1379 Link Here
1371
      custom_file_t *p = _cdio_list_node_data (p_node);
1372
      custom_file_t *p = _cdio_list_node_data (p_node);
1372
1373
1373
      _vcd_directory_mkfile (p_obj->dir, p->iso_pathname, p->start_extent,
1374
      _vcd_directory_mkfile (p_obj->dir, p->iso_pathname, p->start_extent,
1374
                             (p->raw_flag 
1375
                             (p->raw_flag
1375
                              ? (ISO_BLOCKSIZE * (p->size / M2RAW_SECTOR_SIZE))
1376
                              ? (ISO_BLOCKSIZE * (p->size / M2RAW_SECTOR_SIZE))
1376
                              : p->size), 
1377
                              : p->size),
1377
                             p->raw_flag, 1);
1378
                             p->raw_flag, 1);
1378
    }
1379
    }
1379
1380
Lines 1386-1395 Link Here
1386
      mpeg_sequence_t *p_sequence = _cdio_list_node_data (p_node);
1387
      mpeg_sequence_t *p_sequence = _cdio_list_node_data (p_node);
1387
      uint32_t extent = p_sequence->relative_start_extent;
1388
      uint32_t extent = p_sequence->relative_start_extent;
1388
      uint8_t file_num = 0;
1389
      uint8_t file_num = 0;
1389
      
1390
1390
      extent += p_obj->iso_size;
1391
      extent += p_obj->iso_size;
1391
1392
1392
      switch (p_obj->type) 
1393
      switch (p_obj->type)
1393
        {
1394
        {
1394
        case VCD_TYPE_VCD:
1395
        case VCD_TYPE_VCD:
1395
          fmt = "MPEGAV/MUSIC%2.2d.DAT";
1396
          fmt = "MPEGAV/MUSIC%2.2d.DAT";
Lines 1412-1430 Link Here
1412
              fmt = "MPEGAV/AVSEQ%2.2d.MPG";
1413
              fmt = "MPEGAV/AVSEQ%2.2d.MPG";
1413
              file_num = n + 1;
1414
              file_num = n + 1;
1414
            }
1415
            }
1415
            
1416
1416
          break;
1417
          break;
1417
        default:
1418
        default:
1418
          vcd_assert_not_reached ();
1419
          vcd_assert_not_reached ();
1419
        }
1420
        }
1420
1421
1421
      vcd_assert (n < 98);
1422
      vcd_assert (n < 98);
1422
      
1423
1423
      snprintf (avseq_pathname, sizeof (avseq_pathname), fmt, n + 1);
1424
      snprintf (avseq_pathname, sizeof (avseq_pathname), fmt, n + 1);
1424
      
1425
1425
      /* file entry contains front margin, mpeg stream and rear margin */
1426
      /* file entry contains front margin, mpeg stream and rear margin */
1426
      _vcd_directory_mkfile (p_obj->dir, avseq_pathname, extent,
1427
      _vcd_directory_mkfile (p_obj->dir, avseq_pathname, extent,
1427
                             (p_obj->track_front_margin 
1428
                             (p_obj->track_front_margin
1428
                              + p_sequence->info->packets
1429
                              + p_sequence->info->packets
1429
                              + p_obj->track_rear_margin) * ISO_BLOCKSIZE,
1430
                              + p_obj->track_rear_margin) * ISO_BLOCKSIZE,
1430
                             true, file_num);
1431
                             true, file_num);
Lines 1435-1467 Link Here
1435
  /* register isofs dir structures */
1436
  /* register isofs dir structures */
1436
  {
1437
  {
1437
    uint32_t dirs_size = _vcd_directory_get_size (p_obj->dir);
1438
    uint32_t dirs_size = _vcd_directory_get_size (p_obj->dir);
1438
    
1439
1439
    /* be sure to stay out of information areas */
1440
    /* be sure to stay out of information areas */
1440
1441
1441
    switch (p_obj->type) 
1442
    switch (p_obj->type)
1442
      {
1443
      {
1443
      case VCD_TYPE_VCD:
1444
      case VCD_TYPE_VCD:
1444
      case VCD_TYPE_VCD11:
1445
      case VCD_TYPE_VCD11:
1445
      case VCD_TYPE_VCD2:
1446
      case VCD_TYPE_VCD2:
1446
        /* karaoke area starts at 03:00 */
1447
        /* karaoke area starts at 03:00 */
1447
        if (16 + 2 + dirs_size + 2 >= 75) 
1448
        if (16 + 2 + dirs_size + 2 >= 75)
1448
          vcd_error ("directory section to big for a VCD");
1449
          vcd_error ("directory section to big for a VCD");
1449
        break;
1450
        break;
1450
1451
1451
      case VCD_TYPE_SVCD:
1452
      case VCD_TYPE_SVCD:
1452
      case VCD_TYPE_HQVCD:
1453
      case VCD_TYPE_HQVCD:
1453
        /* since no karaoke exists the next fixed area starts at 04:00 */
1454
        /* since no karaoke exists the next fixed area starts at 04:00 */
1454
        if (16 + 2 + dirs_size + 2 >= 150) 
1455
        if (16 + 2 + dirs_size + 2 >= 150)
1455
          vcd_error ("directory section to big for a SVCD");
1456
          vcd_error ("directory section to big for a SVCD");
1456
        break;
1457
        break;
1457
      default:
1458
      default:
1458
        vcd_assert_not_reached ();
1459
        vcd_assert_not_reached ();
1459
      }
1460
      }
1460
    
1461
1461
    /* un-alloc small area */
1462
    /* un-alloc small area */
1462
    
1463
1463
    _vcd_salloc_free (p_obj->iso_bitmap, 18, dirs_size + 2);
1464
    _vcd_salloc_free (p_obj->iso_bitmap, 18, dirs_size + 2);
1464
    
1465
1465
    /* alloc it again! */
1466
    /* alloc it again! */
1466
1467
1467
    _dict_insert (p_obj, "dir", 18, dirs_size, SM_EOR|SM_EOF);
1468
    _dict_insert (p_obj, "dir", 18, dirs_size, SM_EOR|SM_EOF);
Lines 1492-1498 Link Here
1492
    progress_info_t _pi;
1493
    progress_info_t _pi;
1493
1494
1494
    _pi.sectors_written = p_obj->sectors_written;
1495
    _pi.sectors_written = p_obj->sectors_written;
1495
    _pi.total_sectors = p_obj->relative_end_extent + p_obj->iso_size; 
1496
    _pi.total_sectors = p_obj->relative_end_extent + p_obj->iso_size;
1496
    _pi.in_track = p_obj->in_track;
1497
    _pi.in_track = p_obj->in_track;
1497
    _pi.total_tracks = _cdio_list_length (p_obj->mpeg_sequence_list) + 1;
1498
    _pi.total_tracks = _cdio_list_length (p_obj->mpeg_sequence_list) + 1;
1498
1499
Lines 1504-1510 Link Here
1504
1505
1505
static int
1506
static int
1506
_write_m2_image_sector (VcdObj_t *obj, const void *data, uint32_t extent,
1507
_write_m2_image_sector (VcdObj_t *obj, const void *data, uint32_t extent,
1507
                        uint8_t fnum, uint8_t cnum, uint8_t sm, uint8_t ci) 
1508
                        uint8_t fnum, uint8_t cnum, uint8_t sm, uint8_t ci)
1508
{
1509
{
1509
  char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, };
1510
  char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, };
1510
1511
Lines 1513-1519 Link Here
1513
  _vcd_make_mode2(buf, data, extent, fnum, cnum, sm, ci);
1514
  _vcd_make_mode2(buf, data, extent, fnum, cnum, sm, ci);
1514
1515
1515
  vcd_image_sink_write (obj->image_sink, buf, extent);
1516
  vcd_image_sink_write (obj->image_sink, buf, extent);
1516
  
1517
1517
  obj->sectors_written++;
1518
  obj->sectors_written++;
1518
1519
1519
  return _callback_wrapper (obj, false);
1520
  return _callback_wrapper (obj, false);
Lines 1536-1542 Link Here
1536
}
1537
}
1537
1538
1538
static void
1539
static void
1539
_write_source_mode2_raw (VcdObj_t *obj, VcdDataSource_t *source, 
1540
_write_source_mode2_raw (VcdObj_t *obj, VcdDataSource_t *source,
1540
                         uint32_t extent)
1541
                         uint32_t extent)
1541
{
1542
{
1542
  int n;
1543
  int n;
Lines 1544-1550 Link Here
1544
1545
1545
  sectors = vcd_data_source_stat (source) / M2RAW_SECTOR_SIZE;
1546
  sectors = vcd_data_source_stat (source) / M2RAW_SECTOR_SIZE;
1546
1547
1547
  vcd_data_source_seek (source, 0); 
1548
  vcd_data_source_seek (source, 0);
1548
1549
1549
  for (n = 0;n < sectors;n++) {
1550
  for (n = 0;n < sectors;n++) {
1550
    char buf[M2RAW_SECTOR_SIZE] = { 0, };
1551
    char buf[M2RAW_SECTOR_SIZE] = { 0, };
Lines 1559-1565 Link Here
1559
}
1560
}
1560
1561
1561
static void
1562
static void
1562
_write_source_mode2_form1 (VcdObj_t *obj, VcdDataSource_t *source, 
1563
_write_source_mode2_form1 (VcdObj_t *obj, VcdDataSource_t *source,
1563
                           uint32_t extent)
1564
                           uint32_t extent)
1564
{
1565
{
1565
  int n;
1566
  int n;
Lines 1573-1591 Link Here
1573
  if (!last_block_size)
1574
  if (!last_block_size)
1574
    last_block_size = CDIO_CD_FRAMESIZE;
1575
    last_block_size = CDIO_CD_FRAMESIZE;
1575
1576
1576
  vcd_data_source_seek (source, 0); 
1577
  vcd_data_source_seek (source, 0);
1577
1578
1578
  for (n = 0;n < sectors;n++) {
1579
  for (n = 0;n < sectors;n++) {
1579
    char buf[CDIO_CD_FRAMESIZE] = { 0, };
1580
    char buf[CDIO_CD_FRAMESIZE] = { 0, };
1580
1581
1581
    vcd_data_source_read (source, buf, 
1582
    vcd_data_source_read (source, buf,
1582
                          ((n + 1 == sectors) 
1583
                          ((n + 1 == sectors)
1583
                           ? last_block_size
1584
                           ? last_block_size
1584
                           : CDIO_CD_FRAMESIZE), 1);
1585
                           : CDIO_CD_FRAMESIZE), 1);
1585
1586
1586
    if (_write_m2_image_sector (obj, buf, extent+n, 1, 0, 
1587
    if (_write_m2_image_sector (obj, buf, extent+n, 1, 0,
1587
                                ((n+1 < sectors) 
1588
                                ((n+1 < sectors)
1588
                                 ? SM_DATA 
1589
                                 ? SM_DATA
1589
                                 : SM_DATA |SM_EOF),
1590
                                 : SM_DATA |SM_EOF),
1590
                                0))
1591
                                0))
1591
      break;
1592
      break;
Lines 1597-1603 Link Here
1597
static int
1598
static int
1598
_write_sequence (VcdObj_t *p_obj, int track_idx)
1599
_write_sequence (VcdObj_t *p_obj, int track_idx)
1599
{
1600
{
1600
  mpeg_sequence_t *track = 
1601
  mpeg_sequence_t *track =
1601
    _cdio_list_node_data (_vcd_list_at (p_obj->mpeg_sequence_list, track_idx));
1602
    _cdio_list_node_data (_vcd_list_at (p_obj->mpeg_sequence_list, track_idx));
1602
  CdioListNode_t *pause_node;
1603
  CdioListNode_t *pause_node;
1603
  int n, lastsect = p_obj->sectors_written;
1604
  int n, lastsect = p_obj->sectors_written;
Lines 1631-1637 Link Here
1631
    case MPEG_NORM_NTSC_S:
1632
    case MPEG_NORM_NTSC_S:
1632
      norm_str = strdup ("NTSC 2/3 D1 (480x480/29.97fps)");
1633
      norm_str = strdup ("NTSC 2/3 D1 (480x480/29.97fps)");
1633
      break;
1634
      break;
1634
	
1635
1635
    case MPEG_NORM_OTHER:
1636
    case MPEG_NORM_OTHER:
1636
      {
1637
      {
1637
        char buf[1024] = { 0, };
1638
        char buf[1024] = { 0, };
Lines 1674-1690 Link Here
1674
              0
1675
              0
1675
            };
1676
            };
1676
1677
1677
            int i_buf = snprintf (buf, sizeof (buf), 
1678
            int i_buf = snprintf (buf, sizeof (buf),
1678
                                  "audio[%d]: l%d/%2.1fkHz/%dkbps/%s ", 
1679
                                  "audio[%d]: l%d/%2.1fkHz/%dkbps/%s ",
1679
                                  i,
1680
                                  i,
1680
                                  track->info->ahdr[i].layer,
1681
                                  track->info->ahdr[i].layer,
1681
                                  track->info->ahdr[i].sampfreq / 1000.0,
1682
                                  track->info->ahdr[i].sampfreq / 1000.0,
1682
                                  track->info->ahdr[i].bitrate / 1024,
1683
                                  track->info->ahdr[i].bitrate / 1024,
1683
                                  _mode_str[track->info->ahdr[i].mode]);
1684
                                  _mode_str[track->info->ahdr[i].mode]);
1684
                    
1685
1685
            strncat (buf2, buf, sizeof(buf2)-strlen(buf2)-i_buf2-1);
1686
            strncat (buf2, buf, sizeof(buf2)-strlen(buf2)-i_buf2-1);
1686
            i_buf2 += i_buf;
1687
            i_buf2 += i_buf;
1687
          }      
1688
          }
1688
1689
1689
      vcd_info ("writing track %d, %s, %s, %s...", track_idx + 2,
1690
      vcd_info ("writing track %d, %s, %s, %s...", track_idx + 2,
1690
                (track->info->version == MPEG_VERS_MPEG1 ? "MPEG1" : "MPEG2"),
1691
                (track->info->version == MPEG_VERS_MPEG1 ? "MPEG1" : "MPEG2"),
Lines 1708-1714 Link Here
1708
    struct vcd_mpeg_packet_info pkt_flags;
1709
    struct vcd_mpeg_packet_info pkt_flags;
1709
    bool set_trigger = false;
1710
    bool set_trigger = false;
1710
1711
1711
    vcd_mpeg_source_get_packet (track->source, n, buf, &pkt_flags, 
1712
    vcd_mpeg_source_get_packet (track->source, n, buf, &pkt_flags,
1712
                                p_obj->update_scan_offsets);
1713
                                p_obj->update_scan_offsets);
1713
1714
1714
    while (pause_node)
1715
    while (pause_node)
Lines 1724-1736 Link Here
1724
        /* seems it's time to trigger! */
1725
        /* seems it's time to trigger! */
1725
        set_trigger = true;
1726
        set_trigger = true;
1726
1727
1727
        vcd_debug ("setting auto pause trigger for time %f (pts %f) @%d", 
1728
        vcd_debug ("setting auto pause trigger for time %f (pts %f) @%d",
1728
                   _pause->time, pkt_flags.pts, n);
1729
                   _pause->time, pkt_flags.pts, n);
1729
1730
1730
        pause_node = _cdio_list_node_next (pause_node);
1731
        pause_node = _cdio_list_node_next (pause_node);
1731
      }
1732
      }
1732
1733
1733
    switch (vcd_mpeg_packet_get_type (&pkt_flags)) 
1734
    switch (vcd_mpeg_packet_get_type (&pkt_flags))
1734
      {
1735
      {
1735
    case PKT_TYPE_VIDEO:
1736
    case PKT_TYPE_VIDEO:
1736
      mpeg_packets.video++;
1737
      mpeg_packets.video++;
Lines 1745-1751 Link Here
1745
      ci = CI_OGT;
1746
      ci = CI_OGT;
1746
      cnum = CN_OGT;
1747
      cnum = CN_OGT;
1747
      break;
1748
      break;
1748
    
1749
1749
    case PKT_TYPE_AUDIO:
1750
    case PKT_TYPE_AUDIO:
1750
      mpeg_packets.audio++;
1751
      mpeg_packets.audio++;
1751
      sm = SM_FORM2|SM_REALT|SM_AUDIO;
1752
      sm = SM_FORM2|SM_REALT|SM_AUDIO;
Lines 1791-1799 Link Here
1791
      sm |= SM_TRIG;
1792
      sm |= SM_TRIG;
1792
1793
1793
    fnum = track_idx + 1;
1794
    fnum = track_idx + 1;
1794
      
1795
1795
    if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD)
1796
    if (_vcd_obj_has_cap_p (p_obj, _CAP_4C_SVCD)
1796
        && !p_obj->svcd_vcd3_mpegav) /* IEC62107 SVCDs have a 
1797
        && !p_obj->svcd_vcd3_mpegav) /* IEC62107 SVCDs have a
1797
                                        simplified subheader */
1798
                                        simplified subheader */
1798
      {
1799
      {
1799
        fnum = 1;
1800
        fnum = 1;
Lines 1850-1863 Link Here
1850
          bool _need_eor = false;
1851
          bool _need_eor = false;
1851
1852
1852
          vcd_mpeg_source_get_packet (p_segment->source, packet_no,
1853
          vcd_mpeg_source_get_packet (p_segment->source, packet_no,
1853
                                      buf, &pkt_flags, 
1854
                                      buf, &pkt_flags,
1854
                                      p_obj->update_scan_offsets);
1855
                                      p_obj->update_scan_offsets);
1855
1856
1856
          fn = 1;
1857
          fn = 1;
1857
          cn = CN_EMPTY;
1858
          cn = CN_EMPTY;
1858
          sm = SM_FORM2 | SM_REALT;
1859
          sm = SM_FORM2 | SM_REALT;
1859
          ci = CI_EMPTY;
1860
          ci = CI_EMPTY;
1860
  
1861
1861
          while (pause_node)
1862
          while (pause_node)
1862
            {
1863
            {
1863
              pause_t *_pause = _cdio_list_node_data (pause_node);
1864
              pause_t *_pause = _cdio_list_node_data (pause_node);
Lines 1871-1883 Link Here
1871
              /* seems it's time to trigger! */
1872
              /* seems it's time to trigger! */
1872
              set_trigger = true;
1873
              set_trigger = true;
1873
1874
1874
              vcd_debug ("setting auto pause trigger for time %f (pts %f) @%d", 
1875
              vcd_debug ("setting auto pause trigger for time %f (pts %f) @%d",
1875
                         _pause->time, pkt_flags.pts, n);
1876
                         _pause->time, pkt_flags.pts, n);
1876
1877
1877
              pause_node = _cdio_list_node_next (pause_node);
1878
              pause_node = _cdio_list_node_next (pause_node);
1878
            }
1879
            }
1879
            
1880
1880
          switch (vcd_mpeg_packet_get_type (&pkt_flags)) 
1881
          switch (vcd_mpeg_packet_get_type (&pkt_flags))
1881
            {
1882
            {
1882
            case PKT_TYPE_VIDEO:
1883
            case PKT_TYPE_VIDEO:
1883
              sm = SM_FORM2 | SM_REALT | SM_VIDEO;
1884
              sm = SM_FORM2 | SM_REALT | SM_VIDEO;
Lines 1893-1899 Link Here
1893
              if (pkt_flags.video[1] || pkt_flags.video[2])
1894
              if (pkt_flags.video[1] || pkt_flags.video[2])
1894
                { /* search for endcode -- hack */
1895
                { /* search for endcode -- hack */
1895
                  int idx;
1896
                  int idx;
1896
                
1897
1897
                  for (idx = 0; idx <= 2320; idx++)
1898
                  for (idx = 0; idx <= 2320; idx++)
1898
                    if (buf[idx] == 0x00
1899
                    if (buf[idx] == 0x00
1899
                        && buf[idx + 1] == 0x00
1900
                        && buf[idx + 1] == 0x00
Lines 1908-1914 Link Here
1908
1909
1909
            case PKT_TYPE_AUDIO:
1910
            case PKT_TYPE_AUDIO:
1910
              sm = SM_FORM2 | SM_REALT | SM_AUDIO;
1911
              sm = SM_FORM2 | SM_REALT | SM_AUDIO;
1911
                  
1912
1912
              ci = CI_AUDIO;
1913
              ci = CI_AUDIO;
1913
              cn = CN_AUDIO;
1914
              cn = CN_AUDIO;
1914
              break;
1915
              break;
Lines 1938-1944 Link Here
1938
1939
1939
          if (_need_eor)
1940
          if (_need_eor)
1940
            {
1941
            {
1941
              vcd_debug ("setting EOR for SeqEnd at packet# %d ('%s')", 
1942
              vcd_debug ("setting EOR for SeqEnd at packet# %d ('%s')",
1942
                         packet_no, p_segment->id);
1943
                         packet_no, p_segment->id);
1943
              sm |= SM_EOR;
1944
              sm |= SM_EOR;
1944
            }
1945
            }
Lines 1959-1965 Link Here
1959
        }
1960
        }
1960
1961
1961
      _write_m2_image_sector (p_obj, buf, n, fn, cn, sm, ci);
1962
      _write_m2_image_sector (p_obj, buf, n, fn, cn, sm, ci);
1962
          
1963
1963
      n++;
1964
      n++;
1964
    }
1965
    }
1965
1966
Lines 1984-1990 Link Here
1984
  _CDIO_LIST_FOREACH (p_node, _mpeg_info->shdr[0].aps_list)
1985
  _CDIO_LIST_FOREACH (p_node, _mpeg_info->shdr[0].aps_list)
1985
    {
1986
    {
1986
      struct aps_data *_aps = _cdio_list_node_data (p_node);
1987
      struct aps_data *_aps = _cdio_list_node_data (p_node);
1987
  
1988
1988
      if (first)
1989
      if (first)
1989
        {
1990
        {
1990
          best_aps = *_aps;
1991
          best_aps = *_aps;
Lines 1992-1998 Link Here
1992
        }
1993
        }
1993
      else if (fabs (_aps->timestamp - t) < fabs (best_aps.timestamp - t))
1994
      else if (fabs (_aps->timestamp - t) < fabs (best_aps.timestamp - t))
1994
        best_aps = *_aps;
1995
        best_aps = *_aps;
1995
      else 
1996
      else
1996
        break;
1997
        break;
1997
    }
1998
    }
1998
1999
Lines 2042-2070 Link Here
2042
  int n;
2043
  int n;
2043
2044
2044
  /* generate dir sectors */
2045
  /* generate dir sectors */
2045
  
2046
2046
  _vcd_directory_dump_entries (p_obj->dir, 
2047
  _vcd_directory_dump_entries (p_obj->dir,
2047
                               _dict_get_bykey (p_obj, "dir")->buf, 
2048
                               _dict_get_bykey (p_obj, "dir")->buf,
2048
                               _dict_get_bykey (p_obj, "dir")->sector);
2049
                               _dict_get_bykey (p_obj, "dir")->sector);
2049
2050
2050
  _vcd_directory_dump_pathtables (p_obj->dir, 
2051
  _vcd_directory_dump_pathtables (p_obj->dir,
2051
                                  _dict_get_bykey (p_obj, "ptl")->buf, 
2052
                                  _dict_get_bykey (p_obj, "ptl")->buf,
2052
                                  _dict_get_bykey (p_obj, "ptm")->buf);
2053
                                  _dict_get_bykey (p_obj, "ptm")->buf);
2053
      
2054
2054
  /* generate PVD and EVD at last... */
2055
  /* generate PVD and EVD at last... */
2055
  iso9660_set_pvd (_dict_get_bykey (p_obj, "pvd")->buf,
2056
  iso9660_set_pvd (_dict_get_bykey (p_obj, "pvd")->buf,
2056
                   p_obj->iso_volume_label, 
2057
                   p_obj->iso_volume_label,
2057
                   p_obj->iso_publisher_id,
2058
                   p_obj->iso_publisher_id,
2058
                   p_obj->iso_preparer_id,
2059
                   p_obj->iso_preparer_id,
2059
                   p_obj->iso_application_id, 
2060
                   p_obj->iso_application_id,
2060
                   p_obj->iso_size, 
2061
                   p_obj->iso_size,
2061
                   _dict_get_bykey (p_obj, "dir")->buf, 
2062
                   _dict_get_bykey (p_obj, "dir")->buf,
2062
                   _dict_get_bykey (p_obj, "ptl")->sector,
2063
                   _dict_get_bykey (p_obj, "ptl")->sector,
2063
                   _dict_get_bykey (p_obj, "ptm")->sector,
2064
                   _dict_get_bykey (p_obj, "ptm")->sector,
2064
                   iso9660_pathtable_get_size (_dict_get_bykey (p_obj, "ptm")->buf),
2065
                   iso9660_pathtable_get_size (_dict_get_bykey (p_obj, "ptm")->buf),
2065
                   p_create_time
2066
                   p_create_time
2066
);
2067
);
2067
    
2068
2068
  iso9660_set_evd (_dict_get_bykey (p_obj, "evd")->buf);
2069
  iso9660_set_evd (_dict_get_bykey (p_obj, "evd")->buf);
2069
2070
2070
  /* fill VCD relevant files with data */
2071
  /* fill VCD relevant files with data */
Lines 2081-2087 Link Here
2081
        }
2082
        }
2082
2083
2083
      _vcd_pbc_check_unreferenced (p_obj);
2084
      _vcd_pbc_check_unreferenced (p_obj);
2084
  
2085
2085
      set_lot_vcd (p_obj, _dict_get_bykey (p_obj, "lot")->buf, false);
2086
      set_lot_vcd (p_obj, _dict_get_bykey (p_obj, "lot")->buf, false);
2086
      set_psd_vcd (p_obj, _dict_get_bykey (p_obj, "psd")->buf, false);
2087
      set_psd_vcd (p_obj, _dict_get_bykey (p_obj, "psd")->buf, false);
2087
    }
2088
    }
Lines 2105-2111 Link Here
2105
2106
2106
      content = _dict_get_sector (p_obj, n);
2107
      content = _dict_get_sector (p_obj, n);
2107
      flags |= _dict_get_sector_flags (p_obj, n);
2108
      flags |= _dict_get_sector_flags (p_obj, n);
2108
      
2109
2109
      if (content == NULL)
2110
      if (content == NULL)
2110
        content = zero;
2111
        content = zero;
2111
2112
Lines 2137-2169 Link Here
2137
2138
2138
      content = _dict_get_sector (p_obj, n);
2139
      content = _dict_get_sector (p_obj, n);
2139
      flags |= _dict_get_sector_flags (p_obj, n);
2140
      flags |= _dict_get_sector_flags (p_obj, n);
2140
      
2141
2141
      if (content == NULL)
2142
      if (content == NULL)
2142
        {
2143
        {
2143
          vcd_debug ("unexpected empty EXT sector");
2144
          vcd_debug ("unexpected empty EXT sector");
2144
          content = zero;
2145
          content = zero;
2145
        }
2146
        }
2146
      
2147
2147
      _write_m2_image_sector (p_obj, content, n, fileno, 0, flags, 0);
2148
      _write_m2_image_sector (p_obj, content, n, fileno, 0, flags, 0);
2148
    }
2149
    }
2149
2150
2150
  /* write custom files */
2151
  /* write custom files */
2151
2152
2152
  vcd_assert (n == p_obj->custom_file_start_extent);
2153
  vcd_assert (n == p_obj->custom_file_start_extent);
2153
    
2154
2154
  _CDIO_LIST_FOREACH (node, p_obj->custom_file_list)
2155
  _CDIO_LIST_FOREACH (node, p_obj->custom_file_list)
2155
    {
2156
    {
2156
      custom_file_t *p = _cdio_list_node_data (node);
2157
      custom_file_t *p = _cdio_list_node_data (node);
2157
        
2158
2158
      vcd_info ("writing file `%s' (%lu bytes%s)", 
2159
      vcd_info ("writing file `%s' (%lu bytes%s)",
2159
                p->iso_pathname, (unsigned long) p->size, 
2160
                p->iso_pathname, (unsigned long) p->size,
2160
                p->raw_flag ? ", raw sectors file": "");
2161
                p->raw_flag ? ", raw sectors file": "");
2161
      if (p->raw_flag)
2162
      if (p->raw_flag)
2162
        _write_source_mode2_raw (p_obj, p->file, p->start_extent);
2163
        _write_source_mode2_raw (p_obj, p->file, p->start_extent);
2163
      else
2164
      else
2164
        _write_source_mode2_form1 (p_obj, p->file, p->start_extent);
2165
        _write_source_mode2_form1 (p_obj, p->file, p->start_extent);
2165
    }
2166
    }
2166
  
2167
2167
  /* blank unalloced tracks */
2168
  /* blank unalloced tracks */
2168
  while ((n = _vcd_salloc (p_obj->iso_bitmap, SECTOR_NIL, 1)) < p_obj->iso_size)
2169
  while ((n = _vcd_salloc (p_obj->iso_bitmap, SECTOR_NIL, 1)) < p_obj->iso_size)
2169
    _write_m2_image_sector (p_obj, zero, n, 0, 0, SM_DATA, 0);
2170
    _write_m2_image_sector (p_obj, zero, n, 0, 0, SM_DATA, 0);
Lines 2178-2185 Link Here
2178
  long size_sectors = -1;
2179
  long size_sectors = -1;
2179
2180
2180
  vcd_assert (!p_obj->in_output);
2181
  vcd_assert (!p_obj->in_output);
2181
  
2182
2182
  if (_cdio_list_length (p_obj->mpeg_sequence_list) > 0) 
2183
  if (_cdio_list_length (p_obj->mpeg_sequence_list) > 0)
2183
    {
2184
    {
2184
      /* fixme -- make this efficient */
2185
      /* fixme -- make this efficient */
2185
      size_sectors = vcd_obj_begin_output (p_obj);
2186
      size_sectors = vcd_obj_begin_output (p_obj);
Lines 2218-2224 Link Here
2218
  image_size += p_obj->leadout_pregap;
2219
  image_size += p_obj->leadout_pregap;
2219
2220
2220
  if (image_size > CDIO_CD_MAX_SECTORS)
2221
  if (image_size > CDIO_CD_MAX_SECTORS)
2221
    vcd_error ("image too big (%d sectors > %d sectors)", 
2222
    vcd_error ("image too big (%d sectors > %d sectors)",
2222
               (unsigned) image_size, (unsigned) CDIO_CD_MAX_SECTORS);
2223
               (unsigned) image_size, (unsigned) CDIO_CD_MAX_SECTORS);
2223
2224
2224
  {
2225
  {
Lines 2226-2232 Link Here
2226
2227
2227
    if (image_size > CDIO_CD_74MIN_SECTORS)
2228
    if (image_size > CDIO_CD_74MIN_SECTORS)
2228
      vcd_warn ("generated image (%d sectors [%s]) may not fit "
2229
      vcd_warn ("generated image (%d sectors [%s]) may not fit "
2229
                "on 74min CDRs (%d sectors)", 
2230
                "on 74min CDRs (%d sectors)",
2230
                (unsigned) image_size, _tmp, (unsigned) CDIO_CD_74MIN_SECTORS);
2231
                (unsigned) image_size, _tmp, (unsigned) CDIO_CD_74MIN_SECTORS);
2231
2232
2232
    free (_tmp);
2233
    free (_tmp);
Lines 2248-2254 Link Here
2248
  _vcd_salloc_destroy (p_obj->iso_bitmap);
2249
  _vcd_salloc_destroy (p_obj->iso_bitmap);
2249
2250
2250
  _dict_clean (p_obj);
2251
  _dict_clean (p_obj);
2251
  _cdio_list_free (p_obj->buffer_dict_list, true);
2252
  _cdio_list_free (p_obj->buffer_dict_list, true, NULL);
2252
}
2253
}
2253
2254
2254
int
2255
int
Lines 2268-2274 Link Here
2268
      vcd_error ("item id (%s) exists already", p_pbc->item_id);
2269
      vcd_error ("item id (%s) exists already", p_pbc->item_id);
2269
      return -1;
2270
      return -1;
2270
    }
2271
    }
2271
  
2272
2272
  _cdio_list_append (p_obj->pbc_list, p_pbc);
2273
  _cdio_list_append (p_obj->pbc_list, p_pbc);
2273
2274
2274
  return 0;
2275
  return 0;
Lines 2305-2318 Link Here
2305
        mpeg_sequence_t *p_track = _cdio_list_node_data (node);
2306
        mpeg_sequence_t *p_track = _cdio_list_node_data (node);
2306
        CdioListNode_t *p_entry_node;
2307
        CdioListNode_t *p_entry_node;
2307
2308
2308
        _cdio_list_append (p_cue_list, 
2309
        _cdio_list_append (p_cue_list,
2309
                           (p_cue = calloc(1, sizeof (vcd_cue_t))));
2310
                           (p_cue = calloc(1, sizeof (vcd_cue_t))));
2310
        
2311
2311
        p_cue->lsn = p_track->relative_start_extent + p_obj->iso_size;
2312
        p_cue->lsn = p_track->relative_start_extent + p_obj->iso_size;
2312
        p_cue->lsn -= p_obj->track_pregap;
2313
        p_cue->lsn -= p_obj->track_pregap;
2313
        p_cue->type = VCD_CUE_PREGAP_START;
2314
        p_cue->type = VCD_CUE_PREGAP_START;
2314
2315
2315
        _cdio_list_append (p_cue_list, 
2316
        _cdio_list_append (p_cue_list,
2316
                           (p_cue = calloc(1, sizeof (vcd_cue_t))));
2317
                           (p_cue = calloc(1, sizeof (vcd_cue_t))));
2317
2318
2318
        p_cue->lsn = p_track->relative_start_extent + p_obj->iso_size;
2319
        p_cue->lsn = p_track->relative_start_extent + p_obj->iso_size;
Lines 2322-2330 Link Here
2322
          {
2323
          {
2323
            entry_t *_entry = _cdio_list_node_data (p_entry_node);
2324
            entry_t *_entry = _cdio_list_node_data (p_entry_node);
2324
2325
2325
            _cdio_list_append (p_cue_list, 
2326
            _cdio_list_append (p_cue_list,
2326
                               (p_cue = calloc(1, sizeof (vcd_cue_t))));
2327
                               (p_cue = calloc(1, sizeof (vcd_cue_t))));
2327
            
2328
2328
            p_cue->lsn = p_obj->iso_size;
2329
            p_cue->lsn = p_obj->iso_size;
2329
            p_cue->lsn += p_track->relative_start_extent;
2330
            p_cue->lsn += p_track->relative_start_extent;
2330
            p_cue->lsn += p_obj->track_front_margin;
2331
            p_cue->lsn += p_obj->track_front_margin;
Lines 2348-2354 Link Here
2348
2349
2349
    vcd_image_sink_set_cuesheet (p_image_sink, p_cue_list);
2350
    vcd_image_sink_set_cuesheet (p_image_sink, p_cue_list);
2350
2351
2351
    _cdio_list_free (p_cue_list, true);
2352
    _cdio_list_free (p_cue_list, true, NULL);
2352
  }
2353
  }
2353
2354
2354
  /* and now for the pay load */
2355
  /* and now for the pay load */
Lines 2364-2370 Link Here
2364
    p_obj->progress_callback = callback;
2365
    p_obj->progress_callback = callback;
2365
    p_obj->callback_user_data = user_data;
2366
    p_obj->callback_user_data = user_data;
2366
    p_obj->image_sink = p_image_sink;
2367
    p_obj->image_sink = p_image_sink;
2367
  
2368
2368
    if (_callback_wrapper (p_obj, true))
2369
    if (_callback_wrapper (p_obj, true))
2369
      return 1;
2370
      return 1;
2370
2371
Lines 2393-2399 Link Here
2393
        int n, lastsect = p_obj->sectors_written;
2394
        int n, lastsect = p_obj->sectors_written;
2394
2395
2395
        vcd_debug ("writting post-gap ('leadout pregap')...");
2396
        vcd_debug ("writting post-gap ('leadout pregap')...");
2396
        
2397
2397
        for (n = 0; n < p_obj->leadout_pregap; n++)
2398
        for (n = 0; n < p_obj->leadout_pregap; n++)
2398
          _write_m2_image_sector (p_obj, zero, lastsect++, 0, 0, SM_FORM2, 0);
2399
          _write_m2_image_sector (p_obj, zero, lastsect++, 0, 0, SM_FORM2, 0);
2399
      }
2400
      }
Lines 2402-2413 Link Here
2402
      return 1;
2403
      return 1;
2403
2404
2404
    p_obj->image_sink = NULL;
2405
    p_obj->image_sink = NULL;
2405
  
2406
2406
    vcd_image_sink_destroy (p_image_sink);
2407
    vcd_image_sink_destroy (p_image_sink);
2407
2408
2408
    return 0; /* ok */
2409
    return 0; /* ok */
2409
  }
2410
  }
2410
}  
2411
}
2411
2412
2412
const char *
2413
const char *
2413
vcd_version_string (bool full_text)
2414
vcd_version_string (bool full_text)
Lines 2427-2434 Link Here
2427
          "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
2428
          "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
2428
}
2429
}
2429
2430
2430
2431
2431
/* 
2432
/*
2432
 * Local variables:
2433
 * Local variables:
2433
 *  c-file-style: "gnu"
2434
 *  c-file-style: "gnu"
2434
 *  tab-width: 8
2435
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/vcd.h (-50 / +50 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
/* libvcd main header */
21
/* libvcd main header */
22
22
23
#ifndef __VCD_H__
23
#ifndef __VCD_H__
Lines 37-43 Link Here
37
  /** allocates and initializes a new VideoCD object */
37
  /** allocates and initializes a new VideoCD object */
38
  VcdObj_t *
38
  VcdObj_t *
39
  vcd_obj_new (vcd_type_t vcd_type);
39
  vcd_obj_new (vcd_type_t vcd_type);
40
  
40
41
  /** VideoCD parameters */
41
  /** VideoCD parameters */
42
  typedef enum {
42
  typedef enum {
43
    VCD_PARM_INVALID = 0,
43
    VCD_PARM_INVALID = 0,
Lines 63-136 Link Here
63
    VCD_PARM_TRACK_FRONT_MARGIN,  /**< unsigned        [0..150] */
63
    VCD_PARM_TRACK_FRONT_MARGIN,  /**< unsigned        [0..150] */
64
    VCD_PARM_TRACK_REAR_MARGIN    /**< unsigned        [0..150] */
64
    VCD_PARM_TRACK_REAR_MARGIN    /**< unsigned        [0..150] */
65
  } vcd_parm_t;
65
  } vcd_parm_t;
66
  
66
67
  /** sets VideoCD parameter */
67
  /** sets VideoCD parameter */
68
  int 
68
  int
69
  vcd_obj_set_param_uint (VcdObj_t *p_vcdobj, vcd_parm_t param, unsigned arg);
69
  vcd_obj_set_param_uint (VcdObj_t *p_vcdobj, vcd_parm_t param, unsigned arg);
70
70
71
  int 
71
  int
72
  vcd_obj_set_param_str (VcdObj_t *p_vcdobj, vcd_parm_t param, 
72
  vcd_obj_set_param_str (VcdObj_t *p_vcdobj, vcd_parm_t param,
73
                         const char *p_arg);
73
                         const char *p_arg);
74
  
74
75
  int 
75
  int
76
  vcd_obj_set_param_bool (VcdObj_t *p_vcdobj, vcd_parm_t param, bool arg);
76
  vcd_obj_set_param_bool (VcdObj_t *p_vcdobj, vcd_parm_t param, bool arg);
77
  
77
78
  /** add custom files; if raw_flag set, the data source has to
78
  /** add custom files; if raw_flag set, the data source has to
79
      include a mode2 subheader, and thus needs to be a multiple of 2336
79
      include a mode2 subheader, and thus needs to be a multiple of 2336
80
      byte blocksize */
80
      byte blocksize */
81
  int
81
  int
82
  vcd_obj_add_file (VcdObj_t *p_vcdobj, const char iso_pathname[],
82
  vcd_obj_add_file (VcdObj_t *p_vcdobj, const char iso_pathname[],
83
                    VcdDataSource_t *p_file, bool raw_flag);
83
                    VcdDataSource_t *p_file, bool raw_flag);
84
  
84
85
  int
85
  int
86
  vcd_obj_add_dir (VcdObj_t *p_vcdobj, const char iso_pathname[]);
86
  vcd_obj_add_dir (VcdObj_t *p_vcdobj, const char iso_pathname[]);
87
  
87
88
  /* this is for actually adding mpeg items to VCD, returns 
88
  /* this is for actually adding mpeg items to VCD, returns
89
     a negative value for error..  */
89
     a negative value for error..  */
90
  
90
91
  int 
91
  int
92
  vcd_obj_append_sequence_play_item (VcdObj_t *p_vcdobj, 
92
  vcd_obj_append_sequence_play_item (VcdObj_t *p_vcdobj,
93
                                     VcdMpegSource_t *p_mpeg_source, 
93
                                     VcdMpegSource_t *p_mpeg_source,
94
                                     const char item_id[], 
94
                                     const char item_id[],
95
                                     const char default_entry_id[]);
95
                                     const char default_entry_id[]);
96
  
96
97
  int 
97
  int
98
  vcd_obj_add_sequence_entry (VcdObj_t *p_vcdobj, const char sequence_id[], 
98
  vcd_obj_add_sequence_entry (VcdObj_t *p_vcdobj, const char sequence_id[],
99
                              double entry_time, const char entry_id[]);
99
                              double entry_time, const char entry_id[]);
100
  
100
101
  int 
101
  int
102
  vcd_obj_add_sequence_pause (VcdObj_t *p_vcdobj, const char sequence_id[], 
102
  vcd_obj_add_sequence_pause (VcdObj_t *p_vcdobj, const char sequence_id[],
103
                              double pause_timestamp, const char pause_id[]);
103
                              double pause_timestamp, const char pause_id[]);
104
  
104
105
  int 
105
  int
106
  vcd_obj_add_segment_pause (VcdObj_t *p_vcdobj, const char segment_id[], 
106
  vcd_obj_add_segment_pause (VcdObj_t *p_vcdobj, const char segment_id[],
107
                             double pause_timestamp, const char pause_id[]);
107
                             double pause_timestamp, const char pause_id[]);
108
  
108
109
  int 
109
  int
110
  vcd_obj_append_segment_play_item (VcdObj_t *p_vcdobj, 
110
  vcd_obj_append_segment_play_item (VcdObj_t *p_vcdobj,
111
                                    VcdMpegSource_t *mpeg_source, 
111
                                    VcdMpegSource_t *mpeg_source,
112
                                    const char item_id[]);
112
                                    const char item_id[]);
113
  
113
114
  /** warning -- api will change for pbc */
114
  /** warning -- api will change for pbc */
115
  typedef struct _pbc_t pbc_t;
115
  typedef struct _pbc_t pbc_t;
116
  
116
117
  int
117
  int
118
  vcd_obj_append_pbc_node (VcdObj_t *p_vcdobj, struct _pbc_t *p_pbc);
118
  vcd_obj_append_pbc_node (VcdObj_t *p_vcdobj, struct _pbc_t *p_pbc);
119
  
119
120
  /** removes item (sequence, entry, segment, ...) by id, returns
120
  /** removes item (sequence, entry, segment, ...) by id, returns
121
     negative value on error */
121
     negative value on error */
122
  int 
122
  int
123
  vcd_obj_remove_item (VcdObj_t *p_vcdobj, const char id[]);
123
  vcd_obj_remove_item (VcdObj_t *p_vcdobj, const char id[]);
124
  
124
125
  /** returns image size in sectors */
125
  /** returns image size in sectors */
126
  long 
126
  long
127
  vcd_obj_get_image_size (VcdObj_t *p_vcdobj);
127
  vcd_obj_get_image_size (VcdObj_t *p_vcdobj);
128
  
128
129
  /** this one is to be called when every parameter has been set and the
129
  /** this one is to be called when every parameter has been set and the
130
      image is about to be written. returns sectors to be written... */
130
      image is about to be written. returns sectors to be written... */
131
  long 
131
  long
132
  vcd_obj_begin_output (VcdObj_t *p_vcdobj);
132
  vcd_obj_begin_output (VcdObj_t *p_vcdobj);
133
  
133
134
  /** callback hook called every few (>|<) iterations, if it returns a
134
  /** callback hook called every few (>|<) iterations, if it returns a
135
      value != 0 the writing process gets aborted */
135
      value != 0 the writing process gets aborted */
136
  typedef struct
136
  typedef struct
Lines 141-177 Link Here
141
    int total_tracks;
141
    int total_tracks;
142
  }
142
  }
143
  progress_info_t;
143
  progress_info_t;
144
  
144
145
  typedef int (*progress_callback_t) (const progress_info_t *progress_info,
145
  typedef int (*progress_callback_t) (const progress_info_t *progress_info,
146
                                      void *user_data);
146
                                      void *user_data);
147
  
147
148
  /** writes the actual bin image file; a return value != 0 means the
148
  /** writes the actual bin image file; a return value != 0 means the
149
      action was aborted by user or some other error has occured... */
149
      action was aborted by user or some other error has occured... */
150
  int
150
  int
151
  vcd_obj_write_image (VcdObj_t *p_vcdobj, VcdImageSink_t *p_image_sink,
151
  vcd_obj_write_image (VcdObj_t *p_vcdobj, VcdImageSink_t *p_image_sink,
152
                       progress_callback_t callback, void *p_user_data,
152
                       progress_callback_t callback, void *p_user_data,
153
                       const time_t *p_create_time);
153
                       const time_t *p_create_time);
154
  
154
155
  /** this should be called writing the bin and/or cue file is done---even if 
155
  /** this should be called writing the bin and/or cue file is done---even if
156
      an error occurred */
156
      an error occurred */
157
  void 
157
  void
158
  vcd_obj_end_output (VcdObj_t *p_vcdobj);
158
  vcd_obj_end_output (VcdObj_t *p_vcdobj);
159
  
159
160
  /** destructor for VideoCD objects; call this to destory a VideoCD
160
  /** destructor for VideoCD objects; call this to destory a VideoCD
161
      object created by vcd_obj_new () */
161
      object created by vcd_obj_new () */
162
  void 
162
  void
163
  vcd_obj_destroy (VcdObj_t *p_vcdobj);
163
  vcd_obj_destroy (VcdObj_t *p_vcdobj);
164
  
164
165
  const char *
165
  const char *
166
  vcd_version_string (bool full_text);
166
  vcd_version_string (bool full_text);
167
  
167
168
#ifdef __cplusplus
168
#ifdef __cplusplus
169
}
169
}
170
#endif /* __cplusplus */
170
#endif /* __cplusplus */
171
171
172
#endif /* __VCD_H__ */
172
#endif /* __VCD_H__ */
173
173
174
/* 
174
/*
175
 * Local variables:
175
 * Local variables:
176
 *  c-file-style: "gnu"
176
 *  c-file-style: "gnu"
177
 *  tab-width: 8
177
 *  tab-width: 8
(-)vcdimager-0.7.24.ORIG/lib/vcd_read.c (-9 / +9 lines)
Lines 19-25 Link Here
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
22
23
#include "vcd_read.h"
23
#include "vcd_read.h"
24
#include "vcd_assert.h"
24
#include "vcd_assert.h"
25
#include <libvcd/inf.h>
25
#include <libvcd/inf.h>
Lines 30-48 Link Here
30
#include <string.h>
30
#include <string.h>
31
#endif
31
#endif
32
32
33
bool 
33
bool
34
read_pvd(CdIo_t *cdio, iso9660_pvd_t *pvd) 
34
read_pvd(CdIo_t *cdio, iso9660_pvd_t *pvd)
35
{
35
{
36
  if (cdio_read_mode2_sector (cdio, pvd, ISO_PVD_SECTOR, false)) {
36
  if (cdio_read_mode2_sector (cdio, pvd, ISO_PVD_SECTOR, false)) {
37
    vcd_error ("error reading PVD sector (%d)", ISO_PVD_SECTOR);
37
    vcd_error ("error reading PVD sector (%d)", ISO_PVD_SECTOR);
38
    return false;
38
    return false;
39
  }
39
  }
40
  
40
41
  if (pvd->type != ISO_VD_PRIMARY) {
41
  if (pvd->type != ISO_VD_PRIMARY) {
42
    vcd_error ("unexpected PVD type %d", pvd->type);
42
    vcd_error ("unexpected PVD type %d", pvd->type);
43
    return false;
43
    return false;
44
  }
44
  }
45
  
45
46
  if (memcmp (pvd->id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID)))
46
  if (memcmp (pvd->id, ISO_STANDARD_ID, sizeof (ISO_STANDARD_ID)))
47
    {
47
    {
48
      vcd_error ("unexpected ID encountered (expected `"
48
      vcd_error ("unexpected ID encountered (expected `"
Lines 52-59 Link Here
52
  return true;
52
  return true;
53
}
53
}
54
54
55
bool 
55
bool
56
read_entries(CdIo_t *cdio, EntriesVcd_t *entries) 
56
read_entries(CdIo_t *cdio, EntriesVcd_t *entries)
57
{
57
{
58
  if (cdio_read_mode2_sector (cdio, entries, ENTRIES_VCD_SECTOR, false)) {
58
  if (cdio_read_mode2_sector (cdio, entries, ENTRIES_VCD_SECTOR, false)) {
59
    vcd_error ("error reading Entries sector (%d)", ENTRIES_VCD_SECTOR);
59
    vcd_error ("error reading Entries sector (%d)", ENTRIES_VCD_SECTOR);
Lines 73-80 Link Here
73
  }
73
  }
74
}
74
}
75
75
76
bool 
76
bool
77
read_info(CdIo_t *cdio, InfoVcd_t *info, vcd_type_t *vcd_type) 
77
read_info(CdIo_t *cdio, InfoVcd_t *info, vcd_type_t *vcd_type)
78
{
78
{
79
  if (cdio_read_mode2_sector (cdio, info, INFO_VCD_SECTOR, false)) {
79
  if (cdio_read_mode2_sector (cdio, info, INFO_VCD_SECTOR, false)) {
80
    vcd_warn ("error reading Info sector (%d)", INFO_VCD_SECTOR);
80
    vcd_warn ("error reading Info sector (%d)", INFO_VCD_SECTOR);
(-)vcdimager-0.7.24.ORIG/lib/vcd_read.h (+2 lines)
Lines 22-27 Link Here
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
24
24
25
/* We don't want to pull in cdio's config */
26
#define __CDIO_CONFIG_H__
25
#include <cdio/cdio.h>
27
#include <cdio/cdio.h>
26
#include <cdio/iso9660.h>
28
#include <cdio/iso9660.h>
27
29
(-)vcdimager-0.7.24.ORIG/test/check_bitfield.c (-2 / +2 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 304-310 Link Here
304
304
305
      if (u->byte != InfoSpiContents_table[i].intval)
305
      if (u->byte != InfoSpiContents_table[i].intval)
306
	{
306
	{
307
	  printf ("failed at index %d (%.2x != %.2x)\n", 
307
	  printf ("failed at index %d (%.2x != %.2x)\n",
308
		  i, u->byte, InfoSpiContents_table[i].intval);
308
		  i, u->byte, InfoSpiContents_table[i].intval);
309
	  return 1;
309
	  return 1;
310
	}
310
	}
(-)vcdimager-0.7.24.ORIG/test/check_common_fn.in (-2 / +4 lines)
Lines 6-13 Link Here
6
	if cksum "$NAME" | (
6
	if cksum "$NAME" | (
7
		read CRC2 SIZE2 NAME2
7
		read CRC2 SIZE2 NAME2
8
8
9
		if [ "$CRC" != "$CRC2" ]; then
9
		if [ "$CRC" != "$CRC2" ] ; then
10
		    echo "$0: CRC didn't match for $NAME ($CRC != $CRC2)"
10
		    if [ 'quiet' != "$1"  ] ; then
11
			echo "$0: CRC didn't match for $NAME ($CRC != $CRC2)"
12
		    fi
11
		    return 0;
13
		    return 0;
12
		fi
14
		fi
13
15
(-)vcdimager-0.7.24.ORIG/test/check_nrg.sh (-7 / +14 lines)
Lines 26-39 Link Here
26
  exit $RC
26
  exit $RC
27
fi
27
fi
28
28
29
if do_cksum <<EOF
29
if do_cksum "quiet" <<EOF
30
2176989007 2630472 videocd.nrg
31
EOF
32
then
33
    :
34
elif do_cksum <<EOF
30
1284184221 2630472 videocd.nrg
35
1284184221 2630472 videocd.nrg
31
EOF
36
EOF
32
    then
37
then
33
    :
38
    :
34
else
39
else
35
    echo "$0: cksum(1) checksums didn't match :-("
40
    echo "$0: cksum(1) checksums didn't match :-("
36
37
    cksum videocd.nrg
41
    cksum videocd.nrg
38
    exit 1
42
    exit 1
39
fi
43
fi
Lines 71-86 Link Here
71
  exit $RC
75
  exit $RC
72
fi
76
fi
73
77
74
if do_cksum <<EOF
78
if do_cksum "quiet" <<EOF
79
2290177553 1653964 videocd.nrg
80
EOF
81
then
82
    :
83
elif do_cksum <<EOF
75
2897989104 1653964 videocd.nrg
84
2897989104 1653964 videocd.nrg
76
EOF
85
EOF
77
    then
86
then
78
    :
87
    :
79
else
88
else
80
    echo "$0: cksum(1) checksums didn't match :-("
89
    echo "$0: cksum(1) checksums didn't match :-("
81
82
    cksum videocd.nrg
90
    cksum videocd.nrg
83
84
    test_vcdxbuild_cleanup
91
    test_vcdxbuild_cleanup
85
    exit 1
92
    exit 1
86
fi
93
fi
(-)vcdimager-0.7.24.ORIG/test/check_sizeof.c (-1 / +3 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 28-33 Link Here
28
#include <stdio.h>
28
#include <stdio.h>
29
#include <math.h>
29
#include <math.h>
30
30
31
/* We don't want to pull in cdio's config */
32
#define __CDIO_CONFIG_H__
31
#include <cdio/iso9660.h>
33
#include <cdio/iso9660.h>
32
#include <libvcd/types.h>
34
#include <libvcd/types.h>
33
#include <libvcd/files.h>
35
#include <libvcd/files.h>
(-)vcdimager-0.7.24.ORIG/test/check_svcd1.sh (-7 / +25 lines)
Lines 25-36 Link Here
25
    test_vcdimager_cleanup
25
    test_vcdimager_cleanup
26
  fi
26
  fi
27
else
27
else
28
  if do_cksum <<EOF
28
  if do_cksum "quiet" <<EOF
29
1923402845 1587600 videocd.bin
30
3699460731 172 videocd.cue
31
EOF
32
  then
33
      :
34
  elif  do_cksum <<EOF
29
3747978987 1587600 videocd.bin
35
3747978987 1587600 videocd.bin
30
3699460731 172 videocd.cue
36
3699460731 172 videocd.cue
31
EOF
37
EOF
32
    then
38
  then
33
    :
39
      :
34
  else
40
  else
35
    echo "$0: cksum(1) checksums didn't match :-("
41
    echo "$0: cksum(1) checksums didn't match :-("
36
42
Lines 58-68 Link Here
58
  exit $RC
64
  exit $RC
59
fi
65
fi
60
66
61
if do_cksum <<EOF
67
if do_cksum "quiet" <<EOF
68
832619107 4059552 videocd.bin
69
669873986 424 videocd.cue
70
EOF
71
then
72
    :
73
elif do_cksum <<EOF
62
4104676060 4059552 videocd.bin
74
4104676060 4059552 videocd.bin
63
669873986 424 videocd.cue
75
669873986 424 videocd.cue
64
EOF
76
EOF
65
    then
77
then
66
    :
78
    :
67
else
79
else
68
    echo "$0: cksum(1) checksums didn't match :-("
80
    echo "$0: cksum(1) checksums didn't match :-("
Lines 111-121 Link Here
111
  exit $RC
123
  exit $RC
112
fi
124
fi
113
125
114
if do_cksum <<EOF
126
if do_cksum "quiet" <<EOF
127
4248765257 2018016 videocd.bin
128
483250638 172 videocd.cue
129
EOF
130
then
131
    :
132
elif do_cksum "quiet" <<EOF
115
3695643404 2018016 videocd.bin
133
3695643404 2018016 videocd.bin
116
483250638 172 videocd.cue
134
483250638 172 videocd.cue
117
EOF
135
EOF
118
    then
136
then
119
    :
137
    :
120
else
138
else
121
    echo "$0: cksum(1) checksums didn't match :-("
139
    echo "$0: cksum(1) checksums didn't match :-("
(-)vcdimager-0.7.24.ORIG/test/check_vcd11.sh (-4 / +14 lines)
Lines 26-33 Link Here
26
  fi
26
  fi
27
else 
27
else 
28
  if do_cksum <<EOF
28
  if do_cksum <<EOF
29
3746200718 1764000 videocd.bin
30
3699460731 172 videocd.cue
31
EOF
29
EOF
32
    then
30
    then
33
    :
31
    :
Lines 57-67 Link Here
57
  exit $RC
55
  exit $RC
58
fi
56
fi
59
57
60
if do_cksum <<EOF
58
if do_cksum "quiet" <<EOF
59
4286535819 3880800 videocd.bin
60
2088931809 424 videocd.cue
61
EOF
62
then
63
    :
64
elif do_cksum "quiet" <<EOF
61
1013953491 3880800 videocd.bin
65
1013953491 3880800 videocd.bin
62
2088931809 424 videocd.cue
66
2088931809 424 videocd.cue
63
EOF
67
EOF
64
    then
68
then
69
    :
70
elif do_cksum "quiet" <<EOF
71
4286535819 3880800 videocd.bin
72
2088931809 424 videocd.cue
73
EOF
74
then
65
    :
75
    :
66
else
76
else
67
    echo "$0: cksum(1) checksums didn't match :-("
77
    echo "$0: cksum(1) checksums didn't match :-("
(-)vcdimager-0.7.24.ORIG/test/check_vcd20.sh (-24 / +35 lines)
Lines 18-50 Link Here
18
RC=$?
18
RC=$?
19
19
20
if test $RC -ne 0 ; then
20
if test $RC -ne 0 ; then
21
  if test $RC -ne 77 ; then 
21
    if test $RC -ne 77 ; then 
22
    echo vcdimager failed 
22
	echo vcdimager failed 
23
    exit $RC
23
	exit $RC
24
  else
24
    else
25
    echo vcdimager skipped
25
	echo vcdimager skipped
26
    test_vcdimager_cleanup
26
	test_vcdimager_cleanup
27
  fi
27
    fi
28
else 
28
else 
29
  if do_cksum <<EOF
29
    if do_cksum "quiet" <<EOF
30
1594106842 1764000 videocd.bin
31
3699460731 172 videocd.cue
32
EOF
33
    then
34
	:
35
    elif do_cksum <<EOF
30
1170593626 1764000 videocd.bin
36
1170593626 1764000 videocd.bin
31
3699460731 172 videocd.cue
37
3699460731 172 videocd.cue
32
EOF
38
EOF
33
    then
39
    then
34
    :
40
	:
35
  else
41
    else
36
    echo "$0: cksum(1) checksums didn't match :-("
42
	echo "$0: cksum(1) checksums didn't match :-("
37
43
	cksum videocd.bin videocd.cue
38
    cksum videocd.bin videocd.cue
44
	exit 1
39
    exit 1
45
    fi
40
  fi
46
41
47
    echo "$0: vcdimager cksum(1) checksums matched :-)"
42
  echo "$0: vcdimager cksum(1) checksums matched :-)"
48
    
43
49
    test_vcdinfo '-B -i videocd.cue ' \
44
  test_vcdinfo '-B -i videocd.cue ' \
50
	vcd20_test0.dump ${srcdir}/vcd20_test0.right
45
    vcd20_test0.dump ${srcdir}/vcd20_test0.right
51
    RC=$?
46
  RC=$?
52
    check_result $RC 'vcd-info test 0'
47
  check_result $RC 'vcd-info test 0'
48
fi
53
fi
49
54
50
test_vcdxbuild ${srcdir}/${BASE}.xml
55
test_vcdxbuild ${srcdir}/${BASE}.xml
Lines 59-69 Link Here
59
  exit $RC
64
  exit $RC
60
fi
65
fi
61
66
62
if do_cksum <<EOF
67
if do_cksum "quiet" <<EOF
68
3694706815 4840416 videocd.bin
69
2350689551 447 videocd.cue
70
EOF
71
then
72
    :
73
elif do_cksum <<EOF
63
1209563022 4840416 videocd.bin
74
1209563022 4840416 videocd.bin
64
2350689551 447 videocd.cue
75
2350689551 447 videocd.cue
65
EOF
76
EOF
66
    then
77
then
67
    :
78
    :
68
else
79
else
69
    echo "$0: cksum(1) checksums didn't match :-("
80
    echo "$0: cksum(1) checksums didn't match :-("
(-)vcdimager-0.7.24.ORIG/test/mpegscan2.c (-5 / +5 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 45-56 Link Here
45
      _msf.s &= 0x7f;
45
      _msf.s &= 0x7f;
46
      _msf.f &= 0x7f;
46
      _msf.f &= 0x7f;
47
    }
47
    }
48
	  
48
49
  printf (" %.2x:%.2x.%.2x ", 
49
  printf (" %.2x:%.2x.%.2x ",
50
	  _msf.m, _msf.s, _msf.f);
50
	  _msf.m, _msf.s, _msf.f);
51
}
51
}
52
52
53
int 
53
int
54
main (int argc, const char *argv[])
54
main (int argc, const char *argv[])
55
{
55
{
56
  VcdMpegSource_t *src;
56
  VcdMpegSource_t *src;
Lines 108-114 Link Here
108
  {
108
  {
109
    const struct vcd_mpeg_stream_info *_info = vcd_mpeg_source_get_info (src);
109
    const struct vcd_mpeg_stream_info *_info = vcd_mpeg_source_get_info (src);
110
    printf ("mpeg info\n");
110
    printf ("mpeg info\n");
111
  
111
112
    printf (" %d x %d (%f:1) @%f v%d\n", _info->shdr[0].hsize, _info->shdr[0].vsize,
112
    printf (" %d x %d (%f:1) @%f v%d\n", _info->shdr[0].hsize, _info->shdr[0].vsize,
113
	    _info->shdr[0].aratio, _info->shdr[0].frate, _info->version);
113
	    _info->shdr[0].aratio, _info->shdr[0].frate, _info->version);
114
  }
114
  }
(-)vcdimager-0.7.24.ORIG/test/mpegscan.c (-11 / +11 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
Lines 37-43 Link Here
37
#include "mpeg_stream.h"
37
#include "mpeg_stream.h"
38
#include "stream_stdio.h"
38
#include "stream_stdio.h"
39
39
40
int 
40
int
41
main (int argc, const char *argv[])
41
main (int argc, const char *argv[])
42
{
42
{
43
  VcdMpegSource_t *p_src;
43
  VcdMpegSource_t *p_src;
Lines 56-68 Link Here
56
  _CDIO_LIST_FOREACH (p_n, vcd_mpeg_source_get_info (p_src)->shdr[0].aps_list)
56
  _CDIO_LIST_FOREACH (p_n, vcd_mpeg_source_get_info (p_src)->shdr[0].aps_list)
57
    {
57
    {
58
      struct aps_data *p_data = _cdio_list_node_data (p_n);
58
      struct aps_data *p_data = _cdio_list_node_data (p_n);
59
      
59
60
      printf ("aps: %u %f\n", (unsigned int) p_data->packet_no, 
60
      printf ("aps: %u %f\n", (unsigned int) p_data->packet_no,
61
	      p_data->timestamp);
61
	      p_data->timestamp);
62
    }
62
    }
63
63
64
  {
64
  {
65
    CdioListNode_t *aps_node = 
65
    CdioListNode_t *aps_node =
66
      _cdio_list_begin (vcd_mpeg_source_get_info (p_src)->shdr[0].aps_list);
66
      _cdio_list_begin (vcd_mpeg_source_get_info (p_src)->shdr[0].aps_list);
67
    struct aps_data *p_data;
67
    struct aps_data *p_data;
68
    double aps_time;
68
    double aps_time;
Lines 75-81 Link Here
75
75
76
    for (t = 0; t <= vcd_mpeg_source_get_info (p_src)->playing_time; t += 0.5)
76
    for (t = 0; t <= vcd_mpeg_source_get_info (p_src)->playing_time; t += 0.5)
77
      {
77
      {
78
        for(p_n = _cdio_list_node_next (aps_node); p_n; 
78
        for(p_n = _cdio_list_node_next (aps_node); p_n;
79
	    p_n = _cdio_list_node_next (p_n))
79
	    p_n = _cdio_list_node_next (p_n))
80
          {
80
          {
81
            p_data = _cdio_list_node_data (p_n);
81
            p_data = _cdio_list_node_data (p_n);
Lines 86-92 Link Here
86
                aps_time = p_data->timestamp;
86
                aps_time = p_data->timestamp;
87
                aps_packet = p_data->packet_no;
87
                aps_packet = p_data->packet_no;
88
              }
88
              }
89
            else 
89
            else
90
              break;
90
              break;
91
          }
91
          }
92
92
Lines 96-107 Link Here
96
  }
96
  }
97
97
98
  {
98
  {
99
    const struct vcd_mpeg_stream_info *p_info = 
99
    const struct vcd_mpeg_stream_info *p_info =
100
      vcd_mpeg_source_get_info (p_src);
100
      vcd_mpeg_source_get_info (p_src);
101
    printf ("mpeg info\n");
101
    printf ("mpeg info\n");
102
  
102
103
    printf (" %d x %d (%f:1) @%f v%d\n", p_info->shdr[0].hsize, 
103
    printf (" %d x %d (%f:1) @%f v%d\n", p_info->shdr[0].hsize,
104
	    p_info->shdr[0].vsize, p_info->shdr[0].aratio, 
104
	    p_info->shdr[0].vsize, p_info->shdr[0].aratio,
105
	    p_info->shdr[0].frate, p_info->version);
105
	    p_info->shdr[0].frate, p_info->version);
106
  }
106
  }
107
107
(-)vcdimager-0.7.24.ORIG/test/testassert.c (-1 / +1 lines)
Lines 17-23 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
19
*/
20
20
21
#ifdef HAVE_CONFIG_H
21
#ifdef HAVE_CONFIG_H
22
# include "config.h"
22
# include "config.h"
23
#endif
23
#endif
(-)vcdimager-0.7.24.ORIG/test/testimage.c (-5 / +5 lines)
Lines 18-24 Link Here
18
    along with this program; if not, write to the Free Software
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
*/
20
*/
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
23
# include "config.h"
23
# include "config.h"
24
#endif
24
#endif
Lines 48-57 Link Here
48
  if (!strcmp ("nrg", argv[1]))
48
  if (!strcmp ("nrg", argv[1]))
49
    img = cdio_open_nrg (argv[2]);
49
    img = cdio_open_nrg (argv[2]);
50
  else if (!strcmp ("bincue", argv[1]))
50
  else if (!strcmp ("bincue", argv[1]))
51
    img = cdio_open_bincue (argv[2]) /* src, NULL, false) */; 
51
    img = cdio_open_bincue (argv[2]) /* src, NULL, false) */;
52
  else if (!strcmp ("cd", argv[1]))
52
  else if (!strcmp ("cd", argv[1]))
53
    img = cdio_open_cd (argv[2]) /* argv[2]) */;
53
    img = cdio_open_cd (argv[2]) /* argv[2]) */;
54
  else 
54
  else
55
    vcd_error ("unrecognized img type");
55
    vcd_error ("unrecognized img type");
56
56
57
  vcd_assert (img != NULL);
57
  vcd_assert (img != NULL);
Lines 64-70 Link Here
64
    vcd_debug ("size = %lu", (unsigned long int) n);
64
    vcd_debug ("size = %lu", (unsigned long int) n);
65
65
66
    vcd_debug ("reading sector %lu to testimage.out", (unsigned long int) lsn);
66
    vcd_debug ("reading sector %lu to testimage.out", (unsigned long int) lsn);
67
    
67
68
    if (!cdio_read_mode2_sector (img, buf, lsn, true))
68
    if (!cdio_read_mode2_sector (img, buf, lsn, true))
69
      {
69
      {
70
	struct m2f2sector
70
	struct m2f2sector
Lines 91-97 Link Here
91
    else
91
    else
92
      vcd_error ("failed...");
92
      vcd_error ("failed...");
93
93
94
    
94
95
  }
95
  }
96
96
97
  return 0;
97
  return 0;
(-)vcdimager-0.7.24.ORIG/test/testvcd.c (-6 / +6 lines)
Lines 16-22 Link Here
16
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 *
17
 *
18
 */
18
 */
19
/* Test the operation of vcd-info and vcdxrip on a real CD-ROM - not a 
19
/* Test the operation of vcd-info and vcdxrip on a real CD-ROM - not a
20
   CD-ROM image. */
20
   CD-ROM image. */
21
21
22
#ifdef HAVE_CONFIG_H
22
#ifdef HAVE_CONFIG_H
Lines 60-66 Link Here
60
  struct stat statbuf;
60
  struct stat statbuf;
61
61
62
  /* Set to give only errors on open, not warnings. */
62
  /* Set to give only errors on open, not warnings. */
63
  vcd_loglevel_default = VCD_LOG_ERROR; 
63
  vcd_loglevel_default = VCD_LOG_ERROR;
64
64
65
  if ( vcdinfo_open(&p_vcdinfo, &psz_source, DRIVER_DEVICE,
65
  if ( vcdinfo_open(&p_vcdinfo, &psz_source, DRIVER_DEVICE,
66
                    NULL) != VCDINFO_OPEN_VCD) {
66
                    NULL) != VCDINFO_OPEN_VCD) {
Lines 77-94 Link Here
77
    snprintf(cmd, sizeof(cmd), FRONTEND_DIR "cli/vcd-info -i %s", psz_source);
77
    snprintf(cmd, sizeof(cmd), FRONTEND_DIR "cli/vcd-info -i %s", psz_source);
78
    i_rc = system(cmd);
78
    i_rc = system(cmd);
79
  }
79
  }
80
  
80
81
  if (0 != stat(FRONTEND_DIR "xml/vcdxrip", &statbuf)) {
81
  if (0 != stat(FRONTEND_DIR "xml/vcdxrip", &statbuf)) {
82
    printf("Unable to find vcdxrip program; skipping test\n");
82
    printf("Unable to find vcdxrip program; skipping test\n");
83
  } else {
83
  } else {
84
    int i_rc2;
84
    int i_rc2;
85
    snprintf(cmd, sizeof(cmd), 
85
    snprintf(cmd, sizeof(cmd),
86
	     FRONTEND_DIR "xml/vcdxrip --norip --input=%s", psz_source);
86
	     FRONTEND_DIR "xml/vcdxrip --norip --input=%s", psz_source);
87
    i_rc2 = system(cmd);
87
    i_rc2 = system(cmd);
88
    if (i_rc2 && SKIP_TEST_RC != i_rc && !i_rc) 
88
    if (i_rc2 && SKIP_TEST_RC != i_rc && !i_rc)
89
      i_rc = i_rc2;
89
      i_rc = i_rc2;
90
  }
90
  }
91
  
91
92
  free(psz_source);
92
  free(psz_source);
93
  return i_rc;
93
  return i_rc;
94
}
94
}

Return to bug 638646