Package com.castlabs.sdk.base.subtitles

# Class SubtitleParserHelper

java.lang.Object
com.castlabs.sdk.base.subtitles.SubtitleParserHelper

All Implemented Interfaces:
  `Handler.Callback`

public class SubtitleParserHelper extends Object implements Handler.Callback

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static @interface`
  `SubtitleParserHelper.DisplayAlign`
  `static @interface`
  `SubtitleParserHelper.EdgeType`
  `static @interface`
  `SubtitleParserHelper.ScalingMode`
  `static @interface`
  `SubtitleParserHelper.TextAlign`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `MIME_TYPE_CEA608`
  `static final String`
  `MIME_TYPE_DVBSUBS`
  `static final String`
  `MIME_TYPE_DVBTTX`
  `static final String`
  `MIME_TYPE_MP4_VTT`
  `static final String`
  `MIME_TYPE_SRT`
  `static final String`
  `MIME_TYPE_TTML`
  `static final String`
  `MIME_TYPE_VTT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SubtitleParserHelper(Looper looper, Handler rendererHandler)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BaseSubtitleInputBuffer`
  `dequeueInputBuffer()`
  Gets the input buffer for subsequent read operation
  `void`
  `disposeWhenReady()`
  Internal method that sends a dispose indicator to the background thread that will remove the native instance of this helper
  `void`
  `enqueueInputBuffer(BaseSubtitleInputBuffer buffer, String baseUrl, boolean parse)`
  Sets the input buffer after a read operation
  `protected void`
  `finalize()`
  `void`
  `flush()`
  Flushes the helper, canceling the current parsing operation, if there is one.
  `boolean`
  `handleMessage(Message msg)`
  `ImagePool`
  `imagePool()`
  `void`
  `initializeWithWebvtt(String text)`
  `void`
  `setFormat(SubtitleFormat format)`
  Sets the format of subsequent samples.
  `void`
  `updatePlayerPosition(long playerPositionUs)`
  Sets the current player position.

  ### Methods inherited from class java.lang.Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MIME_TYPE_VTT

    public static final String MIME_TYPE_VTT
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_MP4_VTT

    public static final String MIME_TYPE_MP4_VTT
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_TTML

    public static final String MIME_TYPE_TTML
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_SRT

    public static final String MIME_TYPE_SRT
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_CEA608

    public static final String MIME_TYPE_CEA608
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_DVBSUBS

    public static final String MIME_TYPE_DVBSUBS
    See Also:
      - Constant Field Values

  - ### MIME_TYPE_DVBTTX

    public static final String MIME_TYPE_DVBTTX
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SubtitleParserHelper

    public SubtitleParserHelper(@NonNull Looper looper, Handler rendererHandler)
    Parameters:
      `looper` - The `Looper` associated with the thread on which parsing should occur.
      `rendererHandler` - the ui thread parserHandler

- ## Method Details

  - ### imagePool

    public ImagePool imagePool()

  - ### disposeWhenReady

    public void disposeWhenReady()
    Internal method that sends a dispose indicator to the background thread that will remove the native instance of this helper

  - ### flush

    public void flush()
    Flushes the helper, canceling the current parsing operation, if there is one.

  - ### dequeueInputBuffer

    @Nullable public BaseSubtitleInputBuffer dequeueInputBuffer()
    Gets the input buffer for subsequent read operation
    Returns:
      Available input buffer or `null` otherwise

  - ### enqueueInputBuffer

    public void enqueueInputBuffer(@NonNull BaseSubtitleInputBuffer buffer, @NonNull String baseUrl, boolean parse)
    Sets the input buffer after a read operation
    Parameters:
      `buffer` - The input buffer with data read

  - ### setFormat

    public void setFormat(SubtitleFormat format)
    Sets the format of subsequent samples.
    Parameters:
      `format` - The format.

  - ### updatePlayerPosition

    public void updatePlayerPosition(long playerPositionUs)
    Sets the current player position.
    Parameters:
      `playerPositionUs` - Current player position in microseconds

  - ### initializeWithWebvtt

    public void initializeWithWebvtt(String text) throws Exception
    Throws:
      `Exception`

  - ### handleMessage

    public boolean handleMessage(Message msg)
    Specified by:
      `handleMessage` in interface `Handler.Callback`

  - ### finalize

    protected void finalize() throws Throwable
    Overrides:
      `finalize` in class `Object`
    Throws:
      `Throwable`