diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 3b9d810feb9cc8de2968848f46a69232ed9d758b..6861bd832e04b05f864abf71f5d1b5c714232c6d 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -67,7 +67,7 @@ typedef struct OH_AVCodec OH_AVCodec; * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance * @param errorCode specific error code - * @param userData User specific data + * @param userData The data that the user rely on to execute the callback. * @since 9 */ typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData); @@ -80,20 +80,20 @@ typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *us * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance * @param format New output stream description information - * @param userData User specific data + * @param userData The data that the user rely on to execute the callback. * @since 9 */ typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData); /** * @brief When OH_AVCodec needs new input data during the running process, - * the function pointer will be called and carry an available Buffer to fill in the new input data. + * the function pointer will be called and carry an available buffer to fill in the new input data. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance * @param index The index corresponding to the newly available input buffer. * @param data New available input buffer. - * @param userData User specific data + * @param userData The data that the user rely on to execute the callback. * @deprecated since 11 * @useinstead OH_AVCodecOnNeedInputBuffer * @since 9 @@ -101,17 +101,17 @@ typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData); /** - * @brief When new output data is generated during the operation of OH_AVCodec, the function pointer will be - * called and carry a Buffer containing the new output data. It should be noted that the life cycle of the - * OH_AVCodecBufferAttr pointer is only valid when the function pointer is called. , which prohibits continued - * access after the call ends. + * @brief When the resolution of the decoding input stream or the resolution of the encoding output stream changes, + * the function pointer will be called to report the new stream description information. + * It should be noted that the life cycle of the OH_AVFormat pointer is only valid when the function pointer is called, + * and it is forbidden to continue to access after the call ends. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance - * @param index The index corresponding to the new output Buffer. + * @param index The index corresponding to the new output buffer. * @param data Buffer containing the new output data - * @param attr The description of the new output Buffer, please refer to {@link OH_AVCodecBufferAttr} - * @param userData specified data + * @param attr The description of the new output buffer, please refer to {@link OH_AVCodecBufferAttr} + * @param userData The data that the user rely on to execute the callback. * @deprecated since 11 * @useinstead OH_AVCodecOnNewOutputBuffer * @since 9 @@ -121,26 +121,26 @@ typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_ /** * @brief When OH_AVCodec needs new input data during the running process, - * the function pointer will be called and carry an available Buffer to fill in the new input data. + * the function pointer will be called and carry an available buffer to fill in the new input data. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance * @param index The index corresponding to the newly available input buffer. * @param buffer New available input buffer. - * @param userData User specific data + * @param userData The data that the user rely on to execute the callback. * @since 11 */ typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData); /** * @brief When new output data is generated during the operation of OH_AVCodec, the function pointer will be - * called and carry a Buffer containing the new output data. + * called and carry a buffer containing the new output data. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @param codec OH_AVCodec instance - * @param index The index corresponding to the new output Buffer. + * @param index The index corresponding to the new output buffer. * @param buffer Buffer containing the new output buffer. - * @param userData specified data + * @param userData The data that the user rely on to execute the callback. * @since 11 */ typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData); @@ -186,7 +186,7 @@ typedef struct OH_AVCodecCallback { } OH_AVCodecCallback; /** - * @brief the function pointer will be called to get sequence media data. + * @brief The function pointer will be called to get sequence media data. * @syscap SystemCapability.Multimedia.Media.CodecBase * @param data OH_AVBuffer buffer to fill * @param length expected to read size; @@ -288,7 +288,7 @@ extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP; /** - * @brief Enumerates the mime types of audio vivid codec. + * @brief Enumerates the mime types of Audio Vivid codec. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 @@ -378,7 +378,7 @@ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG2; extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2; /** - * @brief Key for timeStamp in surface's extraData, value type is int64_t. + * @brief Key for timeStamp in surfacebuffer, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @deprecated since 14 @@ -386,7 +386,7 @@ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2; */ extern const char *OH_ED_KEY_TIME_STAMP; /** - * @brief Key for endOfStream in surface's extraData, value type is bool. + * @brief Key for endOfStream in surfacebuffer, value type is int32_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @deprecated since 14 @@ -395,7 +395,7 @@ extern const char *OH_ED_KEY_TIME_STAMP; extern const char *OH_ED_KEY_EOS; /** - * @brief Key for track type, value type is int32_t, see {@link OH_MediaType}. + * @brief Key for track media type, value type is int32_t, see {@link OH_MediaType}. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -409,7 +409,7 @@ extern const char *OH_MD_KEY_TRACK_TYPE; */ extern const char *OH_MD_KEY_CODEC_MIME; /** - * @brief Key for file duration in microseconds, value type is int64_t. + * @brief Key for media file duration in microseconds, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -423,7 +423,7 @@ extern const char *OH_MD_KEY_DURATION; */ extern const char *OH_MD_KEY_BITRATE; /** - * @brief Key for max input size, value type is int32_t. + * @brief Key for setting the max decode input size, value type is int32_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -472,7 +472,7 @@ extern const char *OH_MD_KEY_FRAME_RATE; */ extern const char *OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE; /** - * @brief encode profile, the value type is int32_t. see {@link OH_AVCProfile}, {@link OH_HEVCProfile}, + * @brief Encode profile, the value type is int32_t. see {@link OH_AVCProfile}, {@link OH_HEVCProfile}, * {@link OH_AACProfile}. * * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -494,15 +494,17 @@ extern const char *OH_MD_KEY_AUD_CHANNEL_COUNT; */ extern const char *OH_MD_KEY_AUD_SAMPLE_RATE; /** - * @brief Key for the interval of key frame. value type is int32_t, the unit is milliseconds. A negative value means no - * key frames are requested after the first frame. A zero value means a stream containing all key frames is requested. + * @brief Key for the interval of key frame, value type is int32_t, the unit is milliseconds. + * This key is optional and only used for video encoding. A negative value means no key frames + * are requested after the first frame. A zero value means a stream containing all key frames is requested. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 */ extern const char *OH_MD_KEY_I_FRAME_INTERVAL; /** - * @brief Key of the surface rotation angle. value type is int32_t: should be {0, 90, 180, 270}, default is 0. + * @brief Key of the surface rotation angle, value type is int32_t: should be {0, 90, 180, 270}, default is 0. + * This key is only used in video decoding Surface mode. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -510,7 +512,7 @@ extern const char *OH_MD_KEY_I_FRAME_INTERVAL; extern const char *OH_MD_KEY_ROTATION; /** - * @brief Key for video YUV value range flag, value type is bool, true for full range, false for limited range. + * @brief Key for video YUV value range flag, value type is int32_t, 1 for full range, 0 for limited range. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -538,106 +540,108 @@ extern const char *OH_MD_KEY_TRANSFER_CHARACTERISTICS; */ extern const char *OH_MD_KEY_MATRIX_COEFFICIENTS; /** - * @brief Key for the request an I-Frame immediately, value type is bool. + * @brief Key for the request an I-Frame immediately, value type is int32_t. + * It is used when OH_VideoEncoder_SetParameter is called or takes effect immediately with the frame. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_REQUEST_I_FRAME; /** - * @brief Key for the desired encoding quality, value type is int32_t, this key is only. - * supported for encoders that are configured in constant quality mode. + * @brief Key for the desired encoding quality, value type is int32_t, the range of encoding scene values in H264 + * and H265 can be obtained based on the capability query interface {@link OH_AVCapability_GetEncoderQualityRange}, + * this key is only supported for encoders that are configured in constant quality mode. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_QUALITY; /** - * @brief Key of the codec specific data. value type is a uint8_t pointer. - * + * @brief Key of the codec specific data, value type is a uint8_t pointer. + * In video, SPS/PPS is transferred. In audio, extraData is transferred. * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_CODEC_CONFIG; /** - * @brief source format Key for title, value type is string. + * @brief Key for media file title, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_TITLE; /** - * @brief source format Key for artist, value type is string. + * @brief Key for Media file artist, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_ARTIST; /** - * @brief source format Key for album, value type is string. + * @brief key for the media files of the album, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_ALBUM; /** - * @brief source format Key for album artist, value type is string. + * @brief Key for album artist, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_ALBUM_ARTIST; /** - * @brief source format Key for date, value type is string. + * @brief Key for media file date, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_DATE; /** - * @brief source format Key for comment, value type is string. + * @brief Key for media file comment, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_COMMENT; /** - * @brief source format Key for genre, value type is string. + * @brief Key for media file genre, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_GENRE; /** - * @brief source format Key for copyright, value type is string. + * @brief Key for media file copyright, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_COPYRIGHT; /** - * @brief source format Key for language, value type is string. + * @brief Key for media file language, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_LANGUAGE; /** - * @brief source format Key for description, value type is string. + * @brief Key for media file description, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_DESCRIPTION; /** - * @brief source format Key for lyrics, value type is string. + * @brief Key for media file lyrics, value type is string. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ extern const char *OH_MD_KEY_LYRICS; /** - * @brief source format Key for track count, value type is int32_t. + * @brief Key for media file track count, value type is int32_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -660,6 +664,8 @@ extern const char *OH_MD_KEY_CHANNEL_LAYOUT; extern const char *OH_MD_KEY_BITS_PER_CODED_SAMPLE; /** * @brief Key for the aac format, value type is int32_t, supported for aac decoder. + * The aac format is divided into ADTS format and LATM format. + * Where 0 represents LATM format and 1 represents ADTS format. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -673,7 +679,7 @@ extern const char *OH_MD_KEY_AAC_IS_ADTS; */ extern const char *OH_MD_KEY_SBR; /** - * @brief Key for flac compliance level, value type is int32_t. + * @brief Key for flac compliance level, value type is int32_t, only used in audio encoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -725,21 +731,22 @@ extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT; */ extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL; /** - * @brief Key of the video is hdr vivid. value type is bool. + * @brief key for whether the video track in the media file is HDR Vivid, value type is int32_t. + * Demuxer and muxer are supported. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 */ extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID; /** - * @brief Key for number of audio objects. value type is int32_t. + * @brief Key for number of audio objects, value type is int32_t, only used in Audio Vivid decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 */ extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER; /** - * @brief Key for meta data of audio vivid. value type is a uint8_t pointer. + * @brief Key for meta data of Audio Vivid, value type is a uint8_t pointer, only used in Audio Vivid decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 @@ -758,16 +765,18 @@ extern const char *OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNT; /** * @brief Key for enable the temporal scalability mode, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise. * The default value is 0. To query supported, you should use the interface {@link OH_AVCapability_IsFeatureSupported} - * with enum {@link VIDEO_ENCODER_TEMPORAL_SCALABILITY}. This is an optional key that applies only to video encoder. - * It is used in configure. + * with enum {@link VIDEO_ENCODER_TEMPORAL_SCALABILITY}. This is an optional key that applies only to video encoding. + * It is used in Configure state. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 */ extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY; /** - * @brief Key for describing the temporal group of picture size, value type is int32_t. It takes effect only when - * temporal level scale is enable. This is an optional key that applies only to video encoder. It is used in configure. + * @brief Key for describing the interval size at the base layer in temporal group of picture, value type is int32_t. + * It takes effect only when temporal level scale is enable. + * This is an optional key that applies only to video encoding. + * It is used in Configure state. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -776,7 +785,7 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZE; /** * @brief Key for describing the reference mode in temporal group of picture, value type is int32_t, see enum * {@link OH_TemporalGopReferenceMode}. It takes effect only when temporal level sacle is enabled. - * This is an optional key that applies only to video encoder. It is used in configure. + * This is an optional key that applies only to video encodeing. It is used in Configure state. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -786,7 +795,7 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE; * @brief Key for describing the count of used long-term reference frames, value type is int32_t, must be within the * supported range. To get supported range, you should query wthether the capability is supported through the interface * {@link OH_AVCapability_GetFeatureProperties} with enum {@link VIDEO_ENCODER_LONG_TERM_REFERENCE}, otherwise, not set - * the key. This is an optional key that applies only to video encoder. It is used in configure. + * the key. This is an optional key that applies only to video encodeing. It is used in Configure state. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -795,7 +804,7 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNT; /** * @brief Key for describing mark this frame as a long term reference frame, value type is int32_t (0 or 1): 1 is mark, * 0 otherwise. It takes effect only when the number of used long term reference frames is configured. This is an - * optional key that applies only to video encoder input loop. It takes effect immediately. + * optional key that applies only to video encoding input loop. It takes effect immediately. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -803,16 +812,16 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNT; extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTR; /** * @brief Key for describing the long term reference frame poc referenced by this frame, value type is int32_t. This is - * an optional key that applies only to video encoder input loop. It takes effect immediately. + * an optional key that applies only to video encodeing input loop. It takes effect immediately. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 */ extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTR; /** - * @brief Key for indicating this frame is a long-term reference frame, value type is int32_t (0 or 1): 1 is LTR, - * 0 otherwise. This is an optional key that applies only to video encoder output loop. - * It indicates the attribute of the frame. + * @brief Key for whether the frame corresponding to output buffer in OH_AVBuffer is a long-term reference frame, + * value type is int32_t (0 or 1): 1 is LTR,0 otherwise. This is an optional key that applies only + * to video encodeing output loop. It indicates the attribute of the frame. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -820,7 +829,7 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTR; extern const char *OH_MD_KEY_VIDEO_PER_FRAME_IS_LTR; /** * @brief Key for describing the frame poc, value type is int32_t. This is an optional key that applies only to video - * encoder output loop. It indicates the attribute of the frame. + * encodeing output loop. It indicates the attribute of the frame. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -828,7 +837,7 @@ extern const char *OH_MD_KEY_VIDEO_PER_FRAME_IS_LTR; extern const char *OH_MD_KEY_VIDEO_PER_FRAME_POC; /** * @brief Key for describing the top-coordinate (y) of the crop rectangle, value type is int32_t. This is the top-most - * row included in the crop frame, where row indices start at 0. + * row included in the crop frame, where row indices start at 0. This key is only used for video decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -836,7 +845,7 @@ extern const char *OH_MD_KEY_VIDEO_PER_FRAME_POC; extern const char *OH_MD_KEY_VIDEO_CROP_TOP; /** * @brief Key for describing the bottom-coordinate (y) of the crop rectangle, value type is int32_t. This is the - * bottom-most row included in the crop frame, where row indices start at 0. + * bottom-most row included in the crop frame, where row indices start at 0. This key is only used for video decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -845,6 +854,7 @@ extern const char *OH_MD_KEY_VIDEO_CROP_BOTTOM; /** * @brief Key for describing the left-coordinate (x) of the crop rectangle, value type is int32_t. * This is the left-most column included in the crop frame, where column indices start at 0. + * This key is only used for video decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -853,6 +863,7 @@ extern const char *OH_MD_KEY_VIDEO_CROP_LEFT; /** * @brief Key for describing the right-coordinate (x) of the crop rectangle, value type is int32_t. This is the * right-most column included in the crop frame, where column indices start at 0. + * This key is only used for video decoding. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -900,8 +911,8 @@ extern const char *OH_MD_KEY_VIDEO_PIC_HEIGHT; /** * @brief Key to enable the low latency mode, value type is int32_t (0 or 1):1 is enabled, 0 otherwise. * If enabled, the video encoder or video decoder doesn't hold input and output data more than required by - * the codec standards. This is an optional key that applies only to video encoder or video decoder. - * It is used in configure. + * the codec standards. This is an optional key that applies only to video encodeing or video decoding. + * It is used in Configure state. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -925,8 +936,7 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MAX; extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MIN; /** * @brief Key for describing the video frame averge quantization parameter, value type is int32_t. - * This is a part of a video encoder statistics export feature. This value is emitted from video encoder for a video - * frame. + * Indicate the average qp value of the current frame encoding block, which is output with OH_AVBuffer. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -934,22 +944,23 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MIN; extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGE; /** * @brief Key for describing video frame mean squared error, value type is double. - * This is a part of a video encoder statistics export feature. This value is emitted from video encoder for a video - * frame. + * Indicate the MSE statistics of the current frame encoding block, which is output with OH_AVBuffer. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 */ extern const char *OH_MD_KEY_VIDEO_ENCODER_MSE; /** - * @brief Key for decoding timestamp of the buffer in microseconds, value type is int64_t. + * @brief Key for decoding timestamp corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer, + * in microseconds, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 */ extern const char *OH_MD_KEY_DECODING_TIMESTAMP; /** - * @brief Key for duration of the buffer in microseconds, value type is int64_t. + * @brief Key for duration corresponding to the sample of audio, video, or subtitles carried in OH_AVBuffer, + * in microseconds, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -983,7 +994,7 @@ extern const char *OH_MD_KEY_TRACK_START_TIME; * the video decoder will automatically transcode an HDR Vivid video to an SDR video with color space BT709. * If color space conversion capability is not supported, {@link OH_VideoDecoder_Configure} returns * {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION}. - * If the input video is not an HDR vivid video, an error {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION} will + * If the input video is not an HDR Vivid video, an error {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION} will * be reported by callback function {@link OH_AVCodecOnError}. * * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -1042,7 +1053,7 @@ typedef enum OH_MediaType { } OH_MediaType; /** - * @brief AAC Profile + * @brief AAC Profile. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -1062,7 +1073,7 @@ typedef enum OH_AACProfile { } OH_AACProfile; /** - * @brief AVC Profile + * @brief AVC Profile. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 @@ -1074,7 +1085,7 @@ typedef enum OH_AVCProfile { } OH_AVCProfile; /** - * @brief HEVC Profile + * @brief HEVC Profile. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -1193,7 +1204,7 @@ typedef enum OH_MPEG4Profile { } OH_MPEG4Profile; /** - * @brief Enumerates the muxer output file format + * @brief output file format supported by the muxer. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -1226,16 +1237,16 @@ typedef enum OH_AVOutputFormat { * @since 10 */ typedef enum OH_AVSeekMode { - /* seek to sync sample after the time */ + /* Seek to sync sample after the time. If there is no I-frame after the time point, the mode may fail to seek */ SEEK_MODE_NEXT_SYNC = 0, - /* seek to sync sample before the time */ + /* Seek to sync sample before the time */ SEEK_MODE_PREVIOUS_SYNC, - /* seek to sync sample closest to time */ + /* Seek to sync sample closest to time */ SEEK_MODE_CLOSEST_SYNC, } OH_AVSeekMode; /** - * @brief Scaling Mode + * @brief Scaling Mode, only used in Surface mode. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @deprecated since 14 @@ -1256,7 +1267,7 @@ typedef enum OH_ScalingMode { } OH_ScalingMode; /** - * @brief enum Audio Bits Per Coded Sample + * @brief enum Audio Bits Per Coded Sample. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -1276,7 +1287,7 @@ typedef enum OH_BitsPerSample { } OH_BitsPerSample; /** - * @brief Color Primary + * @brief Color Primary. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -1296,7 +1307,7 @@ typedef enum OH_ColorPrimary { } OH_ColorPrimary; /** - * @brief Transfer Characteristic + * @brief Transfer Characteristic, both encoding and decoding are supported. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 @@ -1322,7 +1333,7 @@ typedef enum OH_TransferCharacteristic { } OH_TransferCharacteristic; /** - * @brief Matrix Coefficient + * @brief Matrix Coefficient. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 462d5011d07751e01fed1409fb6d8b60e05dac38..eedb7ad9b1bcdfa07b9d62c2483558167359bf56 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -54,11 +54,11 @@ extern "C" { typedef struct MediaKeySession MediaKeySession; /** - * @brief Creates a video decoder instance from the mime type, which is recommended in most cases. + * @brief Creates a video decoder instance from the mime type, it is recommended to use. * @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 nullptr if memory ran out or the mime type is not supported. + * Return NULL if memory ran out or the mime type is not supported. * @since 9 */ OH_AVCodec *OH_VideoDecoder_CreateByMime(const char *mime); @@ -66,24 +66,26 @@ OH_AVCodec *OH_VideoDecoder_CreateByMime(const char *mime); /** * @brief Create a video decoder instance through the video decoder name. * The premise of using this interface is to know the exact name of the decoder. + * The decoder name can be obtained through capability query. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param name video codec name * @return Returns a Pointer to an OH_AVCodec instance. - * Return nullptr if memory ran out or the decoder name is not supported. + * Return NULL if memory ran out or the decoder name is not supported. * @since 9 */ OH_AVCodec *OH_VideoDecoder_CreateByName(const char *name); /** - * @brief Clear the internal resources of the decoder and destroy the decoder instance + * @brief Clear the internal resources of the decoder and destroy the decoder instance. + * Can not be destoryed repeatedly. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Destroy(OH_AVCodec *codec); @@ -94,13 +96,13 @@ OH_AVErrCode OH_VideoDecoder_Destroy(OH_AVCodec *codec); * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback} - * @param userData User specific data + * @param userData The data that the user rely on to execute the callback * @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 decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. * @deprecated since 11 * @useinstead OH_VideoDecoder_RegisterCallback @@ -114,31 +116,31 @@ OH_AVErrCode OH_VideoDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @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 + * @param userData The data that the user rely on to execute the callback * @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 decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@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); /** - * @brief Specify the output Surface to provide video decoding output, - * this interface must be called before Prepare is called + * @brief Specify the output surface to provide video decoding output, + * this interface must be called before Prepare is called. + * This interface can be directly called in the Executing state. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @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}. - * {@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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, not permit to call the interface in Buffer mode. + * {@link AV_ERR_INVALID_VAL}, 1.the input codec pointer is non decoder instance or NULL; 2.window is NULL. * {@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 */ @@ -146,36 +148,38 @@ OH_AVErrCode OH_VideoDecoder_SetSurface(OH_AVCodec *codec, OHNativeWindow *windo /** * @brief To configure the video decoder, typically, you need to configure the description information of the decoded - * video track, which can be extracted from the OH_AVSource. This interface must be called before Prepare is called. + * video, which can be extracted from the OH_AVSource. This interface must be called before Prepare is called. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @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}. - * {@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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, + * 1. the input codec pointer is non decoder instance or NULL; + * 2. Invalid param in format. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. - * {@link AV_ERR_UNSUPPORT}, unsupported features. * {@link AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION}, video unsupported color space conversion. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Configure(OH_AVCodec *codec, OH_AVFormat *format); /** - * @brief To prepare the internal resources of the decoder, the Configure interface must be called before + * @brief Prepare the internal resources of the decoder, the Configure interface must be called before * calling this interface. * @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}. - * {@link AV_ERR_NO_MEMORY}, instance has already released. - * {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@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. - * {@link AV_ERR_OPERATE_NOT_PERMIT}, decoder is in buffer mode and color space conversion is configured. + * {@link AV_ERR_OPERATE_NOT_PERMIT} + * 1. internal execution error; + * 2. decoder is in Buffer mode and color space conversion is configured. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Prepare(OH_AVCodec *codec); @@ -187,61 +191,62 @@ OH_AVErrCode OH_VideoDecoder_Prepare(OH_AVCodec *codec); * @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}. - * {@link AV_ERR_NO_MEMORY}, instance has already released. - * {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@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. - * {@link AV_ERR_OPERATE_NOT_PERMIT}, video color space conversion is configured but decoder is not prepared. + * {@link AV_ERR_OPERATE_NOT_PERMIT} + * 1. internal execution error; + * 2. video color space conversion is configured but decoder is not Prepared. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Start(OH_AVCodec *codec); /** - * @brief Stop the decoder. After stopping, you can re-enter the Started state through Start, - * but it should be noted that if Codec-Specific-Data has been input to the decoder before, it needs to be input again. + * @brief Stop the decoder and release the input and output buffer. After stopping, + * you can re-enter the Running state through Start, but it should be noted that + * if Codec-Specific-Data has been input to the decoder before, it needs to be input again. * @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}. - * {@link AV_ERR_NO_MEMORY}, instance has already released. - * {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@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. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Stop(OH_AVCodec *codec); /** - * @brief Clear the input and output data buffered in the decoder. After this interface is called, all the Buffer - * indexes previously reported through the asynchronous callback will be invalidated, make sure not to access - * the Buffers corresponding to these indexes. + * @brief Clear the input and output data buffered and parameters in the decoder, for example, PPS/SPS in H264 format. + * After this interface is called, all the buffer indexes previously reported through the asynchronous callback + * will be invalidated, make sure not to access the buffers corresponding to these indexes. * @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}. - * {@link AV_ERR_NO_MEMORY}, instance has already released. - * {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Flush(OH_AVCodec *codec); /** - * @brief Reset the decoder. To continue decoding, you need to call the Configure interface again - * to configure the decoder instance. + * @brief Reset the decoder, the decoder returns to the Initialized state. + * To continue decoding, you need to call the Configure interface again to configure 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}. - * {@link AV_ERR_NO_MEMORY}, instance has already released. - * {@link AV_ERR_INVALID_VAL}, the decoder is nullptr or invalid. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@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. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * @since 9 */ OH_AVErrCode OH_VideoDecoder_Reset(OH_AVCodec *codec); @@ -249,11 +254,11 @@ OH_AVErrCode OH_VideoDecoder_Reset(OH_AVCodec *codec); /** * @brief Get the description information of the output data of the decoder, refer to {@link OH_AVFormat} * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs - * to be manually released by the caller. + * to be released by {@link OH_AVFormat_Destroy}. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @return Returns a pointer to an OH_AVFormat instance. - * Return nullptr if the decoder is nullptr or invaild. + * Return NULL if the decoder is NULL or invaild. * @since 9 */ OH_AVFormat *OH_VideoDecoder_GetOutputDescription(OH_AVCodec *codec); @@ -266,10 +271,12 @@ OH_AVFormat *OH_VideoDecoder_GetOutputDescription(OH_AVCodec *codec); * @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}. - * {@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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL} + * 1. the input codec pointer is non decoder instance or NULL; + * 2. invalid param in format. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @since 9 */ @@ -284,15 +291,15 @@ OH_AVErrCode OH_VideoDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format * process of the decoder, such as PPS/SPS data in H264 format. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index Enter the index value corresponding to the Buffer - * @param attr Information describing the data contained in the Buffer + * @param index Enter the index value corresponding to the buffer, + * should be given by {@link OH_AVCodecOnNeedInputData}. + * @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}. - * {@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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @deprecated since 11 * @useinstead OH_VideoDecoder_PushInputBuffer @@ -301,19 +308,19 @@ OH_AVErrCode OH_VideoDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format OH_AVErrCode OH_VideoDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr); /** - * @brief Return the processed output Buffer 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, + * @brief Return the processed output buffer 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. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index value corresponding to the output Buffer + * @param index The index value corresponding to the output buffer, + * should be given by {@link OH_AVCodecOnNewOutputData} * @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_AVCodecOnNewOutputData}. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @deprecated since 11 * @useinstead OH_VideoDecoder_RenderOutputBuffer @@ -322,17 +329,17 @@ OH_AVErrCode OH_VideoDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH OH_AVErrCode OH_VideoDecoder_RenderOutputData(OH_AVCodec *codec, uint32_t index); /** - * @brief Return the processed output Buffer to the decoder. + * @brief Return the processed output buffer to the decoder. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index value corresponding to the output Buffer + * @param index The index value corresponding to the output buffer, + * should be given by {@link OH_AVCodecOnNewOutputData}. * @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_AVCodecOnNewOutputData}. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @deprecated since 11 * @useinstead OH_VideoDecoder_FreeOutputBuffer @@ -341,43 +348,43 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputData(OH_AVCodec *codec, uint32_t index) OH_AVErrCode OH_VideoDecoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); /** - * @brief Submit the input buffer filled with data to the video decoder. The {@link OH_AVCodecOnNeedInputBuffer} - * callback will report the available input buffer and the corresponding index value. Once the buffer with the - * specified index is submitted to the video decoder, the buffer cannot be accessed again until the - * {@link OH_AVCodecOnNeedInputBuffer} callback is received again reporting that the buffer with the same index is - * available. In addition, for some decoders, it is required to input Codec-Specific-Data to the decoder at the - * beginning to initialize the decoding process of the decoder, such as PPS/SPS data in H264 format. + * @brief Notify the video decoder that the buffer corresponding to the index has been filled with input data. + * {@link OH_AVCodecOnNeedInputBuffer} callback will report the available input buffer and the + * corresponding index value. Once the buffer with the specified index is submitted to the video decoder, + * the buffer cannot be accessed again until the {@link OH_AVCodecOnNeedInputBuffer} callback is received again + * reporting that the buffer with the same index is available. In addition, for some decoders, + * it is required to input Codec-Specific-Data to the decoder at the beginning to initialize the decoding process + * of the decoder, such as PPS/SPS data in H264 format. The invoker can use this interface to transfer the parameters + * required for decoding to the decoder, such as PPS/SPS data in H264 format. + * The parameters can be sent to the decoder independently or together with the data to be decoded. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index of the input buffer. + * @param index The index of the input buffer, should be given by {@link OH_AVCodecOnNeedInputBuffer}. * @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_AVCodecOnNeedInputBuffer}. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. - * {@link AV_ERR_DRM_DECRYPT_FAILED}, the drm-protected video buffer is decrypted failed, - * it is recommended to check the logs. * @since 11 */ OH_AVErrCode OH_VideoDecoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index); /** - * @brief Return the processed output Buffer 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, + * @brief Return the processed output buffer 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. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index value corresponding to the output Buffer + * @param index The index value corresponding to the output buffer, + * should be given by {@link OH_AVCodecOnNewOutputBuffer}. * @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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @since 11 */ @@ -392,16 +399,16 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t inde * 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. + * 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 + * 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. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index value corresponding to the output buffer, should be given by {@link - * OH_AVCodecOnNewOutputBuffer} + * @param index The index value corresponding to the output buffer, + * should be given by {@link OH_AVCodecOnNewOutputBuffer} * @param renderTimestampNs The timestamp is associated with the output buffer when it is sent to the surface. The unit * is nanosecond * @return Returns AV_ERR_OK if the execution is successful, @@ -409,24 +416,29 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t inde * {@link AV_ERR_NO_MEMORY}, the codec has already released. * {@link AV_ERR_INVALID_VAL}, the parameter is invalid. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @since 12 */ OH_AVErrCode OH_VideoDecoder_RenderOutputBufferAtTime(OH_AVCodec *codec, uint32_t index, int64_t renderTimestampNs); /** - * @brief Return the processed output Buffer to the decoder. + * @brief Return the processed output buffer to the decoder. + * Need to call this interface to release output buffer immediately after using. + * otherwise, the decoding process will be blocked. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @param index The index value corresponding to the output Buffer + * @param index The index value corresponding to the output buffer, + * should be given by {@link OH_AVCodecOnNewOutputBuffer}. * @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_NO_MEMORY}, instance has already destoryed. + * {@link AV_ERR_INVALID_VAL} + * 1. the input codec pointer is non decoder instance or NULL; + * 2. the index is vaild or consecutively assigned to the same index, + * the error do not affect the subsequent decode process. * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_OPERATE_NOT_PERMIT}, internal execution error. * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. * @since 11 */ @@ -437,31 +449,33 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index) * switchback from the background. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance - * @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 + * @param isValid Output parameter. A pointer to a bool instance, it is true if the codec instance is valid, + * false if the codec instance is invalid. It is recommend that the invoker initialize isValid to false * @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. - * {@link AV_ERR_UNKNOWN}, unknown error. - * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. + * {@link AV_ERR_INVALID_VAL}, the input codec pointer is non decoder instance or NULL. * @since 10 */ OH_AVErrCode OH_VideoDecoder_IsValid(OH_AVCodec *codec, bool *isValid); /** - * @brief Set decryption info. + * @brief Set decryption configuration. Call this interface before calling the Prepare interface. * * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @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 {@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_NO_MEMORY}, instance has already released or no memory. - * {@link AV_ERR_INVALID_VAL} 3 - If the codec instance is nullptr or invalid, - * the mediaKeySession is nullptr or invalid. + * @param secureVideoPath Secure video Path. Set the secure video path as true and the non secure video path as false. + * In Surface mode, both secure and non secure video Path are supported. + * In Buffer mode, only non secure video Path are supported. + * @return {@link AV_ERR_OK}, execution is successful + * {@link AV_ERR_OPERATE_NOT_PERMIT} + * 1. internal execution error; + * 2. the decode service process is abnormal; + * 3. the media key session service is in an wrong state. + * {@link AV_ERR_NO_MEMORY}, instance has already destoryed or no memory. + * {@link AV_ERR_INVALID_VAL} + * 1. the input codec pointer is non decoder instance or NULL; + * 2. mediaKeySession is NULL or invalid. * @since 11 */ OH_AVErrCode OH_VideoDecoder_SetDecryptionConfig(OH_AVCodec *codec, MediaKeySession *mediaKeySession,