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.
- data/ChangeLog.txt +17 -2
- data/VERSION +1 -1
- data/doc/classes/CdIo.html +19 -31
- data/doc/classes/CdIo.src/M000001.html +1 -1
- data/doc/classes/CdIo.src/M000002.html +1 -1
- data/doc/classes/CdIo.src/M000003.html +1 -1
- data/doc/classes/CdIo.src/M000004.html +1 -1
- data/doc/classes/CdIo.src/M000005.html +1 -1
- data/doc/classes/CdIo.src/M000006.html +1 -1
- data/doc/classes/CdIo.src/M000007.html +1 -1
- data/doc/classes/CdIo.src/M000008.html +1 -1
- data/doc/classes/CdIo/Cd.html +51 -51
- data/doc/classes/CdIo/Cd.src/{M000011.html → M000020.html} +1 -1
- data/doc/classes/CdIo/Cd.src/M000021.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000022.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000023.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000024.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000025.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000026.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000027.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000028.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000029.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000030.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000031.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000032.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000033.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000034.html +3 -3
- data/doc/classes/CdIo/Cd.src/M000035.html +3 -3
- data/doc/classes/CdIo/Cdda.html +428 -0
- data/doc/classes/CdIo/{Cd.src/M000016.html → Cdda.src/M000009.html} +3 -3
- data/doc/classes/CdIo/{Cd.src/M000013.html → Cdda.src/M000010.html} +3 -3
- data/doc/classes/CdIo/{Cd.src/M000036.html → Cdda.src/M000011.html} +3 -3
- data/doc/classes/CdIo/{Cd.src/M000014.html → Cdda.src/M000012.html} +3 -3
- data/doc/classes/CdIo/Cdda.src/M000013.html +17 -0
- data/doc/classes/CdIo/{Cd.src/M000019.html → Cdda.src/M000014.html} +3 -3
- data/doc/classes/CdIo/Cdda.src/M000015.html +17 -0
- data/doc/classes/CdIo/Cdda.src/M000016.html +17 -0
- data/doc/classes/CdIo/Cdda.src/M000017.html +17 -0
- data/doc/classes/CdIo/Cdda.src/M000018.html +17 -0
- data/doc/classes/CdIo/Cdda.src/M000019.html +17 -0
- data/doc/classes/CdIo/{Cd.src/M000015.html → Cdda.src/M000020.html} +3 -3
- data/doc/classes/CdIo/{Cd.src/M000017.html → Cdda.src/M000021.html} +3 -3
- data/doc/classes/CdIo/{Cd.src/M000018.html → Cdda.src/M000022.html} +3 -3
- data/doc/classes/CdIo/Cdda.src/M000023.html +17 -0
- data/doc/classes/CdIo/Cdda.src/M000024.html +17 -0
- data/doc/classes/CdIo/Exception.html +118 -0
- data/doc/classes/CdIo/Exception/BadParameter.html +111 -0
- data/doc/classes/CdIo/Exception/BadPointer.html +111 -0
- data/doc/classes/CdIo/{Device.html → Exception/CddbConn.html} +5 -5
- data/doc/classes/CdIo/Exception/CddbError.html +111 -0
- data/doc/classes/CdIo/{CdText.html → Exception/Error.html} +5 -5
- data/doc/{files/test/testall_rb.html → classes/CdIo/Exception/NoDriver.html} +26 -25
- data/doc/classes/CdIo/Exception/NotPermitted.html +111 -0
- data/doc/classes/CdIo/Exception/Unsupported.html +111 -0
- data/doc/classes/CdIo/Track.html +16 -16
- data/doc/classes/CdIo/Track.src/M000017.html +3 -3
- data/doc/classes/CdIo/Track.src/M000018.html +3 -3
- data/doc/classes/CdIo/Track.src/M000019.html +3 -3
- data/doc/classes/CdIo/Track.src/{M000009.html → M000025.html} +1 -1
- data/doc/classes/CdIo/Track.src/{M000010.html → M000026.html} +1 -1
- data/doc/classes/CdIo/Track.src/{M000011.html → M000027.html} +1 -1
- data/doc/classes/CdIo/TrackCdda.html +169 -0
- data/doc/classes/CdIo/TrackCdda.src/M000031.html +17 -0
- data/doc/classes/CdIo/TrackCdda.src/M000039.html +17 -0
- data/doc/classes/CdIo/TrackCdda.src/M000040.html +17 -0
- data/doc/classes/CdIo/TrackCdda.src/M000041.html +17 -0
- data/doc/classes/CdIo/Tracks.html +15 -15
- data/doc/classes/CdIo/Tracks.src/{M000020.html → M000028.html} +1 -1
- data/doc/classes/CdIo/Tracks.src/{M000021.html → M000029.html} +1 -1
- data/doc/classes/CdIo/Tracks.src/{M000022.html → M000030.html} +1 -1
- data/doc/classes/CdIo/{Cd.src/M000012.html → Tracks.src/M000036.html} +3 -3
- data/doc/classes/CdIo/Tracks.src/M000037.html +17 -0
- data/doc/classes/CdIo/Tracks.src/M000038.html +17 -0
- data/doc/created.rid +1 -1
- data/doc/files/__/rb_cdio_def_rb.html +235 -0
- data/doc/files/rb_cdio_def_rb.html +80 -5
- data/doc/fr_class_index.html +11 -0
- data/doc/fr_method_index.html +33 -14
- data/ext/CdIo.c +58 -3
- data/ext/CdIo.h +74 -1
- data/ext/CdIo_Cd.c +33 -80
- data/ext/CdIo_Cdda.c +607 -0
- data/ext/CdIo_Common.c +53 -8
- data/ext/CdIo_Modulo.c +12 -4
- data/ext/CdIo_Track.c +23 -35
- data/ext/CdIo_TrackCdda.c +13 -0
- data/ext/CdIo_TrackIso9660.c +1 -9
- data/ext/CdIo_Tracks.c +12 -2
- data/ext/extconf.rb +3 -0
- data/ext/mkmf.log +23 -0
- data/lib/rb_cdio_read.rb +23 -14
- data/rb_cdio.def.rb +157 -16
- data/test/data/bad-file.toc +13 -0
- data/test/data/cdda-read.right +3 -0
- data/test/data/cdda.cue +1 -0
- data/test/data/cdda.right +5 -28
- data/test/data/cdda.toc +2 -1
- data/test/data/check_common_fn +9 -9
- data/test/data/check_common_fn.in +9 -9
- data/test/data/check_cue.sh.in +35 -20
- data/test/data/check_iso.sh.in +23 -3
- data/test/data/check_nrg.sh.in +18 -16
- data/test/data/check_opts0.right +2 -24
- data/test/data/check_opts1.right +2 -24
- data/test/data/check_opts2.right +5 -27
- data/test/data/check_opts3.right +5 -27
- data/test/data/check_opts4.right +5 -27
- data/test/data/check_opts5.right +5 -27
- data/test/data/check_opts6.right +5 -27
- data/test/data/check_opts7.right +5 -27
- data/test/data/check_paranoia.sh.in +78 -0
- data/test/data/check_sizeof.c +5 -5
- data/test/data/copying-rr.iso +0 -0
- data/test/data/copying-rr.right +25 -0
- data/test/data/copying.right +3 -3
- data/test/data/data5.toc +3 -3
- data/test/data/data6.toc +2 -2
- data/test/data/data7.toc +3 -3
- data/test/data/isofs-m1-no-rr.right +33 -0
- data/test/data/isofs-m1-read.right +3 -0
- data/test/data/isofs-m1.right +12 -36
- data/test/data/joliet-nojoliet.right +23 -0
- data/test/data/joliet.iso +0 -0
- data/test/data/joliet.right +23 -0
- data/test/data/testbincue.c +19 -3
- data/test/data/testdefault.c +8 -2
- data/test/data/testiso9660.c +10 -5
- data/test/data/testparanoia.c +185 -0
- data/test/data/testtoc.c +18 -5
- data/test/data/vcd2.toc +23 -0
- data/test/data/vcd_demo.right +55 -79
- data/test/data/vcd_demo_vcdinfo.right +97 -0
- data/test/data/videocd.right +37 -61
- data/test/test_cdda.rb +73 -0
- data/test/testall.rb +1 -0
- data/test/testbincue.rb +6 -1
- data/test/testclose.rb +6 -1
- data/test/testmethods.rb +29 -21
- data/test/testtoc.rb +9 -2
- metadata +137 -80
- data/doc/classes/CdIo.src/M000009.html +0 -17
- data/doc/classes/CdIo.src/M000010.html +0 -17
- data/doc/classes/CdIo.src/M000011.html +0 -17
- data/doc/classes/CdIo.src/M000012.html +0 -17
- data/doc/classes/CdIo.src/M000013.html +0 -17
- data/doc/classes/CdIo.src/M000014.html +0 -17
- data/doc/classes/CdIo.src/M000015.html +0 -17
- data/doc/classes/CdIo.src/M000016.html +0 -17
- data/doc/classes/CdIo/Track.src/M000020.html +0 -17
- data/test/data/check_cd_read.sh +0 -53
- data/test/data/check_cue.sh +0 -102
- data/test/data/check_iso.sh +0 -32
- data/test/data/check_nrg.sh +0 -68
- data/test/data/check_opts.sh +0 -33
data/doc/fr_class_index.html
CHANGED
@@ -22,7 +22,18 @@
|
|
22
22
|
<div id="index-entries">
|
23
23
|
<a href="classes/CdIo.html">CdIo</a><br />
|
24
24
|
<a href="classes/CdIo/Cd.html">CdIo::Cd</a><br />
|
25
|
+
<a href="classes/CdIo/Cdda.html">CdIo::Cdda</a><br />
|
26
|
+
<a href="classes/CdIo/Exception.html">CdIo::Exception</a><br />
|
27
|
+
<a href="classes/CdIo/Exception/BadParameter.html">CdIo::Exception::BadParameter</a><br />
|
28
|
+
<a href="classes/CdIo/Exception/BadPointer.html">CdIo::Exception::BadPointer</a><br />
|
29
|
+
<a href="classes/CdIo/Exception/CddbConn.html">CdIo::Exception::CddbConn</a><br />
|
30
|
+
<a href="classes/CdIo/Exception/CddbError.html">CdIo::Exception::CddbError</a><br />
|
31
|
+
<a href="classes/CdIo/Exception/Error.html">CdIo::Exception::Error</a><br />
|
32
|
+
<a href="classes/CdIo/Exception/NoDriver.html">CdIo::Exception::NoDriver</a><br />
|
33
|
+
<a href="classes/CdIo/Exception/NotPermitted.html">CdIo::Exception::NotPermitted</a><br />
|
34
|
+
<a href="classes/CdIo/Exception/Unsupported.html">CdIo::Exception::Unsupported</a><br />
|
25
35
|
<a href="classes/CdIo/Track.html">CdIo::Track</a><br />
|
36
|
+
<a href="classes/CdIo/TrackCdda.html">CdIo::TrackCdda</a><br />
|
26
37
|
<a href="classes/CdIo/TrackIso9660.html">CdIo::TrackIso9660</a><br />
|
27
38
|
<a href="classes/CdIo/Tracks.html">CdIo::Tracks</a><br />
|
28
39
|
</div>
|
data/doc/fr_method_index.html
CHANGED
@@ -20,28 +20,47 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/CdIo/Tracks.html#
|
24
|
-
<a href="classes/CdIo/
|
25
|
-
<a href="classes/CdIo/
|
26
|
-
<a href="classes/CdIo/
|
23
|
+
<a href="classes/CdIo/Tracks.html#M000038">[] (CdIo::Tracks)</a><br />
|
24
|
+
<a href="classes/CdIo/Cdda.html#M000019">artist (CdIo::Cdda)</a><br />
|
25
|
+
<a href="classes/CdIo/TrackCdda.html#M000040">artist (CdIo::TrackCdda)</a><br />
|
26
|
+
<a href="classes/CdIo/Cdda.html#M000021">category (CdIo::Cdda)</a><br />
|
27
|
+
<a href="classes/CdIo/Cdda.html#M000018">cddb_fetch (CdIo::Cdda)</a><br />
|
28
|
+
<a href="classes/CdIo/Cdda.html#M000016">cddb_id (CdIo::Cdda)</a><br />
|
29
|
+
<a href="classes/CdIo/Cdda.html#M000017">cddb_matches (CdIo::Cdda)</a><br />
|
30
|
+
<a href="classes/CdIo/Track.html#M000027">cdtext (CdIo::Track)</a><br />
|
31
|
+
<a href="classes/CdIo/Cd.html#M000029">cdtext (CdIo::Cd)</a><br />
|
32
|
+
<a href="classes/CdIo/Cd.html#M000035">close (CdIo::Cd)</a><br />
|
27
33
|
<a href="classes/CdIo.html#M000002">default_device (CdIo)</a><br />
|
28
34
|
<a href="classes/CdIo.html#M000001">devices (CdIo)</a><br />
|
29
35
|
<a href="classes/CdIo.html#M000005">discmode_describe (CdIo)</a><br />
|
30
|
-
<a href="classes/CdIo/Cd.html#
|
36
|
+
<a href="classes/CdIo/Cd.html#M000033">drive_cap (CdIo::Cd)</a><br />
|
31
37
|
<a href="classes/CdIo.html#M000003">drive_cap_dev (CdIo)</a><br />
|
32
38
|
<a href="classes/CdIo.html#M000004">driver_describe (CdIo)</a><br />
|
33
|
-
<a href="classes/CdIo/Tracks.html#
|
34
|
-
<a href="classes/CdIo/
|
35
|
-
<a href="classes/CdIo/
|
36
|
-
<a href="classes/CdIo/
|
37
|
-
<a href="classes/CdIo/Cd.html#
|
38
|
-
<a href="classes/CdIo/
|
39
|
-
<a href="classes/CdIo/
|
40
|
-
<a href="classes/CdIo/
|
39
|
+
<a href="classes/CdIo/Tracks.html#M000037">each (CdIo::Tracks)</a><br />
|
40
|
+
<a href="classes/CdIo/Cdda.html#M000024">extra_data (CdIo::Cdda)</a><br />
|
41
|
+
<a href="classes/CdIo/Cdda.html#M000022">genre (CdIo::Cdda)</a><br />
|
42
|
+
<a href="classes/CdIo/Track.html#M000026">green? (CdIo::Track)</a><br />
|
43
|
+
<a href="classes/CdIo/Cd.html#M000034">hwinfo (CdIo::Cd)</a><br />
|
44
|
+
<a href="classes/CdIo/Cd.html#M000031">is_cd? (CdIo::Cd)</a><br />
|
45
|
+
<a href="classes/CdIo/Cd.html#M000032">is_dvd? (CdIo::Cd)</a><br />
|
46
|
+
<a href="classes/CdIo/Cdda.html#M000023">length (CdIo::Cdda)</a><br />
|
47
|
+
<a href="classes/CdIo/Tracks.html#M000036">new (CdIo::Tracks)</a><br />
|
48
|
+
<a href="classes/CdIo/Track.html#M000025">new (CdIo::Track)</a><br />
|
49
|
+
<a href="classes/CdIo/Cd.html#M000028">new (CdIo::Cd)</a><br />
|
41
50
|
<a href="classes/CdIo.html#M000008">open (CdIo)</a><br />
|
51
|
+
<a href="classes/CdIo/Cdda.html#M000012">pause (CdIo::Cdda)</a><br />
|
52
|
+
<a href="classes/CdIo/Cdda.html#M000011">play (CdIo::Cdda)</a><br />
|
53
|
+
<a href="classes/CdIo/TrackCdda.html#M000039">play (CdIo::TrackCdda)</a><br />
|
54
|
+
<a href="classes/CdIo/Cdda.html#M000013">resume (CdIo::Cdda)</a><br />
|
55
|
+
<a href="classes/CdIo/Cdda.html#M000014">stop (CdIo::Cdda)</a><br />
|
56
|
+
<a href="classes/CdIo/Cdda.html#M000015">subchannel (CdIo::Cdda)</a><br />
|
57
|
+
<a href="classes/CdIo/Cdda.html#M000020">title (CdIo::Cdda)</a><br />
|
58
|
+
<a href="classes/CdIo/TrackCdda.html#M000041">title (CdIo::TrackCdda)</a><br />
|
42
59
|
<a href="classes/CdIo.html#M000006">track_format_describe (CdIo)</a><br />
|
43
60
|
<a href="classes/CdIo.html#M000007">track_type_describe (CdIo)</a><br />
|
44
|
-
<a href="classes/CdIo/Cd.html#
|
61
|
+
<a href="classes/CdIo/Cd.html#M000030">tracks (CdIo::Cd)</a><br />
|
62
|
+
<a href="classes/CdIo/Cdda.html#M000009">volume (CdIo::Cdda)</a><br />
|
63
|
+
<a href="classes/CdIo/Cdda.html#M000010">volume= (CdIo::Cdda)</a><br />
|
45
64
|
</div>
|
46
65
|
</div>
|
47
66
|
</body>
|
data/ext/CdIo.c
CHANGED
@@ -34,7 +34,7 @@ Init_rb_cdio()
|
|
34
34
|
rb_define_module_function(mCdIo, "is_nrg", rb_cdio_is_nrg, 1);
|
35
35
|
rb_define_module_function(mCdIo, "is_tocfile", rb_cdio_is_tocfile, 1);
|
36
36
|
rb_define_module_function(mCdIo, "is_device", rb_cdio_is_device, -1);
|
37
|
-
|
37
|
+
rb_define_module_function(mCdIo, "close_tray", rb_cdio_close_tray, 1);
|
38
38
|
/**
|
39
39
|
* class CdIo::Cd
|
40
40
|
*/
|
@@ -45,7 +45,7 @@ Init_rb_cdio()
|
|
45
45
|
#define CDIO_ATTR 9
|
46
46
|
const char *attr[CDIO_ATTR] =
|
47
47
|
{ "device", "mcn", "driver_name", "driver_id", "first_track_num",
|
48
|
-
"discmode", "num_tracks", "
|
48
|
+
"discmode", "num_tracks", "last_lsn", "joliet_level"
|
49
49
|
};
|
50
50
|
for (i = 0; i < CDIO_ATTR; i++) {
|
51
51
|
rb_define_attr(cCdIoCd, attr[i], 1, 0);
|
@@ -63,6 +63,28 @@ Init_rb_cdio()
|
|
63
63
|
rb_define_method(cCdIoCd, "drive_cap", rb_cdio_cd_get_drive_cap, 0);
|
64
64
|
rb_define_method(cCdIoCd, "hwinfo", rb_cdio_cd_get_hwinfo, 0);
|
65
65
|
rb_define_method(cCdIoCd, "close", rb_cdio_cd_close, 0);
|
66
|
+
rb_define_method(cCdIoCd, "eject", rb_cdio_cd_eject, 0);
|
67
|
+
// CdIo::CdDa module
|
68
|
+
mCdIoCdda = rb_define_module_under(mCdIo, "Cdda");
|
69
|
+
rb_define_method(mCdIoCdda, "volume", rb_cdio_cdda_get_volume, 0);
|
70
|
+
rb_define_method(mCdIoCdda, "volume=", rb_cdio_cdda_set_volume, 1);
|
71
|
+
rb_define_method(mCdIoCdda, "play", rb_cdio_cdda_play, -1);
|
72
|
+
rb_define_method(mCdIoCdda, "pause", rb_cdio_cdda_pause, 0);
|
73
|
+
rb_define_method(mCdIoCdda, "resume", rb_cdio_cdda_resume, 0);
|
74
|
+
rb_define_method(mCdIoCdda, "stop", rb_cdio_cdda_stop, 0);
|
75
|
+
rb_define_method(mCdIoCdda, "subchannel", rb_cdio_cdda_subchannel, 0);
|
76
|
+
rb_define_method(mCdIoCdda, "cddb_id", rb_cdio_cdda_cddb_id, 0);
|
77
|
+
rb_define_method(mCdIoCdda, "cddb_matches",rb_cdio_cdda_cddb_matches,0);
|
78
|
+
rb_define_method(mCdIoCdda, "cddb_fetch",rb_cdio_cdda_cddb_fetch,1);
|
79
|
+
|
80
|
+
rb_define_method(mCdIoCdda,"artist",rb_cdio_cdda_artist,0);
|
81
|
+
rb_define_method(mCdIoCdda,"title",rb_cdio_cdda_title,0);
|
82
|
+
rb_define_method(mCdIoCdda,"year",rb_cdio_cdda_year,0);
|
83
|
+
rb_define_method(mCdIoCdda,"length",rb_cdio_cdda_length,0);
|
84
|
+
rb_define_method(mCdIoCdda,"genre",rb_cdio_cdda_genre,0);
|
85
|
+
rb_define_method(mCdIoCdda,"category",rb_cdio_cdda_category,0);
|
86
|
+
rb_define_method(mCdIoCdda,"extra_data",rb_cdio_cdda_extra_data,0);
|
87
|
+
|
66
88
|
/** class CdIo::Tracks */
|
67
89
|
cCdIoTracks = rb_define_class_under(mCdIo, "Tracks", rb_cObject);
|
68
90
|
rb_include_module(cCdIoTracks, rb_mEnumerable);
|
@@ -71,7 +93,6 @@ Init_rb_cdio()
|
|
71
93
|
rb_define_method(cCdIoTracks, "<=>", rb_cdio_tracks_diff, 2);
|
72
94
|
rb_define_method(cCdIoTracks, "[]", rb_cdio_tracks_index, 1);
|
73
95
|
rb_define_attr(cCdIoTracks, "cd", 1, 0);
|
74
|
-
rb_define_attr(cCdIoTracks, "tracks", 1, 0);
|
75
96
|
/** class CdIo::Track */
|
76
97
|
cCdIoTrack = rb_define_class_under(mCdIo, "Track", rb_cObject);
|
77
98
|
rb_define_method(cCdIoTrack, "initialize", rb_cdio_track_init, 2);
|
@@ -99,6 +120,33 @@ Init_rb_cdio()
|
|
99
120
|
}
|
100
121
|
rb_define_method(cCdIoTrackIso9660, "initialize",
|
101
122
|
rb_cdio_trackiso9660_init, 2);
|
123
|
+
// class CdIo::TrackCdda
|
124
|
+
cCdIoTrackCdda = rb_define_class_under(mCdIo, "TrackCdda", cCdIoTrack);
|
125
|
+
// rb_define_method(cCdIoTrackCdda, "initialize",
|
126
|
+
// rb_cdio_trackcdda_init, 2);
|
127
|
+
rb_define_method(cCdIoTrackCdda, "play", rb_cdio_trackcdda_play, 0);
|
128
|
+
rb_define_attr(cCdIoTrackCdda,"title",1,0);
|
129
|
+
rb_define_attr(cCdIoTrackCdda,"artist",1,0);
|
130
|
+
rb_define_attr(cCdIoTrackCdda,"extra_data",1,0);
|
131
|
+
|
132
|
+
// exceptions
|
133
|
+
mCdIoException = rb_define_module_under(mCdIo, "Exception");
|
134
|
+
eCdIoError =
|
135
|
+
rb_define_class_under(mCdIoException, "Error", rb_eIOError);
|
136
|
+
eCdIoUnsupported =
|
137
|
+
rb_define_class_under(mCdIoException, "Unsupported", rb_eIOError);
|
138
|
+
eCdIoUnitit =
|
139
|
+
rb_define_class_under(mCdIoException, "Unitit", rb_eIOError);
|
140
|
+
eCdIoNotPermitted =
|
141
|
+
rb_define_class_under(mCdIoException, "NotPermitted", rb_eIOError);
|
142
|
+
eCdIoBadParameter =
|
143
|
+
rb_define_class_under(mCdIoException, "BadParameter", rb_eIOError);
|
144
|
+
eCdIoBadPointer =
|
145
|
+
rb_define_class_under(mCdIoException, "BadPointer", rb_eNoMemError);
|
146
|
+
eCdIoNoDriver =
|
147
|
+
rb_define_class_under(mCdIoException, "NoDriver", rb_eIOError);
|
148
|
+
eCdIoCddbError = rb_define_class_under(mCdIoException, "CddbError",rb_eException);
|
149
|
+
eCdIoCddbConn = rb_define_class_under(mCdIoException, "CddbConn", rb_eIOError);
|
102
150
|
// const for DRIVER
|
103
151
|
rb_define_const(mCdIo, "DRIVER_UNKNOWN", INT2FIX(DRIVER_UNKNOWN));
|
104
152
|
rb_define_const(mCdIo, "DRIVER_FREEBSD", INT2FIX(DRIVER_FREEBSD));
|
@@ -150,4 +198,11 @@ Init_rb_cdio()
|
|
150
198
|
rb_define_const(mCdIo, "TRACK_FORMAT_ERROR", INT2FIX(TRACK_FORMAT_ERROR)); /**< Dunno what is, or some other error. */
|
151
199
|
rb_define_const(mCdIo, "CDIO_CDROM_LEADOUT_TRACK",
|
152
200
|
INT2FIX(CDIO_CDROM_LEADOUT_TRACK));
|
201
|
+
rb_define_const(mCdIoCdda,"SUB_ST_INVALID",INT2FIX(CDIO_MMC_READ_SUB_ST_INVALID));
|
202
|
+
rb_define_const(mCdIoCdda,"SUB_ST_PLAY",INT2FIX(CDIO_MMC_READ_SUB_ST_PLAY));
|
203
|
+
rb_define_const(mCdIoCdda,"SUB_ST_PAUSED",INT2FIX(CDIO_MMC_READ_SUB_ST_PAUSED));
|
204
|
+
rb_define_const(mCdIoCdda,"SUB_ST_COMPLETED",INT2FIX(CDIO_MMC_READ_SUB_ST_COMPLETED));
|
205
|
+
rb_define_const(mCdIoCdda,"SUB_ST_ERROR",INT2FIX(CDIO_MMC_READ_SUB_ST_ERROR));
|
206
|
+
rb_define_const(mCdIoCdda,"SUB_ST_NO_STATUS",INT2FIX(CDIO_MMC_READ_SUB_ST_NO_STATUS));
|
207
|
+
|
153
208
|
}
|
data/ext/CdIo.h
CHANGED
@@ -21,14 +21,42 @@
|
|
21
21
|
#include <string.h>
|
22
22
|
#include <cdio/iso9660.h>
|
23
23
|
#include <cdio/cdtext.h>
|
24
|
+
#include <cdio/audio.h>
|
24
25
|
#include <cdio/cd_types.h>
|
26
|
+
#include <cdio/mmc.h>
|
25
27
|
#include <ruby.h>
|
26
28
|
|
29
|
+
// if we got cddb, include the library
|
30
|
+
#ifdef HAVE_CDDB_CDDB_H
|
31
|
+
#ifndef HAVE_CDDB
|
32
|
+
#define HAVE_CDDB 1
|
33
|
+
#endif
|
34
|
+
#include <cddb/cddb.h>
|
35
|
+
#endif
|
36
|
+
|
37
|
+
/** Test **/
|
38
|
+
|
39
|
+
#if LIBCDIO_VERSION_NUM < 73
|
40
|
+
#error rb_cdio 0.2.0 needs libcdio>=0.73
|
41
|
+
#endif
|
42
|
+
|
43
|
+
|
44
|
+
/** End tests **/
|
45
|
+
|
27
46
|
#define GET_CDIO(self,p) \
|
28
47
|
CdIo* p; \
|
29
48
|
Data_Get_Struct(self, CdIo, p); \
|
30
49
|
if(NULL==p) {rb_raise(rb_eException,"No pointer to CdIo");}
|
31
50
|
|
51
|
+
#define GET_TRACK(obj,p,t) \
|
52
|
+
CdIo* p; \
|
53
|
+
track_t t; \
|
54
|
+
Data_Get_Struct(rb_iv_get(obj, "@cd"), CdIo, p); \
|
55
|
+
if(NULL==p) {rb_raise(rb_eException,"No pointer to CdIo");} \
|
56
|
+
t=FIX2INT(rb_iv_get(obj,"@number"));
|
57
|
+
|
58
|
+
#define HASH_STR(hash,str1,str2) \
|
59
|
+
rb_hash_aset(hash,rb_str_new2(str1),rb_str_new2(str2));
|
32
60
|
|
33
61
|
#undef CDIO_DRIVE_CAP_WRITE_DVD
|
34
62
|
#define CDIO_DRIVE_CAP_WRITE_DVD ( \
|
@@ -39,11 +67,33 @@ if(NULL==p) {rb_raise(rb_eException,"No pointer to CdIo");}
|
|
39
67
|
| CDIO_DRIVE_CAP_WRITE_DVD_RPW \
|
40
68
|
)
|
41
69
|
|
70
|
+
// module CdIo
|
42
71
|
VALUE mCdIo;
|
72
|
+
// class CdIo::Cd
|
43
73
|
VALUE cCdIoCd;
|
74
|
+
// module CdIo::CdDa
|
75
|
+
VALUE mCdIoCdda;
|
76
|
+
// class CdIo::Track
|
44
77
|
VALUE cCdIoTrack;
|
78
|
+
// class CdIo::TrackIso9660
|
45
79
|
VALUE cCdIoTrackIso9660;
|
80
|
+
VALUE cCdIoTrackCdda;
|
81
|
+
// class CdIo::Tracks
|
46
82
|
VALUE cCdIoTracks;
|
83
|
+
// module CdIo::Exception
|
84
|
+
VALUE mCdIoException;
|
85
|
+
// Exceptions
|
86
|
+
VALUE eCdIoError;
|
87
|
+
VALUE eCdIoUnsupported;
|
88
|
+
VALUE eCdIoUnitit;
|
89
|
+
VALUE eCdIoNotPermitted;
|
90
|
+
VALUE eCdIoBadParameter;
|
91
|
+
VALUE eCdIoBadPointer;
|
92
|
+
VALUE eCdIoNoDriver;
|
93
|
+
VALUE eCdIoCddbError;
|
94
|
+
VALUE eCdIoCddbConn;
|
95
|
+
|
96
|
+
|
47
97
|
int Init_CdIo();
|
48
98
|
// Metodos para el m�dulo CdIo
|
49
99
|
|
@@ -70,7 +120,7 @@ VALUE rb_cdio_is_cuefile(VALUE module, VALUE name);
|
|
70
120
|
VALUE rb_cdio_is_nrg(VALUE module, VALUE name);
|
71
121
|
VALUE rb_cdio_is_tocfile(VALUE module, VALUE name);
|
72
122
|
VALUE rb_cdio_is_device(int argc, VALUE * argv, VALUE module);
|
73
|
-
|
123
|
+
VALUE rb_cdio_close_tray(VALUE module, VALUE name);
|
74
124
|
|
75
125
|
/*
|
76
126
|
* M�todos para clase CdIo::Cd
|
@@ -87,7 +137,28 @@ VALUE rb_cdio_cd_get_freedb(VALUE obj);
|
|
87
137
|
VALUE rb_cdio_cd_get_drive_cap(VALUE obj);
|
88
138
|
VALUE rb_cdio_cd_get_hwinfo(VALUE obj);
|
89
139
|
VALUE rb_cdio_cd_close(VALUE obj);
|
140
|
+
VALUE rb_cdio_cd_eject(VALUE obj);
|
90
141
|
VALUE rb_cdio_cd_get_cdtext(VALUE obj);
|
142
|
+
// module functions CdDa
|
143
|
+
VALUE rb_cdio_cdda_get_volume(VALUE obj);
|
144
|
+
VALUE rb_cdio_cdda_set_volume(VALUE obj,VALUE vol);
|
145
|
+
VALUE rb_cdio_cdda_play(int argc,VALUE* argv,VALUE obj);
|
146
|
+
VALUE rb_cdio_cdda_pause(VALUE obj);
|
147
|
+
VALUE rb_cdio_cdda_resume(VALUE obj);
|
148
|
+
VALUE rb_cdio_cdda_stop(VALUE obj);
|
149
|
+
VALUE rb_cdio_cdda_subchannel(VALUE obj);
|
150
|
+
VALUE rb_cdio_cdda_cddb_id(VALUE obj);
|
151
|
+
VALUE rb_cdio_cdda_cddb(VALUE obj);
|
152
|
+
VALUE rb_cdio_cdda_cddb_matches(VALUE obj);
|
153
|
+
VALUE rb_cdio_cdda_cddb_fetch(VALUE obj,VALUE match);
|
154
|
+
|
155
|
+
VALUE rb_cdio_cdda_category(VALUE obj);
|
156
|
+
VALUE rb_cdio_cdda_title(VALUE obj);
|
157
|
+
VALUE rb_cdio_cdda_artist(VALUE obj);
|
158
|
+
VALUE rb_cdio_cdda_year(VALUE obj);
|
159
|
+
VALUE rb_cdio_cdda_genre(VALUE obj);
|
160
|
+
VALUE rb_cdio_cdda_length(VALUE obj);
|
161
|
+
VALUE rb_cdio_cdda_extra_data(VALUE obj);
|
91
162
|
/**
|
92
163
|
* M�todos para la clase CdIo::Tracks
|
93
164
|
*/
|
@@ -107,6 +178,8 @@ VALUE rb_cdio_track_get_cdtext(VALUE obj);
|
|
107
178
|
/* TrackIso9660*/
|
108
179
|
|
109
180
|
VALUE rb_cdio_trackiso9660_init(VALUE obj, VALUE oCd, VALUE i_track);
|
181
|
+
/* TrackCdda */
|
182
|
+
VALUE rb_cdio_trackcdda_play(VALUE obj);
|
110
183
|
/*
|
111
184
|
* M�todos comunes
|
112
185
|
*/
|
data/ext/CdIo_Cd.c
CHANGED
@@ -27,59 +27,6 @@ _cdio_cd_destroy(void *p)
|
|
27
27
|
}
|
28
28
|
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
/**
|
35
|
-
* CDDB
|
36
|
-
* Extraido desde cd-info.
|
37
|
-
**/
|
38
|
-
|
39
|
-
static int
|
40
|
-
cddb_dec_digit_sum(int n)
|
41
|
-
{
|
42
|
-
int ret = 0;
|
43
|
-
|
44
|
-
for (;;) {
|
45
|
-
ret += n % 10;
|
46
|
-
n = n / 10;
|
47
|
-
if (!n)
|
48
|
-
return ret;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
/*
|
53
|
-
* Return the number of seconds (discarding frame portion) of an MSF
|
54
|
-
*/
|
55
|
-
static inline unsigned int
|
56
|
-
msf_seconds(msf_t * msf)
|
57
|
-
{
|
58
|
-
return from_bcd8(msf->m) * 60 + from_bcd8(msf->s);
|
59
|
-
}
|
60
|
-
|
61
|
-
static unsigned long
|
62
|
-
cddb_discid(CdIo * p_cdio, int i_tracks)
|
63
|
-
{
|
64
|
-
int i,
|
65
|
-
t,
|
66
|
-
n = 0;
|
67
|
-
msf_t start_msf;
|
68
|
-
msf_t msf;
|
69
|
-
|
70
|
-
for (i = 1; i <= i_tracks; i++) {
|
71
|
-
cdio_get_track_msf(p_cdio, i, &msf);
|
72
|
-
n += cddb_dec_digit_sum(msf_seconds(&msf));
|
73
|
-
}
|
74
|
-
|
75
|
-
cdio_get_track_msf(p_cdio, 1, &start_msf);
|
76
|
-
cdio_get_track_msf(p_cdio, CDIO_CDROM_LEADOUT_TRACK, &msf);
|
77
|
-
|
78
|
-
t = msf_seconds(&msf) - msf_seconds(&start_msf);
|
79
|
-
|
80
|
-
return ((n % 0xff) << 24 | t << 8 | i_tracks);
|
81
|
-
}
|
82
|
-
|
83
30
|
/**
|
84
31
|
Create a new Cd::CdIo object.
|
85
32
|
The first argument is an String for a device or a cue/bin/toc/nrg file
|
@@ -117,7 +64,8 @@ rb_cdio_cd_new(int argc, VALUE * argv, VALUE class)
|
|
117
64
|
p_cdio = cdio_open(device, driver);
|
118
65
|
|
119
66
|
if (p_cdio == NULL) {
|
120
|
-
rb_raise(
|
67
|
+
rb_raise(eCdIoError,
|
68
|
+
"I can't create the object. Please, verify the media");
|
121
69
|
return Qnil;
|
122
70
|
} else {
|
123
71
|
VALUE c_argv[2];
|
@@ -169,13 +117,16 @@ rb_cdio_cd_init(VALUE self, VALUE device, VALUE driver)
|
|
169
117
|
}
|
170
118
|
}
|
171
119
|
// stat_size
|
172
|
-
rb_iv_set(self, "@
|
173
|
-
|
120
|
+
rb_iv_set(self, "@last_lsn", INT2NUM(cdio_get_disc_last_lsn(p_cdio)));
|
121
|
+
rb_iv_set(self, "@joliet_level",
|
122
|
+
INT2NUM(cdio_get_joliet_level(p_cdio)));
|
123
|
+
|
124
|
+
// si es un disco de audio, lo extiendo con las funciones
|
125
|
+
// del m�dulo Cdda
|
174
126
|
if (CDIO_DISC_MODE_CD_DA == discmode) {
|
175
|
-
|
176
|
-
sprintf(cddb, "%08lx", cddb_discid(p_cdio, nt));
|
177
|
-
rb_iv_set(self, "@cddb_id", rb_str_new2(cddb));
|
127
|
+
rb_extend_object(self, mCdIoCdda);
|
178
128
|
}
|
129
|
+
|
179
130
|
return self;
|
180
131
|
}
|
181
132
|
|
@@ -186,24 +137,14 @@ rb_cdio_cd_init(VALUE self, VALUE device, VALUE driver)
|
|
186
137
|
VALUE
|
187
138
|
rb_cdio_cd_get_tracks(VALUE self)
|
188
139
|
{
|
189
|
-
VALUE
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
track_t first_track_num;
|
196
|
-
track_t num_tracks;
|
197
|
-
first_track_num = cdio_get_first_track_num(p_cdio);
|
198
|
-
num_tracks = cdio_get_num_tracks(p_cdio);
|
199
|
-
// printf("C->Primera pista: %d\n",first_track_num);
|
200
|
-
// printf("C->Numero pistas: %d\n",num_tracks);
|
201
|
-
int j,
|
202
|
-
i = first_track_num;
|
203
|
-
for (j = 0; j < num_tracks; i++, j++) {
|
204
|
-
rb_ary_push(aTracks, get_track(self, i));
|
140
|
+
VALUE tracks = rb_iv_get(self, "@tracks");
|
141
|
+
if (tracks == Qnil) {
|
142
|
+
VALUE argv[1];
|
143
|
+
argv[0] = self;
|
144
|
+
tracks = rb_class_new_instance(1, argv, cCdIoTracks);
|
145
|
+
rb_iv_set(self, "@tracks", tracks);
|
205
146
|
}
|
206
|
-
return
|
147
|
+
return tracks;
|
207
148
|
}
|
208
149
|
|
209
150
|
/**
|
@@ -233,7 +174,8 @@ VALUE
|
|
233
174
|
rb_cdio_cd_is_cd(VALUE obj)
|
234
175
|
{
|
235
176
|
GET_CDIO(obj, p_cdio);
|
236
|
-
return (
|
177
|
+
return (cdio_is_discmode_cdrom(cdio_get_discmode(p_cdio))) ? Qtrue :
|
178
|
+
Qfalse;
|
237
179
|
}
|
238
180
|
|
239
181
|
/**
|
@@ -243,10 +185,11 @@ VALUE
|
|
243
185
|
rb_cdio_cd_is_dvd(VALUE obj)
|
244
186
|
{
|
245
187
|
GET_CDIO(obj, p_cdio);
|
246
|
-
return (
|
188
|
+
return (cdio_is_discmode_dvd(cdio_get_discmode(p_cdio))) ? Qtrue :
|
189
|
+
Qfalse;
|
247
190
|
}
|
248
191
|
|
249
|
-
static
|
192
|
+
static VALUE
|
250
193
|
_get_freedb(VALUE obj)
|
251
194
|
{
|
252
195
|
rb_require("freedb");
|
@@ -256,7 +199,7 @@ _get_freedb(VALUE obj)
|
|
256
199
|
rb_iv_get(obj, "@device"));
|
257
200
|
}
|
258
201
|
|
259
|
-
static
|
202
|
+
static VALUE
|
260
203
|
_get_freedb_error(VALUE obj, VALUE error_info)
|
261
204
|
{
|
262
205
|
rb_raise(rb_eLoadError,
|
@@ -326,3 +269,13 @@ rb_cdio_cd_get_cdtext(VALUE obj)
|
|
326
269
|
const cdtext_t *cdtext = cdio_get_cdtext(p_cdio, 0);
|
327
270
|
return get_cdtext(cdtext);
|
328
271
|
}
|
272
|
+
|
273
|
+
VALUE
|
274
|
+
rb_cdio_cd_eject(VALUE obj)
|
275
|
+
{
|
276
|
+
GET_CDIO(obj, p_cdio);
|
277
|
+
verify_return_code(cdio_eject_media(&p_cdio));
|
278
|
+
rb_gc_start();
|
279
|
+
obj = Qnil;
|
280
|
+
return Qtrue;
|
281
|
+
}
|