Android/QNX buffer queue

The Android/QNX buffer queue is an extension of the XADataLocator structure. The XADataLocator_AndroidBufferQueue structure means the input/ouput is the buffer provided by the app.

Comparison with OpenSL buffer queues

The Android/QNX buffer queue is similar to the OpenSL buffer queues, with the following differences:

  • Each command consists of a key-value pair. These command key-value pairs can be enqueued with the corresponding buffer in the queue, as well as with the associated data.
  • Status key-value pairs can be returned from the OpenMAX AL implementation through the completion callback. These status key-value pairs are returned with the corresponding buffer in the queue.
  • The completion callback receives additional parameters, including buffer pointer, buffer size, and the amount of data used by the data source (or filled by the data sink).
  • The callback must return XA_RESULT_SUCCESS.

Data locator and interface

The data locator type must be XA_DATALOCATOR_ANDROIDBUFFERQUEUE, and the associated structure is XADataLocator_AndroidBufferQueue. The BlackBerry 10 implementation of OpenMAX AL adds the following two interfaces:

Interface

Description

XAAndroidBufferQueueItf

Provides methods to send data from the app-allocated buffers.

XAQNXBufferQueueSinkItf

Provides methods to receive data from OpenMAX AL object-allocated buffers.

Interface IDs

Use the following interface IDs to refer to the interface type within the source code.

ID

Description

XA_IID_ANDROIDBUFFERQUEUESOURCE

The interfaces that provide the buffer queue as the data source. For example, an input stream that contains both audio and video data for the media player object.

XA_IID_ANDROIDAUDIOBUFFERQUEUESOURCE

The interfaces that provide the buffer queue as the audio data source. For example, PCM audio input for the media recording object.

XA_IID_ANDROIDVIDEOBUFFERQUEUESOURCE

The interfaces that provide the buffer queue as the video data source. For example, raw video frames for the media recorder object.

XA_IID_QNXBUFFERQUEUESINK

The interfaces that provide the buffer queue as the data sink. For example, audio and video data in an MP4 file container sent from the media recorder object.

XA_IID_QNXAUDIOBUFFERQUEUESINK

The interfaces that provide the buffer queue as the audio data sink. For example, audio output sent from the media player object.

XA_IID_QNXVIDEOBUFFERQUEUESINK

The interfaces that provide the buffer queue as the video data sink. For example, video output sent from the media player object.

Commands

An application can return one of the following item codes (key-value) pairs:

Command

Description

XA_ANDROID_ITEMKEY_EOS

The end of stream has been reached (playback is complete), no more input is given, and the remaining data must drain. There is no data buffer sent with this command and dataSize must be 0.

XA_ANDROID_ITEMKEY_DISCONTINUITY

Marks a time discontinuity in the stream, for example, seeking to a new point in a stream. The new time is specified as the parameter dataUsed. This item key is specified with the first buffer of the new time. This buffer of data must be an IDR (Instantaneous Decoding Refresh) frame if one exists for the format.

XA_ANDROID_ITEMKEY_FORMAT_CHANGE

A format change must be processed. This command is passed in with the first buffer of the new format, for example, bitrate or resolution.

XAQ_ITEMKEY_LOST_FRAME

The app notifies the decoder that a frame is lost.

XAQ_ITEMKEY_DIRTY_RECTS

The dirty rectangles of the data in screen_buffer_t.

XAQ_ITEMKEY_TIMESTAMP

The time stamp of the buffer.

When the buffer is returned via the callback, the app may reuse it. The OpenMAX AL implementation no longer needs it.

Status

The OpenMAX AL implementation can return status key-value pairs using the callback handler XA_ANDROID_ITEMKEY_BUFFERQUEUEEVENT. The item data is a combination of XA_ANDROIDBUFFERQUEUEEVENT_* flags. The flags explain why the callback handler was called.

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus