Skip to content

Commit

Permalink
Version 1.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
audiamus committed Nov 1, 2020
1 parent 147fcdd commit b1a9943
Show file tree
Hide file tree
Showing 17 changed files with 478 additions and 442 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ The application requires .Net Framework 4.7.1 to be installed. On Windows 10 sys
AAX Audio Converter is configured to support high DPI monitors under Windows 10. It will scale properly when the user changes the DPI or scale factor.

## Download
Windows setup package version 1.15, English and German, with manuals, plus FFmpeg executable:
Windows setup package version 1.15.1, English and German, with manuals, plus FFmpeg executable:

**[AaxAudioConverter-1.15-Setup.exe](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15/AaxAudioConverter-1.15-Setup.exe)**
**[AaxAudioConverter-1.15.1-Setup.exe](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15.1/AaxAudioConverter-1.15.1-Setup.exe)**

Manuals (also included in the setup package):

**[English](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15/AaxAudioConverter.pdf)**
**[English](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15.1/AaxAudioConverter.pdf)**

**[German](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15/AaxAudioConverter.de.pdf)**
**[German](https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15.1/AaxAudioConverter.de.pdf)**


## Dependencies
Expand Down
4 changes: 2 additions & 2 deletions res/Setup.dat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15/AaxAudioConverter-1.15-Setup.exe
MD5: b93df488203e0c04fbd69f3206522359
https://github.com/audiamus/AaxAudioConverter/releases/download/v1.15.1/AaxAudioConverter-1.15.1-Setup.exe
MD5: 88515ace13cc6c0184684bd937cf0d7b
Binary file modified src/AaxAudioConverter/AaxAudioConverter.de.odt
Binary file not shown.
318 changes: 142 additions & 176 deletions src/AaxAudioConverter/AaxAudioConverter.latest.de.rtf

Large diffs are not rendered by default.

425 changes: 195 additions & 230 deletions src/AaxAudioConverter/AaxAudioConverter.latest.rtf

Large diffs are not rendered by default.

Binary file modified src/AaxAudioConverter/AaxAudioConverter.odt
Binary file not shown.
4 changes: 2 additions & 2 deletions src/AaxAudioConverter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// 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.15.0.0")]
[assembly: AssemblyFileVersion ("1.15.0.0")]
[assembly: AssemblyVersion ("1.15.1.0")]
[assembly: AssemblyFileVersion ("1.15.1.0")]
[assembly: NeutralResourcesLanguage ("en")]

