diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 6c41bb59980a422c0a350c601ceae8221b1739b8..672b8db4dfbaa24e2148a4406dbb9b06a10aa929 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -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); @@ -309,8 +407,11 @@ OH_AVErrCode OH_VideoDecoder_IsValid(OH_AVCodec *codec, bool *isValid); * @param codec Pointer to an OH_AVCodec instance * @param mediaKeySession A media key session instance with decryption function. * @param secureVideoPath Require secure decoder or not. - * @return Returns AV_ERR_OK if the execution is successful, - * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @return {@link AV_ERR_OK} 0 - Success + * {@link AV_ERR_OPERATE_NOT_PERMIT} 2 - If the codec service or the media key session + * service is in wrong status. + * {@link AV_ERR_INVALID_VAL} 3 - If the codec instance is nullptr or invalid, + * the mediaKeySession is nullptr or invalid. * @since 11 * @version 1.0 */ diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index 5d51db899ce7ea39023f24b885814643d356d963..9ac83852f148fe921fb69be13ffd54952f1953d5 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -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); diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index 84634687e987dbfa241f494a726351ff3fa3bbdf..60ce78a16bba94ee0fb9041b57e72a19cb4ed720 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -33,7 +33,9 @@ typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeyS * 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); @@ -47,6 +49,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); @@ -62,6 +65,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); @@ -77,6 +82,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); @@ -92,6 +98,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 @@ -109,6 +120,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, @@ -123,6 +139,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); @@ -132,8 +152,9 @@ OH_AVErrCode OH_AVDemuxer_SeekToTime(OH_AVDemuxer *demuxer, int64_t millisecond, * @syscap SystemCapability.Multimedia.Media.Spliter * @param demuxer Pointer to an OH_AVDemuxer instance * @param callback object pointer. - * @return Returns {@link AV_ERR_OK} if the drm info callback is set; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @return {@link AV_ERR_OK} 0 - Success + * {@link AV_ERR_OPERATE_NOT_PERMIT} 2 - If the demuxer engine is not inited or init failed. + * {@link AV_ERR_INVALID_VAL} 3 - If the demuxer instance is nullptr or invalid. * @since 11 * @version 1.0 */ @@ -145,9 +166,10 @@ OH_AVErrCode OH_AVDemuxer_SetMediaKeySystemInfoCallback(OH_AVDemuxer *demuxer, * @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. - * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * 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. * @since 11 * @version 1.0 */ diff --git a/multimedia/av_codec/native_avsource.h b/multimedia/av_codec/native_avsource.h index a211d69505c24d16544741600e1b25bb0bc90293..cacdefb13ad9d293fabbfcdc3a9e6987f982bdc8 100644 --- a/multimedia/av_codec/native_avsource.h +++ b/multimedia/av_codec/native_avsource.h @@ -31,7 +31,13 @@ typedef struct OH_AVSource OH_AVSource; * @brief Creates an OH_AVSource instance that models the media with dataSource. * @syscap SystemCapability.Multimedia.Media.Spliter * @param dataSource An Struct 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. 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); @@ -40,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); @@ -51,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); @@ -62,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); @@ -70,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); @@ -80,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);