TvTrackInfo.Builder

public static final class TvTrackInfo.Builder
extends Object

java.lang.Object
   ↳ android.media.tv.TvTrackInfo.Builder


A builder class for creating TvTrackInfo objects.

Summary

Public constructors

TvTrackInfo.Builder(int type, String id)

Create a TvTrackInfo.Builder.

Public methods

TvTrackInfo build()

Creates a TvTrackInfo instance with the specified fields.

TvTrackInfo.Builder setAudioChannelCount(int audioChannelCount)

Sets the audio channel count.

TvTrackInfo.Builder setAudioSampleRate(int audioSampleRate)

Sets the audio sample rate, in the unit of Hz.

TvTrackInfo.Builder setDescription(CharSequence description)

Sets a user readable description for the current track.

TvTrackInfo.Builder setExtra(Bundle extra)

Sets the extra information about the current track.

TvTrackInfo.Builder setLanguage(String language)

Sets the language information of the current track.

TvTrackInfo.Builder setVideoActiveFormatDescription(byte videoActiveFormatDescription)

Sets the Active Format Description (AFD) code of the video.

TvTrackInfo.Builder setVideoFrameRate(float videoFrameRate)

Sets the frame rate of the video, in the unit fps (frames per rate).

TvTrackInfo.Builder setVideoHeight(int videoHeight)

Sets the height of the video, in the unit of pixels.

TvTrackInfo.Builder setVideoPixelAspectRatio(float videoPixelAspectRatio)

Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video.

TvTrackInfo.Builder setVideoWidth(int videoWidth)

Sets the width of the video, in the unit of pixels.

Inherited methods

Public constructors

TvTrackInfo.Builder

added in API level 21
public TvTrackInfo.Builder (int type, 
                String id)

Create a TvTrackInfo.Builder. Any field that should be included in the TvTrackInfo must be added.

Parameters
type int: The type of the track.

id String: The ID of the track that uniquely identifies the current track among all the other tracks in the same TV program.

This value must never be null.

Throws
IllegalArgumentException if the type is not any of TvTrackInfo.TYPE_AUDIO, TvTrackInfo.TYPE_VIDEO and TvTrackInfo.TYPE_SUBTITLE

Public methods

build

added in API level 21
public TvTrackInfo build ()

Creates a TvTrackInfo instance with the specified fields.

Returns
TvTrackInfo The new TvTrackInfo instance

setAudioChannelCount

added in API level 21
public TvTrackInfo.Builder setAudioChannelCount (int audioChannelCount)

Sets the audio channel count. Valid only for TvTrackInfo.TYPE_AUDIO tracks.

Parameters
audioChannelCount int: The audio channel count.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on an audio track

setAudioSampleRate

added in API level 21
public TvTrackInfo.Builder setAudioSampleRate (int audioSampleRate)

Sets the audio sample rate, in the unit of Hz. Valid only for TvTrackInfo.TYPE_AUDIO tracks.

Parameters
audioSampleRate int: The audio sample rate.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on an audio track

setDescription

added in API level 23
public TvTrackInfo.Builder setDescription (CharSequence description)

Sets a user readable description for the current track.

Parameters
description CharSequence: The user readable description.

Returns
TvTrackInfo.Builder

setExtra

added in API level 21
public TvTrackInfo.Builder setExtra (Bundle extra)

Sets the extra information about the current track.

Parameters
extra Bundle: The extra information.

Returns
TvTrackInfo.Builder

setLanguage

added in API level 21
public TvTrackInfo.Builder setLanguage (String language)

Sets the language information of the current track.

Parameters
language String: The language string encoded by either ISO 639-1 or ISO 639-2/T.

Returns
TvTrackInfo.Builder

setVideoActiveFormatDescription

added in API level 24
public TvTrackInfo.Builder setVideoActiveFormatDescription (byte videoActiveFormatDescription)

Sets the Active Format Description (AFD) code of the video. Valid only for TvTrackInfo.TYPE_VIDEO tracks.

This is needed for applications to be able to scale the video properly based on the information about where in the coded picture the active video is. The complete list of values are defined in ETSI TS 101 154 V1.7.1 Annex B, ATSC A/53 Part 4 and SMPTE 2016-1-2007.

Parameters
videoActiveFormatDescription byte: The AFD code of the video.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on a video track

setVideoFrameRate

added in API level 21
public TvTrackInfo.Builder setVideoFrameRate (float videoFrameRate)

Sets the frame rate of the video, in the unit fps (frames per rate). Valid only for TvTrackInfo.TYPE_VIDEO tracks.

Parameters
videoFrameRate float: The frame rate of the video.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on a video track

setVideoHeight

added in API level 21
public TvTrackInfo.Builder setVideoHeight (int videoHeight)

Sets the height of the video, in the unit of pixels. Valid only for TvTrackInfo.TYPE_VIDEO tracks.

Parameters
videoHeight int: The height of the video.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on a video track

setVideoPixelAspectRatio

added in API level 23
public TvTrackInfo.Builder setVideoPixelAspectRatio (float videoPixelAspectRatio)

Sets the pixel aspect ratio (the ratio of a pixel's width to its height) of the video. Valid only for TvTrackInfo.TYPE_VIDEO tracks.

This is needed for applications to be able to scale the video properly for some video formats such as 720x576 4:3 and 720x576 16:9 where pixels are not square. By default, applications assume the value of 1.0 (square pixels), so it is not necessary to set the pixel aspect ratio for most video formats.

Parameters
videoPixelAspectRatio float: The pixel aspect ratio of the video.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on a video track

setVideoWidth

added in API level 21
public TvTrackInfo.Builder setVideoWidth (int videoWidth)

Sets the width of the video, in the unit of pixels. Valid only for TvTrackInfo.TYPE_VIDEO tracks.

Parameters
videoWidth int: The width of the video.

Returns
TvTrackInfo.Builder

Throws
IllegalStateException if not called on a video track