mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Code cleanup; Reader classes renamed to Decoders, Writers to Encoders, every Decoder must have a corresponding Settings class now just like Encoders. UserDefinedEncoders renamed to CommandLineEncoders, etc.
This commit is contained in:
@@ -5,16 +5,29 @@ using System.IO;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
{
|
||||
[AudioDecoderClass("cuetools", "m2ts", 2)]
|
||||
public class BDLPCMReader : IAudioSource
|
||||
public class DecoderSettings : AudioDecoderSettings
|
||||
{
|
||||
public unsafe BDLPCMReader(string path, Stream IO, ushort pid)
|
||||
public override string Extension => "m2ts";
|
||||
|
||||
public override string Name => "cuetools";
|
||||
|
||||
public override Type DecoderType => typeof(AudioDecoder);
|
||||
|
||||
public override int Priority => 2;
|
||||
|
||||
public DecoderSettings() : base() { }
|
||||
}
|
||||
|
||||
[AudioDecoderClass(typeof(DecoderSettings))]
|
||||
public class AudioDecoder : IAudioSource
|
||||
{
|
||||
public unsafe AudioDecoder(string path, Stream IO, ushort pid)
|
||||
: this(path, IO)
|
||||
{
|
||||
settings.Pid = pid;
|
||||
}
|
||||
|
||||
public unsafe BDLPCMReader(string path, Stream IO)
|
||||
public unsafe AudioDecoder(string path, Stream IO)
|
||||
{
|
||||
_path = path;
|
||||
_IO = IO != null ? IO : new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 0x10000);
|
||||
@@ -24,7 +37,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
_samplePos = 0;
|
||||
_sampleLen = -1;
|
||||
demux_ts_packets(null, 0);
|
||||
settings = new BDLPCMReaderSettings();
|
||||
settings = new BDLPCMDecoderSettings();
|
||||
}
|
||||
|
||||
public AudioDecoderSettings Settings { get { return settings; } }
|
||||
@@ -736,6 +749,6 @@ namespace CUETools.Codecs.BDLPCM
|
||||
int demuxer_channel;
|
||||
TsStream chosenStream;
|
||||
long _samplePos, _sampleLen;
|
||||
BDLPCMReaderSettings settings;
|
||||
BDLPCMDecoderSettings settings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
{
|
||||
public class BDLPCMReaderSettings : AudioDecoderSettings
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class BDLPCMDecoderSettings : AudioDecoderSettings
|
||||
{
|
||||
public BDLPCMReaderSettings()
|
||||
public BDLPCMDecoderSettings()
|
||||
{
|
||||
IgnoreShortItems = true;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool IgnoreShortItems { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public int? Stream { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public ushort? Pid { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,18 +6,31 @@ using System.Globalization;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
{
|
||||
[AudioDecoderClass("cuetools", "mpls", 2)]
|
||||
public class MPLSReader : IAudioSource
|
||||
public class MPLSDecoderSettings : AudioDecoderSettings
|
||||
{
|
||||
public unsafe MPLSReader(string path, Stream IO, ushort pid)
|
||||
public override string Extension => "mpls";
|
||||
|
||||
public override string Name => "cuetools";
|
||||
|
||||
public override Type DecoderType => typeof(MPLSDecoder);
|
||||
|
||||
public override int Priority => 2;
|
||||
|
||||
public MPLSDecoderSettings() : base() { }
|
||||
}
|
||||
|
||||
[AudioDecoderClass(typeof(MPLSDecoderSettings))]
|
||||
public class MPLSDecoder : IAudioSource
|
||||
{
|
||||
public unsafe MPLSDecoder(string path, Stream IO, ushort pid)
|
||||
: this(path, IO)
|
||||
{
|
||||
settings.Pid = pid;
|
||||
}
|
||||
|
||||
public unsafe MPLSReader(string path, Stream IO)
|
||||
public unsafe MPLSDecoder(string path, Stream IO)
|
||||
{
|
||||
settings = new BDLPCMReaderSettings();
|
||||
settings = new BDLPCMDecoderSettings();
|
||||
_path = path;
|
||||
_IO = IO != null ? IO : new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 0x10000);
|
||||
int length = (int)_IO.Length;
|
||||
@@ -36,7 +49,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
|
||||
void openEntries()
|
||||
{
|
||||
readers = new List<BDLPCMReader>();
|
||||
readers = new List<AudioDecoder>();
|
||||
var pids = new List<ushort>();
|
||||
foreach (var item in hdr_m.play_item)
|
||||
foreach (var audio in item.audio)
|
||||
@@ -70,7 +83,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
var m2ts = System.IO.Path.Combine(
|
||||
System.IO.Path.Combine(parent.FullName, "STREAM"),
|
||||
item.clip_id + ".m2ts");
|
||||
var entry = new BDLPCMReader(m2ts, null, chosenPid);
|
||||
var entry = new AudioDecoder(m2ts, null, chosenPid);
|
||||
readers.Add(entry);
|
||||
break;
|
||||
}
|
||||
@@ -437,10 +450,10 @@ namespace CUETools.Codecs.BDLPCM
|
||||
byte[] contents;
|
||||
|
||||
AudioPCMConfig pcm;
|
||||
List<BDLPCMReader> readers;
|
||||
BDLPCMReader currentReader;
|
||||
List<AudioDecoder> readers;
|
||||
AudioDecoder currentReader;
|
||||
MPLSHeader hdr_m;
|
||||
BDLPCMReaderSettings settings;
|
||||
BDLPCMDecoderSettings settings;
|
||||
}
|
||||
|
||||
public struct MPLSPlaylistMark
|
||||
|
||||
Reference in New Issue
Block a user