avcodec capi 补充错误码说明

Signed-off-by: zhanghongran <zhanghongran@huawei.com>
This commit is contained in:
zhanghongran 2024-05-28 22:59:34 +08:00
parent ced28ce015
commit e827049b4b
4 changed files with 300 additions and 59 deletions

View File

@ -30,7 +30,8 @@ typedef struct MediaKeySession MediaKeySession;
* @brief Creates a video decoder instance from the mime type, which is recommended in most cases.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
* @return Returns a Pointer to an OH_AVCodec instance
* @return Returns a Pointer to an OH_AVCodec instance.
* Return nullptr if memory ran out or the mime type is not supported.
* @since 9
* @version 1.0
*/
@ -41,7 +42,8 @@ OH_AVCodec *OH_VideoDecoder_CreateByMime(const char *mime);
* The premise of using this interface is to know the exact name of the decoder.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param name video codec name
* @return Returns a Pointer to an OH_AVCodec instance
* @return Returns a Pointer to an OH_AVCodec instance.
* Return nullptr if memory ran out or the decoder name is not supported.
* @since 9
* @version 1.0
*/
@ -51,8 +53,12 @@ OH_AVCodec *OH_VideoDecoder_CreateByName(const char *name);
* @brief Clear the internal resources of the decoder and destroy the decoder instance
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* @return Returns AV_ERR_OK if succeed,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* @since 9
* @version 1.0
*/
@ -66,7 +72,12 @@ OH_AVErrCode OH_VideoDecoder_Destroy(OH_AVCodec *codec);
* @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @deprecated since 11
* @useinstead OH_VideoDecoder_RegisterCallback
* @since 9
@ -82,7 +93,12 @@ OH_AVErrCode OH_VideoDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb
* @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
@ -94,7 +110,13 @@ OH_AVErrCode OH_VideoDecoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallb
* @param codec Pointer to an OH_AVCodec instance
* @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_OPERATE_NOT_PERMIT}, not permit to call the interface in buffer mode.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -107,7 +129,12 @@ OH_AVErrCode OH_VideoDecoder_SetSurface(OH_AVCodec *codec, OHNativeWindow *windo
* @param codec Pointer to an OH_AVCodec instance
* @param format A pointer to an OH_AVFormat to give the description of the video track to be decoded
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. Invalid param in format.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @since 9
* @version 1.0
*/
@ -119,7 +146,12 @@ OH_AVErrCode OH_VideoDecoder_Configure(OH_AVCodec *codec, OH_AVFormat *format);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -131,7 +163,12 @@ OH_AVErrCode OH_VideoDecoder_Prepare(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -143,7 +180,12 @@ OH_AVErrCode OH_VideoDecoder_Start(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -156,7 +198,12 @@ OH_AVErrCode OH_VideoDecoder_Stop(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -168,7 +215,12 @@ OH_AVErrCode OH_VideoDecoder_Flush(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -180,7 +232,8 @@ OH_AVErrCode OH_VideoDecoder_Reset(OH_AVCodec *codec);
* to be manually released by the caller.
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns a pointer to an OH_AVFormat instance
* @return Returns a pointer to an OH_AVFormat instance.
* Return nullptr if the decoder is nullptr or invaild.
* @since 9
* @version 1.0
*/
@ -193,7 +246,12 @@ OH_AVFormat *OH_VideoDecoder_GetOutputDescription(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @param format pointer to an OH_AVFormat instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. Invalid param in format.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -211,7 +269,13 @@ OH_AVErrCode OH_VideoDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @param index Enter the index value corresponding to the Buffer
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNeedInputData}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @deprecated since 11
* @useinstead OH_VideoDecoder_PushInputBuffer
* @since 9
@ -227,7 +291,13 @@ OH_AVErrCode OH_VideoDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputData}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @deprecated since 11
* @useinstead OH_VideoDecoder_RenderOutputBuffer
* @since 9
@ -241,7 +311,13 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputData(OH_AVCodec *codec, uint32_t index)
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputData}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @deprecated since 11
* @useinstead OH_VideoDecoder_FreeOutputBuffer
* @since 9
@ -260,7 +336,13 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
* @param codec Pointer to an OH_AVCodec instance
* @param index The index of the input buffer.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNeedInputBuffer}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
@ -272,8 +354,14 @@ OH_AVErrCode OH_VideoDecoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
* @syscap SystemCapability.Multimedia.Media.VideoDecoder
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link
* OH_AVErrCode}
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputBuffer}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t index);
@ -284,7 +372,13 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t inde
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputBuffer}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 11
*/
OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
@ -297,7 +391,11 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index)
* @param isValid Output parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
* false if the codec instance is invalid
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* @since 10
*/
OH_AVErrCode OH_VideoDecoder_IsValid(OH_AVCodec *codec, bool *isValid);

