Date: Mon, 28 Jan 2002 15:14:26 -0800 From: Lars Eggert <larse@ISI.EDU> To: Oyvind Moll <oyvindmo@orakel.ntnu.no> Cc: multimedia@FreeBSD.ORG, sos@freebsd.dk, simon.quinn@bigfoot.com Subject: ripit patch [Was: Re: BCP: CD ripping] Message-ID: <3C55DB52.5020104@isi.edu> References: <200201282005.g0SK5D207776@freebsd.dk> <3C55B66B.7000708@isi.edu> <20020128215203.A31299@orakel.ntnu.no>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format. --------------ms080904070409080102010205 Content-Type: multipart/mixed; boundary="------------040902010009040104090803" This is a multi-part message in MIME format. --------------040902010009040104090803 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Oyvind Moll wrote: > | If this is the new preferred method for CDDA extraction, I'll probably > | submit a ripit patch for this if I get it to work. > > Please do :-) (...said the audio/ripit maintainer.) Attached. It was very straightforward. I'm also CC'ing the author (Simon Quinn), in case he'd like to incorporate it into his tree. In summary: The attached patch adds a new ripping scheme to ripit. It uses capabilities of FreeBSD's ATAPI driver (4.4-RELEASE and higher) to directly extract CDDA without 3rd-party tools. Tested on 4.4-RELEASE with lame as an encoder. It's not the most beautiful code, but hey. Lars -- Lars Eggert <larse@isi.edu> Information Sciences Institute http://www.isi.edu/larse/ University of Southern California --------------040902010009040104090803 Content-Type: text/plain; name="ripit.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ripit.patch" --- /usr/local/bin/ripit.pl Fri Jan 18 12:47:51 2002 +++ ripit.pl Mon Jan 28 15:06:15 2002 @@ -25,6 +25,7 @@ # --numcpu [cpus] - Number of parallel encoders to run # # Version 2.0 20/08/01 - Simon Quinn +# Ripping via FreeBSD's "dd" command - Lars Eggert <larse@isi.edu> # # Usage: ripit.pl [--halt] [--bitrate rate] [--year year] [--genre genre] # [--device cddevice] [--encopt options] [--encoder encoder] @@ -43,7 +44,8 @@ $encopt = ""; # options for mp3 encoder $cdripper = 0; # 0 - dagrab, # 1 - cdparanoia, 2 - cdda2wav, - # 3 - tosha, 4 - cdd + # 3 - tosha, 4 - cdd, + # 5 - dd (FreeBSD-4.4 and higher) $cdopt = ""; # options for cdaudio ripper $numcpu = 1; # Number of parallel encoders to run @@ -110,7 +112,7 @@ [--device cddevice] [--encopt options] [--encoder encoder] [--cdripper cdripper] [--cdopt options] [--outputdir dir] [--numcpu cpus] [start_track] -Rippers: 0 - dagrab, 1 - cdparanoia, 2 - cdda2wav, 3 - tosha, 4 - cdd +Rippers: 0 - dagrab, 1 - cdparanoia, 2 - cdda2wav, 3 - tosha, 4 - cdd, 5 - dd Encoders: 0 - Lame, 1 - Gogo, 2 - OggVorbis "; exit 1; @@ -391,6 +393,33 @@ &printflush(RIPLOG,"cdd failed on $tracklist[$_ - 1]\n"); kill 1, @encoders; die "cdd failed on $tracklist[$_ - 1]"; + } + } + elsif ($cdripper == 5) { + # Rip via FreeBSD's "dd" command and the associated CDDA devices + # under /dev. Requires 4.4-RELEASE or higher. + my $cdd_dev = $cddev; + if ($cdd_dev =~ /^\/dev\/(.*)/) { $cdd_dev = $1; } + die "dd extraction only works with ATAPI devices" unless $cddev =~ /acd/; + # See if the device corresponding to the track already exists... + my $trackdev = $cdd_dev; + $trackdev =~ s/(.*)c/$1/; + $trackdev .= "t$riptrackno"; + unless (-b "/dev/$trackdev") { + # ...no, it doesn't. Create it. + &printflush(RIPLOG, "CDDA track device /dev/$trackdev, doesn't ". + "exist, creating...\n"); + my $cwd = `pwd`; + chdir "/dev"; + system("sh MAKEDEV $trackdev") == 0 or die "cannot make $trackdev"; + chdir $cwd; + } + # Ready to extract the data. Also do endian conversion. + if (system("dd if=/dev/$trackdev conv=swab bs=2352 ". + "of=\"$riptrackname.rip\" 2> /dev/null")) { + &printflush(RIPLOG,"cdd failed on $tracklist[$_ - 1]\n"); + kill 1, @encoders; + die "cannot rip track $riptrackno"; } } else { --------------040902010009040104090803-- --------------ms080904070409080102010205 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIInzCC ArUwggIeoAMCAQICAwWBRzANBgkqhkiG9w0BAQIFADCBkjELMAkGA1UEBhMCWkExFTATBgNV BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUx HTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVl bWFpbCBSU0EgMjAwMC44LjMwMB4XDTAxMDgyNDE2NDAwMFoXDTAyMDgyNDE2NDAwMFowVDEP MA0GA1UEBBMGRWdnZXJ0MQ0wCwYDVQQqEwRMYXJzMRQwEgYDVQQDEwtMYXJzIEVnZ2VydDEc MBoGCSqGSIb3DQEJARYNbGFyc2VAaXNpLmVkdTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC gYEA0AvLBsD78nxcUHeHkaMgl3b4qYPnfgbf8Lh+HQP8RgGMRG/Yb+vTpkGezlwt9pkJxiD1 1uZDy4CNNJUu3gKxKSb+zRV70O+lkwwftuHoLHoH4xwo3LcQ2LGDpd+I95tUN4dfJ3TmeEcU SF50dC/SuUI4w8AlhXQ8IxrhgdayTpECAwEAAaNWMFQwKgYFK2UBBAEEITAfAgEAMBowGAIB BAQTTDJ1TXlmZkJOVWJOSkpjZFoyczAYBgNVHREEETAPgQ1sYXJzZUBpc2kuZWR1MAwGA1Ud EwEB/wQCMAAwDQYJKoZIhvcNAQECBQADgYEAheZhn0pQA8zI7U2K1ZIAl11j0a1DKxnp3GtT vOUrGRB3WvYxidvdZ1kizhEsWeXU81TkNDH0DaRqtOEeu6Q2OhB+jeKEqY7IDAJE4/fI0e+d 6PnG1hd+vEvYmsKHkmzBhPc94XUOKNWO+qVNP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QBgNVBAcT CUNhcGUgVG93bjEPMA0GA1UEChMGVGhhd3RlMR0wGwYDVQQLExRDZXJ0aWZpY2F0ZSBTZXJ2 aWNlczEoMCYGA1UEAxMfUGVyc29uYWwgRnJlZW1haWwgUlNBIDIwMDAuOC4zMAIDBYFHMAkG BSsOAwIaBQCgggFhMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8X DTAyMDEyODIzMTQyNlowIwYJKoZIhvcNAQkEMRYEFGb/NKmNOGLAwAYWtcte3qzUuNpDMFIG CSqGSIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMC AgFAMAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMIGtBgsqhkiG9w0BCRACCzGBnaCBmjCBkjEL MAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3du MQ8wDQYDVQQKEwZUaGF3dGUxHTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYD VQQDEx9QZXJzb25hbCBGcmVlbWFpbCBSU0EgMjAwMC44LjMwAgMFgUcwDQYJKoZIhvcNAQEB BQAEgYC41jNQJWSdHKZYGywdzPNw+sQakUMgKRaeMqrKpSTDtlTZmmePg3U7BXclCF9U7il8 QvCQKse4Wq+dtzmsbu/+VlRfUlrillpk9Z6Mxa0g+tsZA+oMfUJV4udJGtCYl5vJhNr+VIR5 icNZDCI3bmoOpSswwCpsWGYbf6dBlondGwAAAAAAAA== --------------ms080904070409080102010205-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C55DB52.5020104>