E3: correzioni della revisione di formati e fotogrammi
Le 16 osservazioni confermate della revisione, ognuna con la sua prova: - JPEG: il controllo stima la memoria di lavoro del decodificatore (progressivo), così un file che non si decodifica esce «troppo grande» e non «illeggibile». - Un EXIF che non si tiene lascia un EXIF minimo con l'orientamento, perché la foto convertita non esca girata. - Fotogrammi: istanti in millisecondi interi; la copia trova l'indice del nome dall'istante, non dall'ordine delle righe. - Video di durata sconosciuta misurati prima di registrare: contano nei limiti di 500 per richiesta e 5000 per video. - Rimuxaggio: la durata del segmento di elst passa nell'MP4, la fine tagliata resta nascosta (anche nei fotogrammi). - H.264: il punto di recupero vale come IDR solo con exact_match_flag. - MP3 in MP4: objectTypeIndication 0x69 fino a 24 kHz, 0x6B oltre. - Conversione della libreria: il lavoro toglie le righe di un formato spento o cambiato; spegnere toglie anche i «Non riuscito»; «Riprova» solo i formati di adesso; pausa per spazio prima di rileggere l'originale. - «Anche i N» conta e mette in coda solo il tipo che si cambia; le impostazioni dell'esportazione si salvano una per volta. - Eliminazione e «Tieni il più grande» scelgono i convertiti nella stessa transazione: nessun convertito orfano. - Un file arrivato tardi in un elemento vecchio mette in coda solo sé (file nuovo = salvato da quando il formato è scelto). - Zip dei fotogrammi a pezzi di 64 KB: un browser lento che legge non si interrompe, uno fermo sì. Decisioni in docs/decisioni.md (28/11), §4.10 della specifica precisato. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb79b05fda
commit
958cb71cd6
38 files changed
+1276
-222
No files matched your search
@@ -116,15 +116,20 @@ public sealed class ExportPlanner(ExportEnvironment env)
|
||||
/// once (a story and its highlight entry, two files with the same bytes); with «Una copia sola» the same file counts
|
||||
/// once across accounts.
|
||||
/// </summary>
|
||||
/// <param name="lengthOf">
|
||||
/// Frames job: the length of a video the library does not know, read from its file (null when unreadable); without
|
||||
/// it such a video is one planned file without instants (<see cref="PlannedFile.UnknownDuration"/>, the dialog).
|
||||
/// </param>
|
||||
internal async IAsyncEnumerable<PlannedFile> EnumerateAsync(
|
||||
ExportJobRequest request,
|
||||
IReadOnlyDictionary<long, EffectiveDestination> effective,
|
||||
ExportSettings settings,
|
||||
[EnumeratorCancellation] CancellationToken ct)
|
||||
[EnumeratorCancellation] CancellationToken ct,
|
||||
Func<ExportCandidate, CancellationToken, Task<TimeSpan?>>? lengthOf = null)
|
||||
{
|
||||
if (request.Frames is { } frames)
|
||||
{
|
||||
await foreach (var frame in EnumerateFramesAsync(request, frames, effective, ct).ConfigureAwait(false))
|
||||
await foreach (var frame in EnumerateFramesAsync(request, frames, effective, lengthOf, ct).ConfigureAwait(false))
|
||||
{
|
||||
yield return frame;
|
||||
}
|
||||
@@ -237,18 +242,21 @@ public sealed class ExportPlanner(ExportEnvironment env)
|
||||
|
||||
/// <summary>
|
||||
/// A frames job (D12, D14 of tappa E3): photos are skipped, videos not due are counted as in «Copia in…», each due
|
||||
/// video gives one planned frame per instant of the request. A video of unknown length gives one planned file
|
||||
/// without an instant (<see cref="PlannedFile.UnknownDuration"/>): its instants are found when the job is recorded.
|
||||
/// Frames are not checked for «già copiato» here: the copy looks at each one's exact instant.
|
||||
/// video gives one planned frame per instant of the request. A video of unknown length is measured by
|
||||
/// <paramref name="lengthOf"/> (the job: before anything is recorded, so that its frames count against the caps of
|
||||
/// D12) or, without it, gives one planned file without an instant (<see cref="PlannedFile.UnknownDuration"/>, the
|
||||
/// dialog). One that cannot be read gets one instant, and the copy says «Fotogramma non disponibile per questo
|
||||
/// video». Frames are not checked for «già copiato» here: the copy looks at each one's exact instant.
|
||||
/// </summary>
|
||||
private async IAsyncEnumerable<PlannedFile> EnumerateFramesAsync(
|
||||
ExportJobRequest request,
|
||||
ExportFramesRequest frames,
|
||||
IReadOnlyDictionary<long, EffectiveDestination> effective,
|
||||
Func<ExportCandidate, CancellationToken, Task<TimeSpan?>>? lengthOf,
|
||||
[EnumeratorCancellation] CancellationToken ct)
|
||||
{
|
||||
var exports = _env.Storage.Exports;
|
||||
var seen = new HashSet<(long Destination, long Account, string Sha256, long Ticks, ExportFormat Format)>();
|
||||
var seen = new HashSet<(long Destination, long Account, string Sha256, long Ms, ExportFormat Format)>();
|
||||
long after = 0;
|
||||
while (true)
|
||||
{
|
||||
@@ -286,13 +294,27 @@ public sealed class ExportPlanner(ExportEnvironment env)
|
||||
Prediction = ExportPrediction.Converted,
|
||||
FirstOfVideo = true,
|
||||
};
|
||||
if (frames.Mode != FrameMode.At && c.Duration is not { } known)
|
||||
var duration = c.Duration ?? TimeSpan.Zero;
|
||||
if (frames.Mode != FrameMode.At && c.Duration is null)
|
||||
{
|
||||
yield return frame with { UnknownDuration = true };
|
||||
continue;
|
||||
if (lengthOf is null)
|
||||
{
|
||||
yield return frame with { UnknownDuration = true };
|
||||
continue;
|
||||
}
|
||||
|
||||
if (await lengthOf(c, ct).ConfigureAwait(false) is not { } measured || measured <= TimeSpan.Zero)
|
||||
{
|
||||
var unreadable = frame with { FrameAt = TimeSpan.Zero };
|
||||
yield return seen.Add((destination, c.AccountId, c.Sha256!, 0, frames.Format))
|
||||
? unreadable
|
||||
: unreadable with { Action = PlannedCopy.AlreadyCopied };
|
||||
continue;
|
||||
}
|
||||
|
||||
duration = measured;
|
||||
}
|
||||
|
||||
var duration = c.Duration ?? TimeSpan.Zero;
|
||||
if (ExportFrames.FrameCount(duration, frames) > ExportFrames.MaxPerVideo)
|
||||
{
|
||||
yield return frame with { Action = PlannedCopy.OverCap };
|
||||
@@ -304,7 +326,8 @@ public sealed class ExportPlanner(ExportEnvironment env)
|
||||
{
|
||||
var planned = frame with { FrameAt = at, FirstOfVideo = first };
|
||||
first = false;
|
||||
if (!seen.Add((destination, c.AccountId, c.Sha256!, at.Ticks, frames.Format)))
|
||||
// By the millisecond the item keeps (ux_export_item_file): two instants on one are one item.
|
||||
if (!seen.Add((destination, c.AccountId, c.Sha256!, (long)at.TotalMilliseconds, frames.Format)))
|
||||
{
|
||||
planned = planned with { Action = PlannedCopy.AlreadyCopied };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user