mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Added Forwarding classes for Extractor and ExtractorOutput
This commit is contained in:
parent
4d925bde81
commit
6d265476e4
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.extractor;
|
||||
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import java.io.IOException;
|
||||
|
||||
/** An overridable {@link Extractor} implementation forwarding all methods to an underlying Extractor. */
|
||||
@UnstableApi
|
||||
public class ForwardingExtractor implements Extractor {
|
||||
private final Extractor delegate;
|
||||
|
||||
public ForwardingExtractor(Extractor delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sniff(ExtractorInput input) throws IOException {
|
||||
return delegate.sniff(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ExtractorOutput output) {
|
||||
delegate.init(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @ReadResult int read(ExtractorInput input, PositionHolder seekPosition)
|
||||
throws IOException {
|
||||
return delegate.read(input, seekPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seek(long position, long timeUs) {
|
||||
delegate.seek(position, timeUs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
delegate.release();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.extractor;
|
||||
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
/** An overridable {@link ExtractorOutput} implementation forwarding all methods to another input. */
|
||||
@UnstableApi
|
||||
public class ForwardingExtractorOutput implements ExtractorOutput {
|
||||
private final ExtractorOutput output;
|
||||
|
||||
public ForwardingExtractorOutput(ExtractorOutput output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrackOutput track(int id, @C.TrackType int type) {
|
||||
return output.track(id, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTracks() {
|
||||
output.endTracks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seekMap(SeekMap seekMap) {
|
||||
output.seekMap(seekMap);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user