From e08e86fea5b24d7d361cb2c663720afab91ab81e Mon Sep 17 00:00:00 2001 From: chudov Date: Fri, 1 Apr 2011 21:34:11 +0000 Subject: [PATCH] EAC plugin for CTDB --- .../CUETools.CTDB.EACPlugin.csproj | 90 ++++++ .../Interop.HelperFunctionsLib.dll | Bin 0 -> 16384 bytes CUETools.CTDB.EACPlugin/Options.Designer.cs | 88 ++++++ CUETools.CTDB.EACPlugin/Options.cs | 19 ++ CUETools.CTDB.EACPlugin/Options.resx | 120 ++++++++ CUETools.CTDB.EACPlugin/Plugin.cs | 291 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++ CUETools.CTDB.EACPlugin/app.config | 3 + 8 files changed, 647 insertions(+) create mode 100644 CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj create mode 100644 CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll create mode 100644 CUETools.CTDB.EACPlugin/Options.Designer.cs create mode 100644 CUETools.CTDB.EACPlugin/Options.cs create mode 100644 CUETools.CTDB.EACPlugin/Options.resx create mode 100644 CUETools.CTDB.EACPlugin/Plugin.cs create mode 100644 CUETools.CTDB.EACPlugin/Properties/AssemblyInfo.cs create mode 100644 CUETools.CTDB.EACPlugin/app.config diff --git a/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj b/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj new file mode 100644 index 0000000..d4da4c6 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj @@ -0,0 +1,90 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {816D964C-9772-46C5-AF1D-49E8C78A1E7C} + Library + Properties + CUETools.CTDB.EACPlugin + CUETools.CTDB.EACPlugin + v2.0 + 512 + + + + + true + full + false + ..\bin\Debug\interop\EAC\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\Release\interop\EAC\ + TRACE + prompt + 4 + + + + False + .\Interop.HelperFunctionsLib.dll + + + + + + + + + + + Form + + + Options.cs + + + + + + Options.cs + + + + + {5802C7E9-157E-4124-946D-70B5AE48A5A1} + CUETools.AccurateRip + + + {1DD41038-D885-46C5-8DDE-E0B82F066584} + CUETools.CDImage + + + {6458A13A-30EF-45A9-9D58-E5031B17BEE2} + CUETools.Codecs + + + {AA2A9A7E-45FB-4632-AD85-85B0E556F818} + CUETools.CTDB + + + + + + + + \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll b/CUETools.CTDB.EACPlugin/Interop.HelperFunctionsLib.dll new file mode 100644 index 0000000000000000000000000000000000000000..d23a5097d4d8c394e37be73d95446af6afb0d6aa GIT binary patch literal 16384 zcmeZ`n!v!!z`(%5z`*eTKLf)K1_*F~Pi0=SlGeO)95&^j%L^CX4U|?VZvly5e z99kI|1i%PP2tdT46qpkd&cFaN8f5MUP(Xl1k%$Hc1|B3X(M$yf1`Z^}9108!9!Pw> zlGKV41_p*L=1_lu{0en9Oql`$LxNsWaZxe@0|VG?Aisk=Y6VjPp&b|)9Q2A(bMlj+ zZUsdQ$SgaEJdAW;U~q!5Ve|yB=OJ!mVqj$mP+(wSF=t?4gef4Ab_(`#Vub1jgXLpA4)FISdR8UlbV_luU|=X?U|=X?Nz z8TpWSQ&4zIP_fRm5;#)&TBy7EkNNNM&>a- zXB9%y$IB+eU<@}!mraJj1kUqeQ)MuP^YT!5?I^q@$UMdaZ2Cz0?y<=*fD1oR?qK9% z*9TW?;JD>9W0zro6y~5<31PQlu!h@L%r3)V1LsX-mtnAl^VYMgGC&GyX$7-w_nGl0rmh&y+2$S}CU_1)o6 zWpIb_7&$rZk$AeC_Rx9`|$ zDTBnj#wo)P0GE5hX~hr-=Y8S~X9$Axc({;x$|yW*6kZrtG?Kn7E>(tLxG5D}3P`*O zT&fHqaJhwCTu8iKT;fQ)OI-R4p>UNSx%46J3uqKNQ3h} zbITxjyrB9a9VW*Msvi(MQ2l`5f$9f1j}=ruzc;XF|NP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rnJ#sDbXO1F`3U z*pMO*#6`idy>}>r4DrtSMJ_oxzKNN6kTJ#7R9M-`@L!cd0kXFPRS&gzkX$UmzyMin z4mTF!K?5w}ASIxEjS&e93?blD2ND6XLHlUJ7=jt%8NwJ`8G;ys89W*M8T=UH89W*M z7~G&cI`*=>{|6cUh3vY6uo)QaA;y4HE2N}@3NSD*fcB*@GK4WCG88emF=R62Fr+eg zGUPF&F+kS&tAKTdFcdK)GUPE7GvqKNGL$f6GUPKr_6XE7Y+%{K1hOfZp@gA`A(J7G zAsvfJ6ToT=7z`N98PXUG7)%(Fz`Kz^E5;ZZoEh>Nav5?NQW^3XN*F+!7eUdi0-jBV z$Q6L?uVnCJNCc|``2eIw2doC>auowo4B(i7A%X!kYX}OB60q7lhD3%OBo`oL@)-&k^cXxCQW3czaJ7)lxP7?R;` zC}!|s$Yg-*wA28**@q#OAsuWY$cF_Cm0(w=Gh{G;c1nQU3-KF59V8Y~7*ZK>!SR(1 z4k^g?-3$hK21W*ds2QMG0J#+wE+ChKLYDy?w-DbD?`A!Q6owoIaEpUs3WF5`BSQc~ z5ko#h3PUN_hsbf_$WY8s40d4>Lk>eFg91Y)LoP!BLq0 + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(139, 13); + this.label1.TabIndex = 0; + this.label1.Text = "CUETools DB Plugin V2.1.1"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(12, 71); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(260, 52); + this.label2.TabIndex = 1; + this.label2.Text = "Copyright (c) 2011 Gregory S. Chudov"; + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(12, 39); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(111, 13); + this.linkLabel1.TabIndex = 3; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "http://db.cuetools.net"; + // + // Options + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 124); + this.Controls.Add(this.linkLabel1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Options"; + this.ShowIcon = false; + this.Text = "Options"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.LinkLabel linkLabel1; + } +} \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/Options.cs b/CUETools.CTDB.EACPlugin/Options.cs new file mode 100644 index 0000000..0138db5 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/Options.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + + +namespace AudioDataPlugIn +{ + public partial class Options : Form + { + public Options() + { + InitializeComponent(); + } + } +} diff --git a/CUETools.CTDB.EACPlugin/Options.resx b/CUETools.CTDB.EACPlugin/Options.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/CUETools.CTDB.EACPlugin/Options.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/Plugin.cs b/CUETools.CTDB.EACPlugin/Plugin.cs new file mode 100644 index 0000000..654d7d7 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/Plugin.cs @@ -0,0 +1,291 @@ +using System; +using System.Collections.Generic; +using System.Text; +using HelperFunctionsLib; +using System.Runtime.InteropServices; +using System.Reflection; +using System.Net; +using System.IO; +using CUETools.CDImage; +using CUETools.AccurateRip; +using CUETools.Codecs; +using CUETools.CTDB; + +namespace AudioDataPlugIn +{ + [Guid("C02A1BF2-5C46-4990-80C2-78E8C395CB80"), + ClassInterface(ClassInterfaceType.None), + ComSourceInterfaces(typeof(IAudioDataTransfer)), + ] + + // Our class needs to inherit the IAudioDataTransfer in + // order to be found by EAC, further the class needs + // to be named AudioDataTransfer and must be in the + // namespace AudioDataPlugIn + + public class AudioDataTransfer : IAudioDataTransfer + { + int m_start_pos = 0, m_length = 0; + bool m_test_mode = false; + IMetadataLookup m_data = null; + CDImageLayout TOC; + string ArId; + AccurateRipVerify ar; + CUEToolsDB ctdb; + bool sequence_ok = true; + bool is_accurate; + string m_drivename; + + + // This functions just returns an unique identifier. + // For that, the string representation of the unique + // guid is used + + public string GetAudioTransferPluginGuid() + { + // Determine the guid attribute of the given class + + Attribute attrib = Attribute.GetCustomAttribute(typeof(AudioDataTransfer), typeof(GuidAttribute)); + + // Is the returned attribute a GuidAttribute as + // we asked for? + + if (attrib is GuidAttribute) + { + // Yes, so return the guid of this class + + return ((GuidAttribute)attrib).Value; + } + else + { + // No, something went wrong. Just return + // the name of the plugin and hope that it + // is unique + + return GetAudioTransferPluginName(); + } + } + + + + // Each plugin has also an (unique) display name + // which will be used for selecting/deselecting + // the plugin and for display in the log file + + public string GetAudioTransferPluginName() + { + // Return the name which should be + // displayed in EAC and in the log file + // including a version number + + return "CUETools DB Plugin V2.1.1"; + } + + + + // Each plugin should have its own options page. + // Even though if there are no options, a help or + // information dialog should be displayed + + public void ShowOptions() + { + // Create a new option dialog object + + Options opt = new Options(); + + // And show that dialog (return when + // the dialog is closed) + + opt.ShowDialog(); + } + + + + // Now to the audio transfer functions, the sequence how + // the functions are called is: + // StartNewSession + // StartNewTransfer + // TransferAudio + // ... + // TransferAudio + // TransferFinshed + // Then perhaps repeating StartNewTransfer to TransferFinished + // (e.g. when extracting several tracks), and finally + // EndOfSession + // This is called just before the log window will be + // shown. You can return a log output in that stage (or + // even display a window of your own - even though it should + // not annoy the user) + + // StartNewSession is called once at the very beginning of an + // extraction session. It receives the CD metadata, the + // name of the used drive, the used read offset and whether + // the offset was setted by AccurateRip (so having a comparable + // offset value) + + public void StartNewSession(IMetadataLookup data, string drivename, int offset, bool aroffset) + { + // Copy the CD metadata to the object + m_data = data; + m_drivename = drivename; + TOC = new CDImageLayout(); + for (int i = 0; i < m_data.NumberOfTracks; i++) + { + uint start = m_data.GetTrackStartPosition(i); + uint next; + if (i < m_data.NumberOfTracks - 1) + { + next = m_data.GetTrackStartPosition(i + 1); + if (!m_data.GetTrackDataTrack(i) && m_data.GetTrackDataTrack(i + 1)) + next -= 152 * 75; + } else + next = m_data.LeadoutPosition; + TOC.AddTrack(new CDTrack( + (uint)i + 1, + start, + next - start, + !m_data.GetTrackDataTrack(i), + m_data.GetTrackPreemphasis(i))); + } + TOC[1][0].Start = 0U; + ArId = AccurateRipVerify.CalculateAccurateRipId(TOC); + ar = new AccurateRipVerify(TOC, null); + ctdb = new CUEToolsDB(TOC, null); + ar.ContactAccurateRip(ArId); + ctdb.ContactDB("EAC 1.0 CTDB 2.1.1: " + m_drivename); + ctdb.Init(true, ar); + this.sequence_ok = true; + this.m_start_pos = 0; + this.m_length = 0; + this.m_test_mode = false; + this.is_accurate = aroffset; // TODO: && not a virtual drive && not a burst mode!!!! + } + + // This function will be called once per session. A session + // is e.g. a file on a real extraction (or the equivalent + // for test extractions). It receives the sector startpos + // the length in sectors and whether the extraction is performed + // in test mode + + public void StartNewTransfer(int startpos, int length, bool testmode) + { + // Copy the current parameters to the objects variables + m_start_pos = startpos - (int)TOC[TOC.FirstAudio][0].Start; + m_length = length; + m_test_mode = testmode; + if (this.sequence_ok) + { + if (this.m_start_pos * 588 != ar.Position) + this.sequence_ok = false; + } + } + + + // This function received the extracted (and + // uncompressed/unmodified audio data), but no WAV + // header. If you want to write out the WAV file + // you need to generate one yourself. It will be always + // 44.1 kHz, stereo 16 bit samples (so 4 bytes per + // stereo sample) + + public void TransferAudioData(Array audiodata) + { + if (!this.m_test_mode && this.sequence_ok) + { + byte[] ad = (byte[])audiodata; + AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, ad, ad.Length / 4); + ar.Write(buff); + } + } + + + + // This function is called after a transfer has finished. + // We don't do here anything, because a track can be delivered + // in several transfers (index extraction) and as AccurateRip + // is only (full) track based, we don't do anything... + + public void TransferFinished() + { + if (this.sequence_ok) + { + if ((m_start_pos + m_length) * 588 != ar.Position) + this.sequence_ok = false; + } + } + + + // The extraction has finished, the log dialog will + // be shown soon, so we can return a string which will + // be displayed in the log window and be written to + // the log file. Anyway, you could also return just + // an empty string, in that case no log output will be done! + public string EndOfSession() + { + StringWriter sw = new StringWriter(); + if (this.sequence_ok) + { + if (TOC.AudioLength * 588 != ar.Position) + this.sequence_ok = false; + } + if (!this.sequence_ok) + return ""; + if (this.sequence_ok) + { + int rippingErrorsCount = 0; // TODO: !!! + DBEntry confirm = null; + if ((ctdb.AccResult == HttpStatusCode.NotFound || ctdb.AccResult == HttpStatusCode.OK) + && this.is_accurate && rippingErrorsCount == 0) + { + foreach (DBEntry entry in ctdb.Entries) + if (entry.toc.TrackOffsets == TOC.TrackOffsets && !entry.hasErrors) + confirm = entry; + + if (confirm != null) + ctdb.Confirm(confirm); + else + ctdb.Submit( + (int)ar.WorstConfidence() + 1, + (int)ar.WorstTotal() + 1, + m_data.AlbumArtist, + m_data.AlbumTitle); + } + sw.WriteLine("[CTDB TOCID: {0}] {1}.", TOC.TOCID, ctdb.DBStatus ?? "found"); + if (ctdb.SubStatus != null && confirm == null) + sw.WriteLine("Submit result: {0}.", ctdb.SubStatus); + foreach (DBEntry entry in ctdb.Entries) + { + string confFormat = (ctdb.Total < 10) ? "{0:0}/{1:0}" : + (ctdb.Total < 100) ? "{0:00}/{1:00}" : "{0:000}/{1:000}"; + string conf = string.Format(confFormat, entry.conf, ctdb.Total); + string dataTrackInfo = !entry.toc[entry.toc.TrackCount].IsAudio ? string.Format("CD-Extra data track length {0}", entry.toc[entry.toc.TrackCount].LengthMSF) : + !entry.toc[1].IsAudio ? string.Format("Playstation type data track length {0}", entry.toc[1].LengthMSF) : "Has no data track"; + string status = + entry.toc.Pregap != TOC.Pregap ? string.Format("Has pregap length {0}", CDImageLayout.TimeToString(entry.toc.Pregap)) : + entry.toc.AudioLength != TOC.AudioLength ? string.Format("Has audio length {0}", CDImageLayout.TimeToString(entry.toc.AudioLength)) : + ((entry.toc.TrackOffsets != TOC.TrackOffsets) ? dataTrackInfo + ", " : "") + + ((!entry.hasErrors) ? "Accurately ripped" : + //((!entry.hasErrors) ? string.Format("Accurately ripped, offset {0}", -entry.offset) : + entry.canRecover ? string.Format("Differs in {0} samples @{1}", entry.repair.CorrectableErrors, entry.repair.AffectedSectors) : + (entry.httpStatus == 0 || entry.httpStatus == HttpStatusCode.OK) ? "No match" : + entry.httpStatus.ToString()); + sw.WriteLine("[{0:x8}] ({1}) {2}{3}", entry.crc, conf, status, entry != confirm || ctdb.SubStatus == null ? "" : (", Submit result: " + ctdb.SubStatus)); + } + bool canFix = false; + if (ctdb.AccResult == HttpStatusCode.OK && rippingErrorsCount != 0) + { + foreach (DBEntry entry in ctdb.Entries) + if (entry.hasErrors && entry.canRecover) + canFix = true; + } + if (canFix) + sw.WriteLine("You can use CUETools to repair this rip."); + + //ar.GenerateFullLog(sw, true, ArId); + } + else + sw.WriteLine("Some tracks have been skipped"); + return sw.ToString(); + } + } +} diff --git a/CUETools.CTDB.EACPlugin/Properties/AssemblyInfo.cs b/CUETools.CTDB.EACPlugin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..75a6da9 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CUETools.CTDB.EACPlugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CUETools.CTDB.EACPlugin")] +[assembly: AssemblyCopyright("Copyright © Gregory S. Chudov 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a8b718f7-3c33-4d04-9606-264ce30fe056")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CUETools.CTDB.EACPlugin/app.config b/CUETools.CTDB.EACPlugin/app.config new file mode 100644 index 0000000..b7db281 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/app.config @@ -0,0 +1,3 @@ + + +