AdBuffer


public final class AdBuffer
extends Object implements Parcelable

java.lang.Object
   ↳ android.media.tv.AdBuffer


Buffer for advertisement data.

Summary

Inherited constants

int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel(Parcel, int): the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)".

Fields

public static final Creator<AdBuffer> CREATOR

Public constructors

AdBuffer(int id, String mimeType, SharedMemory buffer, int offset, int length, long presentationTimeUs, int flags)

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getFlags()

Gets the buffer flags for this ad buffer.

int getId()

Gets corresponding AD request ID.

int getLength()

Gets the data length of this ad buffer.

String getMimeType()

Gets the mime type of the data.

int getOffset()

Gets the offset into the shared memory to begin mapping.

long getPresentationTimeUs()

Gets the presentation time.

SharedMemory getSharedMemory()

Gets the SharedMemory which stores the data.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

abstract void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Fields

CREATOR

Added in API level 34
public static final Creator<AdBuffer> CREATOR

Public constructors

AdBuffer

Added in API level 34
public AdBuffer (int id, 
                String mimeType, 
                SharedMemory buffer, 
                int offset, 
                int length, 
                long presentationTimeUs, 
                int flags)

Parameters
id int

mimeType String: This value cannot be null.

buffer SharedMemory: This value cannot be null.

offset int

length int

presentationTimeUs long

flags int: Value is either 0 or a combination of MediaCodec.BUFFER_FLAG_SYNC_FRAME, MediaCodec.BUFFER_FLAG_KEY_FRAME, MediaCodec.BUFFER_FLAG_CODEC_CONFIG, MediaCodec.BUFFER_FLAG_END_OF_STREAM, MediaCodec.BUFFER_FLAG_PARTIAL_FRAME, android.media.MediaCodec.BUFFER_FLAG_MUXER_DATA, and MediaCodec.BUFFER_FLAG_DECODE_ONLY

Public methods

describeContents

Added in API level 34
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getFlags

Added in API level 34
public int getFlags ()

Gets the buffer flags for this ad buffer.

Returns
int The buffer flags for this ad buffer. Value is either 0 or a combination of MediaCodec.BUFFER_FLAG_SYNC_FRAME, MediaCodec.BUFFER_FLAG_KEY_FRAME, MediaCodec.BUFFER_FLAG_CODEC_CONFIG, MediaCodec.BUFFER_FLAG_END_OF_STREAM, MediaCodec.BUFFER_FLAG_PARTIAL_FRAME, android.media.MediaCodec.BUFFER_FLAG_MUXER_DATA, and MediaCodec.BUFFER_FLAG_DECODE_ONLY

See also:

getId

Added in API level 34
public int getId ()

Gets corresponding AD request ID.

Returns
int The ID of the ad request

getLength

Added in API level 34
public int getLength ()

Gets the data length of this ad buffer.

Returns
int The data length of this ad buffer in bytes.

getMimeType

Added in API level 34
public String getMimeType ()

Gets the mime type of the data.

Returns
String The mime type of the data. This value cannot be null.

getOffset

Added in API level 34
public int getOffset ()

Gets the offset into the shared memory to begin mapping.

Returns
int The offset of this ad buffer in the shared memory in bytes.

getPresentationTimeUs

Added in API level 34
public long getPresentationTimeUs ()

Gets the presentation time.

Returns
long The presentation time in microseconds.

getSharedMemory

Added in API level 34
public SharedMemory getSharedMemory ()

Gets the SharedMemory which stores the data.

Information on how the data in this buffer is formatted can be found using AdRequest.getMetadata()

This data lives in a SharedMemory instance because of the potentially large amount of data needed to store the ad. This optimizes the data communication between the ad data source and the service responsible for its display.

Returns
SharedMemory The SharedMemory that stores the data for this ad buffer. This value cannot be null.

writeToParcel

Added in API level 34
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES