rb_cdio 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/ChangeLog.txt +17 -2
  2. data/VERSION +1 -1
  3. data/doc/classes/CdIo.html +19 -31
  4. data/doc/classes/CdIo.src/M000001.html +1 -1
  5. data/doc/classes/CdIo.src/M000002.html +1 -1
  6. data/doc/classes/CdIo.src/M000003.html +1 -1
  7. data/doc/classes/CdIo.src/M000004.html +1 -1
  8. data/doc/classes/CdIo.src/M000005.html +1 -1
  9. data/doc/classes/CdIo.src/M000006.html +1 -1
  10. data/doc/classes/CdIo.src/M000007.html +1 -1
  11. data/doc/classes/CdIo.src/M000008.html +1 -1
  12. data/doc/classes/CdIo/Cd.html +51 -51
  13. data/doc/classes/CdIo/Cd.src/{M000011.html → M000020.html} +1 -1
  14. data/doc/classes/CdIo/Cd.src/M000021.html +3 -3
  15. data/doc/classes/CdIo/Cd.src/M000022.html +3 -3
  16. data/doc/classes/CdIo/Cd.src/M000023.html +3 -3
  17. data/doc/classes/CdIo/Cd.src/M000024.html +3 -3
  18. data/doc/classes/CdIo/Cd.src/M000025.html +3 -3
  19. data/doc/classes/CdIo/Cd.src/M000026.html +3 -3
  20. data/doc/classes/CdIo/Cd.src/M000027.html +3 -3
  21. data/doc/classes/CdIo/Cd.src/M000028.html +3 -3
  22. data/doc/classes/CdIo/Cd.src/M000029.html +3 -3
  23. data/doc/classes/CdIo/Cd.src/M000030.html +3 -3
  24. data/doc/classes/CdIo/Cd.src/M000031.html +3 -3
  25. data/doc/classes/CdIo/Cd.src/M000032.html +3 -3
  26. data/doc/classes/CdIo/Cd.src/M000033.html +3 -3
  27. data/doc/classes/CdIo/Cd.src/M000034.html +3 -3
  28. data/doc/classes/CdIo/Cd.src/M000035.html +3 -3
  29. data/doc/classes/CdIo/Cdda.html +428 -0
  30. data/doc/classes/CdIo/{Cd.src/M000016.html → Cdda.src/M000009.html} +3 -3
  31. data/doc/classes/CdIo/{Cd.src/M000013.html → Cdda.src/M000010.html} +3 -3
  32. data/doc/classes/CdIo/{Cd.src/M000036.html → Cdda.src/M000011.html} +3 -3
  33. data/doc/classes/CdIo/{Cd.src/M000014.html → Cdda.src/M000012.html} +3 -3
  34. data/doc/classes/CdIo/Cdda.src/M000013.html +17 -0
  35. data/doc/classes/CdIo/{Cd.src/M000019.html → Cdda.src/M000014.html} +3 -3
  36. data/doc/classes/CdIo/Cdda.src/M000015.html +17 -0
  37. data/doc/classes/CdIo/Cdda.src/M000016.html +17 -0
  38. data/doc/classes/CdIo/Cdda.src/M000017.html +17 -0
  39. data/doc/classes/CdIo/Cdda.src/M000018.html +17 -0
  40. data/doc/classes/CdIo/Cdda.src/M000019.html +17 -0
  41. data/doc/classes/CdIo/{Cd.src/M000015.html → Cdda.src/M000020.html} +3 -3
  42. data/doc/classes/CdIo/{Cd.src/M000017.html → Cdda.src/M000021.html} +3 -3
  43. data/doc/classes/CdIo/{Cd.src/M000018.html → Cdda.src/M000022.html} +3 -3
  44. data/doc/classes/CdIo/Cdda.src/M000023.html +17 -0
  45. data/doc/classes/CdIo/Cdda.src/M000024.html +17 -0
  46. data/doc/classes/CdIo/Exception.html +118 -0
  47. data/doc/classes/CdIo/Exception/BadParameter.html +111 -0
  48. data/doc/classes/CdIo/Exception/BadPointer.html +111 -0
  49. data/doc/classes/CdIo/{Device.html → Exception/CddbConn.html} +5 -5
  50. data/doc/classes/CdIo/Exception/CddbError.html +111 -0
  51. data/doc/classes/CdIo/{CdText.html → Exception/Error.html} +5 -5
  52. data/doc/{files/test/testall_rb.html → classes/CdIo/Exception/NoDriver.html} +26 -25
  53. data/doc/classes/CdIo/Exception/NotPermitted.html +111 -0
  54. data/doc/classes/CdIo/Exception/Unsupported.html +111 -0
  55. data/doc/classes/CdIo/Track.html +16 -16
  56. data/doc/classes/CdIo/Track.src/M000017.html +3 -3
  57. data/doc/classes/CdIo/Track.src/M000018.html +3 -3
  58. data/doc/classes/CdIo/Track.src/M000019.html +3 -3
  59. data/doc/classes/CdIo/Track.src/{M000009.html → M000025.html} +1 -1
  60. data/doc/classes/CdIo/Track.src/{M000010.html → M000026.html} +1 -1
  61. data/doc/classes/CdIo/Track.src/{M000011.html → M000027.html} +1 -1
  62. data/doc/classes/CdIo/TrackCdda.html +169 -0
  63. data/doc/classes/CdIo/TrackCdda.src/M000031.html +17 -0
  64. data/doc/classes/CdIo/TrackCdda.src/M000039.html +17 -0
  65. data/doc/classes/CdIo/TrackCdda.src/M000040.html +17 -0
  66. data/doc/classes/CdIo/TrackCdda.src/M000041.html +17 -0
  67. data/doc/classes/CdIo/Tracks.html +15 -15
  68. data/doc/classes/CdIo/Tracks.src/{M000020.html → M000028.html} +1 -1
  69. data/doc/classes/CdIo/Tracks.src/{M000021.html → M000029.html} +1 -1
  70. data/doc/classes/CdIo/Tracks.src/{M000022.html → M000030.html} +1 -1
  71. data/doc/classes/CdIo/{Cd.src/M000012.html → Tracks.src/M000036.html} +3 -3
  72. data/doc/classes/CdIo/Tracks.src/M000037.html +17 -0
  73. data/doc/classes/CdIo/Tracks.src/M000038.html +17 -0
  74. data/doc/created.rid +1 -1
  75. data/doc/files/__/rb_cdio_def_rb.html +235 -0
  76. data/doc/files/rb_cdio_def_rb.html +80 -5
  77. data/doc/fr_class_index.html +11 -0
  78. data/doc/fr_method_index.html +33 -14
  79. data/ext/CdIo.c +58 -3
  80. data/ext/CdIo.h +74 -1
  81. data/ext/CdIo_Cd.c +33 -80
  82. data/ext/CdIo_Cdda.c +607 -0
  83. data/ext/CdIo_Common.c +53 -8
  84. data/ext/CdIo_Modulo.c +12 -4
  85. data/ext/CdIo_Track.c +23 -35
  86. data/ext/CdIo_TrackCdda.c +13 -0
  87. data/ext/CdIo_TrackIso9660.c +1 -9
  88. data/ext/CdIo_Tracks.c +12 -2
  89. data/ext/extconf.rb +3 -0
  90. data/ext/mkmf.log +23 -0
  91. data/lib/rb_cdio_read.rb +23 -14
  92. data/rb_cdio.def.rb +157 -16
  93. data/test/data/bad-file.toc +13 -0
  94. data/test/data/cdda-read.right +3 -0
  95. data/test/data/cdda.cue +1 -0
  96. data/test/data/cdda.right +5 -28
  97. data/test/data/cdda.toc +2 -1
  98. data/test/data/check_common_fn +9 -9
  99. data/test/data/check_common_fn.in +9 -9
  100. data/test/data/check_cue.sh.in +35 -20
  101. data/test/data/check_iso.sh.in +23 -3
  102. data/test/data/check_nrg.sh.in +18 -16
  103. data/test/data/check_opts0.right +2 -24
  104. data/test/data/check_opts1.right +2 -24
  105. data/test/data/check_opts2.right +5 -27
  106. data/test/data/check_opts3.right +5 -27
  107. data/test/data/check_opts4.right +5 -27
  108. data/test/data/check_opts5.right +5 -27
  109. data/test/data/check_opts6.right +5 -27
  110. data/test/data/check_opts7.right +5 -27
  111. data/test/data/check_paranoia.sh.in +78 -0
  112. data/test/data/check_sizeof.c +5 -5
  113. data/test/data/copying-rr.iso +0 -0
  114. data/test/data/copying-rr.right +25 -0
  115. data/test/data/copying.right +3 -3
  116. data/test/data/data5.toc +3 -3
  117. data/test/data/data6.toc +2 -2
  118. data/test/data/data7.toc +3 -3
  119. data/test/data/isofs-m1-no-rr.right +33 -0
  120. data/test/data/isofs-m1-read.right +3 -0
  121. data/test/data/isofs-m1.right +12 -36
  122. data/test/data/joliet-nojoliet.right +23 -0
  123. data/test/data/joliet.iso +0 -0
  124. data/test/data/joliet.right +23 -0
  125. data/test/data/testbincue.c +19 -3
  126. data/test/data/testdefault.c +8 -2
  127. data/test/data/testiso9660.c +10 -5
  128. data/test/data/testparanoia.c +185 -0
  129. data/test/data/testtoc.c +18 -5
  130. data/test/data/vcd2.toc +23 -0
  131. data/test/data/vcd_demo.right +55 -79
  132. data/test/data/vcd_demo_vcdinfo.right +97 -0
  133. data/test/data/videocd.right +37 -61
  134. data/test/test_cdda.rb +73 -0
  135. data/test/testall.rb +1 -0
  136. data/test/testbincue.rb +6 -1
  137. data/test/testclose.rb +6 -1
  138. data/test/testmethods.rb +29 -21
  139. data/test/testtoc.rb +9 -2
  140. metadata +137 -80
  141. data/doc/classes/CdIo.src/M000009.html +0 -17
  142. data/doc/classes/CdIo.src/M000010.html +0 -17
  143. data/doc/classes/CdIo.src/M000011.html +0 -17
  144. data/doc/classes/CdIo.src/M000012.html +0 -17
  145. data/doc/classes/CdIo.src/M000013.html +0 -17
  146. data/doc/classes/CdIo.src/M000014.html +0 -17
  147. data/doc/classes/CdIo.src/M000015.html +0 -17
  148. data/doc/classes/CdIo.src/M000016.html +0 -17
  149. data/doc/classes/CdIo/Track.src/M000020.html +0 -17
  150. data/test/data/check_cd_read.sh +0 -53
  151. data/test/data/check_cue.sh +0 -102
  152. data/test/data/check_iso.sh +0 -32
  153. data/test/data/check_nrg.sh +0 -68
  154. data/test/data/check_opts.sh +0 -33
@@ -1,8 +1,8 @@
1
- // $Id: data6.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
1
+ // $Id: data6.toc,v 1.2 2005/01/23 00:45:57 rocky Exp $
2
2
  // MODE2 track
3
3
  //
4
4
 
5
5
  CD_ROM
6
6
 
7
7
  TRACK MODE2
8
- FILE "vcd_demo.bin" 00:00:00 00:13:57
8
+ FILE "isofs-m1.bin" 00:00:00 00:13:57
@@ -1,13 +1,13 @@
1
- // $Id: data7.toc,v 1.1 2004/05/09 17:05:34 rocky Exp $
1
+ // $Id: data7.toc,v 1.2 2005/01/23 00:45:57 rocky Exp $
2
2
  // Video CD
3
3
  //
4
4
 
5
5
  CD_ROM_XA
6
6
 
7
7
  TRACK MODE1 // ISO filesystem
8
- FILE "vcd_demo.bin" 00:00:00 00:13:57
8
+ FILE "isofs-m1.bin" 00:00:00 00:13:57
9
9
 
10
10
  TRACK MODE2_FORM_MIX // XA track with form 1 and form 2 sectors
11
11
  PREGAP 0:2:0
12
- FILE "vcd_demo.bin" 00:20:71 00:00:00
12
+ FILE "isofs-m1.bin" 00:20:71 00:00:00
13
13
 
@@ -0,0 +1,33 @@
1
+ This is free software; see the source for copying conditions.
2
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
3
+ PARTICULAR PURPOSE.
4
+ __________________________________
5
+
6
+ CD-ROM Track List (1 - 1)
7
+ #: MSF LSN Type Green? Copy?
8
+ 1: 00:02:00 000000 data false no
9
+ 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted)
10
+ Media Catalog Number (MCN): not available
11
+ Last CD Session LSN: not supported by drive/driver
12
+ __________________________________
13
+ CD Analysis Report
14
+ CD-ROM with ISO 9660 filesystem
15
+ ISO 9660: 64 blocks, label `CDROM '
16
+ Application: MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING
17
+ Preparer :
18
+ Publisher :
19
+ System : LINUX
20
+ Volume : CDROM
21
+ Volume Set :
22
+ ISO9660 filesystem
23
+ /:
24
+ d [LSN 23] 2048 Apr 20 2003 11:26:46 .
25
+ d [LSN 23] 2048 Apr 20 2003 11:26:46 ..
26
+ - [LSN 26] 17992 Jul 29 2002 12:39:53 copying
27
+ d [LSN 24] 2048 Apr 20 2003 16:18:53 doc
28
+
29
+ /doc/:
30
+ d [LSN 24] 2048 Apr 20 2003 16:18:53 .
31
+ d [LSN 23] 2048 Apr 20 2003 11:26:46 ..
32
+ - [LSN 35] 648 Apr 20 2003 16:18:53 readme.txt
33
+
@@ -1,3 +1,6 @@
1
+ This is free software; see the source for copying conditions.
2
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
3
+ PARTICULAR PURPOSE.
1
4
  0x0000: 0909 2020 2020 474e 5520 4745 4e45 5241 .. GNU GENERA
2
5
  0x0010: 4c20 5055 424c 4943 204c 4943 454e 5345 L PUBLIC LICENSE
3
6
  0x0020: 0a09 0920 2020 2020 2020 5665 7273 696f ... Versio
@@ -1,36 +1,14 @@
1
1
  This is free software; see the source for copying conditions.
2
2
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
3
3
  PARTICULAR PURPOSE.
4
- Hardware : Disk Image
5
- Can eject : No
6
- Can close tray : No
7
- Can disable manual eject : No
8
- Can select juke-box disc : No
9
-
10
- Can set drive speed : No
11
- Can detect if CD changed : No
12
- Can read multiple sessions : No
13
- Can hard reset device : No
14
-
15
- Reading....
16
- Can play audio : Yes
17
- Can read CD-R : Yes
18
- Can read CD-RW : Yes
19
- Can read DVD-ROM : No
20
-
21
- Writing....
22
- Can write CD-RW : No
23
- Can write DVD-R : No
24
- Can write DVD-RAM : No
25
- Can write DVD-RW : No
26
- Can write DVD+RW : No
27
4
  __________________________________
28
5
 
29
6
  CD-ROM Track List (1 - 1)
30
- #: MSF LSN Type Green?
31
- 1: 00:02:00 000000 data false
32
- 170: 00:06:02 000302 leadout
7
+ #: MSF LSN Type Green? Copy?
8
+ 1: 00:02:00 000000 data false no
9
+ 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted)
33
10
  Media Catalog Number (MCN): not available
11
+ Last CD Session LSN: not supported by drive/driver
34
12
  __________________________________
35
13
  CD Analysis Report
36
14
  CD-ROM with ISO 9660 filesystem
@@ -42,16 +20,14 @@ System : LINUX
42
20
  Volume : CDROM
43
21
  Volume Set :
44
22
  ISO9660 filesystem
45
- root dir in PVD set to lsn 23
46
-
47
23
  /:
48
- Apr 20 2003 07:26 .
49
- Apr 20 2003 07:26 ..
50
- Jul 29 2002 08:39 copying
51
- Apr 20 2003 12:18 doc
24
+ drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 11:26:46 .
25
+ drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 11:26:46 ..
26
+ -rw-r--r-- 1 715 715 [LSN 26] 17992 Jul 29 2002 12:39:53 COPYING
27
+ drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 16:18:53 doc
52
28
 
53
- /DOC/:
54
- Apr 20 2003 12:18 .
55
- Apr 20 2003 07:26 ..
56
- Apr 20 2003 12:18 readme.txt
29
+ /doc/:
30
+ drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 16:18:53 .
31
+ drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 11:26:46 ..
32
+ -rw-rw-r-- 1 715 715 [LSN 35] 648 Apr 20 2003 16:18:53 readme.txt
57
33
 
@@ -0,0 +1,23 @@
1
+ This is free software; see the source for copying conditions.
2
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
3
+ PARTICULAR PURPOSE.
4
+ __________________________________
5
+ ISO-9660 Information
6
+ /:
7
+ d [LSN 28] 2048 Oct 22 2004 22:44:59 .
8
+ d [LSN 28] 2048 Oct 22 2004 22:44:59 ..
9
+ d [LSN 29] 2048 Oct 22 2004 22:44:59 libcdio
10
+
11
+ /libcdio/:
12
+ d [LSN 29] 2048 Oct 22 2004 22:44:59 .
13
+ d [LSN 28] 2048 Oct 22 2004 22:44:59 ..
14
+ - [LSN 34] 17992 Mar 12 2004 07:18:03 copying
15
+ - [LSN 43] 2156 Jun 26 2004 10:01:09 readme
16
+ - [LSN 45] 2849 Aug 12 2004 09:22:23 readme.libcdio
17
+ d [LSN 30] 2048 Oct 22 2004 22:44:59 test
18
+
19
+ /libcdio/test/:
20
+ d [LSN 30] 2048 Oct 22 2004 22:44:59 .
21
+ d [LSN 29] 2048 Oct 22 2004 22:44:59 ..
22
+ - [LSN 47] 74 Jul 25 2004 09:52:32 isofs_m1.cue
23
+
Binary file
@@ -0,0 +1,23 @@
1
+ This is free software; see the source for copying conditions.
2
+ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
3
+ PARTICULAR PURPOSE.
4
+ __________________________________
5
+ ISO-9660 Information
6
+ /:
7
+ d [LSN 31] 2048 Oct 22 2004 22:44:59 .
8
+ d [LSN 31] 2048 Oct 22 2004 22:44:59 ..
9
+ d [LSN 32] 2048 Oct 22 2004 22:44:59 libcdio
10
+
11
+ /libcdio/:
12
+ d [LSN 32] 2048 Oct 22 2004 22:44:59 .
13
+ d [LSN 31] 2048 Oct 22 2004 22:44:59 ..
14
+ - [LSN 34] 17992 Mar 12 2004 07:18:03 COPYING
15
+ - [LSN 43] 2156 Jun 26 2004 10:01:09 README
16
+ - [LSN 45] 2849 Aug 12 2004 09:22:23 README.libcdio
17
+ d [LSN 33] 2048 Oct 22 2004 22:44:59 test
18
+
19
+ /libcdio/test/:
20
+ d [LSN 33] 2048 Oct 22 2004 22:44:59 .
21
+ d [LSN 32] 2048 Oct 22 2004 22:44:59 ..
22
+ - [LSN 47] 74 Jul 25 2004 09:52:32 isofs-m1.cue
23
+
@@ -1,5 +1,5 @@
1
1
  /*
2
- $Id: testbincue.c,v 1.2 2004/07/10 01:18:02 rocky Exp $
2
+ $Id: testbincue.c,v 1.5 2004/10/26 01:21:05 rocky Exp $
3
3
 
4
4
  Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
5
5
 
@@ -38,6 +38,10 @@
38
38
  #endif
39
39
  #include <string.h>
40
40
 
41
+ #ifndef TEST_DIR
42
+ #define TEST_DIR "."
43
+ #endif
44
+
41
45
  #define NUM_GOOD_CUES 2
42
46
  #define NUM_BAD_CUES 7
43
47
  int
@@ -59,26 +63,38 @@ main(int argc, const char *argv[])
59
63
  };
60
64
  int ret=0;
61
65
  unsigned int i;
66
+ char psz_cuefile[500];
62
67
 
68
+ psz_cuefile[sizeof(psz_cuefile)-1] = '\0';
63
69
  cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
64
70
  for (i=0; i<NUM_GOOD_CUES; i++) {
65
- if (!cdio_is_cuefile(cue_file[i])) {
71
+ char *psz_binfile;
72
+ snprintf(psz_cuefile, sizeof(psz_cuefile)-1,
73
+ "%s/%s", TEST_DIR, cue_file[i]);
74
+ psz_binfile = cdio_is_cuefile(psz_cuefile);
75
+ if (!psz_binfile) {
66
76
  printf("Incorrect: %s doesn't parse as a CDRWin CUE file.\n",
67
77
  cue_file[i]);
68
78
  ret=i+1;
69
79
  } else {
70
80
  printf("Correct: %s parses as a CDRWin CUE file.\n",
71
81
  cue_file[i]);
82
+ free(psz_binfile);
72
83
  }
73
84
  }
74
85
 
75
86
  for (i=0; i<NUM_BAD_CUES; i++) {
76
- if (!cdio_is_cuefile(badcue_file[i])) {
87
+ char *psz_binfile;
88
+ snprintf(psz_cuefile, sizeof(psz_cuefile)-1,
89
+ "%s/%s", TEST_DIR, badcue_file[i]);
90
+ psz_binfile=cdio_is_cuefile(psz_cuefile);
91
+ if (!psz_binfile) {
77
92
  printf("Correct: %s doesn't parse as a CDRWin CUE file.\n",
78
93
  badcue_file[i]);
79
94
  } else {
80
95
  printf("Incorrect: %s parses as a CDRWin CUE file.\n",
81
96
  badcue_file[i]);
97
+ free(psz_binfile);
82
98
  ret+=50*i+1;
83
99
  break;
84
100
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
- $Id: testdefault.c,v 1.5 2004/05/07 10:57:50 rocky Exp $
2
+ $Id: testdefault.c,v 1.6 2005/01/23 05:51:44 rocky Exp $
3
3
 
4
- Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
4
+ Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
5
5
 
6
6
  This program is free software; you can redistribute it and/or modify
7
7
  it under the terms of the GNU General Public License as published by
@@ -93,6 +93,8 @@ main(int argc, const char *argv[])
93
93
  }
94
94
 
95
95
  if (!is_in(nrg_images, nrg_files[0])) {
96
+ cdio_free_device_list(nrg_images);
97
+ free(nrg_images);
96
98
  return 10;
97
99
  }
98
100
 
@@ -188,6 +190,10 @@ main(int argc, const char *argv[])
188
190
  return 15;
189
191
  }
190
192
 
193
+ cdio_free_device_list(nrg_images);
194
+ free(nrg_images);
195
+ cdio_free_device_list(bincue_images);
196
+ free(bincue_images);
191
197
  cdio_free_device_list(imgs);
192
198
  free(imgs);
193
199
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- $Id: testiso9660.c,v 1.2 2003/09/21 01:14:30 rocky Exp $
2
+ $Id: testiso9660.c,v 1.4 2005/03/03 10:33:26 rocky Exp $
3
3
 
4
4
  Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
5
5
 
@@ -24,6 +24,9 @@
24
24
  #endif
25
25
 
26
26
  #include <ctype.h>
27
+ #ifdef HAVE_STDLIB_H
28
+ #include <stdlib.h>
29
+ #endif
27
30
  #ifdef HAVE_STRING_H
28
31
  #include <string.h>
29
32
  #endif
@@ -121,8 +124,10 @@ main (int argc, const char *argv[])
121
124
  dst_p = iso9660_pathname_isofy ("this/file.ext", 1);
122
125
  if ( 0 != strncmp(dst_p, "this/file.ext;1", 16) ) {
123
126
  printf("Failed iso9660_pathname_isofy\n");
127
+ free(dst_p);
124
128
  return 10;
125
129
  }
130
+ free(dst_p);
126
131
 
127
132
  /* Test get/set date */
128
133
  {
@@ -135,16 +140,16 @@ main (int argc, const char *argv[])
135
140
  iso9660_set_dtime(p_tm, &dtime);
136
141
  iso9660_get_dtime(&dtime, true, &tm);
137
142
  if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
138
- printf("Time retrieved with iso0660_get_dtime not same as that set with "
139
- "iso9660_set_dtime.\n");
143
+ printf("Local time retrieved with iso9660_get_dtime not same as\n");
144
+ printf("that set with iso9660_set_dtime().\n");
140
145
  return 11;
141
146
  }
142
147
  p_tm = gmtime(&now);
143
148
  iso9660_set_dtime(p_tm, &dtime);
144
149
  iso9660_get_dtime(&dtime, false, &tm);
145
150
  if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
146
- printf("Time retrieved with iso0660_get_dtime not same as that set with "
147
- "iso9660_set_dtime.\n");
151
+ printf("GMT time retrieved with iso9660_get_dtime() not same as that\n");
152
+ printf("set with iso9660_set_dtime().\n");
148
153
  return 12;
149
154
  }
150
155
  }
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
3
+ *
4
+ * This program is free software; you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation; either version 2, or (at your option)
7
+ * any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ *
18
+ */
19
+ /* Simple program to show using libcdio's version of cdparanoia. */
20
+
21
+ #ifdef HAVE_CONFIG_H
22
+ # include "config.h"
23
+ #endif
24
+
25
+ #include <cdio/cdda.h>
26
+ #include <cdio/cd_types.h>
27
+ #include <stdio.h>
28
+
29
+ #ifdef HAVE_STDLIB_H
30
+ #include <stdlib.h>
31
+ #endif
32
+
33
+ #ifdef HAVE_STRING_H
34
+ #include <string.h>
35
+ #endif
36
+
37
+ #ifdef WORDS_BIGENDIAN
38
+ #define BIGENDIAN 1
39
+ #else
40
+ #define BIGENDIAN 0
41
+ #endif
42
+
43
+ #define SKIP_TEST_RC 77
44
+
45
+ #define MAX_SECTORS 50
46
+ uint8_t audio_buf[MAX_SECTORS][CDIO_CD_FRAMESIZE_RAW] = { {0}, };
47
+ paranoia_cb_mode_t audio_status[MAX_SECTORS];
48
+ unsigned int i = 0;
49
+
50
+ static void
51
+ callback(long int inpos, paranoia_cb_mode_t function)
52
+ {
53
+ audio_status[i] = function;
54
+ }
55
+
56
+ int
57
+ main(int argc, const char *argv[])
58
+ {
59
+ cdrom_drive_t *d = NULL; /* Place to store handle given by cd-parapnioa. */
60
+ driver_id_t driver_id;
61
+ char **ppsz_cd_drives; /* List of all drives with a loaded CDDA in it. */
62
+ int i_rc=0;
63
+
64
+ /* See if we can find a device with a loaded CD-DA in it. If successful
65
+ drive_id will be set. */
66
+ ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false,
67
+ &driver_id);
68
+
69
+ if (ppsz_cd_drives && *ppsz_cd_drives) {
70
+ /* Found such a CD-ROM with a CD-DA loaded. Use the first drive in
71
+ the list. */
72
+ d=cdda_identify(*ppsz_cd_drives, 1, NULL);
73
+ } else {
74
+ printf("Unable find or access a CD-ROM drive with an audio CD in it.\n");
75
+ exit(SKIP_TEST_RC);
76
+ }
77
+
78
+ /* Don't need a list of CD's with CD-DA's any more. */
79
+ cdio_free_device_list(ppsz_cd_drives);
80
+
81
+ /* We'll set for verbose paranoia messages. */
82
+ cdda_verbose_set(d, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT);
83
+
84
+ if ( 0 != cdio_cddap_open(d) ) {
85
+ printf("Unable to open disc.\n");
86
+ exit(SKIP_TEST_RC);
87
+ }
88
+
89
+ /* Okay now set up to read up to the first 300 frames of the first
90
+ audio track of the Audio CD. */
91
+ {
92
+ cdrom_paranoia_t *p = paranoia_init(d);
93
+ lsn_t i_first_lsn = cdda_disc_firstsector(d);
94
+
95
+ if ( -1 == i_first_lsn ) {
96
+ printf("Trouble getting starting LSN\n");
97
+ } else {
98
+ lsn_t i_lsn; /* Current LSN to read */
99
+ lsn_t i_last_lsn = cdda_disc_lastsector(d);
100
+ unsigned int i_sectors = i_last_lsn - i_first_lsn + 1;
101
+ unsigned int j;
102
+ unsigned int i_good = 0;
103
+ unsigned int i_bad = 0;
104
+
105
+ /* Set reading mode for full paranoia, but allow skipping sectors. */
106
+ paranoia_modeset(p, PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP);
107
+
108
+ for ( j=0; j<10; j++ ) {
109
+
110
+ /* Pick a place to start reading. */
111
+ i_lsn = i_first_lsn + (rand() % i_sectors);
112
+ paranoia_seek(p, i_lsn, SEEK_SET);
113
+
114
+ printf("Testing %d sectors starting at %ld\n",
115
+ MAX_SECTORS, (long int) i_lsn);
116
+ for ( i = 0;
117
+ i < MAX_SECTORS && i_lsn <= i_last_lsn;
118
+ i++, i_lsn++ ) {
119
+ /* read a sector */
120
+ int16_t *p_readbuf = paranoia_read(p, callback);
121
+ char *psz_err=cdio_cddap_errors(d);
122
+ char *psz_mes=cdio_cddap_messages(d);
123
+
124
+ memcpy(audio_buf[i], p_readbuf, CDIO_CD_FRAMESIZE_RAW);
125
+
126
+ if (psz_mes || psz_err)
127
+ printf("%s%s\n", psz_mes ? psz_mes: "", psz_err ? psz_err: "");
128
+
129
+ if (psz_err) free(psz_err);
130
+ if (psz_mes) free(psz_mes);
131
+ if( !p_readbuf ) {
132
+ printf("paranoia read error. Stopping.\n");
133
+ goto out;
134
+ }
135
+ }
136
+
137
+ /* Compare with the sectors from paranoia. */
138
+ i_lsn -= MAX_SECTORS;
139
+ for ( i = 0; i < MAX_SECTORS; i++, i_lsn++ ) {
140
+ uint8_t readbuf[CDIO_CD_FRAMESIZE_RAW] = {0,};
141
+ if ( PARANOIA_CB_READ == audio_status[i] ||
142
+ PARANOIA_CB_VERIFY == audio_status[i] ) {
143
+ /* We read the block via paranoia without an error. */
144
+
145
+ if ( 0 == cdio_read_audio_sector(d->p_cdio, readbuf, i_lsn) ) {
146
+ if ( BIGENDIAN != d->bigendianp ) {
147
+ /* We will compare in the slow, pedantic way*/
148
+ int j;
149
+ for (j=0; j < CDIO_CD_FRAMESIZE_RAW ; j +=2) {
150
+ if (audio_buf[i][j] != readbuf[j+1] &&
151
+ audio_buf[i][j+1] != readbuf[j] ) {
152
+ printf("LSN %ld doesn't match\n", (long int) i_lsn);
153
+ i_bad++;
154
+ } else {
155
+ i_good++;
156
+ }
157
+ }
158
+ } else {
159
+ if ( 0 != memcmp(audio_buf[i], readbuf,
160
+ CDIO_CD_FRAMESIZE_RAW) ) {
161
+ printf("LSN %ld doesn't match\n", (long int) i_lsn);
162
+ i_bad++;
163
+ } else {
164
+ i_good++;
165
+ }
166
+ }
167
+ }
168
+ } else {
169
+ printf("Skipping LSN %ld because of status: %s\n",
170
+ (long int) i_lsn, paranoia_cb_mode2str[audio_status[i]]);
171
+ }
172
+ }
173
+ }
174
+ printf("%u sectors compared okay %u sectors were different\n",
175
+ i_good, i_bad);
176
+ if (i_bad > i_good) i_rc = 1;
177
+ }
178
+ out: paranoia_free(p);
179
+ }
180
+
181
+ cdio_cddap_close(d);
182
+
183
+ exit(i_rc);
184
+ }
185
+