Skip to main content

OH_VideoDecoder_RenderOutputBufferAtTime

Function OH_VideoDecoder_RenderOutputBufferAtTime 

Source
pub unsafe extern "C" fn OH_VideoDecoder_RenderOutputBufferAtTime(
    codec: *mut OH_AVCodec,
    index: u32,
    renderTimestampNs: i64,
) -> OH_AVErrCode
Available on crate feature api-12 only.
Expand description

Return the processed output buffer with render timestamp to the decoder, and notify the decoder to finish rendering the decoded data contained in the buffer on the output surface. If the output surface is not configured before, calling this interface only returns the output buffer corresponding to the specified index to the decoder. The timestamp may have special meaning depending on the destination surface. Invoker can use the timestamp to render the buffer at a specific time (at the VSYNC at or after the buffer timestamp). For this to work, the timestamp needs to be reasonably close to the current SystemNanoTime. A few notes:

  1. The buffer will not be returned to the codec until the timestamp has passed and the buffer is no longer used by the surface.
  2. Buffers are processed sequentially, so you may block subsequent buffers to be displayed on the surface. This is important if you want to react to user action, e.g. stop the video or seek.
  3. If multiple buffers are sent to the surface to be rendered at the same VSYNC, the last one will be shown, and the other ones will be dropped.
  4. If the timestamp is not “reasonably close” to the current system time, the Surface will ignore the timestamp, and display the buffer at the earliest feasible time. In this mode it will not drop frames.

Required System Capabilities: SystemCapability.Multimedia.Media.VideoDecoder

§Arguments

  • codec - Pointer to an OH_AVCodec instance

  • index - The index value corresponding to the output buffer, should be given by [OH_AVCodecOnNewOutputBuffer]

  • renderTimestampNs - The timestamp is associated with the output buffer when it is sent to the surface. The unit is nanosecond

§Returns

  • Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to OH_AVErrCode. [AV_ERR_NO_MEMORY], the codec has already released. [AV_ERR_INVALID_VAL], the parameter is invalid. [AV_ERR_UNKNOWN], unknown error. [AV_ERR_SERVICE_DIED], avcodec service is died. [AV_ERR_INVALID_STATE], this interface was called in invalid state.

Available since API-level: 12