Class SimpleSubtitleDecoder
- java.lang.Object
-
- com.google.android.exoplayer2.decoder.SimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
-
- com.google.android.exoplayer2.text.SimpleSubtitleDecoder
-
- All Implemented Interfaces:
Decoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
,SubtitleDecoder
- Direct Known Subclasses:
DvbDecoder
,Mp4WebvttDecoder
,PgsDecoder
,SsaDecoder
,SubripDecoder
,TtmlDecoder
,Tx3gDecoder
,WebvttDecoder
@Deprecated public abstract class SimpleSubtitleDecoder extends SimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException> implements SubtitleDecoder
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Base class for subtitle parsers that use their own decode thread.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleSubtitleDecoder(String name)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected SubtitleInputBuffer
createInputBuffer()
Deprecated.Creates a new input buffer.protected SubtitleOutputBuffer
createOutputBuffer()
Deprecated.Creates a new output buffer.protected SubtitleDecoderException
createUnexpectedDecodeException(Throwable error)
Deprecated.Creates an exception to propagate for an unexpected decode error.protected abstract Subtitle
decode(byte[] data, int length, boolean reset)
Deprecated.Decodes data into aSubtitle
.protected SubtitleDecoderException
decode(SubtitleInputBuffer inputBuffer, SubtitleOutputBuffer outputBuffer, boolean reset)
Deprecated.Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.String
getName()
Deprecated.Returns the name of the decoder.void
setPositionUs(long positionUs)
Deprecated.Informs the decoder of the current playback position.-
Methods inherited from class com.google.android.exoplayer2.decoder.SimpleDecoder
dequeueInputBuffer, dequeueOutputBuffer, flush, queueInputBuffer, release, releaseOutputBuffer, setInitialInputBufferSize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.decoder.Decoder
dequeueInputBuffer, dequeueOutputBuffer, flush, queueInputBuffer, release
-
-
-
-
Constructor Detail
-
SimpleSubtitleDecoder
protected SimpleSubtitleDecoder(String name)
Deprecated.- Parameters:
name
- The name of the decoder.
-
-
Method Detail
-
getName
public final String getName()
Deprecated.Description copied from interface:Decoder
Returns the name of the decoder.- Specified by:
getName
in interfaceDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
- Returns:
- The name of the decoder.
-
setPositionUs
public void setPositionUs(long positionUs)
Deprecated.Description copied from interface:SubtitleDecoder
Informs the decoder of the current playback position.Must be called prior to each attempt to dequeue output buffers from the decoder.
- Specified by:
setPositionUs
in interfaceSubtitleDecoder
- Parameters:
positionUs
- The current playback position in microseconds.
-
createInputBuffer
protected final SubtitleInputBuffer createInputBuffer()
Deprecated.Description copied from class:SimpleDecoder
Creates a new input buffer.- Specified by:
createInputBuffer
in classSimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
-
createOutputBuffer
protected final SubtitleOutputBuffer createOutputBuffer()
Deprecated.Description copied from class:SimpleDecoder
Creates a new output buffer.- Specified by:
createOutputBuffer
in classSimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
-
createUnexpectedDecodeException
protected final SubtitleDecoderException createUnexpectedDecodeException(Throwable error)
Deprecated.Description copied from class:SimpleDecoder
Creates an exception to propagate for an unexpected decode error.- Specified by:
createUnexpectedDecodeException
in classSimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
- Parameters:
error
- The unexpected decode error.- Returns:
- The exception to propagate.
-
decode
@Nullable protected final SubtitleDecoderException decode(SubtitleInputBuffer inputBuffer, SubtitleOutputBuffer outputBuffer, boolean reset)
Deprecated.Description copied from class:SimpleDecoder
Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.- Specified by:
decode
in classSimpleDecoder<SubtitleInputBuffer,SubtitleOutputBuffer,SubtitleDecoderException>
- Parameters:
inputBuffer
- The buffer to decode.outputBuffer
- The output buffer to store decoded data. The flagC.BUFFER_FLAG_DECODE_ONLY
will be set if the same flag is set oninputBuffer
, but may be set/unset as required. If the flag is set when the call returns then the output buffer will not be made available to dequeue. The output buffer may not have been populated in this case.reset
- Whether the decoder must be reset before decoding.- Returns:
- A decoder exception if an error occurred, or null if decoding was successful.
-
decode
protected abstract Subtitle decode(byte[] data, int length, boolean reset) throws SubtitleDecoderException
Deprecated.Decodes data into aSubtitle
.- Parameters:
data
- An array holding the data to be decoded, starting at position 0.length
- The number of bytes fromdata
to be decoded.reset
- Whether the decoder must be reset before decoding.- Returns:
- The decoded
Subtitle
. - Throws:
SubtitleDecoderException
- If a decoding error occurs.
-
-