Removed AudioEncoderSettings/AudioDecoderSettings classes, all of their functionality is now in IAudioEncoderSettings/IAudioDecoderSettings interfaces.

This commit is contained in:
Grigory Chudov
2018-03-25 17:24:27 -04:00
parent 50fcd93ab9
commit 320e75d709
98 changed files with 5274 additions and 4863 deletions

View File

@@ -51,7 +51,7 @@ namespace CUETools.Processor
{
IAudioDest dest;
if (audioEncoderType == AudioEncoderType.NoAudio || extension == ".dummy")
return new Codecs.NULL.AudioEncoder(path, new AudioEncoderSettings(pcm)) { FinalSampleCount = finalSampleCount };
return new Codecs.NULL.AudioEncoder(path, new Codecs.WAV.EncoderSettings(pcm)) { FinalSampleCount = finalSampleCount };
CUEToolsFormat fmt;
if (!extension.StartsWith(".") || !config.formats.TryGetValue(extension.Substring(1), out fmt))
throw new Exception("Unsupported audio type: " + path);

View File

@@ -422,7 +422,7 @@ namespace CUETools.Processor
.FindAll(y => y.Extension == x.Extension && y.Lossless == x.Lossless && y.Name == x.Name).Count == 0)
.ToList().ForEach(x => advanced.encoders.Add(x));
backup.decoders.Where(x => advanced.decoders
.FindAll(y => y.Extension == x.Extension && y.Lossless == x.Lossless && y.Name == x.Name).Count == 0)
.FindAll(y => y.Extension == x.Extension && y.Name == x.Name).Count == 0)
.ToList().ForEach(x => advanced.decoders.Add(x));
// Reset the ViewModel
@@ -439,8 +439,8 @@ namespace CUETools.Processor
encoderLossless = Encoders.GetDefault(extension, true);
if (format.encoderLossy == null || !Encoders.TryGetValue(extension, false, format.encoderLossy.Name, out encoderLossy))
encoderLossy = Encoders.GetDefault(extension, false);
if (format.decoder == null || !Decoders.TryGetValue(extension, true, format.decoder.Name, out decoder))
decoder = Decoders.GetDefault(extension, true);
if (format.decoder == null || !Decoders.TryGetValue(extension, format.decoder.Name, out decoder))
decoder = Decoders.GetDefault(extension);
format.encoderLossless = encoderLossless;
format.encoderLossy = encoderLossy;
format.decoder = decoder;
@@ -471,8 +471,8 @@ namespace CUETools.Processor
udcLossless = Encoders.GetDefault(extension, true);
if (encoderLossy == "" || !Encoders.TryGetValue(extension, false, encoderLossy, out udcLossy))
udcLossy = Encoders.GetDefault(extension, false);
if (decoder == "" || !Decoders.TryGetValue(extension, true, decoder, out udcDecoder))
udcDecoder = Decoders.GetDefault(extension, true);
if (decoder == "" || !Decoders.TryGetValue(extension, decoder, out udcDecoder))
udcDecoder = Decoders.GetDefault(extension);
if (!formats.TryGetValue(extension, out format))
formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowEmbed, false, udcLossless, udcLossy, udcDecoder));
else

View File

@@ -11,8 +11,8 @@ namespace CUETools.Processor
{
public static class CUEProcessorPlugins
{
public static List<AudioEncoderSettings> encs;
public static List<AudioDecoderSettings> decs;
public static List<IAudioEncoderSettings> encs;
public static List<IAudioDecoderSettings> decs;
public static List<Type> arcp;
public static List<string> arcp_fmt;
public static Type hdcd;
@@ -20,8 +20,8 @@ namespace CUETools.Processor
static CUEProcessorPlugins()
{
encs = new List<AudioEncoderSettings>();
decs = new List<AudioDecoderSettings>();
encs = new List<IAudioEncoderSettings>();
decs = new List<IAudioDecoderSettings>();
arcp = new List<Type>();
arcp_fmt = new List<string>();
@@ -68,13 +68,13 @@ namespace CUETools.Processor
try
{
if (!type.IsClass || type.IsAbstract) continue;
if (type.GetInterface(typeof(IAudioDecoderSettings).Name) != null && type != typeof(AudioDecoderSettings))
if (type.GetInterface(typeof(IAudioDecoderSettings).Name) != null)
{
decs.Add(Activator.CreateInstance(type) as AudioDecoderSettings);
decs.Add(Activator.CreateInstance(type) as IAudioDecoderSettings);
}
if (type.GetInterface(typeof(IAudioEncoderSettings).Name) != null && type != typeof(AudioEncoderSettings))
if (type.GetInterface(typeof(IAudioEncoderSettings).Name) != null)
{
encs.Add(Activator.CreateInstance(type) as AudioEncoderSettings);
encs.Add(Activator.CreateInstance(type) as IAudioEncoderSettings);
}
CompressionProviderClass archclass = Attribute.GetCustomAttribute(type, typeof(CompressionProviderClass)) as CompressionProviderClass;
if (archclass != null)

View File

@@ -11,7 +11,7 @@ namespace CUETools.Processor
private long nextPos;
private long _samplePos, _sampleLen;
public AudioDecoderSettings Settings { get { return null; } }
public IAudioDecoderSettings Settings => null;
public long Length
{