mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Remove unused extractor constructors
PiperOrigin-RevId: 258754710
This commit is contained in:
parent
c67f18764f
commit
e4f849076c
6 changed files with 12 additions and 36 deletions
|
|
@ -108,7 +108,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
|
||||||
/**
|
/**
|
||||||
* Sets flags for {@link AdtsExtractor} instances created by the factory.
|
* Sets flags for {@link AdtsExtractor} instances created by the factory.
|
||||||
*
|
*
|
||||||
* @see AdtsExtractor#AdtsExtractor(long, int)
|
* @see AdtsExtractor#AdtsExtractor(int)
|
||||||
* @param flags The flags to use.
|
* @param flags The flags to use.
|
||||||
* @return The factory, for convenience.
|
* @return The factory, for convenience.
|
||||||
*/
|
*/
|
||||||
|
|
@ -220,7 +220,6 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
|
||||||
: 0));
|
: 0));
|
||||||
extractors[4] =
|
extractors[4] =
|
||||||
new AdtsExtractor(
|
new AdtsExtractor(
|
||||||
/* firstStreamSampleTimestampUs= */ 0,
|
|
||||||
adtsFlags
|
adtsFlags
|
||||||
| (constantBitrateSeekingEnabled
|
| (constantBitrateSeekingEnabled
|
||||||
? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING
|
? AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,13 @@ public final class Ac3Extractor implements Extractor {
|
||||||
private static final int MAX_SYNC_FRAME_SIZE = 2786;
|
private static final int MAX_SYNC_FRAME_SIZE = 2786;
|
||||||
private static final int ID3_TAG = 0x00494433;
|
private static final int ID3_TAG = 0x00494433;
|
||||||
|
|
||||||
private final long firstSampleTimestampUs;
|
|
||||||
private final Ac3Reader reader;
|
private final Ac3Reader reader;
|
||||||
private final ParsableByteArray sampleData;
|
private final ParsableByteArray sampleData;
|
||||||
|
|
||||||
private boolean startedPacket;
|
private boolean startedPacket;
|
||||||
|
|
||||||
|
/** Creates a new extractor for AC-3 bitstreams. */
|
||||||
public Ac3Extractor() {
|
public Ac3Extractor() {
|
||||||
this(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Ac3Extractor(long firstSampleTimestampUs) {
|
|
||||||
this.firstSampleTimestampUs = firstSampleTimestampUs;
|
|
||||||
reader = new Ac3Reader();
|
reader = new Ac3Reader();
|
||||||
sampleData = new ParsableByteArray(MAX_SYNC_FRAME_SIZE);
|
sampleData = new ParsableByteArray(MAX_SYNC_FRAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +136,7 @@ public final class Ac3Extractor implements Extractor {
|
||||||
|
|
||||||
if (!startedPacket) {
|
if (!startedPacket) {
|
||||||
// Pass data to the reader as though it's contained within a single infinitely long packet.
|
// Pass data to the reader as though it's contained within a single infinitely long packet.
|
||||||
reader.packetStarted(firstSampleTimestampUs, FLAG_DATA_ALIGNMENT_INDICATOR);
|
reader.packetStarted(/* pesTimeUs= */ 0, FLAG_DATA_ALIGNMENT_INDICATOR);
|
||||||
startedPacket = true;
|
startedPacket = true;
|
||||||
}
|
}
|
||||||
// TODO: Make it possible for the reader to consume the dataSource directly, so that it becomes
|
// TODO: Make it possible for the reader to consume the dataSource directly, so that it becomes
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ public final class Ac4Extractor implements Extractor {
|
||||||
|
|
||||||
private static final int ID3_TAG = 0x00494433;
|
private static final int ID3_TAG = 0x00494433;
|
||||||
|
|
||||||
private final long firstSampleTimestampUs;
|
|
||||||
private final Ac4Reader reader;
|
private final Ac4Reader reader;
|
||||||
private final ParsableByteArray sampleData;
|
private final ParsableByteArray sampleData;
|
||||||
|
|
||||||
|
|
@ -62,12 +61,6 @@ public final class Ac4Extractor implements Extractor {
|
||||||
|
|
||||||
/** Creates a new extractor for AC-4 bitstreams. */
|
/** Creates a new extractor for AC-4 bitstreams. */
|
||||||
public Ac4Extractor() {
|
public Ac4Extractor() {
|
||||||
this(/* firstSampleTimestampUs= */ 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Creates a new extractor for AC-4 bitstreams, using the specified first sample timestamp. */
|
|
||||||
public Ac4Extractor(long firstSampleTimestampUs) {
|
|
||||||
this.firstSampleTimestampUs = firstSampleTimestampUs;
|
|
||||||
reader = new Ac4Reader();
|
reader = new Ac4Reader();
|
||||||
sampleData = new ParsableByteArray(READ_BUFFER_SIZE);
|
sampleData = new ParsableByteArray(READ_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +145,7 @@ public final class Ac4Extractor implements Extractor {
|
||||||
|
|
||||||
if (!startedPacket) {
|
if (!startedPacket) {
|
||||||
// Pass data to the reader as though it's contained within a single infinitely long packet.
|
// Pass data to the reader as though it's contained within a single infinitely long packet.
|
||||||
reader.packetStarted(firstSampleTimestampUs, FLAG_DATA_ALIGNMENT_INDICATOR);
|
reader.packetStarted(/* pesTimeUs= */ 0, FLAG_DATA_ALIGNMENT_INDICATOR);
|
||||||
startedPacket = true;
|
startedPacket = true;
|
||||||
}
|
}
|
||||||
// TODO: Make it possible for the reader to consume the dataSource directly, so that it becomes
|
// TODO: Make it possible for the reader to consume the dataSource directly, so that it becomes
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ public final class AdtsExtractor implements Extractor {
|
||||||
private final ParsableByteArray packetBuffer;
|
private final ParsableByteArray packetBuffer;
|
||||||
private final ParsableByteArray scratch;
|
private final ParsableByteArray scratch;
|
||||||
private final ParsableBitArray scratchBits;
|
private final ParsableBitArray scratchBits;
|
||||||
private final long firstStreamSampleTimestampUs;
|
|
||||||
|
|
||||||
@Nullable private ExtractorOutput extractorOutput;
|
@Nullable private ExtractorOutput extractorOutput;
|
||||||
|
|
||||||
|
|
@ -94,22 +93,17 @@ public final class AdtsExtractor implements Extractor {
|
||||||
private boolean startedPacket;
|
private boolean startedPacket;
|
||||||
private boolean hasOutputSeekMap;
|
private boolean hasOutputSeekMap;
|
||||||
|
|
||||||
|
/** Creates a new extractor for ADTS bitstreams. */
|
||||||
public AdtsExtractor() {
|
public AdtsExtractor() {
|
||||||
this(0);
|
this(/* flags= */ 0);
|
||||||
}
|
|
||||||
|
|
||||||
public AdtsExtractor(long firstStreamSampleTimestampUs) {
|
|
||||||
this(/* firstStreamSampleTimestampUs= */ firstStreamSampleTimestampUs, /* flags= */ 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param firstStreamSampleTimestampUs The timestamp to be used for the first sample of the stream
|
* Creates a new extractor for ADTS bitstreams.
|
||||||
* output from this extractor.
|
*
|
||||||
* @param flags Flags that control the extractor's behavior.
|
* @param flags Flags that control the extractor's behavior.
|
||||||
*/
|
*/
|
||||||
public AdtsExtractor(long firstStreamSampleTimestampUs, @Flags int flags) {
|
public AdtsExtractor(@Flags int flags) {
|
||||||
this.firstStreamSampleTimestampUs = firstStreamSampleTimestampUs;
|
|
||||||
this.firstSampleTimestampUs = firstStreamSampleTimestampUs;
|
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
reader = new AdtsReader(true);
|
reader = new AdtsReader(true);
|
||||||
packetBuffer = new ParsableByteArray(MAX_PACKET_SIZE);
|
packetBuffer = new ParsableByteArray(MAX_PACKET_SIZE);
|
||||||
|
|
@ -172,7 +166,7 @@ public final class AdtsExtractor implements Extractor {
|
||||||
public void seek(long position, long timeUs) {
|
public void seek(long position, long timeUs) {
|
||||||
startedPacket = false;
|
startedPacket = false;
|
||||||
reader.seek();
|
reader.seek();
|
||||||
firstSampleTimestampUs = firstStreamSampleTimestampUs + timeUs;
|
firstSampleTimestampUs = timeUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -217,9 +217,7 @@ public final class AdtsExtractorSeekTest {
|
||||||
// Internal methods
|
// Internal methods
|
||||||
|
|
||||||
private static AdtsExtractor createAdtsExtractor() {
|
private static AdtsExtractor createAdtsExtractor() {
|
||||||
return new AdtsExtractor(
|
return new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING);
|
||||||
/* firstStreamSampleTimestampUs= */ 0,
|
|
||||||
/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertFirstSampleAfterSeekContainTargetSeekTime(
|
private void assertFirstSampleAfterSeekContainTargetSeekTime(
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,7 @@ public final class AdtsExtractorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSample_withSeeking() throws Exception {
|
public void testSample_withSeeking() throws Exception {
|
||||||
ExtractorAsserts.assertBehavior(
|
ExtractorAsserts.assertBehavior(
|
||||||
() ->
|
() -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
|
||||||
new AdtsExtractor(
|
|
||||||
/* firstStreamSampleTimestampUs= */ 0,
|
|
||||||
/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
|
|
||||||
"ts/sample_cbs.adts");
|
"ts/sample_cbs.adts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue