Fixed typo and minor formatting.
This commit is contained in:
parent
f0eb57a40b
commit
82e3854c84
@ -50,6 +50,7 @@ namespace AaxDecrypter
|
|||||||
private StepSequence steps { get; }
|
private StepSequence steps { get; }
|
||||||
private DownloadLicense downloadLicense { get; set; }
|
private DownloadLicense downloadLicense { get; set; }
|
||||||
private FFMpegAaxcProcesser aaxcProcesser;
|
private FFMpegAaxcProcesser aaxcProcesser;
|
||||||
|
|
||||||
public static async Task<AaxcDownloadConverter> CreateAsync(string outDirectory, DownloadLicense dlLic, ChapterInfo chapters = null)
|
public static async Task<AaxcDownloadConverter> CreateAsync(string outDirectory, DownloadLicense dlLic, ChapterInfo chapters = null)
|
||||||
{
|
{
|
||||||
var converter = new AaxcDownloadConverter(outDirectory, dlLic, chapters);
|
var converter = new AaxcDownloadConverter(outDirectory, dlLic, chapters);
|
||||||
@ -170,22 +171,19 @@ namespace AaxDecrypter
|
|||||||
private void AaxcProcesser_ProgressUpdate(object sender, TimeSpan e)
|
private void AaxcProcesser_ProgressUpdate(object sender, TimeSpan e)
|
||||||
{
|
{
|
||||||
double averageRate = getAverageProcessRate(e);
|
double averageRate = getAverageProcessRate(e);
|
||||||
|
|
||||||
double remainingSecsToProcess = (aaxcTagLib.Properties.Duration - e).TotalSeconds;
|
double remainingSecsToProcess = (aaxcTagLib.Properties.Duration - e).TotalSeconds;
|
||||||
|
|
||||||
double estTimeRemaining = remainingSecsToProcess / averageRate;
|
double estTimeRemaining = remainingSecsToProcess / averageRate;
|
||||||
|
|
||||||
if (double.IsNormal(estTimeRemaining))
|
if (double.IsNormal(estTimeRemaining))
|
||||||
DecryptTimeRemaining?.Invoke(this, TimeSpan.FromSeconds(estTimeRemaining));
|
DecryptTimeRemaining?.Invoke(this, TimeSpan.FromSeconds(estTimeRemaining));
|
||||||
|
|
||||||
|
|
||||||
double progressPercent = 100 * e.TotalSeconds / aaxcTagLib.Properties.Duration.TotalSeconds;
|
double progressPercent = 100 * e.TotalSeconds / aaxcTagLib.Properties.Duration.TotalSeconds;
|
||||||
|
|
||||||
DecryptProgressUpdate?.Invoke(this, (int)progressPercent);
|
DecryptProgressUpdate?.Invoke(this, (int)progressPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculates the average processing rate based on the last <see cref="MAX_NUM_AVERAGE"/> samples.
|
/// Calculates the average processing rate based on the last 2 to <see cref="MAX_NUM_AVERAGE"/> samples.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lastProcessedPosition">Position in the audio file last processed</param>
|
/// <param name="lastProcessedPosition">Position in the audio file last processed</param>
|
||||||
/// <returns>The average processing rate, in book_duration_seconds / second.</returns>
|
/// <returns>The average processing rate, in book_duration_seconds / second.</returns>
|
||||||
@ -200,7 +198,7 @@ namespace AaxDecrypter
|
|||||||
if (streamPositions.Count < 2)
|
if (streamPositions.Count < 2)
|
||||||
return double.PositiveInfinity;
|
return double.PositiveInfinity;
|
||||||
|
|
||||||
//Calculate the harmonic mean of the last AVERAGE_NUM progress updates
|
//Calculate the harmonic mean of the last 2 to MAX_NUM_AVERAGE progress updates
|
||||||
//Units are Book_Duration_Seconds / second
|
//Units are Book_Duration_Seconds / second
|
||||||
|
|
||||||
var lastPos = streamPositions.Count > MAX_NUM_AVERAGE ? streamPositions.Dequeue() : null;
|
var lastPos = streamPositions.Count > MAX_NUM_AVERAGE ? streamPositions.Dequeue() : null;
|
||||||
@ -226,6 +224,7 @@ namespace AaxDecrypter
|
|||||||
double harmonicMean = harmonicNumerator / harmonicDenominator;
|
double harmonicMean = harmonicNumerator / harmonicDenominator;
|
||||||
return harmonicMean;
|
return harmonicMean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private const int MAX_NUM_AVERAGE = 15;
|
private const int MAX_NUM_AVERAGE = 15;
|
||||||
private class StreamPosition
|
private class StreamPosition
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user