82 changes: 74 additions & 8 deletions src/AaxAudioConverterLib/AaxAudioConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ private void detectSilenceChapterParallel (Book.Part part, string filestub) {
ProgressInfo.ProgressInfoChapterCancel (book.TitleTag, ch)
}))) {

string filename = $"{filestub} - {part.PartNumber}.{i}{ext}";
string filename = $"{filestub} - {part.ChapterId(chapter)}{ext}";
chapter.TmpFileName = Path.Combine (TempDirectoryLong, filename);

// Extract chapter to temp file
Expand Down Expand Up @@ -1695,10 +1695,26 @@ private bool transcodeTrackMulti (Book.Part part, Track track, string inFile, FF
string actcode = null;
if (withActivationCode)
actcode = part.ActivationCode;
if (Settings.ConvFormat == EConvFormat.mp3)
return transcodeTrackMultiWithChapter (part, track, inFile, modifiers, actcode, threadProg);
else
return transcodeTrackMulti (part, track, inFile, modifiers, actcode, threadProg);
}

private bool transcodeTrackMultiWithChapter (Book.Part part, Track track, string inFile, FFmpeg.ETranscode modifiers, string actcode, ThreadProgress threadProg) {
string metafile = ffmpegChapters (part, track);
if (metafile is null)
return false;

FFmpeg ffmpeg = new FFmpeg (inFile, metafile) {
Cancel = Callbacks.Cancel,
Progress = threadProg.Report
};

return transcodeTrackMulti (part, track, inFile, modifiers, actcode, threadProg);
return transcodeTrack (ffmpeg, modifiers, actcode, track.Time, track.FileName);
}


private bool transcodeTrackMulti (Book.Part part, Track track, string inFile, FFmpeg.ETranscode modifiers, string actcode, ThreadProgress threadProg) {
FFmpeg ffmpeg = new FFmpeg (inFile) {
Cancel = Callbacks.Cancel,
Expand All @@ -1708,6 +1724,7 @@ private bool transcodeTrackMulti (Book.Part part, Track track, string inFile, FF
return transcodeTrack (ffmpeg, modifiers, actcode, track.Time, track.FileName);
}


private bool transcodeTrackSingle (Book.Part part, string inFile, string outFile, FFmpeg.ETranscode modifiers, ThreadProgress threadProg) {
if (part.Chapters is null || part.Chapters.Count == 0)
return false;
Expand All @@ -1724,15 +1741,62 @@ private bool transcodeTrackSingle (Book.Part part, string inFile, string outFile
if (intermediateCopy) {
return makeIntermediateCopy (part, inFile, outFile, modifiers, tim, threadProg);
} else {
FFmpeg ffmpeg = new FFmpeg (inFile) {
Cancel = Callbacks.Cancel,
Progress = threadProg.Report
};
return transcodeTrack (ffmpeg, modifiers, part.ActivationCode, tim, outFile);
if (Settings.ConvFormat == EConvFormat.mp3)
return transcodeTrackSingleWithChapters (part, inFile, outFile, modifiers, threadProg, tim);
else
return transcodeTrackSingle (part, inFile, outFile, modifiers, threadProg, tim);
}

}

private bool transcodeTrackSingleWithChapters (Book.Part part, string inFile, string outFile, FFmpeg.ETranscode modifiers, ThreadProgress threadProg, TimeInterval tim) {
string metafile = ffmpegChapters (part, part.Tracks.FirstOrDefault());
if (metafile is null)
return false;

FFmpeg ffmpeg = new FFmpeg (inFile, metafile) {
Cancel = Callbacks.Cancel,
Progress = threadProg.Report
};
return transcodeTrack (ffmpeg, modifiers, part.ActivationCode, tim, outFile);
}

private bool transcodeTrackSingle (Book.Part part, string inFile, string outFile, FFmpeg.ETranscode modifiers, ThreadProgress threadProg, TimeInterval tim) {
FFmpeg ffmpeg = new FFmpeg (inFile) {
Cancel = Callbacks.Cancel,
Progress = threadProg.Report
};
return transcodeTrack (ffmpeg, modifiers, part.ActivationCode, tim, outFile);
}

private string ffmpegChapters (Book.Part part, Track track) {
if (track is null)
return null;

IEnumerable<Chapter> chapters = null;
switch (Settings.ConvMode) {
case EConvMode.single:
chapters = part.Chapters2;
break;
default:
chapters = track.MetaChapters;
break;
}

// unique filename required
string metafile = Path.GetFileNameWithoutExtension (track.FileName) + $" ({part.TrackId(track)}) meta.txt";
metafile = Path.Combine (TempDirectoryLong, metafile);

var ffmetadata = new FFMetaData (chapters);
bool succ = ffmetadata.Write (metafile);
Log (3, this, () => $"ffmetafile=\"{metafile.SubstitUser ()}\", #chapters={ffmetadata.Chapters.Count}, succ={succ}");
if (!succ)
return null;

return metafile;
}


private bool makeIntermediateCopy (Book.Part part, string inFile, string outFile, FFmpeg.ETranscode modifiers, TimeInterval tim, ThreadProgress threadProg) {
Log (3, this, () => $"out=\"{outFile.SubstitUser ()}\"");

Expand Down Expand Up @@ -1802,7 +1866,9 @@ private void getContentMetadata (Book.Part part) {

private bool updateTags (Book book, Track track) {
bool succ = TagAndFileNamingHelper.WriteMetaData (Resources, Settings, book, track);
succ = succ && TagAndFileNamingHelper.WriteMetaDataChapters (Resources, Settings, book, track);

if (Settings.ConvFormat == EConvFormat.mp4)
succ = succ && TagAndFileNamingHelper.WriteMetaDataChapters (Resources, Settings, book, track);

Log (3, this, () => $"track=\"{track.Title}\" \"{Path.GetFileName(track.FileName)}\", succ={succ}");
return succ;
Expand Down
4 changes: 2 additions & 2 deletions src/AaxAudioConverterLib/AaxAudioConverterLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="ATL, Version=3.12.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\z440.atl.core.3.12.0\lib\net45\ATL.dll</HintPath>
<Reference Include="ATL, Version=3.13.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\z440.atl.core.3.13.0\lib\net45\ATL.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
6 changes: 6 additions & 0 deletions src/AaxAudioConverterLib/Book.Part.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public void SwapChapters () {
_namedChaptersNotIn2 = !_namedChaptersNotIn2;
}

public string TrackId (Track track) =>
$"{PartNumber}.{Tracks?.IndexOf(track)+1}";
public string ChapterId (Chapter chapter) =>
$"{PartNumber}.{Chapters?.IndexOf(chapter)+1}";


public void SetMetaChapters (IConvSettings settings) {
switch (settings.ConvMode) {
case EConvMode.chapters:
Expand Down
6 changes: 4 additions & 2 deletions src/AaxAudioConverterLib/FFMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using audiamus.aux.ex;
using static audiamus.aux.Logging;

namespace audiamus.aaxconv.lib {

Expand Down Expand Up @@ -62,9 +62,11 @@ public bool Read (string filename) {
public bool Write (string filename) {
if (Chapters is null || Chapters.Count == 0)
return false;
Log (3, this, $"\"{filename.SubstitUser ()}\": #chapters={Chapters.Count ()}");
using (var osm = new StreamWriter (filename)) {
osm.WriteLine (FFMETADATA);
foreach (var ch in Chapters) {
Log (3, this, ch.ToString ());
osm.WriteLine (CHAPTER);
osm.WriteLine ($"{Tags[0]}=1/1000");
osm.WriteLine ($"{Tags[1]}={(int)ch.Time.Begin.TotalMilliseconds}");
Expand Down
15 changes: 13 additions & 2 deletions src/AaxAudioConverterLib/FFmpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public enum ETranscode {
bool _success;
bool _error;
bool _aborted;
bool _matchedDuration;

bool _listComplete;
#endregion
Expand Down Expand Up @@ -167,6 +168,7 @@ public bool VerifyActivation (string actBytes, bool withChapters = false) {
public bool Transcode (string filenameOut, ETranscode modifiers, string actBytes = null, TimeSpan? from = null, TimeSpan? to = null) {
_success = false;
_aborted = false;
_matchedDuration = false;
AudioMeta.Time.Duration = TimeSpan.Zero;

string param = FFMPEG_TRANSCODE;
Expand Down Expand Up @@ -230,6 +232,7 @@ public bool ExtractMeta (string filenameOut) {
public bool DetectSilence (string actBytes = null) {
_success = false;
_aborted = false;
_matchedDuration = false;
AudioMeta.Time.Duration = TimeSpan.Zero;
Silences = new List<TimeInterval> ();

Expand Down Expand Up @@ -464,15 +467,20 @@ private void ffMpegAsyncHandlerSilence (object sendingProcess, DataReceivedEvent
#endif
Log (4, this, () => ID + outLine.Data.SubstitUser ());

if (_success)
return;

var t = AudioMeta.Time;

Match match;
if (t.Duration == TimeSpan.Zero) {
if (!_matchedDuration) {

match = _rgxDuration.Match (outLine.Data);
if (match.Success) {
TimeSpan duration = tryParseTimestamp (match);
t.Duration = duration;

_matchedDuration = true;
}

} else {
Expand Down Expand Up @@ -509,9 +517,11 @@ private void ffMpegAsyncHandlerSilence (object sendingProcess, DataReceivedEvent
match = _rgxTimestamp1.Match (outLine.Data);

if (!match.Success) {

match = _rgxMuxFinal.Match (outLine.Data);
if (match.Success)
_success = true;

return;

}
Expand Down Expand Up @@ -552,9 +562,10 @@ private void ffMpegAsyncHandlerTranscode (object sendingProcess, DataReceivedEve
matchTs = _rgxTimestamp2.Match (outLine.Data);
if (!matchTs.Success) {

if (t.Duration == TimeSpan.Zero) {
if (!_matchedDuration) {
Match matchDur = _rgxDuration.Match (outLine.Data);
if (matchDur.Success) {
_matchedDuration = true;
TimeSpan duration = tryParseTimestamp (matchDur);
if (t.Begin == TimeSpan.Zero)
t.Duration = duration;
Expand Down
4 changes: 2 additions & 2 deletions src/AaxAudioConverterLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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.15.0.0")]
[assembly: AssemblyFileVersion ("1.15.0.0")]
[assembly: AssemblyVersion ("1.15.1.0")]
[assembly: AssemblyFileVersion ("1.15.1.0")]
2 changes: 1 addition & 1 deletion src/AaxAudioConverterLib/TagAndFileNamingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ private bool writeMetaDataChapters () {
ATL.Settings.MP4_createNeroChapters = true;
ATL.Settings.MP4_createQuicktimeChapters = true;
ATL.Settings.FileBufferSize = 2_000_000;
ATL.Settings.ForceDiskIO = true;
//ATL.Settings.ForceDiskIO = true;

tagFile.Chapters.Clear ();

Expand Down
38 changes: 29 additions & 9 deletions src/AaxAudioConverterLib/ThreadProgress.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,60 @@
using System;
using System.Diagnostics;
//using static audiamus.aux.Logging;
#define xEXTRA

using System;
#if EXTRA
using static audiamus.aux.Logging;
#endif

namespace audiamus.aaxconv.lib {

class ThreadProgress : IDisposable {
#if EXTRA
const int LVL = 3;

private static int __id = 0;
private readonly int _id = ++__id;

private string ID => $"{{#{_id}}} ";
#endif

const int _1000 = 1000;
readonly Action<ProgressMessage> _report;

private int _valuePerMille;

public ThreadProgress (Action<ProgressMessage> report) {
#if EXTRA
Log (LVL, this, () => ID);
#endif
_report = report;
}

public void Dispose () {
//Log0 (3, this);
#if EXTRA
Log (LVL, this, () => ID);
#endif
int inc = _1000 - _valuePerMille;
if (inc > 0) {
#if TRACE && EXTRA
Trace.WriteLine ($"{this.GetType ().Name}.{nameof (Dispose)} {inc}");
#if EXTRA
Log (LVL, this, () => $"{ID}{inc}");
#endif
_report?.Invoke (new ProgressMessage {
IncStepsPerMille = (uint)inc
IncStepsPerMille = (uint)inc
});
}
}

public void Report (double value) {
#if EXTRA
Log (LVL, this, () => $"{ID}val={value}");
#endif
int val = (int)(value * _1000);
int total = Math.Min (_1000, val);
int inc = total - _valuePerMille;
_valuePerMille = total;
if (inc > 0) {
#if TRACE && EXTRA
Trace.WriteLine ($"{this.GetType ().Name}.{nameof (Report)} {value:f3}->{inc}");
#if EXTRA
Log (LVL, this, () => $"{ID}{inc}");
#endif
_report?.Invoke (new ProgressMessage {
IncStepsPerMille = (uint)inc
Expand Down
2 changes: 1 addition & 1 deletion src/AaxAudioConverterLib/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net471" />
<package id="TagLibSharp" version="2.2.0" targetFramework="net471" />
<package id="z440.atl.core" version="3.12.0" targetFramework="net471" />
<package id="z440.atl.core" version="3.13.0" targetFramework="net471" />
</packages>
2 changes: 1 addition & 1 deletion src/InnoSetup/AaxAudioConverter setup.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppSetupName 'AAX Audio Converter'
#define MyAppVersion '1.15'
#define MyAppVersion '1.15.1'
#define MyProgramExe = 'AaxAudioConverter.exe'
#define MyCompany = 'audiamus'

Expand Down

0 comments on commit b1a9943

Please sign in to comment.