diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/SpliceInfoSectionReader.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/SpliceInfoSectionReader.java index 2ff3e05a99..e8caa4be7b 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/SpliceInfoSectionReader.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/ts/SpliceInfoSectionReader.java @@ -42,8 +42,6 @@ public final class SpliceInfoSectionReader implements SectionPayloadReader { this.timestampAdjuster = timestampAdjuster; idGenerator.generateNewId(); output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_METADATA); - output.format( - Format.createSampleFormat(idGenerator.getFormatId(), MimeTypes.APPLICATION_SCTE35)); } @Override diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java index 733d42e77f..55bea3bc4b 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorTest.java @@ -48,6 +48,11 @@ public final class TsExtractorTest { ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample.ts"); } + @Test + public void testSampleScte35() throws Exception { + ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_scte35.ts"); + } + @Test public void testStreamWithJunkData() throws Exception { ExtractorAsserts.assertBehavior( diff --git a/testdata/src/test/assets/ts/sample_scte35.ts b/testdata/src/test/assets/ts/sample_scte35.ts new file mode 100644 index 0000000000..81f9ce9c21 Binary files /dev/null and b/testdata/src/test/assets/ts/sample_scte35.ts differ diff --git a/testdata/src/test/assets/ts/sample_scte35.ts.0.dump b/testdata/src/test/assets/ts/sample_scte35.ts.0.dump new file mode 100644 index 0000000000..84cc6b7fc6 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_scte35.ts.0.dump @@ -0,0 +1,146 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=25887]] + getPosition(66733) = [[timeUs=66733, position=51963]] +numberOfTracks = 4 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + bitrate = -1 + id = 1/256 + containerMimeType = null + sampleMimeType = video/mpeg2 + maxInputSize = -1 + width = 640 + height = 426 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33366 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + bitrate = -1 + id = 1/257 + containerMimeType = null + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = 1 + sampleRate = 44100 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = und + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 22455 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 48577 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 74700 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 100822 + flags = 1 + data = length 1254, hash 73FB07B8 +track 600: + total output bytes = 105 + sample count = 3 + format 0: + bitrate = -1 + id = null + containerMimeType = null + sampleMimeType = application/x-scte35 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = -1400000 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 33366 + flags = 1 + data = length 35, hash A892AAAF + sample 1: + time = 33366 + flags = 1 + data = length 35, hash A892AAAF + sample 2: + time = 33366 + flags = 1 + data = length 35, hash DFA3EF74 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/8448 + containerMimeType = null + sampleMimeType = application/cea-608 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_scte35.ts.1.dump b/testdata/src/test/assets/ts/sample_scte35.ts.1.dump new file mode 100644 index 0000000000..f7e1c0de8b --- /dev/null +++ b/testdata/src/test/assets/ts/sample_scte35.ts.1.dump @@ -0,0 +1,146 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=25887]] + getPosition(66733) = [[timeUs=66733, position=51963]] +numberOfTracks = 4 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + bitrate = -1 + id = 1/256 + containerMimeType = null + sampleMimeType = video/mpeg2 + maxInputSize = -1 + width = 640 + height = 426 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 55610 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 88977 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + bitrate = -1 + id = 1/257 + containerMimeType = null + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = 1 + sampleRate = 44100 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = und + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 44699 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 70821 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 96944 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 123066 + flags = 1 + data = length 1254, hash 73FB07B8 +track 600: + total output bytes = 105 + sample count = 3 + format 0: + bitrate = -1 + id = null + containerMimeType = null + sampleMimeType = application/x-scte35 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = -1400000 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 55610 + flags = 1 + data = length 35, hash A892AAAF + sample 1: + time = 55610 + flags = 1 + data = length 35, hash A892AAAF + sample 2: + time = 55610 + flags = 1 + data = length 35, hash DFA3EF74 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/8448 + containerMimeType = null + sampleMimeType = application/cea-608 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_scte35.ts.2.dump b/testdata/src/test/assets/ts/sample_scte35.ts.2.dump new file mode 100644 index 0000000000..111078654b --- /dev/null +++ b/testdata/src/test/assets/ts/sample_scte35.ts.2.dump @@ -0,0 +1,146 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=25887]] + getPosition(66733) = [[timeUs=66733, position=51963]] +numberOfTracks = 4 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + bitrate = -1 + id = 1/256 + containerMimeType = null + sampleMimeType = video/mpeg2 + maxInputSize = -1 + width = 640 + height = 426 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 77854 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 111221 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + bitrate = -1 + id = 1/257 + containerMimeType = null + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = 1 + sampleRate = 44100 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = und + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 66943 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 93065 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 119188 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 145310 + flags = 1 + data = length 1254, hash 73FB07B8 +track 600: + total output bytes = 105 + sample count = 3 + format 0: + bitrate = -1 + id = null + containerMimeType = null + sampleMimeType = application/x-scte35 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = -1400000 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 77854 + flags = 1 + data = length 35, hash A892AAAF + sample 1: + time = 77854 + flags = 1 + data = length 35, hash A892AAAF + sample 2: + time = 77854 + flags = 1 + data = length 35, hash DFA3EF74 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/8448 + containerMimeType = null + sampleMimeType = application/cea-608 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_scte35.ts.3.dump b/testdata/src/test/assets/ts/sample_scte35.ts.3.dump new file mode 100644 index 0000000000..25716ee1c6 --- /dev/null +++ b/testdata/src/test/assets/ts/sample_scte35.ts.3.dump @@ -0,0 +1,118 @@ +seekMap: + isSeekable = true + duration = 66733 + getPosition(0) = [[timeUs=0, position=0]] + getPosition(1) = [[timeUs=1, position=0]] + getPosition(33366) = [[timeUs=33366, position=25887]] + getPosition(66733) = [[timeUs=66733, position=51963]] +numberOfTracks = 4 +track 256: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/256 + containerMimeType = null + sampleMimeType = video/mpeg2 + maxInputSize = -1 + width = 640 + height = 426 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + data = length 22, hash CE183139 +track 257: + total output bytes = 2508 + sample count = 2 + format 0: + bitrate = -1 + id = 1/257 + containerMimeType = null + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = 1 + sampleRate = 44100 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = und + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 66733 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 1: + time = 92855 + flags = 1 + data = length 1254, hash 73FB07B8 +track 600: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = null + containerMimeType = null + sampleMimeType = application/x-scte35 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = -1400000 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/8448 + containerMimeType = null + sampleMimeType = application/cea-608 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +tracksEnded = true diff --git a/testdata/src/test/assets/ts/sample_scte35.ts.unklen.dump b/testdata/src/test/assets/ts/sample_scte35.ts.unklen.dump new file mode 100644 index 0000000000..9da31f231f --- /dev/null +++ b/testdata/src/test/assets/ts/sample_scte35.ts.unklen.dump @@ -0,0 +1,143 @@ +seekMap: + isSeekable = false + duration = UNSET TIME + getPosition(0) = [[timeUs=0, position=0]] +numberOfTracks = 4 +track 256: + total output bytes = 45026 + sample count = 2 + format 0: + bitrate = -1 + id = 1/256 + containerMimeType = null + sampleMimeType = video/mpeg2 + maxInputSize = -1 + width = 640 + height = 426 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + data = length 22, hash CE183139 + sample 0: + time = 33366 + flags = 1 + data = length 20711, hash 34341E8 + sample 1: + time = 66733 + flags = 0 + data = length 18112, hash EC44B35B +track 257: + total output bytes = 5015 + sample count = 4 + format 0: + bitrate = -1 + id = 1/257 + containerMimeType = null + sampleMimeType = audio/mpeg-L2 + maxInputSize = 4096 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = 1 + sampleRate = 44100 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = und + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 22455 + flags = 1 + data = length 1253, hash 727FD1C6 + sample 1: + time = 48577 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 2: + time = 74700 + flags = 1 + data = length 1254, hash 73FB07B8 + sample 3: + time = 100822 + flags = 1 + data = length 1254, hash 73FB07B8 +track 600: + total output bytes = 105 + sample count = 3 + format 0: + bitrate = -1 + id = null + containerMimeType = null + sampleMimeType = application/x-scte35 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = -1400000 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: + sample 0: + time = 33366 + flags = 1 + data = length 35, hash A892AAAF + sample 1: + time = 33366 + flags = 1 + data = length 35, hash A892AAAF + sample 2: + time = 33366 + flags = 1 + data = length 35, hash DFA3EF74 +track 8448: + total output bytes = 0 + sample count = 0 + format 0: + bitrate = -1 + id = 1/8448 + containerMimeType = null + sampleMimeType = application/cea-608 + maxInputSize = -1 + width = -1 + height = -1 + frameRate = -1.0 + rotationDegrees = 0 + pixelWidthHeightRatio = 1.0 + channelCount = -1 + sampleRate = -1 + pcmEncoding = -1 + encoderDelay = 0 + encoderPadding = 0 + subsampleOffsetUs = 9223372036854775807 + selectionFlags = 0 + language = null + drmInitData = - + metadata = null + initializationData: +tracksEnded = true