FileDocCategorySizeDatePackage
SubtitleData.javaAPI DocAndroid 5.1 API2386Thu Mar 12 22:22:30 GMT 2015android.media

SubtitleData

public final class SubtitleData extends Object
hide
Class to hold the subtitle track's data, including:
  • Track index
  • Start time (in microseconds) of the data
  • Duration (in microseconds) of the data
  • A byte-array of the data

To receive the subtitle data, applications need to do the following:

  • Select a track of type MEDIA_TRACK_TYPE_SUBTITLE with {@link MediaPlayer.selectTrack(int)
  • Implement the {@link MediaPlayer.OnSubtitleDataListener} interface
  • Register the {@link MediaPlayer.OnSubtitleDataListener} callback on a MediaPlayer object
see
android.media.MediaPlayer

Fields Summary
private static final String
TAG
private int
mTrackIndex
private long
mStartTimeUs
private long
mDurationUs
private byte[]
mData
Constructors Summary
public SubtitleData(android.os.Parcel parcel)


       
        if (!parseParcel(parcel)) {
            throw new IllegalArgumentException("parseParcel() fails");
        }
    
Methods Summary
public byte[]getData()

        return mData;
    
public longgetDurationUs()

        return mDurationUs;
    
public longgetStartTimeUs()

        return mStartTimeUs;
    
public intgetTrackIndex()

        return mTrackIndex;
    
private booleanparseParcel(android.os.Parcel parcel)

        parcel.setDataPosition(0);
        if (parcel.dataAvail() == 0) {
            return false;
        }

        mTrackIndex = parcel.readInt();
        mStartTimeUs = parcel.readLong();
        mDurationUs = parcel.readLong();
        mData = new byte[parcel.readInt()];
        parcel.readByteArray(mData);

        return true;