View File

@ -43,7 +43,8 @@ typedef void (*OH_VideoEncoder_OnNeedInputParameter)(OH_AVCodec *codec, uint32_t
* @brief Creates a video encoder instance from the mime type, which is recommended in most cases.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE}
* @return Returns a Pointer to an OH_AVCodec instance
* @return Returns a Pointer to an OH_AVCodec instance.
* Return nullptr if memory ran out or the mime type is not supported.
* @since 9
* @version 1.0
*/
@ -54,7 +55,8 @@ OH_AVCodec *OH_VideoEncoder_CreateByMime(const char *mime);
* know the exact name of the encoder.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param name Video encoder name
* @return Returns a Pointer to an OH_AVCodec instance
* @return Returns a Pointer to an OH_AVCodec instance.
* Return nullptr if memory ran out or the encoder name is not supported.
* @since 9
* @version 1.0
*/
@ -65,7 +67,11 @@ OH_AVCodec *OH_VideoEncoder_CreateByName(const char *name);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* @since 9
* @version 1.0
*/
@ -79,7 +85,12 @@ OH_AVErrCode OH_VideoEncoder_Destroy(OH_AVCodec *codec);
* @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @deprecated since 11
* @useinstead OH_VideoEncoder_RegisterCallback
* @since 9
@ -94,8 +105,13 @@ OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb
* @param codec Pointer to an OH_AVCodec instance
* @param callback A collection of all callback functions, see {@link OH_AVCodecCallback}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link
* OH_AVErrCode}
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
@ -109,8 +125,13 @@ OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallb
* @param codec Pointer to an OH_AVCodec instance
* @param onInputParameter A callback functions, see {@link OH_VideoEncoder_OnNeedInputParameter}
* @param userData User specific data
* @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link
* OH_AVErrCode}
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @since 12
*/
OH_AVErrCode OH_VideoEncoder_RegisterParameterCallback(OH_AVCodec *codec,
@ -124,7 +145,12 @@ OH_AVErrCode OH_VideoEncoder_RegisterParameterCallback(OH_AVCodec *codec,
* @param codec Pointer to an OH_AVCodec instance
* @param format A pointer to an OH_AVFormat that gives the description of the video track to be encoded
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid. Invalid param in format.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare.
* @since 9
* @version 1.0
*/
@ -136,7 +162,12 @@ OH_AVErrCode OH_VideoEncoder_Configure(OH_AVCodec *codec, OH_AVFormat *format);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -148,7 +179,12 @@ OH_AVErrCode OH_VideoEncoder_Prepare(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -159,7 +195,12 @@ OH_AVErrCode OH_VideoEncoder_Start(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -172,7 +213,12 @@ OH_AVErrCode OH_VideoEncoder_Stop(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -184,7 +230,12 @@ OH_AVErrCode OH_VideoEncoder_Flush(OH_AVCodec *codec);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -196,7 +247,8 @@ OH_AVErrCode OH_VideoEncoder_Reset(OH_AVCodec *codec);
* be manually released by the caller.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns a pointer to an OH_AVFormat instance
* @return Returns a pointer to an OH_AVFormat instance.
* Return nullptr if the codec is nullptr or invaild.
* @since 9
* @version 1.0
*/
@ -209,7 +261,12 @@ OH_AVFormat *OH_VideoEncoder_GetOutputDescription(OH_AVCodec *codec);
* @param codec Pointer to an OH_AVCodec instance
* @param format OH_AVFormat handle pointer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid. Invalid param in format.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -222,7 +279,12 @@ OH_AVErrCode OH_VideoEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format
* @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}, the application is responsible for
* managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, inner resource has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -234,7 +296,13 @@ OH_AVErrCode OH_VideoEncoder_GetSurface(OH_AVCodec *codec, OHNativeWindow **wind
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputData}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @deprecated since 11
* @useinstead OH_VideoEncoder_FreeOutputBuffer
* @since 9
@ -248,7 +316,12 @@ OH_AVErrCode OH_VideoEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index);
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 9
* @version 1.0
*/
@ -261,7 +334,13 @@ OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream(OH_AVCodec *codec);
* @param index Enter the index value corresponding to the Buffer
* @param attr Information describing the data contained in the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNeedInputData}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @deprecated since 11
* @useinstead OH_VideoEncoder_PushInputBuffer
* @since 10
@ -274,7 +353,14 @@ OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
* @param codec Pointer to an OH_AVCodec instance
* @param index Enter the index value corresponding to the Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNeedInputBuffer}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
@ -286,7 +372,13 @@ OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
* @param codec Pointer to an OH_AVCodec instance
* @param index Enter the index value corresponding to the input parameter
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* Index should be given by {@link OH_VideoEncoder_OnNeedInputParameter}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 12
*/
OH_AVErrCode OH_VideoEncoder_PushInputParameter(OH_AVCodec *codec, uint32_t index);
@ -297,7 +389,13 @@ OH_AVErrCode OH_VideoEncoder_PushInputParameter(OH_AVCodec *codec, uint32_t inde
* @param codec Pointer to an OH_AVCodec instance
* @param index The index value corresponding to the output Buffer
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* Buffer index should be given by {@link OH_AVCodecOnNewOutputBuffer}.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state.
* @since 11
*/
OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index);
@ -308,7 +406,8 @@ OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index)
* instance pointed to by the return value needs to be manually released by the caller.
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
* @param codec Pointer to an OH_AVCodec instance
* @return Returns a pointer to an OH_AVFormat instance
* @return Returns a pointer to an OH_AVFormat instance.
* Return nullptr if the encoder is nullptr or invaild.
* @since 10
*/
OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec);
@ -321,7 +420,11 @@ OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec);
* @param isValid Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
* false if the codec instance is invalid
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}.
* {@link AV_ERR_NO_MEMORY}, instance has already released.
* {@link AV_ERR_INVALID_VAL}, the encoder is nullptr or invalid.
* {@link AV_ERR_UNKNOWN}, unknown error.
* {@link AV_ERR_SERVICE_DIED}, avcodec service is died.
* @since 10
*/
OH_AVErrCode OH_VideoEncoder_IsValid(OH_AVCodec *codec, bool *isValid);

