mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-23 06:39:54 +00:00
【修改说明】 新增AVCodec kit 5.0接口
Signed-off-by: li-jianchao1993 <lijianchao9@huawei.com>
This commit is contained in:
parent
2476571e32
commit
640c300890
@ -263,6 +263,54 @@
|
||||
"first_introduced": "11",
|
||||
"name": "OH_MD_KEY_AUDIO_VIVID_METADATA"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZE"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_CROP_TOP"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_CROP_BOTTOM"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_CROP_LEFT"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_CROP_RIGHT"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_STRIDE"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_SLICE_HEIGHT"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCY"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENCODER_QP_MAX"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_MD_KEY_VIDEO_ENCODER_QP_MIN"
|
||||
},
|
||||
{
|
||||
"first_introduced": "10",
|
||||
"name": "OH_AVCodec_GetCapability"
|
||||
|
@ -263,7 +263,13 @@ extern const char *OH_MD_KEY_PROFILE;
|
||||
extern const char *OH_MD_KEY_AUD_CHANNEL_COUNT;
|
||||
/* Key for audio sample rate, value type is uint32_t */
|
||||
extern const char *OH_MD_KEY_AUD_SAMPLE_RATE;
|
||||
/* Key for the interval of key frame. value type is int32_t, the unit is milliseconds. */
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 9
|
||||
*/
|
||||
extern const char *OH_MD_KEY_I_FRAME_INTERVAL;
|
||||
/* Key of the surface rotation angle. value type is int32_t: should be {0, 90, 180, 270}, default is 0. */
|
||||
extern const char *OH_MD_KEY_ROTATION;
|
||||
@ -347,6 +353,113 @@ extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER;
|
||||
/* Key for meta data of audio vivid. value type is a uint8_t pointer */
|
||||
extern const char *OH_MD_KEY_AUDIO_VIVID_METADATA;
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE;
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_CROP_RIGHT;
|
||||
/**
|
||||
* @brief Key for describing the stride of the video buffer layout, value type is int32_t. Stride (or row increment) is
|
||||
* the difference between the index of a pixel and that of the pixel directly underneath. For YUV 420 formats, the
|
||||
* stride corresponds to the Y plane; the stride of the U and V planes can be calculated based on the color format,
|
||||
* though it is generally undefined and depends on the device and release.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_STRIDE;
|
||||
/**
|
||||
* @brief Key for describing the plane height of a multi-planar (YUV) video buffer layout, value type is int32_t.
|
||||
* Slice height (or plane height/vertical stride) is the number of rows that must be skipped to get from
|
||||
* the top of the Y plane to the top of the U plane in the buffer. In essence the offset of the U plane
|
||||
* is sliceHeight * stride. The height of the U/V planes can be calculated based on the color format,
|
||||
* though it is generally undefined and depends on the device and release.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_SLICE_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.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCY;
|
||||
/**
|
||||
* @brief Key for describing the maximum quantization parameter allowed for video encoder, value type is int32_t.
|
||||
* It is used in configure/setparameter or takes effect immediately with the frame.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MAX;
|
||||
/**
|
||||
* @brief Key for describing the minimum quantization parameter allowed for video encoder, value type is int32_t.
|
||||
* It is used in configure/setparameter or takes effect immediately with the frame.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
extern const char *OH_MD_KEY_VIDEO_ENCODER_QP_MIN;
|
||||
|
||||
/**
|
||||
* @brief Media type.
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
@ -515,6 +628,66 @@ typedef enum OH_MatrixCoefficient {
|
||||
MATRIX_COEFFICIENT_ICTCP = 14,
|
||||
} OH_MatrixCoefficient;
|
||||
|
||||
/**
|
||||
* @brief AVC Level.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum OH_AVCLevel {
|
||||
AVC_LEVEL_1 = 0,
|
||||
AVC_LEVEL_1b = 1,
|
||||
AVC_LEVEL_11 = 2,
|
||||
AVC_LEVEL_12 = 3,
|
||||
AVC_LEVEL_13 = 4,
|
||||
AVC_LEVEL_2 = 5,
|
||||
AVC_LEVEL_21 = 6,
|
||||
AVC_LEVEL_22 = 7,
|
||||
AVC_LEVEL_3 = 8,
|
||||
AVC_LEVEL_31 = 9,
|
||||
AVC_LEVEL_32 = 10,
|
||||
AVC_LEVEL_4 = 11,
|
||||
AVC_LEVEL_41 = 12,
|
||||
AVC_LEVEL_42 = 13,
|
||||
AVC_LEVEL_5 = 14,
|
||||
AVC_LEVEL_51 = 15,
|
||||
} OH_AVCLevel;
|
||||
|
||||
/**
|
||||
* @brief HEVC Level.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum OH_HEVCLevel {
|
||||
HEVC_LEVEL_1 = 0,
|
||||
HEVC_LEVEL_2 = 1,
|
||||
HEVC_LEVEL_21 = 2,
|
||||
HEVC_LEVEL_3 = 3,
|
||||
HEVC_LEVEL_31 = 4,
|
||||
HEVC_LEVEL_4 = 5,
|
||||
HEVC_LEVEL_41 = 6,
|
||||
HEVC_LEVEL_5 = 7,
|
||||
HEVC_LEVEL_51 = 8,
|
||||
HEVC_LEVEL_52 = 9,
|
||||
HEVC_LEVEL_6 = 10,
|
||||
HEVC_LEVEL_61 = 11,
|
||||
HEVC_LEVEL_62 = 12,
|
||||
} OH_HEVCLevel;
|
||||
|
||||
/**
|
||||
* @brief The reference mode in temporal group of picture.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.CodecBase
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum OH_TemporalGopReferenceMode {
|
||||
/** Refer to latest short-term reference frame. */
|
||||
ADJACENT_REFERENCE = 0,
|
||||
/** Refer to latest long-term reference frame. */
|
||||
JUMP_REFERENCE = 1,
|
||||
} OH_TemporalGopReferenceMode;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -24,6 +24,21 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief When OH_AVCodec needs new input parameter during the running process, the function pointer will be called and
|
||||
* carry an available OH_AVFormat to fill in the new input parameter. This parameter takes effect immediately with the
|
||||
* frame.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
|
||||
* @param codec OH_AVCodec instance
|
||||
* @param index The index corresponding to the new OH_AVFormat instance
|
||||
* @param parameter Parameter containing the new OH_AVFormat instance
|
||||
* @param userData specified data
|
||||
* @since 12
|
||||
*/
|
||||
typedef void (*OH_VideoEncoder_OnNeedInputParameter)(OH_AVCodec *codec, uint32_t index, OH_AVFormat *parameter,
|
||||
void *userData);
|
||||
|
||||
/**
|
||||
* @brief Creates a video encoder instance from the mime type, which is recommended in most cases.
|
||||
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
|
||||
@ -85,6 +100,23 @@ OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb
|
||||
*/
|
||||
OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData);
|
||||
|
||||
/**
|
||||
* @brief Set the asynchronous callback function so that your application can respond to the events generated by the
|
||||
* video encoder. This interface is optional only for input surface. If this interface is used, it must be invoked
|
||||
* before {@link OH_VideoEncoder_Configure}.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
|
||||
* @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}
|
||||
* @since 12
|
||||
*/
|
||||
OH_AVErrCode OH_VideoEncoder_RegisterParameterCallback(OH_AVCodec *codec,
|
||||
OH_VideoEncoder_OnNeedInputParameter onInputParameter,
|
||||
void *userData);
|
||||
|
||||
/**
|
||||
* @brief To configure the video encoder, typically, you need to configure the description information of the
|
||||
* encoded video track. This interface must be called before Prepare is called.
|
||||
@ -247,6 +279,18 @@ OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH
|
||||
*/
|
||||
OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief Submit the input parameter filled with data to the video encoder.
|
||||
*
|
||||
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
|
||||
* @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}
|
||||
* @since 12
|
||||
*/
|
||||
OH_AVErrCode OH_VideoEncoder_PushInputParameter(OH_AVCodec *codec, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief Return the processed output Buffer to the encoder.
|
||||
* @syscap SystemCapability.Multimedia.Media.VideoEncoder
|
||||
|
@ -82,5 +82,13 @@
|
||||
{
|
||||
"first_introduced": "11",
|
||||
"name": "OH_VideoEncoder_FreeOutputBuffer"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_VideoEncoder_RegisterParameterCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_VideoEncoder_PushInputParameter"
|
||||
}
|
||||
]
|
||||
|
@ -23,20 +23,30 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @brief Enumerate the categories of OH_AVCodec's Buffer tags
|
||||
* @brief Enumerate the categories of OH_AVCodec's Buffer tags.
|
||||
* @syscap SystemCapability.Multimedia.Media.Core
|
||||
* @since 9
|
||||
*/
|
||||
typedef enum OH_AVCodecBufferFlags {
|
||||
AVCODEC_BUFFER_FLAGS_NONE = 0,
|
||||
/* Indicates that the Buffer is an End-of-Stream frame */
|
||||
/** Indicates that the Buffer is an End-of-Stream frame. */
|
||||
AVCODEC_BUFFER_FLAGS_EOS = 1 << 0,
|
||||
/* Indicates that the Buffer contains keyframes */
|
||||
/** Indicates that the Buffer contains keyframes. */
|
||||
AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1,
|
||||
/* Indicates that the data contained in the Buffer is only part of a frame */
|
||||
/** Indicates that the data contained in the Buffer is only part of a frame. */
|
||||
AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2,
|
||||
/* Indicates that the Buffer contains Codec-Specific-Data */
|
||||
/** Indicates that the Buffer contains Codec-Specific-Data. */
|
||||
AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3,
|
||||
/** Flag is used to discard packets which are required to maintain valid decoder state but are not required
|
||||
* for output and should be dropped after decoding.
|
||||
* @since 12
|
||||
*/
|
||||
AVCODEC_BUFFER_FLAGS_DISCARD = 1 << 4,
|
||||
/** Flag is used to indicate packets that contain frames that can be discarded by the decoder,
|
||||
* I.e. Non-reference frames.
|
||||
* @since 12
|
||||
*/
|
||||
AVCODEC_BUFFER_FLAGS_DISPOSABLE = 1 << 5,
|
||||
} OH_AVCodecBufferFlags;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user