mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Removed AudioEncoderSettings/AudioDecoderSettings classes, all of their functionality is now in IAudioEncoderSettings/IAudioDecoderSettings interfaces.
This commit is contained in:
@@ -4,6 +4,8 @@ using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using CUETools.Codecs;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
//Copyright (c) 2008 Grigory Chudov.
|
||||
//This library is based on ALAC decoder by David Hammerton.
|
||||
@@ -27,17 +29,32 @@ using CUETools.Codecs;
|
||||
|
||||
namespace CUETools.Codecs.ALAC
|
||||
{
|
||||
public class DecoderSettings : AudioDecoderSettings
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class DecoderSettings : IAudioDecoderSettings
|
||||
{
|
||||
public override string Extension => "m4a";
|
||||
#region IAudioDecoderSettings implementation
|
||||
[Browsable(false)]
|
||||
public string Extension => "m4a";
|
||||
|
||||
public override string Name => "cuetools";
|
||||
[Browsable(false)]
|
||||
public string Name => "cuetools";
|
||||
|
||||
public override Type DecoderType => typeof(AudioDecoder);
|
||||
[Browsable(false)]
|
||||
public Type DecoderType => typeof(AudioDecoder);
|
||||
|
||||
public override int Priority => 2;
|
||||
[Browsable(false)]
|
||||
public int Priority => 2;
|
||||
|
||||
public DecoderSettings() : base() { }
|
||||
public IAudioDecoderSettings Clone()
|
||||
{
|
||||
return MemberwiseClone() as IAudioDecoderSettings;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public DecoderSettings()
|
||||
{
|
||||
this.Init();
|
||||
}
|
||||
}
|
||||
|
||||
public class AudioDecoder : IAudioSource
|
||||
@@ -73,7 +90,7 @@ namespace CUETools.Codecs.ALAC
|
||||
}
|
||||
|
||||
private DecoderSettings m_settings;
|
||||
public AudioDecoderSettings Settings => m_settings;
|
||||
public IAudioDecoderSettings Settings => m_settings;
|
||||
|
||||
private void InitTables()
|
||||
{
|
||||
|
||||
@@ -35,26 +35,59 @@ using Newtonsoft.Json;
|
||||
namespace CUETools.Codecs.ALAC
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class EncoderSettings: AudioEncoderSettings
|
||||
public class EncoderSettings: IAudioEncoderSettings
|
||||
{
|
||||
public override string Extension => "m4a";
|
||||
#region IAudioEncoderSettings implementation
|
||||
[Browsable(false)]
|
||||
public string Extension => "m4a";
|
||||
|
||||
public override string Name => "cuetools";
|
||||
[Browsable(false)]
|
||||
public string Name => "cuetools";
|
||||
|
||||
public override Type EncoderType => typeof(AudioEncoder);
|
||||
[Browsable(false)]
|
||||
public Type EncoderType => typeof(AudioEncoder);
|
||||
|
||||
public override int Priority => 1;
|
||||
[Browsable(false)]
|
||||
public bool Lossless => true;
|
||||
|
||||
public override bool Lossless => true;
|
||||
[Browsable(false)]
|
||||
public int Priority => 1;
|
||||
|
||||
[Browsable(false)]
|
||||
public string SupportedModes => "0 1 2 3 4 5 6 7 8 9 10";
|
||||
|
||||
[Browsable(false)]
|
||||
public string DefaultMode => "5";
|
||||
|
||||
[Browsable(false)]
|
||||
[DefaultValue("")]
|
||||
[JsonProperty]
|
||||
public string EncoderMode { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public AudioPCMConfig PCM { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public int BlockSize { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
[DefaultValue(4096)]
|
||||
public int Padding { get; set; }
|
||||
|
||||
public IAudioEncoderSettings Clone()
|
||||
{
|
||||
return MemberwiseClone() as IAudioEncoderSettings;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public EncoderSettings()
|
||||
: base("0 1 2 3 4 5 6 7 8 9 10", "5")
|
||||
{
|
||||
this.Init();
|
||||
}
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (EncoderModeIndex < 0
|
||||
if (this.GetEncoderModeIndex() < 0
|
||||
|| Padding < 0
|
||||
|| (BlockSize != 0 && (BlockSize < 256 || BlockSize >= Int32.MaxValue)))
|
||||
throw new Exception("unsupported encoder settings");
|
||||
@@ -140,7 +173,7 @@ namespace CUETools.Codecs.ALAC
|
||||
windowType = new WindowFunction[lpc.MAX_LPC_WINDOWS];
|
||||
windowSections = new LpcWindowSection[lpc.MAX_LPC_WINDOWS, lpc.MAX_LPC_SECTIONS];
|
||||
|
||||
eparams.set_defaults(m_settings.EncoderModeIndex);
|
||||
eparams.set_defaults(m_settings.GetEncoderModeIndex());
|
||||
|
||||
frame = new ALACFrame(Settings.PCM.ChannelCount == 2 ? 5 : Settings.PCM.ChannelCount);
|
||||
chunk_pos = new List<int>();
|
||||
@@ -161,13 +194,7 @@ namespace CUETools.Codecs.ALAC
|
||||
|
||||
EncoderSettings m_settings;
|
||||
|
||||
public AudioEncoderSettings Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
}
|
||||
public IAudioEncoderSettings Settings => m_settings;
|
||||
|
||||
#if INTEROP
|
||||
[DllImport("kernel32.dll")]
|
||||
|
||||
Reference in New Issue
Block a user