View File

@ -43,7 +43,9 @@ typedef void (*Demuxer_MediaKeySystemInfoCallback)(OH_AVDemuxer *demuxer, DRM_Me
* Free the resources of the instance by calling OH_AVDemuxer_Destroy.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param source Pointer to an OH_AVSource instance.
* @return Returns a pointer to an OH_AVDemuxer instance
* @return Returns a pointer to an OH_AVDemuxer instance if the execution is successful, otherwise returns nullptr.
* Possible failure causes:
* 1. source is invalid.
* @since 10
*/
OH_AVDemuxer *OH_AVDemuxer_CreateWithSource(OH_AVSource *source);
@ -57,6 +59,7 @@ OH_AVDemuxer *OH_AVDemuxer_CreateWithSource(OH_AVSource *source);
* @param demuxer Pointer to an OH_AVDemuxer instance.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid.
* @since 10
*/
OH_AVErrCode OH_AVDemuxer_Destroy(OH_AVDemuxer *demuxer);
@ -72,6 +75,8 @@ OH_AVErrCode OH_AVDemuxer_Destroy(OH_AVDemuxer *demuxer);
* @param trackIndex The index of the selected track.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid, demuxer is not properly initialized,
* trackIndex is out of range, track is not supported to be read.
* @since 10
*/
OH_AVErrCode OH_AVDemuxer_SelectTrackByID(OH_AVDemuxer *demuxer, uint32_t trackIndex);
@ -87,6 +92,7 @@ OH_AVErrCode OH_AVDemuxer_SelectTrackByID(OH_AVDemuxer *demuxer, uint32_t trackI
* @param trackIndex The index of the unselected track.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid, demuxer is not properly initialized.
* @since 10
*/
OH_AVErrCode OH_AVDemuxer_UnselectTrackByID(OH_AVDemuxer *demuxer, uint32_t trackIndex);
@ -102,6 +108,11 @@ OH_AVErrCode OH_AVDemuxer_UnselectTrackByID(OH_AVDemuxer *demuxer, uint32_t trac
* @param info The OH_AVCodecBufferAttr handle pointer to the buffer storing sample information.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid, demuxer is not properly initialized, sample is invalid,
* trackIndex is out of range.
* {@link AV_ERR_OPERATE_NOT_PERMIT} trackIndex has not been selected.
* {@link AV_ERR_NO_MEMORY} capability of sample is not enough to store all frame data.
* {@link AV_ERR_UNKNOWN} failed to read or parse frame from file.
* @deprecated since 11
* @useinstead OH_AVDemuxer_ReadSampleBuffer
* @since 10
@ -119,6 +130,11 @@ OH_AVErrCode OH_AVDemuxer_ReadSample(OH_AVDemuxer *demuxer, uint32_t trackIndex,
* @param sample The OH_AVBuffer handle pointer to the buffer storing the sample data and corresponding attribute.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid, demuxer is not properly initialized, sample is invalid,
* trackIndex is out of range.
* {@link AV_ERR_OPERATE_NOT_PERMIT} trackIndex has not been selected.
* {@link AV_ERR_NO_MEMORY} capability of sample is not enough to store frame data.
* {@link AV_ERR_UNKNOWN} failed to read or parse frame from file.
* @since 11
*/
OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t trackIndex,
@ -133,6 +149,10 @@ OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t track
* @param mode The mode for seeking. See {@link OH_AVSeekMode}.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} demuxer is invalid, demuxer is not properly initialized,
* millisecond is out of range.
* {@link AV_ERR_OPERATE_NOT_PERMIT} trackIndex has not been selected, resource is unseekable.
* {@link AV_ERR_UNKNOWN} failed to seek.
* @since 10
*/
OH_AVErrCode OH_AVDemuxer_SeekToTime(OH_AVDemuxer *demuxer, int64_t millisecond, OH_AVSeekMode mode);
@ -170,7 +190,7 @@ OH_AVErrCode OH_AVDemuxer_SetDemuxerMediaKeySystemInfoCallback(OH_AVDemuxer *dem
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param demuxer Pointer to an OH_AVDemuxer instance
* @param mediaKeySystemInfo Indicates the media key system info which ram space allocated by callee and
released by caller.
* released by caller.
* @return {@link AV_ERR_OK} 0 - Success
* {@link AV_ERR_INVALID_VAL} 3 - If the demuxer instance is nullptr or invalid
* or the mediaKeySystemInfo is nullptr.

View File

@ -28,12 +28,16 @@ extern "C" {
typedef struct OH_AVSource OH_AVSource;
/**
* @brief Creates an OH_AVSource instance that models the media with dataSource.
* @brief Creates an OH_AVSource instance that models the media with data source.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param dataSource An Struct for a remote media resource.
* @param dataSource User customized media resource.
* @return Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
* Possible failure causes: 1. dataSource is nullptr. 2. dataSource->size == 0. 3. set data source failed.
* 4. out of memory. 5. demuxer engine is nullptr.
* Possible failure causes:
* 1. dataSource is nullptr.
* 2. dataSource->size == 0.
* 3. set data source failed.
* 4. out of memory.
* 5. demuxer engine is nullptr.
* @since 12
*/
OH_AVSource *OH_AVSource_CreateWithDataSource(OH_AVDataSource *dataSource);
@ -42,7 +46,11 @@ OH_AVSource *OH_AVSource_CreateWithDataSource(OH_AVDataSource *dataSource);
* @brief Creates an OH_AVSource instance that models the media at the URI.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param uri An URI for a remote media resource.
* @return Returns a pointer to an OH_AVSource instance
* @return Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
* Possible failure causes:
* 1. network anomaly.
* 2. resource is invalid.
* 3. file format is not supported.
* @since 10
*/
OH_AVSource *OH_AVSource_CreateWithURI(char *uri);
@ -53,7 +61,13 @@ OH_AVSource *OH_AVSource_CreateWithURI(char *uri);
* @param fd The fileDescriptor of data source.
* @param offset The offset into the file to start reading.
* @param size The file size in bytes.
* @return Returns a pointer to an OH_AVSource instance
* @return Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
* Possible failure causes:
* 1. fd is invalid.
* 2. offset is not start pos of resource.
* 3. size error.
* 4. resource is invalid.
* 5. file format is not supported.
* @since 10
*/
OH_AVSource *OH_AVSource_CreateWithFD(int32_t fd, int64_t offset, int64_t size);
@ -64,6 +78,7 @@ OH_AVSource *OH_AVSource_CreateWithFD(int32_t fd, int64_t offset, int64_t size);
* @param source Pointer to an OH_AVSource instance.
* @return Returns AV_ERR_OK if the execution is successful,
* otherwise returns a specific error code, refer to {@link OH_AVErrCode}
* {@link AV_ERR_INVALID_VAL} source is invalid.
* @since 10
*/
OH_AVErrCode OH_AVSource_Destroy(OH_AVSource *source);
@ -72,7 +87,9 @@ OH_AVErrCode OH_AVSource_Destroy(OH_AVSource *source);
* @brief Get the format info of source.
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param source Pointer to an OH_AVSource instance.
* @return Returns the source's format info.
* @return Returns the source's format info if the execution is successful, otherwise returns nullptr.
* Possible failure causes:
* 1. source is invalid.
* @since 10
*/
OH_AVFormat *OH_AVSource_GetSourceFormat(OH_AVSource *source);
@ -82,7 +99,10 @@ OH_AVFormat *OH_AVSource_GetSourceFormat(OH_AVSource *source);
* @syscap SystemCapability.Multimedia.Media.Spliter
* @param source Pointer to an OH_AVSource instance.
* @param trackIndex The track index to get format.
* @return Returns the track's format info.
* @return Returns the track's format info if the execution is successful, otherwise returns nullptr.
* Possible failure causes:
* 1. source is invalid.
* 2. trackIndex is out of range.
* @since 10
*/
OH_AVFormat *OH_AVSource_GetTrackFormat(OH_AVSource *source, uint32_t trackIndex);