mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Renamed CUETools.Codecs.BLDLPCM into CUETools.Codecs.MPEG
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using CUETools.Codecs.MPEG;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
namespace CUETools.Codecs.MPEG.BDLPCM
|
||||
{
|
||||
public class AudioDecoder : IAudioSource
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
namespace CUETools.Codecs.MPEG.BDLPCM
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class DecoderSettings : IAudioDecoderSettings
|
||||
@@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net40;net20;netstandard2.0</TargetFrameworks>
|
||||
<Version>2.1.7.0</Version>
|
||||
<AssemblyName>CUETools.Codecs.BDLPCM</AssemblyName>
|
||||
<RootNamespace>CUETools.Codecs</RootNamespace>
|
||||
<AssemblyName>CUETools.Codecs.MPEG</AssemblyName>
|
||||
<RootNamespace>CUETools.Codecs.MPEG</RootNamespace>
|
||||
<Product>CUETools</Product>
|
||||
<Description>A library for encoding and decoding BluRay Disc LPCM audio.</Description>
|
||||
<Copyright>Copyright (c) 2008-2018 Grigory Chudov</Copyright>
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
namespace CUETools.Codecs.MPEG
|
||||
{
|
||||
internal unsafe class FrameReader
|
||||
{
|
||||
@@ -1,19 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
namespace CUETools.Codecs.MPEG.MPLS
|
||||
{
|
||||
public class MPLSDecoder : IAudioSource
|
||||
public class AudioDecoder : IAudioSource
|
||||
{
|
||||
public unsafe MPLSDecoder(string path, Stream IO, ushort pid)
|
||||
: this(new MPLS.DecoderSettings() { StreamId = pid }, path, IO)
|
||||
public unsafe AudioDecoder(string path, Stream IO, ushort pid)
|
||||
: this(new DecoderSettings() { StreamId = pid }, path, IO)
|
||||
{
|
||||
}
|
||||
|
||||
public unsafe MPLSDecoder(MPLS.DecoderSettings settings, string path, Stream IO)
|
||||
public unsafe AudioDecoder(DecoderSettings settings, string path, Stream IO)
|
||||
{
|
||||
m_settings = settings;
|
||||
_path = path;
|
||||
@@ -23,7 +22,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
if (_IO.Read(contents, 0, length) != length) throw new Exception("");
|
||||
fixed (byte* ptr = &contents[0])
|
||||
{
|
||||
FrameReader fr = new FrameReader(ptr, length);
|
||||
var fr = new FrameReader(ptr, length);
|
||||
hdr_m = parseHeader(fr);
|
||||
fr = new FrameReader(ptr + hdr_m.list_pos, length - hdr_m.list_pos);
|
||||
parsePlaylist(fr);
|
||||
@@ -34,7 +33,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
|
||||
void openEntries()
|
||||
{
|
||||
readers = new List<AudioDecoder>();
|
||||
readers = new List<BDLPCM.AudioDecoder>();
|
||||
var pids = new List<int>();
|
||||
foreach (var item in hdr_m.play_item)
|
||||
foreach (var audio in item.audio)
|
||||
@@ -68,7 +67,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 AudioDecoder(m2ts, null, chosenPid);
|
||||
var entry = new BDLPCM.AudioDecoder(m2ts, null, chosenPid);
|
||||
readers.Add(entry);
|
||||
break;
|
||||
}
|
||||
@@ -97,7 +96,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
void parsePlaylist(FrameReader parentFr)
|
||||
{
|
||||
uint len = parentFr.read_uint();
|
||||
FrameReader fr = new FrameReader(parentFr, len);
|
||||
var fr = new FrameReader(parentFr, len);
|
||||
parentFr.skip(len);
|
||||
ushort reserved = fr.read_ushort();
|
||||
hdr_m.list_count = fr.read_ushort();
|
||||
@@ -109,7 +108,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
void parsePlaylistMarks(FrameReader parentFr)
|
||||
{
|
||||
uint len = parentFr.read_uint();
|
||||
FrameReader fr = new FrameReader(parentFr, len);
|
||||
var fr = new FrameReader(parentFr, len);
|
||||
parentFr.skip(len);
|
||||
hdr_m.mark_count = fr.read_ushort();
|
||||
for (int ii = 0; ii < hdr_m.mark_count; ii++)
|
||||
@@ -125,7 +124,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
|
||||
// PlayItem Length
|
||||
ushort len = parentFr.read_ushort();
|
||||
FrameReader fr = new FrameReader(parentFr, len);
|
||||
var fr = new FrameReader(parentFr, len);
|
||||
parentFr.skip(len);
|
||||
|
||||
// Primary Clip identifer
|
||||
@@ -195,7 +194,7 @@ namespace CUETools.Codecs.BDLPCM
|
||||
MPLSStream s = new MPLSStream();
|
||||
|
||||
byte len = parentFr.read_byte();
|
||||
FrameReader fr = new FrameReader(parentFr, len);
|
||||
var fr = new FrameReader(parentFr, len);
|
||||
parentFr.skip(len);
|
||||
|
||||
s.stream_type = fr.read_byte();
|
||||
@@ -435,10 +434,10 @@ namespace CUETools.Codecs.BDLPCM
|
||||
byte[] contents;
|
||||
|
||||
AudioPCMConfig pcm;
|
||||
List<AudioDecoder> readers;
|
||||
AudioDecoder currentReader;
|
||||
List<BDLPCM.AudioDecoder> readers;
|
||||
BDLPCM.AudioDecoder currentReader;
|
||||
MPLSHeader hdr_m;
|
||||
MPLS.DecoderSettings m_settings;
|
||||
DecoderSettings m_settings;
|
||||
}
|
||||
|
||||
public struct MPLSPlaylistMark
|
||||
@@ -4,7 +4,7 @@ using System.ComponentModel;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CUETools.Codecs.MPLS
|
||||
namespace CUETools.Codecs.MPEG.MPLS
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class DecoderSettings : IAudioDecoderSettings
|
||||
@@ -17,7 +17,7 @@ namespace CUETools.Codecs.MPLS
|
||||
public string Name => "cuetools";
|
||||
|
||||
[Browsable(false)]
|
||||
public Type DecoderType => typeof(BDLPCM.MPLSDecoder);
|
||||
public Type DecoderType => typeof(AudioDecoder);
|
||||
|
||||
[Browsable(false)]
|
||||
public int Priority => 2;
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CUETools.Codecs.BDLPCM
|
||||
namespace CUETools.Codecs.MPEG
|
||||
{
|
||||
internal class TsStream
|
||||
{
|
||||
@@ -111,4 +111,13 @@ namespace CUETools.Codecs.ffmpegdll
|
||||
this.Init();
|
||||
}
|
||||
}
|
||||
public class MpegDecoderSettings : DecoderSettings, IAudioDecoderSettings
|
||||
{
|
||||
public override string Extension => "aob";
|
||||
public override string Format => "mpeg";
|
||||
public MpegDecoderSettings()
|
||||
{
|
||||
this.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ namespace CUETools.Codecs
|
||||
formats.Add("ogg", new CUEToolsFormat("ogg", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encodersViewModel.GetDefault("ogg", false), null));
|
||||
formats.Add("opus", new CUEToolsFormat("opus", CUEToolsTagger.TagLibSharp, false, true, false, true, null, encodersViewModel.GetDefault("opus", false), null));
|
||||
formats.Add("mlp", new CUEToolsFormat("mlp", CUEToolsTagger.APEv2, true, false, false, false, null, null, decodersViewModel.GetDefault("mlp")));
|
||||
formats.Add("aob", new CUEToolsFormat("aob", CUEToolsTagger.APEv2, true, false, false, false, null, null, decodersViewModel.GetDefault("aob")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<ProjectReference Include="..\CUETools.Codecs\CUETools.Codecs.csproj" />
|
||||
<ProjectReference Include="..\CUETools.Processor\CUETools.Processor.csproj" />
|
||||
<ProjectReference Include="..\CUETools.CTDB\CUETools.CTDB.csproj" />
|
||||
<ProjectReference Include="..\CUETools.Codecs.BDLPCM\CUETools.Codecs.BDLPCM.csproj" />
|
||||
<ProjectReference Include="..\CUETools.Codecs.MPEG\CUETools.Codecs.MPEG.csproj" />
|
||||
<ProjectReference Include="..\CUETools.CDImage\CUETools.CDImage.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using CUETools.CDImage;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.Codecs.BDLPCM;
|
||||
using CUETools.CTDB;
|
||||
using CUETools.Processor;
|
||||
using System;
|
||||
@@ -124,8 +123,8 @@ namespace CUETools.eac3to
|
||||
{
|
||||
IAudioSource audioSource = null;
|
||||
IAudioDest audioDest = null;
|
||||
var videos = new List<MPLSStream>();
|
||||
var audios = new List<MPLSStream>();
|
||||
var videos = new List<Codecs.MPEG.MPLS.MPLSStream>();
|
||||
var audios = new List<Codecs.MPEG.MPLS.MPLSStream>();
|
||||
List<uint> chapters;
|
||||
TimeSpan duration;
|
||||
TagLib.UserDefined.AdditionalFileTypes.Config = config;
|
||||
@@ -136,7 +135,7 @@ namespace CUETools.eac3to
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
var mpls = new MPLSDecoder(new Codecs.MPLS.DecoderSettings(), sourceFile, null);
|
||||
var mpls = new Codecs.MPEG.MPLS.AudioDecoder(new Codecs.MPEG.MPLS.DecoderSettings(), sourceFile, null);
|
||||
audioSource = mpls;
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
int frameRate = 0;
|
||||
@@ -310,14 +309,14 @@ namespace CUETools.eac3to
|
||||
|
||||
throw new Exception("Unknown encoder format: " + destFile);
|
||||
}
|
||||
if (audioSource is MPLSDecoder)
|
||||
if (audioSource is Codecs.MPEG.MPLS.AudioDecoder)
|
||||
{
|
||||
if (stream - chapterStreams <= videos.Count)
|
||||
throw new Exception("Video extraction not supported.");
|
||||
if (stream - chapterStreams - videos.Count > audios.Count)
|
||||
throw new Exception(string.Format("The source file doesn't contain a track with the number {0}.", stream));
|
||||
int pid = audios[stream - chapterStreams - videos.Count - 1].pid;
|
||||
(audioSource.Settings as Codecs.MPLS.DecoderSettings).StreamId = pid;
|
||||
(audioSource.Settings as Codecs.MPEG.MPLS.DecoderSettings).StreamId = pid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,9 +105,9 @@
|
||||
<Project>{1dd41038-d885-46c5-8dde-e0b82f066584}</Project>
|
||||
<Name>CUETools.CDImage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CUETools.Codecs.BDLPCM\CUETools.Codecs.BDLPCM.csproj">
|
||||
<ProjectReference Include="..\CUETools.Codecs.MPEG\CUETools.Codecs.MPEG.csproj">
|
||||
<Project>{e75f7ccd-4266-42e1-a039-dc7eb5edd8f6}</Project>
|
||||
<Name>CUETools.Codecs.BDLPCM</Name>
|
||||
<Name>CUETools.Codecs.MPEG</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CUETools.Codecs.Flake\CUETools.Codecs.Flake.csproj">
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CUETools.CDImage;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.CTDB;
|
||||
using CUETools.Processor;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
//using System.Windows.Shapes;
|
||||
using CUETools.Codecs.BDLPCM;
|
||||
using CUETools.CDImage;
|
||||
using CUETools.CTDB;
|
||||
using System.ComponentModel;
|
||||
using Krystalware.UploadHelper;
|
||||
using CUETools.Codecs;
|
||||
//using CUETools.Codecs.Flake;
|
||||
using CUETools.Processor;
|
||||
using System.Collections.ObjectModel;
|
||||
//using Microsoft.Win32;
|
||||
|
||||
namespace BluTools
|
||||
{
|
||||
@@ -75,7 +64,7 @@ namespace BluTools
|
||||
|
||||
private void textBoxSource_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
var titleSets = new List<MPLSDecoder>();
|
||||
var titleSets = new List<CUETools.Codecs.MPEG.MPLS.AudioDecoder>();
|
||||
IEnumerable<string> playlists = null;
|
||||
try
|
||||
{
|
||||
@@ -87,7 +76,7 @@ namespace BluTools
|
||||
if (playlists != null)
|
||||
foreach (var playlist in playlists)
|
||||
{
|
||||
var title = new MPLSDecoder(new CUETools.Codecs.MPLS.DecoderSettings(), playlist, null);
|
||||
var title = new CUETools.Codecs.MPEG.MPLS.AudioDecoder(new CUETools.Codecs.MPEG.MPLS.DecoderSettings(), playlist, null);
|
||||
if (filterDups)
|
||||
{
|
||||
if (titleSets.Exists(title2 =>
|
||||
@@ -125,10 +114,10 @@ namespace BluTools
|
||||
cmbMetadata.ItemsSource = new List<CTDBResponseMeta>();
|
||||
ctdb = null;
|
||||
|
||||
var audios = new List<MPLSStream>();
|
||||
var audios = new List<CUETools.Codecs.MPEG.MPLS.MPLSStream>();
|
||||
if (e.AddedItems.Count == 1)
|
||||
{
|
||||
MPLSDecoder rdr = e.AddedItems[0] as MPLSDecoder;
|
||||
var rdr = e.AddedItems[0] as CUETools.Codecs.MPEG.MPLS.AudioDecoder;
|
||||
rdr.MPLSHeader.play_item.ForEach(i => i.audio.ForEach(v => { if (!audios.Exists(v1 => v1.pid == v.pid)) audios.Add(v); }));
|
||||
|
||||
var chapters = rdr.Chapters;
|
||||
@@ -190,7 +179,7 @@ namespace BluTools
|
||||
{
|
||||
if (e.AddedItems.Count == 1)
|
||||
{
|
||||
MPLSStream stream = (MPLSStream)(e.AddedItems[0]);
|
||||
CUETools.Codecs.MPEG.MPLS.MPLSStream stream = (CUETools.Codecs.MPEG.MPLS.MPLSStream)(e.AddedItems[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +189,7 @@ namespace BluTools
|
||||
BackgroundWorker workerExtract;
|
||||
CUEMetadataEntry metaresult;
|
||||
ObservableCollection<CUEMetadataEntry> metaresults;
|
||||
MPLSDecoder chosenReader;
|
||||
CUETools.Codecs.MPEG.MPLS.AudioDecoder chosenReader;
|
||||
ushort pid;
|
||||
string outputFolderPath;
|
||||
string outputAudioPath;
|
||||
@@ -213,8 +202,8 @@ namespace BluTools
|
||||
private void buttonExtract_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (cmbTitleSet.SelectedItem == null) return;
|
||||
pid = ((MPLSStream)cmbAudioTrack.SelectedItem).pid;
|
||||
chosenReader = cmbTitleSet.SelectedItem as MPLSDecoder;
|
||||
pid = ((CUETools.Codecs.MPEG.MPLS.MPLSStream)cmbAudioTrack.SelectedItem).pid;
|
||||
chosenReader = cmbTitleSet.SelectedItem as CUETools.Codecs.MPEG.MPLS.AudioDecoder;
|
||||
metaresult = cmbMetadata.SelectedItem as CUEMetadataEntry;
|
||||
outputFolderPath = Path.Combine(textBoxDestination.Text, metaresult != null ?
|
||||
metaresult.metadata.Artist + " - " + metaresult.metadata.Year + " - " + metaresult.metadata.Title :
|
||||
@@ -239,10 +228,10 @@ namespace BluTools
|
||||
|
||||
void workerExtract_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
MPLSDecoder reader = null;
|
||||
CUETools.Codecs.MPEG.MPLS.AudioDecoder reader = null;
|
||||
try
|
||||
{
|
||||
reader = new MPLSDecoder(chosenReader.Path, null, pid);
|
||||
reader = new CUETools.Codecs.MPEG.MPLS.AudioDecoder(chosenReader.Path, null, pid);
|
||||
Directory.CreateDirectory(outputFolderPath);
|
||||
if (File.Exists(outputCuePath)) throw new Exception(string.Format("File \"{0}\" already exists", outputCuePath));
|
||||
if (File.Exists(outputAudioPath)) throw new Exception(string.Format("File \"{0}\" already exists", outputAudioPath));
|
||||
|
||||
@@ -163,7 +163,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsMediaLib", "..\Third
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUETools.Codecs.WMA", "..\CUETools.Codecs.WMA\CUETools.Codecs.WMA.csproj", "{082D6B9E-326E-4D15-9798-DE70A6EDAE9E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUETools.Codecs.BDLPCM", "..\CUETools.Codecs.BDLPCM\CUETools.Codecs.BDLPCM.csproj", "{E75F7CCD-4266-42E1-A039-DC7EB5EDD8F6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUETools.Codecs.BDLPCM", "..\CUETools.Codecs.MPEG\CUETools.Codecs.MPEG.csproj", "{E75F7CCD-4266-42E1-A039-DC7EB5EDD8F6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CUETools.eac3to", "..\CUETools.eac3to\CUETools.eac3to.csproj", "{E3FF7539-6B22-4922-8FEF-6D26F2C2E3CE}"
|
||||
EndProject
|
||||
|
||||
Reference in New Issue
Block a user