Populate track duration(s) in Avi, Flac and Wav extractors

PiperOrigin-RevId: 689716977
This commit is contained in:
rohks 2024-10-25 03:00:35 -07:00 committed by Copybara-Service
parent 45317394da
commit e25bc2c1a5
104 changed files with 116 additions and 4 deletions

View File

@ -222,6 +222,7 @@ public final class FlacExtractor implements Extractor {
@Nullable
Metadata metadata = streamMetadata.getMetadataCopyWithAppendedEntriesFrom(id3Metadata);
outputFormat(streamMetadata, metadata, trackOutput);
trackOutput.durationUs(streamMetadata.getDurationUs());
}
}

View File

@ -519,6 +519,7 @@ public final class AviExtractor implements Extractor {
if (trackType == C.TRACK_TYPE_AUDIO || trackType == C.TRACK_TYPE_VIDEO) {
TrackOutput trackOutput = extractorOutput.track(streamId, trackType);
trackOutput.format(builder.build());
trackOutput.durationUs(durationUs);
ChunkReader chunkReader =
new ChunkReader(
streamId, trackType, durationUs, aviStreamHeaderChunk.length, trackOutput);

View File

@ -232,6 +232,7 @@ public final class FlacExtractor implements Extractor {
minFrameSize = max(flacStreamMetadata.minFrameSize, FlacConstants.MIN_FRAME_HEADER_SIZE);
castNonNull(trackOutput)
.format(flacStreamMetadata.getFormat(streamMarkerAndInfoBlock, id3Metadata));
castNonNull(trackOutput).durationUs(flacStreamMetadata.getDurationUs());
state = STATE_GET_FRAME_START_MARKER;
}

View File

@ -339,9 +339,11 @@ public final class WavExtractor implements Extractor {
@Override
public void init(int dataStartPosition, long dataEndPosition) {
extractorOutput.seekMap(
new WavSeekMap(wavFormat, /* framesPerBlock= */ 1, dataStartPosition, dataEndPosition));
WavSeekMap wavSeekMap =
new WavSeekMap(wavFormat, /* framesPerBlock= */ 1, dataStartPosition, dataEndPosition);
extractorOutput.seekMap(wavSeekMap);
trackOutput.format(format);
trackOutput.durationUs(wavSeekMap.getDurationUs());
}
@Override
@ -493,9 +495,11 @@ public final class WavExtractor implements Extractor {
@Override
public void init(int dataStartPosition, long dataEndPosition) {
extractorOutput.seekMap(
new WavSeekMap(wavFormat, framesPerBlock, dataStartPosition, dataEndPosition));
WavSeekMap wavSeekMap =
new WavSeekMap(wavFormat, framesPerBlock, dataStartPosition, dataEndPosition);
extractorOutput.seekMap(wavSeekMap);
trackOutput.format(format);
trackOutput.durationUs(wavSeekMap.getDurationUs());
}
@Override

View File

@ -9,6 +9,7 @@ numberOfTracks = 2
track 0:
total output bytes = 252777
sample count = 96
track duration = 4087416
format 0:
id = 0
sampleMimeType = video/mp4v-es
@ -402,6 +403,7 @@ track 0:
track 1:
total output bytes = 65280
sample count = 170
track duration = 4080000
format 0:
id = 1
sampleMimeType = audio/mpeg

View File

@ -9,6 +9,7 @@ numberOfTracks = 2
track 0:
total output bytes = 165531
sample count = 66
track duration = 4087416
format 0:
id = 0
sampleMimeType = video/mp4v-es
@ -282,6 +283,7 @@ track 0:
track 1:
total output bytes = 44160
sample count = 115
track duration = 4080000
format 0:
id = 1
sampleMimeType = audio/mpeg

View File

@ -9,6 +9,7 @@ numberOfTracks = 2
track 0:
total output bytes = 102418
sample count = 42
track duration = 4087416
format 0:
id = 0
sampleMimeType = video/mp4v-es
@ -186,6 +187,7 @@ track 0:
track 1:
total output bytes = 28032
sample count = 73
track duration = 4080000
format 0:
id = 1
sampleMimeType = audio/mpeg

View File

@ -9,6 +9,7 @@ numberOfTracks = 2
track 0:
total output bytes = 17833
sample count = 6
track duration = 4087416
format 0:
id = 0
sampleMimeType = video/mp4v-es
@ -42,6 +43,7 @@ track 0:
track 1:
total output bytes = 3840
sample count = 10
track duration = 4080000
format 0:
id = 1
sampleMimeType = audio/mpeg

View File

@ -9,6 +9,7 @@ numberOfTracks = 2
track 0:
total output bytes = 252777
sample count = 96
track duration = 4087416
format 0:
id = 0
sampleMimeType = video/mp4v-es
@ -402,6 +403,7 @@ track 0:
track 1:
total output bytes = 65280
sample count = 170
track duration = 4080000
format 0:
id = 1
sampleMimeType = audio/mpeg

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
channelCount = 2

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
channelCount = 2

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
channelCount = 2

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
channelCount = 2

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
channelCount = 2

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 445
sample count = 1
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -6,6 +6,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 1984
sample count = 1
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -6,6 +6,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 144086
sample count = 27
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 6456

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 100240
sample count = 19
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 6456

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 48500
sample count = 10
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 6456

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3385
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 6456

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 144086
sample count = 27
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 6456

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 482416
sample count = 27
track duration = 2741000
format 0:
averageBitrate = 1408000
peakBitrate = 1408000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 334960
sample count = 19
track duration = 2741000
format 0:
averageBitrate = 1408000
peakBitrate = 1408000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 169072
sample count = 10
track duration = 2741000
format 0:
averageBitrate = 1408000
peakBitrate = 1408000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 21616
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1408000
peakBitrate = 1408000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 482416
sample count = 27
track duration = 2741000
format 0:
averageBitrate = 1408000
peakBitrate = 1408000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 113666
sample count = 23
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 55652
sample count = 12
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 3829
sample count = 2
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 164431
sample count = 33
track duration = 2741000
format 0:
sampleMimeType = audio/flac
maxInputSize = 5776

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 362432
sample count = 23
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 182208
sample count = 12
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 18368
sample count = 2
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 526272
sample count = 33
track duration = 2741000
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 88200
sample count = 10
track duration = 1000000
format 0:
averageBitrate = 705600
peakBitrate = 705600

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 58802
sample count = 7
track duration = 1000000
format 0:
averageBitrate = 705600
peakBitrate = 705600

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 29402
sample count = 4
track duration = 1000000
format 0:
averageBitrate = 705600
peakBitrate = 705600

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 2
sample count = 1
track duration = 1000000
format 0:
averageBitrate = 705600
peakBitrate = 705600

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 88200
sample count = 10
track duration = 1000000
format 0:
averageBitrate = 705600
peakBitrate = 705600

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 89804
sample count = 11
track duration = 1018185
format 0:
averageBitrate = 177004
peakBitrate = 177004

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 61230
sample count = 7
track duration = 1018185
format 0:
averageBitrate = 177004
peakBitrate = 177004

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 32656
sample count = 4
track duration = 1018185
format 0:
averageBitrate = 177004
peakBitrate = 177004

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 4082
sample count = 1
track duration = 1018185
format 0:
averageBitrate = 177004
peakBitrate = 177004

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 89804
sample count = 11
track duration = 1018185
format 0:
averageBitrate = 177004
peakBitrate = 177004

View File

@ -9,6 +9,7 @@ numberOfTracks = 1
track 0:
total output bytes = 66936
sample count = 4
track duration = 348625
format 0:
averageBitrate = 1536000
peakBitrate = 1536000

Some files were not shown because too many files have changed in this diff Show More