Commit 05ef643e by eguven Committed by Oliver Woodman

Copy from V1: Extractor.release() method releases all kept resources.

This method is needed by FlacExtractor to release native resources.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119143922
parent 7c35e38b
...@@ -97,4 +97,8 @@ public interface Extractor { ...@@ -97,4 +97,8 @@ public interface Extractor {
*/ */
void seek(); void seek();
/**
* Releases all kept resources.
*/
void release();
} }
...@@ -120,6 +120,11 @@ public final class FlvExtractor implements Extractor, SeekMap { ...@@ -120,6 +120,11 @@ public final class FlvExtractor implements Extractor, SeekMap {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException, public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException,
InterruptedException { InterruptedException {
while (true) { while (true) {
......
...@@ -273,6 +273,11 @@ public final class MatroskaExtractor implements Extractor { ...@@ -273,6 +273,11 @@ public final class MatroskaExtractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException, public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException,
InterruptedException { InterruptedException {
sampleRead = false; sampleRead = false;
......
...@@ -111,6 +111,11 @@ public final class Mp3Extractor implements Extractor { ...@@ -111,6 +111,11 @@ public final class Mp3Extractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
if (synchronizedHeaderData == 0 && !synchronizeCatchingEndOfInput(input)) { if (synchronizedHeaderData == 0 && !synchronizeCatchingEndOfInput(input)) {
......
...@@ -170,6 +170,11 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -170,6 +170,11 @@ public final class FragmentedMp4Extractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
while (true) { while (true) {
......
...@@ -107,6 +107,11 @@ public final class Mp4Extractor implements Extractor, SeekMap { ...@@ -107,6 +107,11 @@ public final class Mp4Extractor implements Extractor, SeekMap {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
while (true) { while (true) {
......
...@@ -94,6 +94,11 @@ public final class OggVorbisExtractor implements Extractor, SeekMap { ...@@ -94,6 +94,11 @@ public final class OggVorbisExtractor implements Extractor, SeekMap {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
......
...@@ -122,6 +122,11 @@ public final class AdtsExtractor implements Extractor { ...@@ -122,6 +122,11 @@ public final class AdtsExtractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
int bytesRead = input.read(packetBuffer.data, 0, MAX_PACKET_SIZE); int bytesRead = input.read(packetBuffer.data, 0, MAX_PACKET_SIZE);
......
...@@ -121,6 +121,11 @@ public final class PsExtractor implements Extractor { ...@@ -121,6 +121,11 @@ public final class PsExtractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
// First peek and check what type of start code is next. // First peek and check what type of start code is next.
......
...@@ -124,6 +124,11 @@ public final class TsExtractor implements Extractor { ...@@ -124,6 +124,11 @@ public final class TsExtractor implements Extractor {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
if (!input.readFully(tsPacketBuffer.data, 0, TS_PACKET_SIZE, true)) { if (!input.readFully(tsPacketBuffer.data, 0, TS_PACKET_SIZE, true)) {
......
...@@ -59,6 +59,11 @@ public final class WavExtractor implements Extractor, SeekMap { ...@@ -59,6 +59,11 @@ public final class WavExtractor implements Extractor, SeekMap {
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
if (wavHeader == null) { if (wavHeader == null) {
......
...@@ -87,6 +87,11 @@ import java.util.regex.Pattern; ...@@ -87,6 +87,11 @@ import java.util.regex.Pattern;
} }
@Override @Override
public void release() {
// Do nothing
}
@Override
public int read(ExtractorInput input, PositionHolder seekPosition) public int read(ExtractorInput input, PositionHolder seekPosition)
throws IOException, InterruptedException { throws IOException, InterruptedException {
int currentFileSize = (int) input.getLength(); int currentFileSize = (int) input.getLength();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment