From 46a5c92a8c5b381b84b562eb8f3529b13d9b156a Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Thu, 30 Nov 2023 16:53:27 +0800 Subject: [PATCH 01/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91API11=E6=96=B0=E5=A2=9Eavcodec&avbuffer?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- .../av_codec/native_avcodec_audiocodec.h | 210 ++++++++++++++++++ .../av_codec/native_avcodec_audiodecoder.h | 32 ++- .../av_codec/native_avcodec_audioencoder.h | 30 +++ multimedia/av_codec/native_avcodec_base.h | 171 +++++++++----- .../av_codec/native_avcodec_videodecoder.h | 63 +++++- .../av_codec/native_avcodec_videoencoder.h | 85 ++++++- multimedia/av_codec/native_avdemuxer.h | 18 ++ multimedia/av_codec/native_avmuxer.h | 20 ++ multimedia/media_foundation/native_avbuffer.h | 154 +++++++++++++ .../native_averrors.h | 0 .../native_avformat.h | 0 .../native_avmemory.h | 3 +- 12 files changed, 721 insertions(+), 65 deletions(-) create mode 100644 multimedia/av_codec/native_avcodec_audiocodec.h create mode 100644 multimedia/media_foundation/native_avbuffer.h rename multimedia/{av_codec => media_foundation}/native_averrors.h (100%) rename multimedia/{av_codec => media_foundation}/native_avformat.h (100%) rename multimedia/{av_codec => media_foundation}/native_avmemory.h (98%) diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h new file mode 100644 index 000000000..e31e89eba --- /dev/null +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NATIVE_AVCODEC_AUDIOCODEC_H +#define NATIVE_AVCODEC_AUDIOCODEC_H + +#include +#include +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" +#include "native_avcodec_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create an audio encoder or decoder instance from the mime type, which is recommended in most cases. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE} + * @param isEncoder true indicates the need to create an encoder, while false indicates the need to create a decoder. + * @return Returns a Pointer to an OH_AVCodec instance + * @since 11 + */ +OH_AVCodec *OH_AudioCodec_CreateByMime(const char *mime, bool isEncoder); + +/** + * @brief Create an audio codec instance through the audio codec name. + * The premise of using this interface is to know the exact name of the codec. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @param name Audio codec name + * @return Returns a Pointer to an OH_AVCodec instance + * @since 11 + */ +OH_AVCodec *OH_AudioCodec_CreateByName(const char *name); + +/** + * @brief Clear the internal resources of the codec and destroy the codec instance + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Destroy(OH_AVCodec *codec); + +/** + * @brief Set the asynchronous callback function so that your application + * can respond to the events generated by the audio codec. This interface must be called before Prepare is called. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData); + +/** + * @brief To configure the audio codec, typically, you need to configure the description information of the + * audio track. This interface must be called before Prepare is called. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @param codec Pointer to an OH_AVCodec instance + * @param format A pointer to an OH_AVFormat giving a description of the audio track to be encoded or decoded + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Configure(OH_AVCodec *codec, OH_AVFormat *format); + +/** + * @brief To prepare the internal resources of the codec, the Configure interface must be called + * before calling this interface. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Prepare(OH_AVCodec *codec); + +/** + * @brief Start the codec, this interface must be called after the Prepare is successful. + * After being successfully started, the codec will start reporting NeedInputData events. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Start(OH_AVCodec *codec); + +/** + * @brief Stop the codec. After stopping, you can re-enter the Started state through Start, + * but it should be noted that need to re-enter if the codec has been input before + * Codec-Specific-Data. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Stop(OH_AVCodec *codec); + +/** + * @brief Clear the input and output data buffered in the codec. 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.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_Flush(OH_AVCodec *codec); + +/** + * @brief Reset the codec. To continue encoding or decoding, you need to call the Configure interface again to + * configure the codec instance. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ + +OH_AVErrCode OH_AudioCodec_Reset(OH_AVCodec *codec); + +/** + * @brief Get the description information of the output data of the codec, refer to {@link OH_AVFormat} for details. + * 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 + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @param codec Pointer to an OH_AVCodec instance + * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, + * or destroyed with OH_AVCodec; + * @since 11 + */ +OH_AVFormat *OH_AudioCodec_GetOutputDescription(OH_AVCodec *codec); + +/** + * @brief Set dynamic parameters to the codec. Note: This interface can only be called after the codec is started. + * At the same time, incorrect parameter settings may cause encoding or decoding failure. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_SetParameter(OH_AVCodec *codec, OH_AVFormat *format); + +/** + * @brief Submit the input buffer filled with data to the audio codec. The {@link OH_AVCodecOnNeedInputData} callback + * will report the available input buffer and the corresponding index value. Once the buffer with the specified index + * is submitted to the audio codec, the buffer cannot be accessed again until the {@link OH_AVCodecOnNeedInputData} + * callback is received again reporting that the buffer with the same index is available. In addition, for some + * codecs, it is required to input Codec-Specific-Data to the codec at the beginning to initialize the encoding or + * decoding process of the codec. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_PushInputBuffer(OH_AVCodec *codec, uint32_t index); + +/** + * @brief Return the processed output Buffer to the codec. + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index); + +/** + * @brief Check whether the current codec instance is valid. It can be used fault recovery or app + * switchback from the background + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @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 + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AudioCodec_IsValid(OH_AVCodec *codec, bool *isValid); + +#ifdef __cplusplus +} +#endif +#endif // NATIVE_AVCODEC_AUDIOCODEC_H \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_audiodecoder.h b/multimedia/av_codec/native_avcodec_audiodecoder.h index bb62e8a8c..ed3ac92b6 100644 --- a/multimedia/av_codec/native_avcodec_audiodecoder.h +++ b/multimedia/av_codec/native_avcodec_audiodecoder.h @@ -32,6 +32,8 @@ extern "C" { * @syscap SystemCapability.Multimedia.Media.AudioDecoder * @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE} * @return Returns a Pointer to an OH_AVCodec instance + * @deprecated since 11 + * @useinstead OH_AudioCodec_CreateByMime * @since 9 * @version 1.0 */ @@ -43,6 +45,8 @@ OH_AVCodec *OH_AudioDecoder_CreateByMime(const char *mime); * @syscap SystemCapability.Multimedia.Media.AudioDecoder * @param name Audio codec name * @return Returns a Pointer to an OH_AVCodec instance + * @deprecated since 11 + * @useinstead OH_AudioCodec_CreateByName * @since 9 * @version 1.0 */ @@ -54,6 +58,8 @@ OH_AVCodec *OH_AudioDecoder_CreateByName(const char *name); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Destroy * @since 9 * @version 1.0 */ @@ -68,6 +74,8 @@ OH_AVErrCode OH_AudioDecoder_Destroy(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_RegisterCallback * @since 9 * @version 1.0 */ @@ -75,12 +83,14 @@ OH_AVErrCode OH_AudioDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb /** * @brief To configure the audio decoder, typically, you need to configure the description information of the decoded - * audio track, which can be extracted from the container. This interface must be called before Prepare is called. + * audio track, which can be extracted from the OH_AVSource. This interface must be called before Prepare is called. * @syscap SystemCapability.Multimedia.Media.AudioDecoder * @param codec Pointer to an OH_AVCodec instance * @param format A pointer to an OH_AVFormat giving a description of the audio 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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Configure * @since 9 * @version 1.0 */ @@ -93,6 +103,8 @@ OH_AVErrCode OH_AudioDecoder_Configure(OH_AVCodec *codec, OH_AVFormat *format); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Prepare * @since 9 * @version 1.0 */ @@ -105,6 +117,8 @@ OH_AVErrCode OH_AudioDecoder_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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Start * @since 9 * @version 1.0 */ @@ -118,6 +132,8 @@ OH_AVErrCode OH_AudioDecoder_Start(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Stop * @since 9 * @version 1.0 */ @@ -131,6 +147,8 @@ OH_AVErrCode OH_AudioDecoder_Stop(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Flush * @since 9 * @version 1.0 */ @@ -143,6 +161,8 @@ OH_AVErrCode OH_AudioDecoder_Flush(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Reset * @since 9 * @version 1.0 */ @@ -157,6 +177,8 @@ OH_AVErrCode OH_AudioDecoder_Reset(OH_AVCodec *codec); * @param codec Pointer to an OH_AVCodec instance * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, * or destroyed with OH_AVCodec; + * @deprecated since 11 + * @useinstead OH_AudioCodec_GetOutputDescription * @since 9 * @version 1.0 */ @@ -170,6 +192,8 @@ OH_AVFormat *OH_AudioDecoder_GetOutputDescription(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_SetParameter * @since 9 * @version 1.0 */ @@ -188,6 +212,8 @@ OH_AVErrCode OH_AudioDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_PushInputBuffer * @since 9 * @version 1.0 */ @@ -200,6 +226,8 @@ OH_AVErrCode OH_AudioDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_FreeOutputBuffer * @since 9 * @version 1.0 */ @@ -214,6 +242,8 @@ OH_AVErrCode OH_AudioDecoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); * 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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_IsValid * @since 10 */ OH_AVErrCode OH_AudioDecoder_IsValid(OH_AVCodec *codec, bool *isValid); diff --git a/multimedia/av_codec/native_avcodec_audioencoder.h b/multimedia/av_codec/native_avcodec_audioencoder.h index 7493f69e0..f070285ad 100644 --- a/multimedia/av_codec/native_avcodec_audioencoder.h +++ b/multimedia/av_codec/native_avcodec_audioencoder.h @@ -31,6 +31,8 @@ extern "C" { * @syscap SystemCapability.Multimedia.Media.AudioEncoder * @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE} * @return Returns a Pointer to an OH_AVCodec instance + * @deprecated since 11 + * @useinstead OH_AudioCodec_CreateByMime * @since 9 * @version 1.0 */ @@ -42,6 +44,8 @@ OH_AVCodec *OH_AudioEncoder_CreateByMime(const char *mime); * @syscap SystemCapability.Multimedia.Media.AudioEncoder * @param name Audio encoder name * @return Returns a Pointer to an OH_AVCodec instance + * @deprecated since 11 + * @useinstead OH_AudioCodec_CreateByName * @since 9 * @version 1.0 */ @@ -53,6 +57,8 @@ OH_AVCodec *OH_AudioEncoder_CreateByName(const char *name); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Destroy * @since 9 * @version 1.0 */ @@ -67,6 +73,8 @@ OH_AVErrCode OH_AudioEncoder_Destroy(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_RegisterCallback * @since 9 * @version 1.0 */ @@ -80,6 +88,8 @@ OH_AVErrCode OH_AudioEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallb * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Configure * @since 9 * @version 1.0 */ @@ -92,6 +102,8 @@ OH_AVErrCode OH_AudioEncoder_Configure(OH_AVCodec *codec, OH_AVFormat *format); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Prepare * @since 9 * @version 1.0 */ @@ -104,6 +116,8 @@ OH_AVErrCode OH_AudioEncoder_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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Start * @since 9 * @version 1.0 */ @@ -115,6 +129,8 @@ OH_AVErrCode OH_AudioEncoder_Start(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Stop * @since 9 * @version 1.0 */ @@ -128,6 +144,8 @@ OH_AVErrCode OH_AudioEncoder_Stop(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Flush * @since 9 * @version 1.0 */ @@ -140,6 +158,8 @@ OH_AVErrCode OH_AudioEncoder_Flush(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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_Reset * @since 9 * @version 1.0 */ @@ -153,6 +173,8 @@ OH_AVErrCode OH_AudioEncoder_Reset(OH_AVCodec *codec); * @param codec Pointer to an OH_AVCodec instance * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, * or destroyed with OH_AVCodec; + * @deprecated since 11 + * @useinstead OH_AudioCodec_GetOutputDescription * @since 9 * @version 1.0 */ @@ -166,6 +188,8 @@ OH_AVFormat *OH_AudioEncoder_GetOutputDescription(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_SetParameter * @since 9 * @version 1.0 */ @@ -182,6 +206,8 @@ OH_AVErrCode OH_AudioEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_PushInputBuffer * @since 9 * @version 1.0 */ @@ -194,6 +220,8 @@ OH_AVErrCode OH_AudioEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH * @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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_FreeOutputBuffer * @since 9 * @version 1.0 */ @@ -208,6 +236,8 @@ OH_AVErrCode OH_AudioEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); * 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} + * @deprecated since 11 + * @useinstead OH_AudioCodec_IsValid * @since 10 */ OH_AVErrCode OH_AudioEncoder_IsValid(OH_AVCodec *codec, bool *isValid); diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 4d43427ca..94088df0e 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -21,6 +21,7 @@ #include "native_averrors.h" #include "native_avformat.h" #include "native_avmemory.h" +#include "native_avbuffer.h" #ifdef __cplusplus extern "C" { @@ -29,41 +30,6 @@ extern "C" { typedef struct NativeWindow OHNativeWindow; typedef struct OH_AVCodec OH_AVCodec; -/** - * @brief Enumerate the categories of OH_AVCodec's Buffer tags - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 9 - * @version 1.0 - */ -typedef enum OH_AVCodecBufferFlags { - AVCODEC_BUFFER_FLAGS_NONE = 0, - /* Indicates that the Buffer is an End-of-Stream frame */ - AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, - /* 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 */ - AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, - /* Indicates that the Buffer contains Codec-Specific-Data */ - AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, -} OH_AVCodecBufferFlags; - -/** - * @brief Define the Buffer description information of OH_AVCodec - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 9 - * @version 1.0 - */ -typedef struct OH_AVCodecBufferAttr { - /* Presentation timestamp of this Buffer in microseconds */ - int64_t pts; - /* The size of the data contained in the Buffer in bytes */ - int32_t size; - /* The starting offset of valid data in this Buffer */ - int32_t offset; - /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ - uint32_t flags; -} OH_AVCodecBufferAttr; - /** * @brief When an error occurs in the running of the OH_AVCodec instance, the function pointer will be called * to report specific error information. @@ -97,6 +63,8 @@ typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format * @param index The index corresponding to the newly available input buffer. * @param data New available input buffer. * @param userData User specific data + * @deprecated since 11 + * @useinstead OH_AVCodecOnNeedInputBuffer * @since 9 * @version 1.0 */ @@ -113,11 +81,37 @@ typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_ * @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 + * @deprecated since 11 + * @useinstead OH_AVCodecOnNewOutputBuffer * @since 9 * @version 1.0 */ typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, - OH_AVCodecBufferAttr *attr, void *userData); + OH_AVCodecBufferAttr *attr, 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. + * @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 + * @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. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @param codec OH_AVCodec instance + * @param index The index corresponding to the new output Buffer. + * @param buffer Buffer containing the new output buffer. + * @param userData specified data + * @since 11 + */ +typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData); /** * @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this @@ -127,7 +121,9 @@ typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_ * @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError} * @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged} * @param onNeedInputData Monitoring codec requires input data, refer to {@link OH_AVCodecOnNeedInputData} - * @param onNeedInputData Monitor codec to generate output data, refer to {@link onNeedInputData} + * @param onNeedOutputData Monitor codec to generate output data, refer to {@link OH_AVCodecOnNewOutputData} + * @deprecated since 11 + * @useinstead OH_AVCodecCallback * @since 9 * @version 1.0 */ @@ -138,11 +134,28 @@ typedef struct OH_AVCodecAsyncCallback { OH_AVCodecOnNewOutputData onNeedOutputData; } OH_AVCodecAsyncCallback; +/** + * @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this + * structure to the OH_AVCodec instance, and process the information reported through the callback to ensure the + * normal operation of OH_AVCodec. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @param onError Monitor OH_AVCodec operation errors, refer to {@link OH_AVCodecOnError} + * @param onStreamChanged Monitor codec stream information, refer to {@link OH_AVCodecOnStreamChanged} + * @param onNeedInputBuffer Monitoring codec requires input buffer, refer to {@link OH_AVCodecOnNeedInputBuffer} + * @param onNewOutputBuffer Monitor codec to generate output buffer, refer to {@link OH_AVCodecOnNewOutputBuffer} + * @since 11 + */ +typedef struct OH_AVCodecCallback { + OH_AVCodecOnError onError; + OH_AVCodecOnStreamChanged onStreamChanged; + OH_AVCodecOnNeedInputBuffer onNeedInputBuffer; + OH_AVCodecOnNewOutputBuffer onNewOutputBuffer; +} OH_AVCodecCallback; + /** * @brief Enumerates the MIME types of audio and video codecs * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 - * @version 1.0 */ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_AVC; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AAC; @@ -156,14 +169,27 @@ extern const char *OH_AVCODEC_MIMETYPE_AUDIO_FLAC; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VORBIS; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_MPEG; extern const char *OH_AVCODEC_MIMETYPE_VIDEO_HEVC; + +/** + * @brief Enumerates the types of audio and video muxer + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP; + +/** + * @brief Enumerates the MIME types of audio codecs + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 11 + */ extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AVS3DA; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS; +extern const char *OH_AVCODEC_MIMETYPE_AUDIO_G711MU; /** * @brief The extra data's key of surface Buffer @@ -177,7 +203,7 @@ extern const char *OH_ED_KEY_TIME_STAMP; extern const char *OH_ED_KEY_EOS; /** - * @brief Provides the uniform container for storing the media description. + * @brief Provides the uniform key for storing the media description. * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 * @version 1.0 @@ -216,7 +242,7 @@ extern const char *OH_MD_KEY_I_FRAME_INTERVAL; extern const char *OH_MD_KEY_ROTATION; /** - * @brief Provides the uniform container for storing the media description. + * @brief Provides the uniform key for storing the media description. * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ @@ -259,18 +285,6 @@ extern const char *OH_MD_KEY_DESCRIPTION; extern const char *OH_MD_KEY_LYRICS; /* source format Key for track count, value type is uint32_t */ extern const char *OH_MD_KEY_TRACK_COUNT; -/* Key for type of file, value type is int32_t, see @OH_FileType */ -extern const char *OH_MD_KEY_FILE_TYPE; -/* Key for whether the file contains video tracks, value type is boolean */ -extern const char *OH_MD_KEY_HAS_VIDEO; -/* Key for whether the file contains audio tracks, value type is boolean */ -extern const char *OH_MD_KEY_HAS_AUDIO; -/* Key for author of file, value type is string */ -extern const char *OH_MD_KEY_AUTHOR; -/* Key for composer of file, value type is string */ -extern const char *OH_MD_KEY_COMPOSER; -/* Key for cover of file, value type is uint8_t pointer */ -extern const char *OH_MD_KEY_COVER; /* Key for the desired encoding channel layout, value type is int64_t, this key is only supported for encoders */ extern const char *OH_MD_KEY_CHANNEL_LAYOUT; /* Key for bits per coded sample, value type is uint32_t, supported for flac encoder, see @OH_BitsPerSample */ @@ -291,18 +305,43 @@ extern const char *OH_MD_KEY_SCALING_MODE; extern const char *OH_MD_MAX_INPUT_BUFFER_COUNT; /* Key for max output buffer count, value type is int32_t */ extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT; + +/** + * @brief Provides the uniform key for storing the media description. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 11 + */ +/* Key for type of file, value type is int32_t, see @OH_FileType */ +extern const char *OH_MD_KEY_FILE_TYPE; +/* Key for whether the file contains video tracks, value type is boolean */ +extern const char *OH_MD_KEY_HAS_VIDEO; +/* Key for whether the file contains audio tracks, value type is boolean */ +extern const char *OH_MD_KEY_HAS_AUDIO; +/* Key for author of file, value type is string */ +extern const char *OH_MD_KEY_AUTHOR; +/* Key for composer of file, value type is string */ +extern const char *OH_MD_KEY_COMPOSER; +/* Key for cover of file, value type is uint8_t pointer */ +extern const char *OH_MD_KEY_COVER; /* Key for codec compression level, value type is uint32_t */ extern const char *OH_MD_KEY_COMPRESSION_LEVEL; /* Key for encode level, value type is int32_t. see @OH_HEVCLevel. */ extern const char *OH_MD_KEY_LEVEL; /* Key for chroma location, value type is int32_t. see @OH_ChromaLocation. */ extern const char *OH_MD_KEY_VIDEO_CHROMA_LOCATION; +/* Key of the video is hdr vivid. value type is bool */ +extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID; +/* Key for HDRVivid video CUVV Configuration Box, value type is uint8_t pointer, see @OH_CUVVConfigBox. */ +extern const char *OH_MD_KEY_VIDEO_CUVV_CONFIG_BOX; +/* Key for number of audio objects. value type is int32_t */ +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 File type. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - * @version 1.0 + * @since 11 */ typedef enum OH_FileType { FILE_TYPE_UNKNOW = 0, @@ -394,9 +433,9 @@ typedef enum OH_HEVCProfile { /** * @brief HEVC Level * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 + * @since 11 */ -enum OH_HEVCLevel { +typedef enum OH_HEVCLevel { HEVC_LEVEL_1 = 0, HEVC_LEVEL_2 = 1, HEVC_LEVEL_21 = 2, @@ -481,18 +520,30 @@ typedef enum OH_MatrixCoefficient { /** * @brief Chroma Location * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 + * @since 11 */ -enum OH_ChromaLocation { +typedef enum OH_ChromaLocation { CHROMA_LOC_UNSPECIFIED = 0, - CHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 - CHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 + CHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 + CHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 CHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 CHROMA_LOC_TOP = 4, CHROMA_LOC_BOTTOMLEFT = 5, CHROMA_LOC_BOTTOM = 6, }; +/** + * @brief Cuvv Configuration Box + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 11 + */ +typedef struct OH_CUVVConfigBox { + uint16_t cuva_version_map; + uint16_t terminal_provide_code; + uint16_t terminal_provide_oriented_code; +} OH_CUVVConfigBox; + + /** * @brief Scaling Mode * @syscap SystemCapability.Multimedia.Media.CodecBase diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 3bc557751..933e512df 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -68,11 +68,26 @@ OH_AVErrCode OH_VideoDecoder_Destroy(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_VideoDecoder_RegisterCallback * @since 9 * @version 1.0 */ OH_AVErrCode OH_VideoDecoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData); +/** + * @brief Set the asynchronous callback function so that your application can respond to the events + * generated by the video decoder. This interface must be called before Prepare is called. + * @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 + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @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 @@ -88,7 +103,7 @@ 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 container. This interface must be called before Prepare is called. + * video track, 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 @@ -198,6 +213,8 @@ OH_AVErrCode OH_VideoDecoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format * @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} + * @deprecated since 11 + * @useinstead OH_VideoDecoder_PushInputBuffer * @since 9 * @version 1.0 */ @@ -212,6 +229,8 @@ OH_AVErrCode OH_VideoDecoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH * @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} + * @deprecated since 11 + * @useinstead OH_VideoDecoder_RenderOutputBuffer * @since 9 * @version 1.0 */ @@ -224,11 +243,53 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputData(OH_AVCodec *codec, uint32_t index) * @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} + * @deprecated since 11 + * @useinstead OH_VideoDecoder_FreeOutputBuffer * @since 9 * @version 1.0 */ 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. + * @syscap SystemCapability.Multimedia.Media.VideoDecoder + * @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} + * @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, + * 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 + * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link + * OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_VideoDecoder_RenderOutputBuffer(OH_AVCodec *codec, uint32_t index); + +/** + * @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 + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index); + /** * @brief Check whether the current codec instance is valid. It can be used fault recovery or app * switchback from the background. diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index 86b8750d6..e91950d0d 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -27,6 +27,19 @@ 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. + * @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 11 + */ +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 @@ -61,18 +74,48 @@ OH_AVErrCode OH_VideoEncoder_Destroy(OH_AVCodec *codec); /** * @brief Set the asynchronous callback function so that your application can respond to the events generated by the - * video encoder. This interface must be called before Prepare is called + * video encoder. This interface must be called before Prepare is called. * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @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 * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @deprecated since 11 + * @useinstead OH_VideoEncoder_RegisterCallback * @since 9 * @version 1.0 */ OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback 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 must be called before Prepare is called. + * @syscap SystemCapability.Multimedia.Media.VideoEncoder + * @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} + * @since 11 + */ +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 + * OH_VideoEncoder_Prepare and after OH_VideoEncoder_GetSurface. + * @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 11 + */ +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. @@ -175,7 +218,8 @@ OH_AVErrCode OH_VideoEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format * @brief Get the input Surface from the video encoder, this interface must be called before Prepare is called. * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @param codec Pointer to an OH_AVCodec instance - * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} + * @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} * @since 9 @@ -190,6 +234,8 @@ OH_AVErrCode OH_VideoEncoder_GetSurface(OH_AVCodec *codec, OHNativeWindow **wind * @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} + * @deprecated since 11 + * @useinstead OH_VideoEncoder_FreeOutputBuffer * @since 9 * @version 1.0 */ @@ -215,10 +261,45 @@ OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream(OH_AVCodec *codec); * @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} + * @deprecated since 11 + * @useinstead OH_VideoEncoder_PushInputBuffer * @since 10 */ OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr); +/** + * @brief Submit the input buffer 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 Buffer + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + */ +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 11 + */ +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 + * @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} + * @since 11 + */ +OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index); + /** * @brief Get the input data description of the encoder after call {@OH_VideoEncoder_Configure}, * refer to {@link OH_AVFormat} for details. It should be noted that the life cycle of the OH_AVFormat diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index cdcff0914..b43de5097 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -27,6 +27,7 @@ extern "C" { #endif typedef struct OH_AVDemuxer OH_AVDemuxer; +typedef struct OH_AVBuffer OH_AVBuffer; /** * @brief Creates an OH_AVDemuxer instance for getting samples from source. @@ -92,11 +93,28 @@ 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} + * @deprecated since 11 + * @useinstead OH_AVDemuxer_ReadSampleBuffer * @since 10 */ OH_AVErrCode OH_AVDemuxer_ReadSample(OH_AVDemuxer *demuxer, uint32_t trackIndex, OH_AVMemory *sample, OH_AVCodecBufferAttr *info); +/** + * @brief Get the current encoded sample and sample-related information from the specified + * track. The track index must be selected before reading sample. The demuxer will advance + * automatically after calling this interface. + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param demuxer Pointer to an OH_AVDemuxer instance. + * @param trackIndex The index of the track from which read an encoded sample. + * @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} + * @since 11 +*/ +OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t trackIndex, + OH_AVBuffer *sample); + /** * @brief All selected tracks seek near to the requested time according to the seek mode. * @syscap SystemCapability.Multimedia.Media.Spliter diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index ec7e647dc..b575643c7 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -29,6 +29,7 @@ extern "C" { #endif typedef struct OH_AVMuxer OH_AVMuxer; +typedef struct OH_AVBuffer OH_AVBuffer; /** * @brief Create an OH_AVMuxer instance by output file description and format. @@ -90,6 +91,8 @@ OH_AVErrCode OH_AVMuxer_Start(OH_AVMuxer *muxer); * @param info The buffer information related to this sample {@link OH_AVCodecBufferAttr} * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @deprecated since 11 + * @useinstead OH_AVMuxer_WriteSampleBuffer * @since 10 */ OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, @@ -97,6 +100,23 @@ OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, OH_AVMemory *sample, OH_AVCodecBufferAttr info); +/** + * @brief Write an encoded sample to the muxer. + * Note: This interface can only be called after OH_AVMuxer_Start and before OH_AVMuxer_Stop. The application needs to + * make sure that the samples are written to the right tracks. Also, it needs to make sure the samples for each track are + * written in chronological order. + * @syscap SystemCapability.Multimedia.Media.Muxer + * @param muxer Pointer to an OH_AVMuxer instance + * @param trackIndex The track index for this sample + * @param sample The encoded or demuxer sample, which including data and buffer information + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, + uint32_t trackIndex, + OH_AVBuffer *sample); + /** * @brief Stop the muxer. * Note: Once the muxer stops, it can not be restarted. diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h new file mode 100644 index 000000000..927408998 --- /dev/null +++ b/multimedia/media_foundation/native_avbuffer.h @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NATIVE_AVBUFFER_H +#define NATIVE_AVBUFFER_H + +#include +#include +#include "native_averrors.h" +#include "native_avformat.h" + +#ifdef __cplusplus +extern "C" { +#endif +typedef struct OH_AVBuffer OH_AVBuffer; +typedef struct OH_NativeBuffer OH_NativeBuffer; +/** + * @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 */ + AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, + /* 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 */ + AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, + /* Indicates that the Buffer contains Codec-Specific-Data */ + AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, +} OH_AVCodecBufferFlags; + +/** + * @brief Define the Buffer description information of OH_AVCodec + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ +typedef struct OH_AVCodecBufferAttr { + /* Presentation timestamp of this Buffer in microseconds */ + int64_t pts; + /* The size of the data contained in the Buffer in bytes */ + int32_t size; + /* The starting offset of valid data in this Buffer */ + int32_t offset; + /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ + uint32_t flags; +} OH_AVCodecBufferAttr; + +/** + * @brief Create an OH_AVBuffer instance + * @syscap SystemCapability.Multimedia.Media.Core + * @param capacity the buffer's capacity, bytes + * @return Returns a pointer to an OH_AVBuffer instance, needs to be freed by OH_AVBuffer_Destroy + * @since 11 + */ +OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity); + +/** + * @brief Clear the internal resources of the buffer and destroy the buffer instance + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link + * OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); + +/** + * @brief Get the buffer's attribute + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return Returns the description of the buffer, please refer to {@link OH_AVCodecBufferAttr} + * @since 11 + */ +OH_AVCodecBufferAttr OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer); + +/** + * @brief Set the buffer's attribute + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @param attr The description of the buffer, please refer to {@link OH_AVCodecBufferAttr} + * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link + * OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr attr); + +/** + * @brief Get the buffer's parameter. 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. + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return Returns Encapsulate OH_AVFormat structure instance pointer, refer to {@link OH_AVFormat} + * @since 11 + */ +OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); + +/** + * @brief Set the buffer's parameter + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @param format Encapsulate OH_AVFormat structure instance pointer, refer to {@link OH_AVFormat} + * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link + * OH_AVErrCode} + * @since 11 + */ +OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, OH_AVFormat *format); + +/** + * @brief Get the buffer's virtual address + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return the buffer's virtual address if the buffer is valid, otherwise nullptr + * @since 11 + */ +uint8_t *OH_AVBuffer_GetAddr(OH_AVBuffer *buffer); + +/** + * @brief Get the buffer's capacity + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return the buffer's capacity if the buffer is valid, otherwise -1 + * @since 11 + */ +int32_t OH_AVBuffer_GetCapacity(OH_AVBuffer *buffer); + +/** + * @brief Get the OH_NativeBuffer instance pointer + * @syscap SystemCapability.Multimedia.Media.Core + * @param buffer Encapsulate OH_AVBuffer structure instance pointer + * @return Returns Encapsulate OH_NativeBuffer structure instance pointer is successful, + * otherwise returns nullptr, refer to {@link OH_NativeBuffer} + * @since 11 + */ +OH_NativeBuffer *OH_AVBuffer_GetNativeBuffer(OH_AVBuffer *buffer); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AVBUFFER_H diff --git a/multimedia/av_codec/native_averrors.h b/multimedia/media_foundation/native_averrors.h similarity index 100% rename from multimedia/av_codec/native_averrors.h rename to multimedia/media_foundation/native_averrors.h diff --git a/multimedia/av_codec/native_avformat.h b/multimedia/media_foundation/native_avformat.h similarity index 100% rename from multimedia/av_codec/native_avformat.h rename to multimedia/media_foundation/native_avformat.h diff --git a/multimedia/av_codec/native_avmemory.h b/multimedia/media_foundation/native_avmemory.h similarity index 98% rename from multimedia/av_codec/native_avmemory.h rename to multimedia/media_foundation/native_avmemory.h index a165d290a..ba377873e 100644 --- a/multimedia/av_codec/native_avmemory.h +++ b/multimedia/media_foundation/native_avmemory.h @@ -55,7 +55,8 @@ uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem); int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem); /** - * @brief Clear the internal resources of the memory and destroy the memory instance + * @brief Clear the internal resources of the memory and destroy the memory + * instance * @syscap SystemCapability.Multimedia.Media.Core * @param mem Encapsulate OH_AVMemory structure instance pointer * @return Returns AV_ERR_OK if the execution is successful, From 2180b58adcd4feaad530e9c602611e63f520a704 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Fri, 1 Dec 2023 12:24:14 +0800 Subject: [PATCH 02/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E8=B0=83=E6=95=B4API11=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_base.h | 2 +- multimedia/media_foundation/native_avbuffer.h | 33 +---------- .../media_foundation/native_avbuffer_info.h | 55 +++++++++++++++++++ 3 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 multimedia/media_foundation/native_avbuffer_info.h diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 94088df0e..2c2794ceb 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -21,7 +21,7 @@ #include "native_averrors.h" #include "native_avformat.h" #include "native_avmemory.h" -#include "native_avbuffer.h" +#include "native_avbuffer_info.h" #ifdef __cplusplus extern "C" { diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index 927408998..4f0e2cc41 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -20,44 +20,13 @@ #include #include "native_averrors.h" #include "native_avformat.h" +#include "native_avbuffer_info.h" #ifdef __cplusplus extern "C" { #endif typedef struct OH_AVBuffer OH_AVBuffer; typedef struct OH_NativeBuffer OH_NativeBuffer; -/** - * @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 */ - AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, - /* 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 */ - AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, - /* Indicates that the Buffer contains Codec-Specific-Data */ - AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, -} OH_AVCodecBufferFlags; - -/** - * @brief Define the Buffer description information of OH_AVCodec - * @syscap SystemCapability.Multimedia.Media.Core - * @since 9 - */ -typedef struct OH_AVCodecBufferAttr { - /* Presentation timestamp of this Buffer in microseconds */ - int64_t pts; - /* The size of the data contained in the Buffer in bytes */ - int32_t size; - /* The starting offset of valid data in this Buffer */ - int32_t offset; - /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ - uint32_t flags; -} OH_AVCodecBufferAttr; /** * @brief Create an OH_AVBuffer instance diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h new file mode 100644 index 000000000..058a750e9 --- /dev/null +++ b/multimedia/media_foundation/native_avbuffer_info.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NATIVE_AVBUFFER_COMMON_H +#define NATIVE_AVBUFFER_COMMON_H + +#include +#include + +/** + * @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 */ + AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, + /* 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 */ + AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, + /* Indicates that the Buffer contains Codec-Specific-Data */ + AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3, +} OH_AVCodecBufferFlags; + +/** + * @brief Define the Buffer description information of OH_AVCodec + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ +typedef struct OH_AVCodecBufferAttr { + /* Presentation timestamp of this Buffer in microseconds */ + int64_t pts; + /* The size of the data contained in the Buffer in bytes */ + int32_t size; + /* The starting offset of valid data in this Buffer */ + int32_t offset; + /* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */ + uint32_t flags; +} OH_AVCodecBufferAttr; + +#enfif // NATIVE_AVBUFFER_COMMON_H \ No newline at end of file From 532992b26b78c58e1f5f8ed51ca0566aacce26cb Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Fri, 1 Dec 2023 13:25:02 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9API11=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/media_foundation/native_avbuffer_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h index 058a750e9..d6285c274 100644 --- a/multimedia/media_foundation/native_avbuffer_info.h +++ b/multimedia/media_foundation/native_avbuffer_info.h @@ -52,4 +52,4 @@ typedef struct OH_AVCodecBufferAttr { uint32_t flags; } OH_AVCodecBufferAttr; -#enfif // NATIVE_AVBUFFER_COMMON_H \ No newline at end of file +#endif // NATIVE_AVBUFFER_COMMON_H \ No newline at end of file From 2e7f5dbd6cd5c4c429f87593324a8f24620cad93 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Sat, 2 Dec 2023 16:18:07 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E6=A2=B3=E7=90=86=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_base.h | 141 +++++++----------- .../media_foundation/native_avbuffer_info.h | 7 + 2 files changed, 62 insertions(+), 86 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 2c2794ceb..33e681407 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -185,7 +185,7 @@ extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP; * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 */ -extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AVS3DA; +extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VIVID; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_OPUS; @@ -311,18 +311,6 @@ extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT; * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 */ -/* Key for type of file, value type is int32_t, see @OH_FileType */ -extern const char *OH_MD_KEY_FILE_TYPE; -/* Key for whether the file contains video tracks, value type is boolean */ -extern const char *OH_MD_KEY_HAS_VIDEO; -/* Key for whether the file contains audio tracks, value type is boolean */ -extern const char *OH_MD_KEY_HAS_AUDIO; -/* Key for author of file, value type is string */ -extern const char *OH_MD_KEY_AUTHOR; -/* Key for composer of file, value type is string */ -extern const char *OH_MD_KEY_COMPOSER; -/* Key for cover of file, value type is uint8_t pointer */ -extern const char *OH_MD_KEY_COVER; /* Key for codec compression level, value type is uint32_t */ extern const char *OH_MD_KEY_COMPRESSION_LEVEL; /* Key for encode level, value type is int32_t. see @OH_HEVCLevel. */ @@ -338,25 +326,6 @@ 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 File type. - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 - */ -typedef enum OH_FileType { - FILE_TYPE_UNKNOW = 0, - FILE_TYPE_MP4 = 101, - FILE_TYPE_MPEGTS = 102, - FILE_TYPE_MKV = 103, - FILE_TYPE_AMR = 201, - FILE_TYPE_AAC = 202, - FILE_TYPE_MP3 = 203, - FILE_TYPE_FLAC = 204, - FILE_TYPE_OGG = 205, - FILE_TYPE_M4A = 206, - FILE_TYPE_WAV = 207, -} OH_FileType; - /** * @brief Media type. * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -392,31 +361,6 @@ typedef enum OH_AVCProfile { AVC_PROFILE_MAIN = 8, } OH_AVCProfile; -/** - * @brief Enumerates the muxer output file format - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_AVOutputFormat { - AV_OUTPUT_FORMAT_DEFAULT = 0, - AV_OUTPUT_FORMAT_MPEG_4 = 2, - AV_OUTPUT_FORMAT_M4A = 6, -} OH_AVOutputFormat; - -/** - * @brief Seek Mode - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_AVSeekMode { - /* seek to sync sample after the time */ - SEEK_MODE_NEXT_SYNC = 0, - /* seek to sync sample before the time */ - SEEK_MODE_PREVIOUS_SYNC, - /* seek to sync sample closest to time */ - SEEK_MODE_CLOSEST_SYNC, -} OH_AVSeekMode; - /** * @brief HEVC Profile * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -451,6 +395,60 @@ typedef enum OH_HEVCLevel { HEVC_LEVEL_62 = 12, }; +/** + * @brief Enumerates the muxer output file format + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +typedef enum OH_AVOutputFormat { + AV_OUTPUT_FORMAT_DEFAULT = 0, + AV_OUTPUT_FORMAT_MPEG_4 = 2, + AV_OUTPUT_FORMAT_M4A = 6, +} OH_AVOutputFormat; + +/** + * @brief Seek Mode + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +typedef enum OH_AVSeekMode { + /* seek to sync sample after the time */ + SEEK_MODE_NEXT_SYNC = 0, + /* seek to sync sample before the time */ + SEEK_MODE_PREVIOUS_SYNC, + /* seek to sync sample closest to time */ + SEEK_MODE_CLOSEST_SYNC, +} OH_AVSeekMode; + +/** + * @brief Scaling Mode + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +typedef enum OH_ScalingMode { + SCALING_MODE_SCALE_TO_WINDOW = 1, + SCALING_MODE_SCALE_CROP = 2, +} OH_ScalingMode; + +/** + * @brief enum Audio Bits Per Coded Sample + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +typedef enum OH_BitsPerSample { + SAMPLE_U8 = 0, + SAMPLE_S16LE = 1, + SAMPLE_S24LE = 2, + SAMPLE_S32LE = 3, + SAMPLE_F32LE = 4, + SAMPLE_U8P = 5, + SAMPLE_S16P = 6, + SAMPLE_S24P = 7, + SAMPLE_S32P = 8, + SAMPLE_F32P = 9, + INVALID_WIDTH = -1 +} OH_BitsPerSample; + /** * @brief Color Primary * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -543,35 +541,6 @@ typedef struct OH_CUVVConfigBox { uint16_t terminal_provide_oriented_code; } OH_CUVVConfigBox; - -/** - * @brief Scaling Mode - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_ScalingMode { - SCALING_MODE_SCALE_TO_WINDOW = 1, - SCALING_MODE_SCALE_CROP = 2, -} OH_ScalingMode; - -/** - * @brief enum Audio Bits Per Coded Sample - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_BitsPerSample { - SAMPLE_U8 = 0, - SAMPLE_S16LE = 1, - SAMPLE_S24LE = 2, - SAMPLE_S32LE = 3, - SAMPLE_F32LE = 4, - SAMPLE_U8P = 5, - SAMPLE_S16P = 6, - SAMPLE_S24P = 7, - SAMPLE_S32P = 8, - SAMPLE_F32P = 9, - INVALID_WIDTH = -1 -} OH_BitsPerSample; #ifdef __cplusplus } #endif diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h index d6285c274..4aacb674a 100644 --- a/multimedia/media_foundation/native_avbuffer_info.h +++ b/multimedia/media_foundation/native_avbuffer_info.h @@ -19,6 +19,9 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /** * @brief Enumerate the categories of OH_AVCodec's Buffer tags * @syscap SystemCapability.Multimedia.Media.Core @@ -52,4 +55,8 @@ typedef struct OH_AVCodecBufferAttr { uint32_t flags; } OH_AVCodecBufferAttr; +#ifdef __cplusplus +} +#endif + #endif // NATIVE_AVBUFFER_COMMON_H \ No newline at end of file From f5d9439c842c845b050882aeff569554f25d48b4 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Sat, 2 Dec 2023 17:02:48 +0800 Subject: [PATCH 05/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E5=88=A0=E9=99=A4=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=A7=84=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_base.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 33e681407..a60eab277 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -173,9 +173,16 @@ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_HEVC; /** * @brief Enumerates the types of audio and video muxer * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 11 * @since 10 */ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4; + +/** + * @brief Enumerates the types of audio and video muxer + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ extern const char *OH_AVCODEC_MIMETYPE_IMAGE_JPG; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_PNG; extern const char *OH_AVCODEC_MIMETYPE_IMAGE_BMP; From 66898dccb262edec3430cff05e2f56bb1ff038a4 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Mon, 4 Dec 2023 12:21:46 +0800 Subject: [PATCH 06/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E5=8C=97=E5=90=91=E5=88=A0=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_base.h | 40 ++--------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index a60eab277..1eddd14da 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -318,16 +318,12 @@ extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT; * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 11 */ -/* Key for codec compression level, value type is uint32_t */ -extern const char *OH_MD_KEY_COMPRESSION_LEVEL; -/* Key for encode level, value type is int32_t. see @OH_HEVCLevel. */ -extern const char *OH_MD_KEY_LEVEL; +/* Key for audio codec compression level, value type is uint32_t */ +extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL; /* Key for chroma location, value type is int32_t. see @OH_ChromaLocation. */ extern const char *OH_MD_KEY_VIDEO_CHROMA_LOCATION; /* Key of the video is hdr vivid. value type is bool */ extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID; -/* Key for HDRVivid video CUVV Configuration Box, value type is uint8_t pointer, see @OH_CUVVConfigBox. */ -extern const char *OH_MD_KEY_VIDEO_CUVV_CONFIG_BOX; /* Key for number of audio objects. value type is int32_t */ extern const char *OH_MD_KEY_AUDIO_OBJECT_NUMBER; /* Key for meta data of audio vivid. value type is a uint8_t pointer */ @@ -381,27 +377,6 @@ typedef enum OH_HEVCProfile { HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4, } OH_HEVCProfile; -/** - * @brief HEVC Level - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 - */ -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, -}; - /** * @brief Enumerates the muxer output file format * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -537,17 +512,6 @@ typedef enum OH_ChromaLocation { CHROMA_LOC_BOTTOM = 6, }; -/** - * @brief Cuvv Configuration Box - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 - */ -typedef struct OH_CUVVConfigBox { - uint16_t cuva_version_map; - uint16_t terminal_provide_code; - uint16_t terminal_provide_oriented_code; -} OH_CUVVConfigBox; - #ifdef __cplusplus } #endif From 54bde8ebcbe0b26ae9ac08468c99a4c0664505c5 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Tue, 5 Dec 2023 12:16:11 +0800 Subject: [PATCH 07/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_base.h | 17 ----------------- .../media_foundation/native_avbuffer_info.h | 6 +++--- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 1eddd14da..c2fc71f8e 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -320,8 +320,6 @@ extern const char *OH_MD_MAX_OUTPUT_BUFFER_COUNT; */ /* Key for audio codec compression level, value type is uint32_t */ extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL; -/* Key for chroma location, value type is int32_t. see @OH_ChromaLocation. */ -extern const char *OH_MD_KEY_VIDEO_CHROMA_LOCATION; /* Key of the video is hdr vivid. value type is bool */ extern const char *OH_MD_KEY_VIDEO_IS_HDR_VIVID; /* Key for number of audio objects. value type is int32_t */ @@ -497,21 +495,6 @@ typedef enum OH_MatrixCoefficient { MATRIX_COEFFICIENT_ICTCP = 14, } OH_MatrixCoefficient; -/** - * @brief Chroma Location - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 - */ -typedef enum OH_ChromaLocation { - CHROMA_LOC_UNSPECIFIED = 0, - CHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 - CHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 - CHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 - CHROMA_LOC_TOP = 4, - CHROMA_LOC_BOTTOMLEFT = 5, - CHROMA_LOC_BOTTOM = 6, -}; - #ifdef __cplusplus } #endif diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h index 4aacb674a..78ec7c3e8 100644 --- a/multimedia/media_foundation/native_avbuffer_info.h +++ b/multimedia/media_foundation/native_avbuffer_info.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef NATIVE_AVBUFFER_COMMON_H -#define NATIVE_AVBUFFER_COMMON_H +#ifndef NATIVE_AVBUFFER_INFO_H +#define NATIVE_AVBUFFER_INFO_H #include #include @@ -59,4 +59,4 @@ typedef struct OH_AVCodecBufferAttr { } #endif -#endif // NATIVE_AVBUFFER_COMMON_H \ No newline at end of file +#endif // NATIVE_AVBUFFER_INFO_H From f3a51b2b6a62691ae46a6091aabdffcf36d48669 Mon Sep 17 00:00:00 2001 From: peng Date: Wed, 6 Dec 2023 20:57:37 +0800 Subject: [PATCH 08/33] modify AudioCodec interface Signed-off-by: peng --- multimedia/av_codec/native_avcodec_audiocodec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h index e31e89eba..34269b2f9 100644 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -80,7 +80,7 @@ OH_AVErrCode OH_AudioCodec_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallbac * otherwise returns a specific error code, refer to {@link OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AudioCodec_Configure(OH_AVCodec *codec, OH_AVFormat *format); +OH_AVErrCode OH_AudioCodec_Configure(OH_AVCodec *codec, const OH_AVFormat *format); /** * @brief To prepare the internal resources of the codec, the Configure interface must be called @@ -143,7 +143,7 @@ OH_AVErrCode OH_AudioCodec_Reset(OH_AVCodec *codec); /** * @brief Get the description information of the output data of the codec, refer to {@link OH_AVFormat} for details. * 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 + * be manually released by the caller calling OH_AVFormat_Destroy. * @syscap SystemCapability.Multimedia.Media.AudioCodec * @param codec Pointer to an OH_AVCodec instance * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, @@ -162,7 +162,7 @@ OH_AVFormat *OH_AudioCodec_GetOutputDescription(OH_AVCodec *codec); * otherwise returns a specific error code, refer to {@link OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AudioCodec_SetParameter(OH_AVCodec *codec, OH_AVFormat *format); +OH_AVErrCode OH_AudioCodec_SetParameter(OH_AVCodec *codec, const OH_AVFormat *format); /** * @brief Submit the input buffer filled with data to the audio codec. The {@link OH_AVCodecOnNeedInputData} callback From 3a1a7c2b3aae6bfa18e1be17ee86fb9bca31b88f Mon Sep 17 00:00:00 2001 From: peng Date: Wed, 6 Dec 2023 20:59:53 +0800 Subject: [PATCH 09/33] add function link Signed-off-by: peng --- multimedia/av_codec/native_avcodec_audiocodec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h index 34269b2f9..13f6731b5 100644 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -143,7 +143,7 @@ OH_AVErrCode OH_AudioCodec_Reset(OH_AVCodec *codec); /** * @brief Get the description information of the output data of the codec, refer to {@link OH_AVFormat} for details. * 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 calling OH_AVFormat_Destroy. + * be manually released by the caller calling {@link OH_AVFormat_Destroy}. * @syscap SystemCapability.Multimedia.Media.AudioCodec * @param codec Pointer to an OH_AVCodec instance * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, From 214661a51205c0a469af184b0e802e4801a186a3 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Wed, 6 Dec 2023 21:43:18 +0800 Subject: [PATCH 10/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9avbuffer=20NDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/media_foundation/native_avbuffer.h | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index 4f0e2cc41..e4f1d8f08 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -29,10 +29,11 @@ typedef struct OH_AVBuffer OH_AVBuffer; typedef struct OH_NativeBuffer OH_NativeBuffer; /** - * @brief Create an OH_AVBuffer instance + * @brief Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed to + * by the return value * needs to be manually released by OH_AVBuffer_Destroy * @syscap SystemCapability.Multimedia.Media.Core * @param capacity the buffer's capacity, bytes - * @return Returns a pointer to an OH_AVBuffer instance, needs to be freed by OH_AVBuffer_Destroy + * @return Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr * @since 11 */ OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity); @@ -51,28 +52,33 @@ OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); * @brief Get the buffer's attribute * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer - * @return Returns the description of the buffer, please refer to {@link OH_AVCodecBufferAttr} + * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to + * {@link OH_AVCodecBufferAttr} + * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link + * OH_AVErrCode} * @since 11 */ -OH_AVCodecBufferAttr OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer); +OH_AVErrCode OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr); /** * @brief Set the buffer's attribute * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer - * @param attr The description of the buffer, please refer to {@link OH_AVCodecBufferAttr} + * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to + * {@link OH_AVCodecBufferAttr} * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link * OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr attr); +OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBufferAttr *attr); /** * @brief Get the buffer's parameter. 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. + * by the return value * needs to be manually released by OH_AVFormat_Destroy * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer - * @return Returns Encapsulate OH_AVFormat structure instance pointer, refer to {@link OH_AVFormat} + * @return Returns Encapsulate OH_AVFormat structure instance pointer if the execution is successful, + * otherwise returns nullptr * @since 11 */ OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); @@ -81,12 +87,12 @@ OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); * @brief Set the buffer's parameter * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer - * @param format Encapsulate OH_AVFormat structure instance pointer, refer to {@link OH_AVFormat} + * @param format Encapsulate OH_AVFormat structure instance pointer * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link * OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, OH_AVFormat *format); +OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, const OH_AVFormat *format); /** * @brief Get the buffer's virtual address @@ -107,11 +113,12 @@ uint8_t *OH_AVBuffer_GetAddr(OH_AVBuffer *buffer); int32_t OH_AVBuffer_GetCapacity(OH_AVBuffer *buffer); /** - * @brief Get the OH_NativeBuffer instance pointer + * @brief Get the OH_NativeBuffer instance pointer,It should be noted that the life cycle of the OH_AVBuffer + * instance pointed to by the return value * needs to be manually released by OH_NativeBuffer_Unreference * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns Encapsulate OH_NativeBuffer structure instance pointer is successful, - * otherwise returns nullptr, refer to {@link OH_NativeBuffer} + * otherwise returns nullptr * @since 11 */ OH_NativeBuffer *OH_AVBuffer_GetNativeBuffer(OH_AVBuffer *buffer); From 5c4e3e4f4ce7087ac7b5584e40e30c060970a413 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Wed, 6 Dec 2023 22:03:02 +0800 Subject: [PATCH 11/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/media_foundation/native_avbuffer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index e4f1d8f08..f1ea1b6d7 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -30,7 +30,7 @@ typedef struct OH_NativeBuffer OH_NativeBuffer; /** * @brief Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed to - * by the return value * needs to be manually released by OH_AVBuffer_Destroy + * by the return value * needs to be manually released by {@link OH_AVBuffer_Destroy} * @syscap SystemCapability.Multimedia.Media.Core * @param capacity the buffer's capacity, bytes * @return Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr @@ -74,7 +74,7 @@ OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBuff /** * @brief Get the buffer's parameter. 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 OH_AVFormat_Destroy + * by the return value * needs to be manually released by {@link OH_AVFormat_Destroy} * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns Encapsulate OH_AVFormat structure instance pointer if the execution is successful, @@ -114,7 +114,7 @@ int32_t OH_AVBuffer_GetCapacity(OH_AVBuffer *buffer); /** * @brief Get the OH_NativeBuffer instance pointer,It should be noted that the life cycle of the OH_AVBuffer - * instance pointed to by the return value * needs to be manually released by OH_NativeBuffer_Unreference + * instance pointed to by the return value * needs to be manually released by {@link OH_NativeBuffer_Unreference} * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns Encapsulate OH_NativeBuffer structure instance pointer is successful, From c47faf0475157aeda0ca6880263561cd1bf41003 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Thu, 7 Dec 2023 09:48:47 +0800 Subject: [PATCH 12/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- .../av_codec/native_avcodec_videodecoder.h | 4 ++-- .../av_codec/native_avcodec_videoencoder.h | 10 +++++----- multimedia/media_foundation/native_avbuffer.h | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 933e512df..a364d8f89 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -49,7 +49,7 @@ OH_AVCodec *OH_VideoDecoder_CreateByMime(const char *mime); 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. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -90,7 +90,7 @@ OH_AVErrCode OH_VideoDecoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallb /** * @brief Specify the output Surface to provide video decoding output, - * this interface must be called before Prepare is called + * this interface must be called before Prepare is called. * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index e91950d0d..455cea145 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -34,7 +34,7 @@ extern "C" { * @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 + * @param userData User specified data * @since 11 */ typedef void (*OH_VideoEncoder_OnNeedInputParameter)(OH_AVCodec *codec, uint32_t index, OH_AVFormat *parameter, @@ -62,7 +62,7 @@ OH_AVCodec *OH_VideoEncoder_CreateByMime(const char *mime); OH_AVCodec *OH_VideoEncoder_CreateByName(const char *name); /** - * @brief Clear the internal resources of the encoder and destroy the encoder instance + * @brief Clear the internal resources of the encoder and destroy the encoder instance. * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -104,7 +104,7 @@ OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallb /** * @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 - * OH_VideoEncoder_Prepare and after OH_VideoEncoder_GetSurface. + * {@link OH_VideoEncoder_Prepare} and after {@link OH_VideoEncoder_GetSurface}. * @param codec Pointer to an OH_AVCodec instance * @param onInputParameter A callback functions, see {@link OH_VideoEncoder_OnNeedInputParameter} * @param userData User specific data @@ -243,7 +243,7 @@ OH_AVErrCode OH_VideoEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); /** * @brief Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify - * the encoder of the end of the stream in surface mode + * the encoder of the end of the stream in surface mode. * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -313,7 +313,7 @@ OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec); /** * @brief Check whether the current codec instance is valid. It can be used fault recovery or app - * switchback from the background + * switchback from the background. * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @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, diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index f1ea1b6d7..171b68ea4 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -30,7 +30,7 @@ typedef struct OH_NativeBuffer OH_NativeBuffer; /** * @brief Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed to - * by the return value * needs to be manually released by {@link OH_AVBuffer_Destroy} + * by the return value * needs to be manually released by {@link OH_AVBuffer_Destroy}. * @syscap SystemCapability.Multimedia.Media.Core * @param capacity the buffer's capacity, bytes * @return Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr @@ -39,7 +39,7 @@ typedef struct OH_NativeBuffer OH_NativeBuffer; OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity); /** - * @brief Clear the internal resources of the buffer and destroy the buffer instance + * @brief Clear the internal resources of the buffer and destroy the buffer instance. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns AV_ERR_OK if the execution is successful, otherwise returns a specific error code, refer to {@link @@ -49,7 +49,7 @@ OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity); OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); /** - * @brief Get the buffer's attribute + * @brief Get the buffer's attribute. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to @@ -61,7 +61,7 @@ OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); OH_AVErrCode OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr); /** - * @brief Set the buffer's attribute + * @brief Set the buffer's attribute. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to @@ -74,7 +74,7 @@ OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBuff /** * @brief Get the buffer's parameter. 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 {@link OH_AVFormat_Destroy} + * by the return value * needs to be manually released by {@link OH_AVFormat_Destroy}. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns Encapsulate OH_AVFormat structure instance pointer if the execution is successful, @@ -84,7 +84,7 @@ OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBuff OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); /** - * @brief Set the buffer's parameter + * @brief Set the buffer's parameter. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param format Encapsulate OH_AVFormat structure instance pointer @@ -95,7 +95,7 @@ OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, const OH_AVFormat *format); /** - * @brief Get the buffer's virtual address + * @brief Get the buffer's virtual address. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return the buffer's virtual address if the buffer is valid, otherwise nullptr @@ -114,7 +114,7 @@ int32_t OH_AVBuffer_GetCapacity(OH_AVBuffer *buffer); /** * @brief Get the OH_NativeBuffer instance pointer,It should be noted that the life cycle of the OH_AVBuffer - * instance pointed to by the return value * needs to be manually released by {@link OH_NativeBuffer_Unreference} + * instance pointed to by the return value * needs to be manually released by {@link OH_NativeBuffer_Unreference}. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @return Returns Encapsulate OH_NativeBuffer structure instance pointer is successful, From dbf32f445f4872b15f36029c76a3075e2e6e026c Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Thu, 7 Dec 2023 10:52:30 +0800 Subject: [PATCH 13/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9muxer=E6=8E=A5=E5=8F=A3&?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/native_avmuxer.h | 2 +- multimedia/media_foundation/native_avbuffer.h | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index b575643c7..a2a21998a 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -115,7 +115,7 @@ OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, */ OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, uint32_t trackIndex, - OH_AVBuffer *sample); + const OH_AVBuffer *sample); /** * @brief Stop the muxer. diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index 171b68ea4..19ec2be46 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -29,8 +29,8 @@ typedef struct OH_AVBuffer OH_AVBuffer; typedef struct OH_NativeBuffer OH_NativeBuffer; /** - * @brief Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed to - * by the return value * needs to be manually released by {@link OH_AVBuffer_Destroy}. + * @brief Create an OH_AVBuffer instance, It should be noted that the life cycle of the OH_AVBuffer instance pointed + * to by the return value * needs to be manually released by {@link OH_AVBuffer_Destroy}. * @syscap SystemCapability.Multimedia.Media.Core * @param capacity the buffer's capacity, bytes * @return Returns a pointer to an OH_AVBuffer instance if the execution is successful, otherwise returns nullptr @@ -42,8 +42,8 @@ OH_AVBuffer *OH_AVBuffer_Create(int32_t capacity); * @brief Clear the internal resources of the buffer and destroy the buffer instance. * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer - * @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} * @since 11 */ OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); @@ -54,8 +54,8 @@ OH_AVErrCode OH_AVBuffer_Destroy(OH_AVBuffer *buffer); * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to * {@link OH_AVCodecBufferAttr} - * @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} * @since 11 */ OH_AVErrCode OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr *attr); @@ -66,8 +66,8 @@ OH_AVErrCode OH_AVBuffer_GetBufferAttr(OH_AVBuffer *buffer, OH_AVCodecBufferAttr * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param attr Encapsulate OH_AVCodecBufferAttr structure instance pointer, please refer to * {@link OH_AVCodecBufferAttr} - * @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} * @since 11 */ OH_AVErrCode OH_AVBuffer_SetBufferAttr(OH_AVBuffer *buffer, const OH_AVCodecBufferAttr *attr); @@ -88,8 +88,8 @@ OH_AVFormat *OH_AVBuffer_GetParameter(OH_AVBuffer *buffer); * @syscap SystemCapability.Multimedia.Media.Core * @param buffer Encapsulate OH_AVBuffer structure instance pointer * @param format Encapsulate OH_AVFormat structure instance pointer - * @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} * @since 11 */ OH_AVErrCode OH_AVBuffer_SetParameter(OH_AVBuffer *buffer, const OH_AVFormat *format); From f0254ff2ebebe13b8ccb5696cd73a8010830aedf Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Fri, 8 Dec 2023 11:13:13 +0800 Subject: [PATCH 14/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E5=BA=9F=E5=BC=83avmemory=EF=BC=8C=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E4=B8=BAavbuffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- multimedia/av_codec/native_avcodec_audiocodec.h | 2 +- multimedia/media_foundation/native_avmemory.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h index 13f6731b5..a74425e94 100644 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -143,7 +143,7 @@ OH_AVErrCode OH_AudioCodec_Reset(OH_AVCodec *codec); /** * @brief Get the description information of the output data of the codec, refer to {@link OH_AVFormat} for details. * 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 calling {@link OH_AVFormat_Destroy}. + * be manually released by calling {@link OH_AVFormat_Destroy}. * @syscap SystemCapability.Multimedia.Media.AudioCodec * @param codec Pointer to an OH_AVCodec instance * @return Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription, diff --git a/multimedia/media_foundation/native_avmemory.h b/multimedia/media_foundation/native_avmemory.h index ba377873e..489a4ff49 100644 --- a/multimedia/media_foundation/native_avmemory.h +++ b/multimedia/media_foundation/native_avmemory.h @@ -30,6 +30,8 @@ typedef struct OH_AVMemory OH_AVMemory; * @syscap SystemCapability.Multimedia.Media.Core * @param size the memory's size, bytes. * @return Returns a pointer to an OH_AVMemory instance, needs to be freed by OH_AVMemory_Destroy. + * @deprecated since 11 + * @useinstead OH_AVBuffer_Create * @since 10 */ OH_AVMemory *OH_AVMemory_Create(int32_t size); @@ -39,6 +41,8 @@ OH_AVMemory *OH_AVMemory_Create(int32_t size); * @syscap SystemCapability.Multimedia.Media.Core * @param mem Encapsulate OH_AVMemory structure instance pointer * @return the memory's virtual address if the memory is valid, otherwise nullptr. + * @deprecated since 11 + * @useinstead OH_AVBuffer_GetAddr * @since 9 * @version 1.0 */ @@ -49,6 +53,8 @@ uint8_t *OH_AVMemory_GetAddr(struct OH_AVMemory *mem); * @syscap SystemCapability.Multimedia.Media.Core * @param mem Encapsulate OH_AVMemory structure instance pointer * @return the memory's size if the memory is valid, otherwise -1. + * @deprecated since 11 + * @useinstead OH_AVBuffer_GetCapacity * @since 9 * @version 1.0 */ @@ -61,6 +67,8 @@ int32_t OH_AVMemory_GetSize(struct OH_AVMemory *mem); * @param mem Encapsulate OH_AVMemory structure instance pointer * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @deprecated since 11 + * @useinstead OH_AVBuffer_Destroy * @since 10 */ OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem); From d1ef381f71a0a78a851d93d841bb7763a2d3aec3 Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Fri, 8 Dec 2023 17:24:15 +0800 Subject: [PATCH 15/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=E5=88=A0=E9=99=A4=E5=8F=82=E6=95=B0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- .../av_codec/native_avcodec_videoencoder.h | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index 455cea145..576b737b9 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -27,19 +27,6 @@ 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. - * @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 User specified data - * @since 11 - */ -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 @@ -101,21 +88,6 @@ 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_Prepare} and after {@link OH_VideoEncoder_GetSurface}. - * @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 11 - */ -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. @@ -278,17 +250,6 @@ 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 11 - */ -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 From 4f3566a175a14b760a02c140e9281cb006e6c629 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 11 Dec 2023 03:10:13 +0000 Subject: [PATCH 16/33] fix vibrator header out dir Signed-off-by: hellohyh001 --- sensors/miscdevice/vibrator/BUILD.gn | 2 +- sensors/sensor/oh_sensor_type.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sensors/miscdevice/vibrator/BUILD.gn b/sensors/miscdevice/vibrator/BUILD.gn index ef533e246..d843b2d08 100644 --- a/sensors/miscdevice/vibrator/BUILD.gn +++ b/sensors/miscdevice/vibrator/BUILD.gn @@ -14,7 +14,7 @@ import("//build/ohos.gni") ohos_ndk_headers("ndk_vibrator_header") { - dest_dir = "$ndk_headers_out_dir/sensors/miscdevice/vibrator" + dest_dir = "$ndk_headers_out_dir/sensors" sources = [ "./include/vibrator.h", "./include/vibrator_type.h", diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index 16f05c98c..f8ca2c4db 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -277,35 +277,35 @@ typedef struct Sensor_Event Sensor_Event; /** * @brief Obtains the sensor type. * - * @param Sensor_Event - Pointer to the sensor data information. + * @param sensorEvent - Pointer to the sensor data information. * @param sensorType - Pointer to the sensor type. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_SensorEvent_GetType(Sensor_Event* Sensor_Event, Sensor_Type *sensorType); +int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType); /** * @brief Obtains the timestamp of sensor data. * - * @param Sensor_Event - Pointer to the sensor data information. + * @param sensorEvent - Pointer to the sensor data information. * @param timestamp - Pointer to the timestamp. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* Sensor_Event, int64_t *timestamp); +int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp); /** * @brief Obtains the accuracy of sensor data. * - * @param Sensor_Event - Pointer to the sensor data information. + * @param sensorEvent - Pointer to the sensor data information. * @param accuracy - Pointer to the accuracy. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy *accuracy); +int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy); /** * @brief Obtains sensor data. The data length and content depend on the sensor type. @@ -333,14 +333,14 @@ int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy * * SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked. * SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value. * - * @param Sensor_Event - Pointer to the sensor data information. + * @param sensorEvent - Pointer to the sensor data information. * @param data - Double pointer to the sensor data. * @param length - Pointer to the array length. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_SensorEvent_GetData(Sensor_Event* Sensor_Event, float **data, uint32_t *length); +int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length); /** * @brief Defines the sensor subscription ID, which uniquely identifies a sensor. @@ -371,7 +371,7 @@ int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id); * @brief Obtains the sensor type. * * @param id - Pointer to the sensor subscription ID. - * @param id - Pointer to the sensor type. + * @param sensorType - Pointer to the sensor type. * @return Returns SENSOR_SUCCESS if the operation is successful; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 From 538adb759dde0f78168eaeac8398518e40e2b79b Mon Sep 17 00:00:00 2001 From: wangzhaoyong Date: Mon, 27 Nov 2023 19:31:03 +0800 Subject: [PATCH 17/33] ndk add napi_coerce_to_native_binding_object Signed-off-by: wangzhaoyong Change-Id: Iabecb80670e34402acad9ca7daa53949054b1d4f --- arkui/napi/libnapi.ndk.json | 3 ++- arkui/napi/native_api.h | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index cb8eb7bc9..1534e5c91 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -145,5 +145,6 @@ {"name": "napi_async_destroy"}, {"name": "napi_open_callback_scope"}, {"name": "napi_close_callback_scope"}, - {"name": "node_api_get_module_file_name"} + {"name": "node_api_get_module_file_name"}, + {"name": "napi_coerce_to_native_binding_object"} ] \ No newline at end of file diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index 379f8b5bb..f56036533 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -79,6 +79,9 @@ NAPI_INNER_EXTERN napi_status napi_adjust_external_memory(napi_env env, extern "C" { #endif +typedef void* (*napi_native_binding_detach_callback)(napi_env env, void* native_object, void* hint); +typedef napi_value (*napi_native_binding_attach_callback)(napi_env env, void* native_object, void* hint); + NAPI_EXTERN napi_status napi_run_script_path(napi_env env, const char* path, napi_value* result); NAPI_EXTERN napi_status napi_queue_async_work_with_qos(napi_env env, napi_async_work work, napi_qos_t qos); NAPI_EXTERN napi_status napi_load_module(napi_env env, const char* path, napi_value* result); @@ -119,6 +122,12 @@ NAPI_EXTERN napi_status napi_create_object_with_named_properties(napi_env env, size_t property_count, const char** keys, const napi_value* values); +NAPI_EXTERN napi_status napi_coerce_to_native_binding_object(napi_env env, + napi_value js_object, + napi_native_binding_detach_callback detach_cb, + napi_native_binding_attach_callback attach_cb, + void* native_object, + void* hint); #ifdef __cplusplus } From 4376c7fe9e34b977ae6866908dd6e5b6559ca234 Mon Sep 17 00:00:00 2001 From: linyuanpeng Date: Sat, 2 Dec 2023 15:27:24 +0800 Subject: [PATCH 18/33] channel layout enum Signed-off-by: linyuanpeng --- .../native_audio_channel_layout.h | 334 ++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 multimedia/media_foundation/native_audio_channel_layout.h diff --git a/multimedia/media_foundation/native_audio_channel_layout.h b/multimedia/media_foundation/native_audio_channel_layout.h new file mode 100644 index 000000000..8b0e26874 --- /dev/null +++ b/multimedia/media_foundation/native_audio_channel_layout.h @@ -0,0 +1,334 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file native_audio_channel_layout.h + * + * @brief The channel layout indicates the appearance and order of the speakers for recording or playback. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 11 + */ + +#ifndef NATIVE_AUDIO_CHANNEL_LAYOUT_H +#define NATIVE_AUDIO_CHANNEL_LAYOUT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio Channel Set + * A 64-bit integer with bits set for each channel. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 11 + */ +typedef enum OH_AudioChannelSet { + /** Channel set For FRONT-LEFT position */ + CH_SET_FRONT_LEFT = 1ULL << 0U, + + /** Channel set For FRONT_RIGHT position */ + CH_SET_FRONT_RIGHT = 1ULL << 1U, + + /** Channel set For FRONT_CENTER position */ + CH_SET_FRONT_CENTER = 1ULL << 2U, + + /** Channel set For LOW_FREQUENCY position */ + CH_SET_LOW_FREQUENCY = 1ULL << 3U, + + /** Channel set For BACK_LEFT position */ + CH_SET_BACK_LEFT = 1ULL << 4U, + + /** Channel set For BACK_RIGHT position */ + CH_SET_BACK_RIGHT = 1ULL << 5U, + + /** Channel set For FRONT_LEFT_OF_CENTER position */ + CH_SET_FRONT_LEFT_OF_CENTER = 1ULL << 6U, + + /** Channel set For FRONT_RIGHT_OF_CENTER position */ + CH_SET_FRONT_RIGHT_OF_CENTER = 1ULL << 7U, + + /** Channel set For BACK_CENTER position */ + CH_SET_BACK_CENTER = 1ULL << 8U, + + /** Channel set For SIDE_LEFT position */ + CH_SET_SIDE_LEFT = 1ULL << 9U, + + /** Channel set For SIDE_RIGHT position */ + CH_SET_SIDE_RIGHT = 1ULL << 10U, + + /** Channel set For TOP_CENTER position */ + CH_SET_TOP_CENTER = 1ULL << 11U, + + /** Channel set For TOP_FRONT_LEFT position */ + CH_SET_TOP_FRONT_LEFT = 1ULL << 12U, + + /** Channel set For TOP_FRONT_CENTER position */ + CH_SET_TOP_FRONT_CENTER = 1ULL << 13U, + + /** Channel set For TOP_FRONT_RIGHT position */ + CH_SET_TOP_FRONT_RIGHT = 1ULL << 14U, + + /** Channel set For TOP_BACK_LEFT position */ + CH_SET_TOP_BACK_LEFT = 1ULL << 15U, + + /** Channel set For TOP_BACK_CENTER position */ + CH_SET_TOP_BACK_CENTER = 1ULL << 16U, + + /** Channel set For TOP_BACK_RIGHT position */ + CH_SET_TOP_BACK_RIGHT = 1ULL << 17U, + + /** Channel set For STEREO_LEFT position */ + CH_SET_STEREO_LEFT = 1ULL << 29U, + + /** Channel set For STEREO_RIGHT position */ + CH_SET_STEREO_RIGHT = 1ULL << 30U, + + /** Channel set For WIDE_LEFT position */ + CH_SET_WIDE_LEFT = 1ULL << 31U, + + /** Channel set For WIDE_RIGHT position */ + CH_SET_WIDE_RIGHT = 1ULL << 32U, + + /** Channel set For SURROUND_DIRECT_LEFT position */ + CH_SET_SURROUND_DIRECT_LEFT = 1ULL << 33U, + + /** Channel set For SURROUND_DIRECT_RIGHT position */ + CH_SET_SURROUND_DIRECT_RIGHT = 1ULL << 34U, + + /** Channel set For LOW_FREQUENCY_2 position */ + CH_SET_LOW_FREQUENCY_2 = 1ULL << 35U, + + /** Channel set For TOP_SIDE_LEFT position */ + CH_SET_TOP_SIDE_LEFT = 1ULL << 36U, + + /** Channel set For TOP_SIDE_RIGHT position */ + CH_SET_TOP_SIDE_RIGHT = 1ULL << 37U, + + /** Channel set For BOTTOM_FRONT_CENTER position */ + CH_SET_BOTTOM_FRONT_CENTER = 1ULL << 38U, + + /** Channel set For BOTTOM_FRONT_LEFT position */ + CH_SET_BOTTOM_FRONT_LEFT = 1ULL << 39U, + + /** Channel set For BOTTOM_FRONT_RIGHT position */ + CH_SET_BOTTOM_FRONT_RIGHT = 1ULL << 40U +} OH_AudioChannelSet; + +/** + * @brief Ambisonic attribute set. + * A set of 64-bit integers indicate the ambisonic attributes. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 11 + */ +typedef enum OH_AmbAttributeSet { + /** Ambisonic attribute: order 1 */ + AMB_ORD_1 = 1ULL << 0U, + + /** Ambisonic attribute: order 2 */ + AMB_ORD_2 = 2ULL << 0U, + + /** Ambisonic attribute: order 3 */ + AMB_ORD_3 = 3ULL << 0U, + + /** Ambisonic attribute: ACN Component Ordering */ + AMB_COM_ACN = 0ULL << 8U, + + /** Ambisonic attribute: FUMA Component Ordering */ + AMB_COM_FUMA = 1ULL << 8U, + + /** Ambisonic attribute: N3D Normalization */ + AMB_NOR_N3D = 0ULL << 12U, + + /** Ambisonic attribute: SN3D Normalization */ + AMB_NOR_SN3D = 1ULL << 12U, + + /** Channel layout: Ambisonic mode */ + AMB_MODE = 1ULL << 44U +} OH_AmbAttributeSet; + +/** + * @brief Audio Channel Layout + * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 11 + */ +typedef enum OH_AudioChannelLayout { + /** Unknown Channel Layout */ + CH_LAYOUT_UNKNOWN = 0ULL, + + /** Channel Layout For Mono, 1 channel in total */ + CH_LAYOUT_MONO = CH_SET_FRONT_CENTER, + + /** Channel Layout For Stereo, 2 channels in total */ + CH_LAYOUT_STEREO = CH_SET_FRONT_LEFT | CH_SET_FRONT_RIGHT, + + /** Channel Layout For Stereo-Downmix, 2 channels in total */ + CH_LAYOUT_STEREO_DOWNMIX = CH_SET_STEREO_LEFT | CH_SET_STEREO_RIGHT, + + /** Channel Layout For 2.1, 3 channels in total */ + CH_LAYOUT_2POINT1 = CH_LAYOUT_STEREO | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 3.0, 3 channels in total */ + CH_LAYOUT_3POINT0 = CH_LAYOUT_STEREO | CH_SET_BACK_CENTER, + + /** Channel Layout For Surround, 3 channels in total */ + CH_LAYOUT_SURROUND = CH_LAYOUT_STEREO | CH_SET_FRONT_CENTER, + + /** Channel Layout For 3.1, 4 channels in total */ + CH_LAYOUT_3POINT1 = CH_LAYOUT_SURROUND | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 4.0, 4 channels in total */ + CH_LAYOUT_4POINT0 = CH_LAYOUT_SURROUND | CH_SET_BACK_CENTER, + + /** Channel Layout For Quad-Side, 4 channels in total */ + CH_LAYOUT_QUAD_SIDE = CH_LAYOUT_STEREO | CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT, + + /** Channel Layout For Quad, 4 channels in total */ + CH_LAYOUT_QUAD = CH_LAYOUT_STEREO | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT, + + /** Channel Layout For 2.0.2, 4 channels in total */ + CH_LAYOUT_2POINT0POINT2 = CH_LAYOUT_STEREO | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT, + + /** Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total */ + CH_LAYOUT_AMB_ORDER1_ACN_N3D = AMB_MODE | AMB_ORD_1 | AMB_COM_ACN | AMB_NOR_N3D, + + /** Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total */ + CH_LAYOUT_AMB_ORDER1_ACN_SN3D = AMB_MODE | AMB_ORD_1 | AMB_COM_ACN | AMB_NOR_SN3D, + + /** Channel Layout For ORDER1-FUMA FOA, 4 channels in total */ + CH_LAYOUT_AMB_ORDER1_FUMA = AMB_MODE | AMB_ORD_1 | AMB_COM_FUMA, + + /** Channel Layout For 4.1, 5 channels in total */ + CH_LAYOUT_4POINT1 = CH_LAYOUT_4POINT0 | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 5.0, 5 channels in total */ + CH_LAYOUT_5POINT0 = CH_LAYOUT_SURROUND | CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT, + + /** Channel Layout For 5.0-Back, 5 channels in total */ + CH_LAYOUT_5POINT0_BACK = CH_LAYOUT_SURROUND | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT, + + /** Channel Layout For 2.1.2, 5 channels in total */ + CH_LAYOUT_2POINT1POINT2 = CH_LAYOUT_2POINT0POINT2 | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 3.0.2, 5 channels in total */ + CH_LAYOUT_3POINT0POINT2 = CH_LAYOUT_2POINT0POINT2 | CH_SET_FRONT_CENTER, + + /** Channel Layout For 5.1, 6 channels in total */ + CH_LAYOUT_5POINT1 = CH_LAYOUT_5POINT0 | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 5.1-Back, 6 channels in total */ + CH_LAYOUT_5POINT1_BACK = CH_LAYOUT_5POINT0_BACK | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 6.0, 6 channels in total */ + CH_LAYOUT_6POINT0 = CH_LAYOUT_5POINT0 | CH_SET_BACK_CENTER, + + /** Channel Layout For 3.1.2, 6 channels in total */ + CH_LAYOUT_3POINT1POINT2 = CH_LAYOUT_3POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT, + + /** Channel Layout For 6.0-Front, 6 channels in total */ + CH_LAYOUT_6POINT0_FRONT = CH_LAYOUT_QUAD_SIDE | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER, + + /** Channel Layout For Hexagonal, 6 channels in total */ + CH_LAYOUT_HEXAGONAL = CH_LAYOUT_5POINT0_BACK | CH_SET_BACK_CENTER, + + /** Channel Layout For 6.1, 7 channels in total */ + CH_LAYOUT_6POINT1 = CH_LAYOUT_5POINT1 | CH_SET_BACK_CENTER, + + /** Channel Layout For 6.1-Back, 7 channels in total */ + CH_LAYOUT_6POINT1_BACK = CH_LAYOUT_5POINT1_BACK | CH_SET_BACK_CENTER, + + /** Channel Layout For 6.1-Front, 7 channels in total */ + CH_LAYOUT_6POINT1_FRONT = CH_LAYOUT_6POINT0_FRONT | CH_SET_LOW_FREQUENCY, + + /** Channel Layout For 7.0, 7 channels in total */ + CH_LAYOUT_7POINT0 = CH_LAYOUT_5POINT0 | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT, + + /** Channel Layout For 7.0-Front, 7 channels in total */ + CH_LAYOUT_7POINT0_FRONT = CH_LAYOUT_5POINT0 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER, + + /** Channel Layout For 7.1, 8 channels in total */ + CH_LAYOUT_7POINT1 = CH_LAYOUT_5POINT1 | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT, + + /** Channel Layout For Octagonal, 8 channels in total */ + CH_LAYOUT_OCTAGONAL = CH_LAYOUT_5POINT0 | CH_SET_BACK_LEFT | CH_SET_BACK_CENTER | CH_SET_BACK_RIGHT, + + /** Channel Layout For 5.1.2, 8 channels in total */ + CH_LAYOUT_5POINT1POINT2 = CH_LAYOUT_5POINT1 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT, + + /** Channel Layout For 7.1-Wide, 8 channels in total */ + CH_LAYOUT_7POINT1_WIDE = CH_LAYOUT_5POINT1 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER, + + /** Channel Layout For 7.1-Wide-Back, 8 channels in total */ + CH_LAYOUT_7POINT1_WIDE_BACK = CH_LAYOUT_5POINT1_BACK | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER, + + /** Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total */ + CH_LAYOUT_AMB_ORDER2_ACN_N3D = AMB_MODE | AMB_ORD_2 | AMB_COM_ACN | AMB_NOR_N3D, + + /** Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total */ + CH_LAYOUT_AMB_ORDER2_ACN_SN3D = AMB_MODE | AMB_ORD_2 | AMB_COM_ACN | AMB_NOR_SN3D, + + /** Channel Layout For ORDER2-FUMA HOA, 9 channels in total */ + CH_LAYOUT_AMB_ORDER2_FUMA = AMB_MODE | AMB_ORD_2 | AMB_COM_FUMA, + + /** Channel Layout For 5.1.4, 10 channels in total */ + CH_LAYOUT_5POINT1POINT4 = CH_LAYOUT_5POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT | + CH_SET_TOP_BACK_LEFT | CH_SET_TOP_BACK_RIGHT, + + /** Channel Layout For 7.1.2, 10 channels in total */ + CH_LAYOUT_7POINT1POINT2 = CH_LAYOUT_7POINT1 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT, + + /** Channel Layout For 7.1.4, 12 channels in total */ + CH_LAYOUT_7POINT1POINT4 = CH_LAYOUT_7POINT1 | CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT | + CH_SET_TOP_BACK_LEFT | CH_SET_TOP_BACK_RIGHT, + + /** Channel Layout For 10.2, 12 channels in total */ + CH_LAYOUT_10POINT2 = CH_SET_FRONT_LEFT | CH_SET_FRONT_RIGHT | CH_SET_FRONT_CENTER | CH_SET_TOP_FRONT_LEFT | + CH_SET_TOP_FRONT_RIGHT | CH_SET_BACK_LEFT | CH_SET_BACK_RIGHT | CH_SET_BACK_CENTER | + CH_SET_SIDE_LEFT | CH_SET_SIDE_RIGHT | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT, + + /** Channel Layout For 9.1.4, 14 channels in total */ + CH_LAYOUT_9POINT1POINT4 = CH_LAYOUT_7POINT1POINT4 | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT, + + /** Channel Layout For 9.1.6, 16 channels in total */ + CH_LAYOUT_9POINT1POINT6 = CH_LAYOUT_9POINT1POINT4 | CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT, + + /** Channel Layout For Hexadecagonal, 16 channels in total */ + CH_LAYOUT_HEXADECAGONAL = CH_LAYOUT_OCTAGONAL | CH_SET_WIDE_LEFT | CH_SET_WIDE_RIGHT | CH_SET_TOP_BACK_LEFT | + CH_SET_TOP_BACK_RIGHT | CH_SET_TOP_BACK_CENTER | CH_SET_TOP_FRONT_CENTER | + CH_SET_TOP_FRONT_LEFT | CH_SET_TOP_FRONT_RIGHT, + + /** Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total */ + CH_LAYOUT_AMB_ORDER3_ACN_N3D = AMB_MODE | AMB_ORD_3 | AMB_COM_ACN | AMB_NOR_N3D, + + /** Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total */ + CH_LAYOUT_AMB_ORDER3_ACN_SN3D = AMB_MODE | AMB_ORD_3 | AMB_COM_ACN | AMB_NOR_SN3D, + + /** Channel Layout For ORDER3-FUMA HOA, 16 channels in total */ + CH_LAYOUT_AMB_ORDER3_FUMA = AMB_MODE | AMB_ORD_3 | AMB_COM_FUMA, + + /** Channel Layout For 22.2, 24 channels in total */ + CH_LAYOUT_22POINT2 = CH_LAYOUT_7POINT1POINT4 | CH_SET_FRONT_LEFT_OF_CENTER | CH_SET_FRONT_RIGHT_OF_CENTER | + CH_SET_BACK_CENTER | CH_SET_TOP_CENTER | CH_SET_TOP_FRONT_CENTER | CH_SET_TOP_BACK_CENTER | + CH_SET_TOP_SIDE_LEFT | CH_SET_TOP_SIDE_RIGHT | CH_SET_BOTTOM_FRONT_LEFT | + CH_SET_BOTTOM_FRONT_RIGHT | CH_SET_BOTTOM_FRONT_CENTER | CH_SET_LOW_FREQUENCY_2 +} OH_AudioChannelLayout; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AUDIO_CHANNEL_LAYOUT_H \ No newline at end of file From 811f38b4054507a60bf94febe5f7f2c539c67b8b Mon Sep 17 00:00:00 2001 From: linziming Date: Thu, 28 Dec 2023 07:45:19 +0000 Subject: [PATCH 19/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9json=20&=20=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6include=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: linziming Change-Id: Ie64d4eeb8b7948a258708ec471f598cab396fd86 --- multimedia/av_codec/audio_codec/BUILD.gn | 32 +++++++++++++++++++ .../libnative_media_acodec.ndk.json | 17 ++++++++++ .../libnative_media_avdemuxer.ndk.json | 1 + .../avmuxer/libnative_media_avmuxer.ndk.json | 1 + .../libnative_media_codecbase.ndk.json | 3 +- .../av_codec/native_avcodec_audiocodec.h | 3 -- .../av_codec/native_avcodec_audiodecoder.h | 3 -- .../av_codec/native_avcodec_audioencoder.h | 4 +-- multimedia/av_codec/native_avcodec_base.h | 4 +-- .../av_codec/native_avcodec_videodecoder.h | 3 -- .../av_codec/native_avcodec_videoencoder.h | 3 -- multimedia/av_codec/native_avdemuxer.h | 3 -- multimedia/av_codec/native_avmuxer.h | 17 +++------- .../libnative_media_vdec.ndk.json | 4 +++ .../libnative_media_venc.ndk.json | 3 ++ .../core/BUILD.gn | 11 +++++-- .../core/libnative_media_core.ndk.json | 11 +++++-- 17 files changed, 83 insertions(+), 40 deletions(-) create mode 100644 multimedia/av_codec/audio_codec/BUILD.gn create mode 100644 multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json rename multimedia/{av_codec => media_foundation}/core/BUILD.gn (72%) rename multimedia/{av_codec => media_foundation}/core/libnative_media_core.ndk.json (71%) diff --git a/multimedia/av_codec/audio_codec/BUILD.gn b/multimedia/av_codec/audio_codec/BUILD.gn new file mode 100644 index 000000000..1758e9055 --- /dev/null +++ b/multimedia/av_codec/audio_codec/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("native_media_acodec_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" + sources = + [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audiocodec.h" ] +} + +ohos_ndk_library("libnative_media_acodec") { + ndk_description_file = "./libnative_media_acodec.ndk.json" + min_compact_version = "1" + output_name = "native_media_acodec" + output_extension = "so" + + system_capability = "SystemCapability.Multimedia.Media.AudioCodec" + system_capability_headers = + [ "multimedia/player_framework/native_avcodec_audiocodec.h" ] +} diff --git a/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json b/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json new file mode 100644 index 000000000..7584ba550 --- /dev/null +++ b/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json @@ -0,0 +1,17 @@ +[ + { "name": "OH_AudioCodec_CreateByMime" }, + { "name": "OH_AudioCodec_CreateByName" }, + { "name": "OH_AudioCodec_Destroy" }, + { "name": "OH_AudioCodec_RegisterCallback" }, + { "name": "OH_AudioCodec_Configure" }, + { "name": "OH_AudioCodec_Prepare" }, + { "name": "OH_AudioCodec_Start" }, + { "name": "OH_AudioCodec_Stop" }, + { "name": "OH_AudioCodec_Flush" }, + { "name": "OH_AudioCodec_Reset" }, + { "name": "OH_AudioCodec_GetOutputDescription" }, + { "name": "OH_AudioCodec_SetParameter" }, + { "name": "OH_AudioCodec_PushInputBuffer" }, + { "name": "OH_AudioCodec_FreeOutputBuffer" }, + { "name": "OH_AudioCodec_IsValid" } +] diff --git a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json index bf9ca16b8..e48922ce8 100644 --- a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json +++ b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json @@ -4,5 +4,6 @@ { "name": "OH_AVDemuxer_SelectTrackByID" }, { "name": "OH_AVDemuxer_UnselectTrackByID" }, { "name": "OH_AVDemuxer_ReadSample" }, + { "name": "OH_AVDemuxer_ReadSampleBuffer" }, { "name": "OH_AVDemuxer_SeekToTime" } ] diff --git a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json index b831c325d..dcf7a6588 100644 --- a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json +++ b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json @@ -4,6 +4,7 @@ { "name": "OH_AVMuxer_AddTrack" }, { "name": "OH_AVMuxer_Start" }, { "name": "OH_AVMuxer_WriteSample" }, + { "name": "OH_AVMuxer_WriteSampleBuffer" }, { "name": "OH_AVMuxer_Stop" }, { "name": "OH_AVMuxer_Destroy" } ] diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 3e19fb31d..4ff2ee686 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -56,6 +56,8 @@ { "name": "OH_MD_KEY_DESCRIPTION" }, { "name": "OH_MD_KEY_LYRICS" }, { "name": "OH_MD_KEY_TRACK_COUNT" }, + { "name": "OH_AVCodec_GetCapability" }, + { "name": "OH_AVCodec_GetCapabilityByCategory" }, { "name": "OH_AVCapability_IsHardware" }, { "name": "OH_AVCapability_GetName" }, { "name": "OH_AVCapability_GetMaxSupportedInstances" }, @@ -80,4 +82,3 @@ { "name": "OH_AVCapability_GetSupportedLevelsForProfile" }, { "name": "OH_AVCapability_AreProfileAndLevelSupported" } ] - diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h index a74425e94..cc34cd037 100644 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -18,9 +18,6 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus diff --git a/multimedia/av_codec/native_avcodec_audiodecoder.h b/multimedia/av_codec/native_avcodec_audiodecoder.h index ed3ac92b6..e834aa233 100644 --- a/multimedia/av_codec/native_avcodec_audiodecoder.h +++ b/multimedia/av_codec/native_avcodec_audiodecoder.h @@ -18,9 +18,6 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus diff --git a/multimedia/av_codec/native_avcodec_audioencoder.h b/multimedia/av_codec/native_avcodec_audioencoder.h index f070285ad..b990c4857 100644 --- a/multimedia/av_codec/native_avcodec_audioencoder.h +++ b/multimedia/av_codec/native_avcodec_audioencoder.h @@ -18,10 +18,8 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" #include "native_avcodec_base.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index c2fc71f8e..8d6bd7c3f 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -18,10 +18,8 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" +#include "native_avbuffer.h" #include "native_avmemory.h" -#include "native_avbuffer_info.h" #ifdef __cplusplus extern "C" { diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index a364d8f89..beffc8d1e 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -18,9 +18,6 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index 576b737b9..2b9ddc94f 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -18,9 +18,6 @@ #include #include -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index b43de5097..c5935a2e0 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -18,8 +18,6 @@ #include #include "native_avcodec_base.h" -#include "native_averrors.h" -#include "native_avmemory.h" #include "native_avsource.h" #ifdef __cplusplus @@ -27,7 +25,6 @@ extern "C" { #endif typedef struct OH_AVDemuxer OH_AVDemuxer; -typedef struct OH_AVBuffer OH_AVBuffer; /** * @brief Creates an OH_AVDemuxer instance for getting samples from source. diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index a2a21998a..5c04ae768 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -19,17 +19,12 @@ #include #include #include "native_avcodec_base.h" -#include "native_averrors.h" -#include "native_avformat.h" -#include "native_avmemory.h" - #ifdef __cplusplus extern "C" { #endif typedef struct OH_AVMuxer OH_AVMuxer; -typedef struct OH_AVBuffer OH_AVBuffer; /** * @brief Create an OH_AVMuxer instance by output file description and format. @@ -95,16 +90,14 @@ OH_AVErrCode OH_AVMuxer_Start(OH_AVMuxer *muxer); * @useinstead OH_AVMuxer_WriteSampleBuffer * @since 10 */ -OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, - uint32_t trackIndex, - OH_AVMemory *sample, +OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, uint32_t trackIndex, OH_AVMemory *sample, OH_AVCodecBufferAttr info); /** * @brief Write an encoded sample to the muxer. * Note: This interface can only be called after OH_AVMuxer_Start and before OH_AVMuxer_Stop. The application needs to - * make sure that the samples are written to the right tracks. Also, it needs to make sure the samples for each track are - * written in chronological order. + * make sure that the samples are written to the right tracks. Also, it needs to make sure the samples for each track + * are written in chronological order. * @syscap SystemCapability.Multimedia.Media.Muxer * @param muxer Pointer to an OH_AVMuxer instance * @param trackIndex The track index for this sample @@ -113,9 +106,7 @@ OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, - uint32_t trackIndex, - const OH_AVBuffer *sample); +OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, uint32_t trackIndex, const OH_AVBuffer *sample); /** * @brief Stop the muxer. diff --git a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json index 7e6fd7d7a..a66078f3f 100644 --- a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json +++ b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json @@ -3,6 +3,7 @@ { "name": "OH_VideoDecoder_CreateByName" }, { "name": "OH_VideoDecoder_Destroy" }, { "name": "OH_VideoDecoder_SetCallback" }, + { "name": "OH_VideoDecoder_RegisterCallback" }, { "name": "OH_VideoDecoder_SetSurface" }, { "name": "OH_VideoDecoder_Configure" }, { "name": "OH_VideoDecoder_Prepare" }, @@ -13,7 +14,10 @@ { "name": "OH_VideoDecoder_GetOutputDescription" }, { "name": "OH_VideoDecoder_SetParameter" }, { "name": "OH_VideoDecoder_PushInputData" }, + { "name": "OH_VideoDecoder_PushInputBuffer" }, { "name": "OH_VideoDecoder_RenderOutputData" }, + { "name": "OH_VideoDecoder_RenderOutputBuffer" }, { "name": "OH_VideoDecoder_FreeOutputData" }, + { "name": "OH_VideoDecoder_FreeOutputBuffer" }, { "name": "OH_VideoDecoder_IsValid" } ] diff --git a/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json b/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json index 28febaa45..80e53bd90 100644 --- a/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json +++ b/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json @@ -3,6 +3,7 @@ { "name": "OH_VideoEncoder_CreateByName" }, { "name": "OH_VideoEncoder_Destroy" }, { "name": "OH_VideoEncoder_SetCallback" }, + { "name": "OH_VideoEncoder_RegisterCallback" }, { "name": "OH_VideoEncoder_Configure" }, { "name": "OH_VideoEncoder_Prepare" }, { "name": "OH_VideoEncoder_Start" }, @@ -13,8 +14,10 @@ { "name": "OH_VideoEncoder_SetParameter" }, { "name": "OH_VideoEncoder_GetSurface" }, { "name": "OH_VideoEncoder_FreeOutputData" }, + { "name": "OH_VideoEncoder_FreeOutputBuffer" }, { "name": "OH_VideoEncoder_NotifyEndOfStream" }, { "name": "OH_VideoEncoder_PushInputData" }, + { "name": "OH_VideoEncoder_PushInputBuffer" }, { "name": "OH_VideoEncoder_GetInputDescription" }, { "name": "OH_VideoEncoder_IsValid" } ] diff --git a/multimedia/av_codec/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn similarity index 72% rename from multimedia/av_codec/core/BUILD.gn rename to multimedia/media_foundation/core/BUILD.gn index 8d047d2eb..8e0fa912b 100644 --- a/multimedia/av_codec/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -13,12 +13,15 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") + ohos_ndk_headers("native_media_core_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ - "//interface/sdk_c/multimedia/av_codec/native_averrors.h", - "//interface/sdk_c/multimedia/av_codec/native_avformat.h", - "//interface/sdk_c/multimedia/av_codec/native_avmemory.h", + "//interface/sdk_c/multimedia/media_foundation/native_avbuffer.h", + "//interface/sdk_c/multimedia/media_foundation/native_avbuffer_info.h", + "//interface/sdk_c/multimedia/media_foundation/native_averrors.h", + "//interface/sdk_c/multimedia/media_foundation/native_avformat.h", + "//interface/sdk_c/multimedia/media_foundation/native_avmemory.h", ] } @@ -30,6 +33,8 @@ ohos_ndk_library("libnative_media_core") { system_capability = "SystemCapability.Multimedia.Media.Core" system_capability_headers = [ + "multimedia/player_framework/native_avbuffer.h", + "multimedia/player_framework/native_avbuffer_info.h", "multimedia/player_framework/native_averrors.h", "multimedia/player_framework/native_avformat.h", "multimedia/player_framework/native_avmemory.h", diff --git a/multimedia/av_codec/core/libnative_media_core.ndk.json b/multimedia/media_foundation/core/libnative_media_core.ndk.json similarity index 71% rename from multimedia/av_codec/core/libnative_media_core.ndk.json rename to multimedia/media_foundation/core/libnative_media_core.ndk.json index f7ceabdb5..06942afd5 100644 --- a/multimedia/av_codec/core/libnative_media_core.ndk.json +++ b/multimedia/media_foundation/core/libnative_media_core.ndk.json @@ -21,6 +21,13 @@ { "name": "OH_AVMemory_GetAddr" }, { "name": "OH_AVMemory_GetSize" }, { "name": "OH_AVMemory_Destroy" }, - { "name": "OH_AVCodec_GetCapability" }, - { "name": "OH_AVCodec_GetCapabilityByCategory" } + { "name": "OH_AVBuffer_Create" }, + { "name": "OH_AVBuffer_Destroy" }, + { "name": "OH_AVBuffer_GetBufferAttr" }, + { "name": "OH_AVBuffer_SetBufferAttr" }, + { "name": "OH_AVBuffer_GetParameter" }, + { "name": "OH_AVBuffer_SetParameter" }, + { "name": "OH_AVBuffer_GetAddr" }, + { "name": "OH_AVBuffer_GetCapacity" }, + { "name": "OH_AVBuffer_GetNativeBuffer" } ] From 7a0307bf4e2b098f856908629a869c9c2ca4e7d6 Mon Sep 17 00:00:00 2001 From: peng Date: Thu, 28 Dec 2023 17:32:04 +0800 Subject: [PATCH 20/33] audio_channel_layout mark Signed-off-by: peng --- .../av_codec/avcodec_audio_channel_layout.h | 24 +++++++++---------- multimedia/av_codec/native_avmuxer.h | 7 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/multimedia/av_codec/avcodec_audio_channel_layout.h b/multimedia/av_codec/avcodec_audio_channel_layout.h index 4b6354d2b..32826229b 100644 --- a/multimedia/av_codec/avcodec_audio_channel_layout.h +++ b/multimedia/av_codec/avcodec_audio_channel_layout.h @@ -24,6 +24,8 @@ extern "C" { * @brief Audio Channel Set * A 64-bit integer with bits set for each channel. * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 11 + * @useinstead OH_AudioChannelSet * @since 10 */ enum AudioChannelSet : uint64_t { @@ -91,6 +93,8 @@ enum AudioChannelSet : uint64_t { * Indicates that the channel order in which the user requests decoder output * is the native codec channel order. * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 11 + * @useinstead OH_AudioChannelLayout * @since 10 */ enum AudioChannelLayout : uint64_t { @@ -146,18 +150,14 @@ enum AudioChannelLayout : uint64_t { AudioChannelSet::TOP_FRONT_LEFT | AudioChannelSet::TOP_FRONT_RIGHT), STEREO_DOWNMIX = (AudioChannelSet::STEREO_LEFT | AudioChannelSet::STEREO_RIGHT), - CH_2POINT0POINT2 = (STEREO | AudioChannelSet::TOP_SIDE_LEFT | AudioChannelSet::TOP_SIDE_RIGHT), - CH_2POINT1POINT2 = (CH_2POINT0POINT2 | AudioChannelSet::LOW_FREQUENCY), - CH_3POINT0POINT2 = (CH_2POINT0POINT2 | AudioChannelSet::FRONT_CENTER), - HOA_ORDER1_ACN_N3D = 0x100000000001, - HOA_ORDER1_ACN_SN3D = 0x100000001001, - HOA_ORDER1_FUMA = 0x100000000101, - HOA_ORDER2_ACN_N3D = 0x100000000002, - HOA_ORDER2_ACN_SN3D = 0x100000001002, - HOA_ORDER2_FUMA = 0x100000000102, - HOA_ORDER3_ACN_N3D = 0x100000000003, - HOA_ORDER3_ACN_SN3D = 0x100000001003, - HOA_ORDER3_FUMA = 0x100000000103, + HOA_FIRST = AudioChannelSet::AMBISONICS_ACN0 | AudioChannelSet::AMBISONICS_ACN1 | AudioChannelSet::AMBISONICS_ACN2 | + AudioChannelSet::AMBISONICS_ACN3, + HOA_SECOND = HOA_FIRST | AudioChannelSet::AMBISONICS_ACN4 | AudioChannelSet::AMBISONICS_ACN5 | + AudioChannelSet::AMBISONICS_ACN6 | AudioChannelSet::AMBISONICS_ACN7 | AudioChannelSet::AMBISONICS_ACN8, + HOA_THIRD = HOA_SECOND | AudioChannelSet::AMBISONICS_ACN9 | AudioChannelSet::AMBISONICS_ACN10 | + AudioChannelSet::AMBISONICS_ACN11 | AudioChannelSet::AMBISONICS_ACN12 | + AudioChannelSet::AMBISONICS_ACN13 | AudioChannelSet::AMBISONICS_ACN14 | + AudioChannelSet::AMBISONICS_ACN15, }; #ifdef __cplusplus } diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index 5c04ae768..2e622508c 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -90,8 +90,8 @@ OH_AVErrCode OH_AVMuxer_Start(OH_AVMuxer *muxer); * @useinstead OH_AVMuxer_WriteSampleBuffer * @since 10 */ -OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, uint32_t trackIndex, OH_AVMemory *sample, - OH_AVCodecBufferAttr info); +OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, uint32_t trackIndex, + OH_AVMemory *sample, OH_AVCodecBufferAttr info); /** * @brief Write an encoded sample to the muxer. @@ -106,7 +106,8 @@ OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, uint32_t trackIndex, OH_A * otherwise returns a specific error code, refer to {@link OH_AVErrCode} * @since 11 */ -OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, uint32_t trackIndex, const OH_AVBuffer *sample); +OH_AVErrCode OH_AVMuxer_WriteSampleBuffer(OH_AVMuxer *muxer, uint32_t trackIndex, + const OH_AVBuffer *sample); /** * @brief Stop the muxer. From a916df414902992e7cf745a76323b2e176abcfe1 Mon Sep 17 00:00:00 2001 From: linziming Date: Thu, 28 Dec 2023 11:17:53 +0000 Subject: [PATCH 21/33] =?UTF-8?q?format=20check=E5=91=8A=E8=AD=A6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: linziming Change-Id: Icac6e733b86245b072e4ade0ee787fbf7251977b --- multimedia/av_codec/audio_codec/BUILD.gn | 3 +-- multimedia/av_codec/audio_decoder/BUILD.gn | 3 +-- multimedia/av_codec/audio_encoder/BUILD.gn | 3 +-- multimedia/av_codec/avdemuxer/BUILD.gn | 2 +- multimedia/av_codec/avmuxer/BUILD.gn | 2 +- multimedia/av_codec/avsource/BUILD.gn | 2 +- multimedia/av_codec/codec_base/BUILD.gn | 6 +++--- multimedia/av_codec/video_decoder/BUILD.gn | 3 +-- multimedia/av_codec/video_encoder/BUILD.gn | 3 +-- multimedia/media_foundation/core/BUILD.gn | 10 +++++----- 10 files changed, 16 insertions(+), 21 deletions(-) diff --git a/multimedia/av_codec/audio_codec/BUILD.gn b/multimedia/av_codec/audio_codec/BUILD.gn index 1758e9055..4f5ca4be6 100644 --- a/multimedia/av_codec/audio_codec/BUILD.gn +++ b/multimedia/av_codec/audio_codec/BUILD.gn @@ -16,8 +16,7 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_acodec_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = - [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audiocodec.h" ] + sources = [ "../native_avcodec_audiocodec.h" ] } ohos_ndk_library("libnative_media_acodec") { diff --git a/multimedia/av_codec/audio_decoder/BUILD.gn b/multimedia/av_codec/audio_decoder/BUILD.gn index bee0a5e69..af55b57f8 100644 --- a/multimedia/av_codec/audio_decoder/BUILD.gn +++ b/multimedia/av_codec/audio_decoder/BUILD.gn @@ -15,8 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_adec_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = - [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audiodecoder.h" ] + sources = [ "../native_avcodec_audiodecoder.h" ] } ohos_ndk_library("libnative_media_adec") { diff --git a/multimedia/av_codec/audio_encoder/BUILD.gn b/multimedia/av_codec/audio_encoder/BUILD.gn index 8ecb69c8a..c19086740 100644 --- a/multimedia/av_codec/audio_encoder/BUILD.gn +++ b/multimedia/av_codec/audio_encoder/BUILD.gn @@ -15,8 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_aenc_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = - [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audioencoder.h" ] + sources = [ "../native_avcodec_audioencoder.h" ] } ohos_ndk_library("libnative_media_aenc") { diff --git a/multimedia/av_codec/avdemuxer/BUILD.gn b/multimedia/av_codec/avdemuxer/BUILD.gn index 54e236d9f..c8a28ddc3 100644 --- a/multimedia/av_codec/avdemuxer/BUILD.gn +++ b/multimedia/av_codec/avdemuxer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_avdemuxer_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = [ "//interface/sdk_c/multimedia/av_codec/native_avdemuxer.h" ] + sources = [ "../native_avdemuxer.h" ] } ohos_ndk_library("libnative_media_avdemuxer") { diff --git a/multimedia/av_codec/avmuxer/BUILD.gn b/multimedia/av_codec/avmuxer/BUILD.gn index 5002afe02..97edfd594 100644 --- a/multimedia/av_codec/avmuxer/BUILD.gn +++ b/multimedia/av_codec/avmuxer/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_avmuxer_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = [ "//interface/sdk_c/multimedia/av_codec/native_avmuxer.h" ] + sources = [ "../native_avmuxer.h" ] } ohos_ndk_library("libnative_media_avmuxer") { diff --git a/multimedia/av_codec/avsource/BUILD.gn b/multimedia/av_codec/avsource/BUILD.gn index 395fc8474..388dfe852 100644 --- a/multimedia/av_codec/avsource/BUILD.gn +++ b/multimedia/av_codec/avsource/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_avsource_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = [ "//interface/sdk_c/multimedia/av_codec/native_avsource.h" ] + sources = [ "../native_avsource.h" ] } ohos_ndk_library("libnative_media_avsource") { diff --git a/multimedia/av_codec/codec_base/BUILD.gn b/multimedia/av_codec/codec_base/BUILD.gn index 99e9bf280..30ff2ef20 100644 --- a/multimedia/av_codec/codec_base/BUILD.gn +++ b/multimedia/av_codec/codec_base/BUILD.gn @@ -16,9 +16,9 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_codecbase_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ - "//interface/sdk_c/multimedia/av_codec/avcodec_audio_channel_layout.h", - "//interface/sdk_c/multimedia/av_codec/native_avcapability.h", - "//interface/sdk_c/multimedia/av_codec/native_avcodec_base.h", + "../avcodec_audio_channel_layout.h", + "../native_avcapability.h", + "../native_avcodec_base.h", ] } diff --git a/multimedia/av_codec/video_decoder/BUILD.gn b/multimedia/av_codec/video_decoder/BUILD.gn index ed160ae96..2f7b753b0 100644 --- a/multimedia/av_codec/video_decoder/BUILD.gn +++ b/multimedia/av_codec/video_decoder/BUILD.gn @@ -15,8 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_vdec_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = - [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videodecoder.h" ] + sources = [ "../native_avcodec_videodecoder.h" ] } ohos_ndk_library("libnative_media_vdec") { diff --git a/multimedia/av_codec/video_encoder/BUILD.gn b/multimedia/av_codec/video_encoder/BUILD.gn index e3d3000a0..9878bd444 100644 --- a/multimedia/av_codec/video_encoder/BUILD.gn +++ b/multimedia/av_codec/video_encoder/BUILD.gn @@ -15,8 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_venc_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" - sources = - [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videoencoder.h" ] + sources = [ "../native_avcodec_videoencoder.h" ] } ohos_ndk_library("libnative_media_venc") { diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn index 8e0fa912b..b0bc5678e 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -17,11 +17,11 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_core_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ - "//interface/sdk_c/multimedia/media_foundation/native_avbuffer.h", - "//interface/sdk_c/multimedia/media_foundation/native_avbuffer_info.h", - "//interface/sdk_c/multimedia/media_foundation/native_averrors.h", - "//interface/sdk_c/multimedia/media_foundation/native_avformat.h", - "//interface/sdk_c/multimedia/media_foundation/native_avmemory.h", + "../native_avbuffer.h", + "../native_avbuffer_info.h", + "../native_averrors.h", + "../native_avformat.h", + "../native_avmemory.h", ] } From 0a9faba710b7ca34d1f81b33bea13d9b2c3b0095 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Fri, 29 Dec 2023 11:44:06 +0800 Subject: [PATCH 22/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=92=8C=E6=9E=B6=E6=9E=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=B8=8A=E9=9D=A2=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/native_avcodec_videodecoder.h | 4 ++-- multimedia/av_codec/native_avcodec_videoencoder.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index beffc8d1e..46dc45b8c 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -46,7 +46,7 @@ OH_AVCodec *OH_VideoDecoder_CreateByMime(const char *mime); 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 * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -87,7 +87,7 @@ OH_AVErrCode OH_VideoDecoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallb /** * @brief Specify the output Surface to provide video decoding output, - * this interface must be called before Prepare is called. + * this interface must be called before Prepare is called * @syscap SystemCapability.Multimedia.Media.VideoDecoder * @param codec Pointer to an OH_AVCodec instance * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index 2b9ddc94f..fa0abea85 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -46,7 +46,7 @@ OH_AVCodec *OH_VideoEncoder_CreateByMime(const char *mime); OH_AVCodec *OH_VideoEncoder_CreateByName(const char *name); /** - * @brief Clear the internal resources of the encoder and destroy the encoder instance. + * @brief Clear the internal resources of the encoder and destroy the encoder instance * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -212,7 +212,7 @@ OH_AVErrCode OH_VideoEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); /** * @brief Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify - * the encoder of the end of the stream in surface mode. + * the encoder of the end of the stream in surface mode * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @param codec Pointer to an OH_AVCodec instance * @return Returns AV_ERR_OK if the execution is successful, @@ -271,7 +271,7 @@ OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec); /** * @brief Check whether the current codec instance is valid. It can be used fault recovery or app - * switchback from the background. + * switchback from the background * @syscap SystemCapability.Multimedia.Media.VideoEncoder * @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, From 1a182670efe4f8587d5123900c1e5fffa9bf0ea2 Mon Sep 17 00:00:00 2001 From: zhangwuf Date: Fri, 29 Dec 2023 15:14:34 +0800 Subject: [PATCH 23/33] =?UTF-8?q?CAPI=E8=A7=A3=E6=9E=90=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=AE=8F=E5=AE=9A=E4=B9=89=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=92=8Ccheck=E8=AF=AD=E6=B3=95=E6=8C=87?= =?UTF-8?q?=E4=BB=A4bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangwuf --- .../src/coreImpl/check/check_syntax.py | 7 +- .../src/coreImpl/parser/parse_include.py | 106 ++++-------------- .../capi_parser/src/coreImpl/parser/parser.py | 9 +- 3 files changed, 35 insertions(+), 87 deletions(-) diff --git a/build-tools/capi_parser/src/coreImpl/check/check_syntax.py b/build-tools/capi_parser/src/coreImpl/check/check_syntax.py index b06307628..70572b31a 100644 --- a/build-tools/capi_parser/src/coreImpl/check/check_syntax.py +++ b/build-tools/capi_parser/src/coreImpl/check/check_syntax.py @@ -14,12 +14,17 @@ # limitations under the License. import re +import os import subprocess from typedef.check.check import ApiResultInfo, ErrorMessage, ErrorType, LogType, ErrorLevel def check_syntax(file_path): - cmd_list = ['clang', r'-I sysroot\ndk_musl_include_files', '-std=c99'] + cmd_list = ['clang'] + if os.path.exists(r'.\sysroot'): + args = ['-I{}'.format(dir_path) for dir_path, _, _ in os.walk(r'.\sysroot')] + cmd_list.extend(args) + cmd_list.append('-std=c99') result_list = [] command = cmd_list + [file_path] run_result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/build-tools/capi_parser/src/coreImpl/parser/parse_include.py b/build-tools/capi_parser/src/coreImpl/parser/parse_include.py index ec4132637..14c84d2ce 100644 --- a/build-tools/capi_parser/src/coreImpl/parser/parse_include.py +++ b/build-tools/capi_parser/src/coreImpl/parser/parse_include.py @@ -71,59 +71,6 @@ def processing_no_child(cursor, data): # 处理没有子节点的节点 data["integer_value"] = token.spelling # 获取整型变量值 -def get_complex_def(tokens_new, count_token, tokens, data): - count = 1 - logo = 0 - logo_com = 0 - count_com = 0 - for token_2 in tokens_new: - if token_2.spelling == ')': - break - else: - count += 1 - if count != count_token: - for token in tokens_new[count:]: - if token.spelling == '{' or token.spelling == '(' or token.spelling == '##': - logo = 1 - - if count_token == count: - pass - elif logo == 1: # 获取复合型宏定义宏名 - logo_com = logo - count_com = count + 1 - tokens_name = tokens[:count + 1] - data["name"] = ''.join([token.spelling for token in tokens_name]) - return logo_com, count_com - - -def processing_complex_def(tokens, data): # 处理复合型宏 - tokens_new = tokens[1:] # 跳过正常宏名 - logo_com = 0 # 记录复合型,复合型文本也得根据这个 - count_com = 0 - count_token = len(tokens_new) # value () - for token in tokens_new: - if token.kind.name == 'KEYWORD': - break - if token.kind.name == 'IDENTIFIER': - logo_com, count_com = get_complex_def(tokens_new, count_token, tokens, data) - get_def_text(tokens, data, logo_com, count_com) # 获取宏文本 - - -def get_def_text(tokens, data, logo_compose, count_compose): # 获取宏文本 - if logo_compose == 1: - marco_expansion = ''.join([token.spelling for token in tokens[count_compose:]]) # 获取宏文本,有就记录,没有不管 - if marco_expansion: - data["text"] = marco_expansion - else: - pass - else: - marco_expansion = ''.join([token.spelling for token in tokens[1:]]) # 获取宏文本,有就记录,没有不管 - if marco_expansion: - data["text"] = marco_expansion - else: - pass - - def get_token(cursor): tokens = [] for token in cursor.get_tokens(): @@ -187,38 +134,29 @@ def processing_enum(cursor, data): # 获取枚举值 def processing_def(cursor, data): # 处理宏定义 - if data['node_content']['content']: - split_data = data['node_content']['content'].split() - split_data_three = data['node_content']['content'].split('\t') - if len(split_data) == 2: - pattern = r'\((.*?), (.*?)\)' - if re.search(pattern, data['node_content']['content']): - data['name'] = data['node_content']['content'] - else: - data['name'] = split_data[0] - data['text'] = split_data[1] - elif len(split_data_three) == 2: - data['name'] = split_data_three[0] - data['text'] = split_data_three[1] - else: - marco_ext = cursor.extent - tokens = cursor.translation_unit.get_tokens(extent=marco_ext) # 找到对应的宏定义位置 - tokens = list(tokens) # Generator转为list - processing_complex_def(tokens, data) # 获取宏名和宏文本 - else: - print('mar_define error, its content is none') - data["type"] = "def_no_type" - - judgment_def_func(data) - - -def judgment_def_func(data): data['is_def_func'] = False - if '(' in data['name'] and ')' in data['name']: - data['is_def_func'] = True - index = data['name'].index('(') - data['def_func_name'] = data['name'][:index] - data['def_func_param'] = data['name'][index:] + data['name'] = cursor.spelling + name_len = len(data['name']) + str1_len = len(data['node_content']['content']) + text = '' + if name_len != str1_len: + if data['node_content']['content']: + if data['node_content']['content'][name_len] == '(': + right_index = data['node_content']['content'].index(')') + param = data['node_content']['content'][name_len:right_index + 1] + text = data['node_content']['content'][right_index + 1:] + data['is_def_func'] = True + data['def_func_name'] = data['name'] + data['def_func_param'] = param + data['name'] = ''.join(data['name'] + param) + else: + text = data['node_content']['content'][name_len:] + else: + print('mar_define error, its content is none') + if text: + text = text.strip() # 删除两边的字符(默认是删除左右空格) + data['text'] = text + data["type"] = "def_no_type" def processing_func(cursor, data): # 处理函数 diff --git a/build-tools/capi_parser/src/coreImpl/parser/parser.py b/build-tools/capi_parser/src/coreImpl/parser/parser.py index 45d5696dd..33d49d083 100644 --- a/build-tools/capi_parser/src/coreImpl/parser/parser.py +++ b/build-tools/capi_parser/src/coreImpl/parser/parser.py @@ -264,8 +264,12 @@ def copy_self_include(link_include_path, self_include_file, flag=-1): if std_include and not os.path.exists(std_include): shutil.copytree(self_include_file, std_include) - for dir_path, _, _ in os.walk(std_include): - link_include_path.append(dir_path) + for dir_path, _, files in os.walk(std_include): + for file in files: + if not file.endswith('.h'): + os.remove(os.path.join(dir_path, file)) + elif dir_path not in link_include_path: + link_include_path.append(dir_path) def delete_typedef_child(child): @@ -295,6 +299,7 @@ def parser_include_ast(gn_file_path, include_path, flag=-1): # 对于单 link_include_path = [] copy_std_lib(link_include_path) find_include(link_include_path) + link_include(gn_file_path, StringConstant.FUNK_NAME.value, link_include_path) copy_self_include(link_include_path, gn_file_path, flag) modes = stat.S_IRWXO | stat.S_IRWXG | stat.S_IRWXU From 460a69bebaed740a08c809f2e30249c8de772bd0 Mon Sep 17 00:00:00 2001 From: guoxing Date: Fri, 29 Dec 2023 07:15:23 +0000 Subject: [PATCH 24/33] encode Signed-off-by: guoxing --- .../native_drawing/drawing_text_declaration.h | 24 + .../native_drawing/drawing_text_typography.h | 490 ++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 122 ++++- 3 files changed, 635 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index f999968da..14cfaa33b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -82,6 +82,30 @@ typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; */ typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; +/** + * @brief Defines an OH_Drawing_TextBox, which is used to create an OH_Drawing_TextBox object. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; + +/** + * @brief Defines an OH_Drawing_PositionAndAffinity, + * which is used to create an OH_Drawing_PositionAndAffinity object. + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; + +/** + * @brief Defines an OH_Drawing_Range, which is used to create an OH_Drawing_Range object. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Range OH_Drawing_Range; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 1576b967a..3a5e5ef58 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -148,6 +148,144 @@ enum OH_Drawing_FontStyle { FONT_STYLE_ITALIC, }; +/** + * @brief Enumerates placeholder vertical alignment. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Offset At Baseline */ + ALIGNMENT_OFFSET_AT_BASELINE, + /** Above Baseline */ + ALIGNMENT_ABOVE_BASELINE, + /** Below Baseline */ + ALIGNMENT_BELOW_BASELINE, + /** Top of Row Box */ + ALIGNMENT_TOP_OF_ROW_BOX, + /** Bottom of Row Box */ + ALIGNMENT_BOTTOM_OF_ROW_BOX, + /** Center of Row Box */ + ALIGNMENT_CENTER_OF_ROW_BOX, +} OH_Drawing_PlaceholderVerticalAlignment; + +/** + * @brief Defines the placeholder span. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** width of placeholder */ + double width; + /** height of placeholder */ + double height; + /** alignment of placeholder */ + OH_Drawing_PlaceholderVerticalAlignment alignment; + /** baseline of placeholder */ + OH_Drawing_TextBaseline baseline; + /** baselineoffset of placeholder */ + double baselineOffset; +} OH_Drawing_PlaceholderSpan; + +/** + * @brief Enumerates text decoration style. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Solid style */ + TEXT_DECORATION_STYLE_SOLID, + /** Double style */ + TEXT_DECORATION_STYLE_DOUBLE, + /** Dotted style */ + TEXT_DECORATION_STYLE_DOTTED, + /** Dashed style */ + TEXT_DECORATION_STYLE_DASHED, + /** Wavy style */ + TEXT_DECORATION_STYLE_WAVY, +} OH_Drawing_TextDecorationStyle; + +/** + * @brief Enumerates ellipsis modal. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Head modal */ + ELLIPSIS_MODAL_HEAD = 0, + /** Middle modal */ + ELLIPSIS_MODAL_MIDDLE = 1, + /** Tail modal */ + ELLIPSIS_MODAL_TAIL = 2, +} OH_Drawing_EllipsisModal; + +/** + * @brief Enumerates break strategy. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Greedy strategy */ + BREAK_STRATEGY_GREEDY = 0, + /** Quality strategy */ + BREAK_STRATEGY_HIGH_QUALITY = 1, + /** Balanced strategy */ + BREAK_STRATEGY_BALANCED = 2, +} OH_Drawing_BreakStrategy; + +/** + * @brief Enumerates word break type. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Normal type */ + WORD_BREAK_TYPE_NORMAL = 0, + /** Break All type */ + WORD_BREAK_TYPE_BREAK_ALL = 1, + /** Break Word type */ + WORD_BREAK_TYPE_BREAK_WORD = 2, +} OH_Drawing_WordBreakType; + +/** + * @brief Enumerates rect height style. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Tight style */ + RECT_HEIGHT_STYLE_TIGHT, + /** Max style */ + RECT_HEIGHT_STYLE_MAX, + /** Includelinespacemiddle style */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, + /** Includelinespacetop style */ + RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, + /** Includelinespacebottom style */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, + /** Struct style */ + RECT_HEIGHT_STYLE_STRUCT, +} OH_Drawing_RectHeightStyle; + +/** + * @brief Enumerates rect Width style. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Tight style */ + RECT_WIDTH_STYLE_TIGHT, + /** Max style */ + RECT_WIDTH_STYLE_MAX, +} OH_Drawing_RectWidthStyle; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -511,6 +649,358 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); */ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +/** + * @brief Sets the placeholder. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param OH_Drawing_PlaceholderSpan Indicates the pointer to an OH_Drawing_PlaceholderSpan object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); + +/** + * @brief Gets the exceed maxLines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the exceed maxLines. + * @since 11 + * @version 1.0 + */ +bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); + +/** + * @brief Gets the rects for range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param size_t Indicates the start of range to set. + * @param size_t Indicates the end of range to set. + * @param OH_Drawing_RectHeightStyle Indicates the height style to set. + * For details, see the enum OH_Drawing_RectHeightStyle. + * @param OH_Drawing_RectWidthStyle Indicates the width style to set. + * For details, see the enum OH_Drawing_RectWidthStyle. + * @return Returns the rects for range. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*, + size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); + +/** + * @brief Gets the rects for placeholders. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the rects for placeholders. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); + +/** + * @brief Gets left from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns left from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets right from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns right from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets top from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns top from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets bottom from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns bottom from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets direction from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns direction from textbox. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets size of textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @return Returns size of textbox. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); + +/** + * @brief Gets the glyphposition at coordinate. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param double Indicates the positionX of typography to set. + * @param double Indicates the positionY of typography to set. + * @return Returns the glyphposition at coordinate. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, + double, double); + +/** + * @brief Gets the glyphposition at coordinate with cluster. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param double Indicates the positionX of typography to set. + * @param double Indicates the positionY of typography to set. + * @return Returns the glyphposition at coordinate with cluster. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, + double, double); + +/** + * @brief Gets position from position and affinity. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @return Returns position from position and affinity. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief Gets affinity from position and affinity. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @return Returns affinity from position and affinity. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief Gets the word boundary. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param size_t Indicates the size of text to set. + * @return Returns the word boundary. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); + +/** + * @brief Gets start from range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @return Returns start from range. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); + +/** + * @brief Gets end from range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @return Returns end from range. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); + +/** + * @brief Gets the line count. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the line count. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); + +/** + * @brief Sets the decoration style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param int Indicates the text decoration style to set. + * For details, see the enum OH_Drawing_TextDecorationStyle. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the decoration thickness scale. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the thickness scale of text decoration to set. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the letter spacing. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the letter space to set. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the word spacing. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the word space to set. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the half leading. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param bool Indicates the half leading to set. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); + +/** + * @brief Sets the ellipsis. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param char* Indicates the pointer to ellipsis style. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); + +/** + * @brief Sets the ellipsis modal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param int Indicates the ellipsis model to set. For details, see the enum OH_Drawing_EllipsisModal. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the break strategy. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the break strategy to set. For details, see the enum OH_Drawing_BreakStrategy. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the word break type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the word break type to set. For details, see the enum OH_Drawing_WordBreakType. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the ellipsis modal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the ellipsis modal to set. For details, see the enum OH_Drawing_EllipsisModal. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); + +/** + * @brief get line height. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param int Indicates the line number. + * @return Returns line height. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); + +/** + * @brief get line width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param int Indicates the line number. + * @return Returns line width. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 222d418be..263e21461 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -143,5 +143,125 @@ { "name": "OH_Drawing_TypographyGetMinIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetAlphabeticBaseline" }, - { "name": "OH_Drawing_TypographyGetIdeographicBaseline" } + { "name": "OH_Drawing_TypographyGetIdeographicBaseline" }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyHandlerAddPlaceholder" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyDidExceedMaxLines" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetRectsForRange" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetRectsForPlaceholders" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetLeftFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetRightFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetTopFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetBottomFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetTextDirectionFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetSizeOfTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetPositionFromPositionAndAffinity" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetAffinityFromPositionAndAffinity" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetWordBoundary" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetStartFromRange" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetEndFromRange" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineCount" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleDecorationStyle" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleDecorationThicknessScale" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleLetterSpacing" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleWordSpacing" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleHalfLeading" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleEllipsis" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleEllipsisModal" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextBreakStrategy" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextWordBreakType" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextEllipsisModal" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineHeight" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineWidth" + } ] \ No newline at end of file From e075476417836f005bf321b232687c5f3405c89d Mon Sep 17 00:00:00 2001 From: huchang Date: Tue, 28 Nov 2023 19:56:26 +0800 Subject: [PATCH 25/33] supports reporting device change reason Signed-off-by: huchang Change-Id: Id4889cc4b1598b333173053a145c562d6c8c146a --- .../common/native_audiostream_base.h | 27 +++++++++++++++++++ .../common/native_audiostreambuilder.h | 11 ++++++++ multimedia/player_framework/avplayer_base.h | 4 +++ 3 files changed, 42 insertions(+) diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 4d4cc435b..999148461 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -549,6 +549,33 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { void* userData, OH_AudioStream_Result error); } OH_AudioCapturer_Callbacks; + +/** + * @brief Defines reason for device changes of one audio stream. + * + * @since 11 + */ +typedef enum { + /*Unknown.*/ + REASON_UNKNOWN = 0, + /*New Device become available.*/ + REASON_NEW_DEVICE_BECOME_AVAILABLE = 1, + /*Old Device become unavailable. Applications should consider to pause the audio playback when this reason is + reported.*/ + REASON_OLD_DEVICE_BECOME_UNAVAILABLE = 2, + /*Device is overrode by user or system.*/ + REASON_OVERRODE = 3, +} OH_AudioStreamDeviceChangeReason; + +/** + * @brief Callback when the output device of an audio renderer changed. + * + * @param renderer AudioRenderer where this event occurs. + * @param userData User data which is passed by user. + * @param reason Indicates that why does the output device changes. + */ +typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer* renderer, void* userData, + OH_AudioStreamDeviceChangeReason reason); #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index 41a0e6679..1328510bb 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -164,6 +164,17 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilde OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_Callbacks callbacks, void* userData); +/** + * @brief Set the callback when the output device of an audio renderer changed. + * + * @param builder Reference provided by OH_AudioStreamBuilder_Create() + * @param callback Callback to the function that will process this device change event. + * @param userData Pointer to an application data structure that will be passed to the callback functions. + * @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error. + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback(OH_AudioStreamBuilder* builder, + OH_AudioRenderer_OutputDeviceChangeCallback callback, void* userData); + /* * Set the callbacks for the capturer client * diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 3128b6852..0c87bbd7a 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -146,6 +146,10 @@ typedef enum AVPlayerOnInfoType { AV_INFO_TYPE_TRACK_INFO_UPDATE = 15, /* return the subtitle of playback. */ AV_INFO_TYPE_SUBTITLE_UPDATE = 16, + /** Return the reason when the audio output device changed. When this info is reported, the extra param of + * {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStreamDeviceChangeReason} in audio framework. + */ + AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGED = 17, } AVPlayerOnInfoType; /** From b3869643576b982e955572ecba0326bc97e8a40a Mon Sep 17 00:00:00 2001 From: huchang Date: Wed, 29 Nov 2023 21:02:23 +0800 Subject: [PATCH 26/33] adjust comments Signed-off-by: huchang Change-Id: Id75da48370c8db46b861c2772c2ab86ea2662549 --- .../common/native_audiostream_base.h | 19 ++++++++++--------- .../common/native_audiostreambuilder.h | 1 + multimedia/player_framework/avplayer_base.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 999148461..10332c357 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -556,16 +556,16 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { * @since 11 */ typedef enum { - /*Unknown.*/ + /* Unknown. */ REASON_UNKNOWN = 0, - /*New Device become available.*/ - REASON_NEW_DEVICE_BECOME_AVAILABLE = 1, - /*Old Device become unavailable. Applications should consider to pause the audio playback when this reason is - reported.*/ - REASON_OLD_DEVICE_BECOME_UNAVAILABLE = 2, - /*Device is overrode by user or system.*/ + /* New Device available. */ + REASON_NEW_DEVICE_AVAILABLE = 1, + /* Old Device unavailable. Applications should consider to pause the audio playback when this reason is + reported. */ + REASON_OLD_DEVICE_UNAVAILABLE = 2, + /* Device is overrode by user or system. */ REASON_OVERRODE = 3, -} OH_AudioStreamDeviceChangeReason; +} OH_AudioStream_DeviceChangeReason; /** * @brief Callback when the output device of an audio renderer changed. @@ -573,9 +573,10 @@ typedef enum { * @param renderer AudioRenderer where this event occurs. * @param userData User data which is passed by user. * @param reason Indicates that why does the output device changes. + * @since 11 */ typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer* renderer, void* userData, - OH_AudioStreamDeviceChangeReason reason); + OH_AudioStream_DeviceChangeReason reason); #ifdef __cplusplus } #endif diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index 1328510bb..44b1e4ae2 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -171,6 +171,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBu * @param callback Callback to the function that will process this device change event. * @param userData Pointer to an application data structure that will be passed to the callback functions. * @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error. + * @since 11 */ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_OutputDeviceChangeCallback callback, void* userData); diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 0c87bbd7a..9c6d99b80 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -147,7 +147,7 @@ typedef enum AVPlayerOnInfoType { /* return the subtitle of playback. */ AV_INFO_TYPE_SUBTITLE_UPDATE = 16, /** Return the reason when the audio output device changed. When this info is reported, the extra param of - * {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStreamDeviceChangeReason} in audio framework. + * {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStream_DeviceChangeReason} in audio framework. */ AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGED = 17, } AVPlayerOnInfoType; From 6227a93c851e177c5160a54ef63aa1186d6a1095 Mon Sep 17 00:00:00 2001 From: huchang Date: Mon, 4 Dec 2023 22:29:05 +0800 Subject: [PATCH 27/33] add export json Signed-off-by: huchang Change-Id: I2dad86ecddc03847f038777324d0216fc3be9c82 --- multimedia/audio_framework/ohaudio.ndk.json | 4 ++++ multimedia/player_framework/avplayer_base.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index e098fad58..daff64a64 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -39,6 +39,10 @@ "first_introduced": "10", "name": "OH_AudioStreamBuilder_SetRendererCallback" }, + { + "first_introduced": "11", + "name": "OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback" + }, { "first_introduced": "10", "name": "OH_AudioStreamBuilder_SetCapturerCallback" diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 9c6d99b80..98b1f4080 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -146,10 +146,10 @@ typedef enum AVPlayerOnInfoType { AV_INFO_TYPE_TRACK_INFO_UPDATE = 15, /* return the subtitle of playback. */ AV_INFO_TYPE_SUBTITLE_UPDATE = 16, - /** Return the reason when the audio output device changed. When this info is reported, the extra param of + /** Return the reason when the audio output device changes. When this info is reported, the extra param of * {@link OH_AVPlayerOnInfo} is the same as {@OH_AudioStream_DeviceChangeReason} in audio framework. */ - AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGED = 17, + AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17, } AVPlayerOnInfoType; /** From 4242c180fe02badbf77943b84a13043fab5d0bc0 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Fri, 29 Dec 2023 15:39:59 +0800 Subject: [PATCH 28/33] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E3=80=91=20=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=92=8C=E6=9E=B6=E6=9E=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=B8=8A=E9=9D=A2=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/native_avcodec_base.h | 1 + 1 file changed, 1 insertion(+) diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 8d6bd7c3f..b26dc2454 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -154,6 +154,7 @@ typedef struct OH_AVCodecCallback { * @brief Enumerates the MIME types of audio and video codecs * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 + * @version 1.0 */ extern const char *OH_AVCODEC_MIMETYPE_VIDEO_AVC; extern const char *OH_AVCODEC_MIMETYPE_AUDIO_AAC; From 550aee8bc7da082bbf9ffa5f5948f3008f0f831f Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Fri, 29 Dec 2023 14:24:48 +0800 Subject: [PATCH 29/33] =?UTF-8?q?native=E6=8E=A5=E5=8F=A3=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=8C=83=E5=9B=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- global/resource_management/include/raw_file.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global/resource_management/include/raw_file.h b/global/resource_management/include/raw_file.h index c45a947d6..0fb7627fe 100644 --- a/global/resource_management/include/raw_file.h +++ b/global/resource_management/include/raw_file.h @@ -223,7 +223,7 @@ bool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descri * @since 11 * @version 1.0 */ -int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, size_t length); +int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, int64_t length); /** * @brief Uses the 64-bit data type to seek a data read position based on the specified offset within a raw file. @@ -239,7 +239,7 @@ int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, si * @since 11 * @version 1.0 */ -int OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, long offset, int whence); +int OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, int64_t offset, int whence); /** * @brief Obtains the raw file length represented by an int64_t. From 83f2dc27204e0b269209791bbfe90e63f2d689ac Mon Sep 17 00:00:00 2001 From: zhanghongran Date: Sun, 31 Dec 2023 17:43:16 +0800 Subject: [PATCH 30/33] =?UTF-8?q?=E6=B7=BB=E5=8A=A0first=5Fintroduced?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghongran --- .../libnative_media_acodec.ndk.json | 75 ++- .../libnative_media_adec.ndk.json | 75 ++- .../libnative_media_aenc.ndk.json | 75 ++- .../libnative_media_avdemuxer.ndk.json | 35 +- .../avmuxer/libnative_media_avmuxer.ndk.json | 40 +- .../libnative_media_avsource.ndk.json | 25 +- .../libnative_media_codecbase.ndk.json | 445 ++++++++++++++---- .../libnative_media_vdec.ndk.json | 105 ++++- .../libnative_media_venc.ndk.json | 105 ++++- 9 files changed, 791 insertions(+), 189 deletions(-) diff --git a/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json b/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json index 7584ba550..47dfd626d 100644 --- a/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json +++ b/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json @@ -1,17 +1,62 @@ [ - { "name": "OH_AudioCodec_CreateByMime" }, - { "name": "OH_AudioCodec_CreateByName" }, - { "name": "OH_AudioCodec_Destroy" }, - { "name": "OH_AudioCodec_RegisterCallback" }, - { "name": "OH_AudioCodec_Configure" }, - { "name": "OH_AudioCodec_Prepare" }, - { "name": "OH_AudioCodec_Start" }, - { "name": "OH_AudioCodec_Stop" }, - { "name": "OH_AudioCodec_Flush" }, - { "name": "OH_AudioCodec_Reset" }, - { "name": "OH_AudioCodec_GetOutputDescription" }, - { "name": "OH_AudioCodec_SetParameter" }, - { "name": "OH_AudioCodec_PushInputBuffer" }, - { "name": "OH_AudioCodec_FreeOutputBuffer" }, - { "name": "OH_AudioCodec_IsValid" } + { + "first_introduced": "11", + "name": "OH_AudioCodec_CreateByMime" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_CreateByName" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Destroy" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Configure" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Prepare" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Start" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Stop" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Flush" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_Reset" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_GetOutputDescription" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_SetParameter" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_PushInputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_FreeOutputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_AudioCodec_IsValid" + } ] diff --git a/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json b/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json index 1b4472c05..2f11d9276 100644 --- a/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json +++ b/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json @@ -1,17 +1,62 @@ [ - { "name": "OH_AudioDecoder_CreateByMime" }, - { "name": "OH_AudioDecoder_CreateByName" }, - { "name": "OH_AudioDecoder_Destroy" }, - { "name": "OH_AudioDecoder_SetCallback" }, - { "name": "OH_AudioDecoder_Configure" }, - { "name": "OH_AudioDecoder_Prepare" }, - { "name": "OH_AudioDecoder_Start" }, - { "name": "OH_AudioDecoder_Stop" }, - { "name": "OH_AudioDecoder_Flush" }, - { "name": "OH_AudioDecoder_Reset" }, - { "name": "OH_AudioDecoder_GetOutputDescription" }, - { "name": "OH_AudioDecoder_SetParameter" }, - { "name": "OH_AudioDecoder_PushInputData" }, - { "name": "OH_AudioDecoder_FreeOutputData" }, - { "name": "OH_AudioDecoder_IsValid" } + { + "first_introduced": "9", + "name": "OH_AudioDecoder_CreateByMime" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_CreateByName" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Destroy" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_SetCallback" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Configure" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Prepare" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Start" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Stop" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Flush" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_Reset" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_GetOutputDescription" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_SetParameter" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_PushInputData" + }, + { + "first_introduced": "9", + "name": "OH_AudioDecoder_FreeOutputData" + }, + { + "first_introduced": "10", + "name": "OH_AudioDecoder_IsValid" + } ] diff --git a/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json b/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json index 830a103a7..12d102305 100644 --- a/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json +++ b/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json @@ -1,17 +1,62 @@ [ - { "name": "OH_AudioEncoder_CreateByMime" }, - { "name": "OH_AudioEncoder_CreateByName" }, - { "name": "OH_AudioEncoder_Destroy" }, - { "name": "OH_AudioEncoder_SetCallback" }, - { "name": "OH_AudioEncoder_Configure" }, - { "name": "OH_AudioEncoder_Prepare" }, - { "name": "OH_AudioEncoder_Start" }, - { "name": "OH_AudioEncoder_Stop" }, - { "name": "OH_AudioEncoder_Flush" }, - { "name": "OH_AudioEncoder_Reset" }, - { "name": "OH_AudioEncoder_GetOutputDescription" }, - { "name": "OH_AudioEncoder_SetParameter" }, - { "name": "OH_AudioEncoder_PushInputData" }, - { "name": "OH_AudioEncoder_FreeOutputData" }, - { "name": "OH_AudioEncoder_IsValid" } + { + "first_introduced": "9", + "name": "OH_AudioEncoder_CreateByMime" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_CreateByName" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Destroy" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_SetCallback" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Configure" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Prepare" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Start" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Stop" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Flush" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_Reset" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_GetOutputDescription" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_SetParameter" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_PushInputData" + }, + { + "first_introduced": "9", + "name": "OH_AudioEncoder_FreeOutputData" + }, + { + "first_introduced": "10", + "name": "OH_AudioEncoder_IsValid" + } ] diff --git a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json index e48922ce8..0f1551246 100644 --- a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json +++ b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json @@ -1,9 +1,30 @@ [ - { "name": "OH_AVDemuxer_CreateWithSource" }, - { "name": "OH_AVDemuxer_Destroy" }, - { "name": "OH_AVDemuxer_SelectTrackByID" }, - { "name": "OH_AVDemuxer_UnselectTrackByID" }, - { "name": "OH_AVDemuxer_ReadSample" }, - { "name": "OH_AVDemuxer_ReadSampleBuffer" }, - { "name": "OH_AVDemuxer_SeekToTime" } + { + "first_introduced": "10", + "name": "OH_AVDemuxer_CreateWithSource" + }, + { + "first_introduced": "10", + "name": "OH_AVDemuxer_Destroy" + }, + { + "first_introduced": "10", + "name": "OH_AVDemuxer_SelectTrackByID" + }, + { + "first_introduced": "10", + "name": "OH_AVDemuxer_UnselectTrackByID" + }, + { + "first_introduced": "10", + "name": "OH_AVDemuxer_ReadSample" + }, + { + "first_introduced": "10", + "name": "OH_AVDemuxer_SeekToTime" + }, + { + "first_introduced": "11", + "name": "OH_AVDemuxer_ReadSampleBuffer" + } ] diff --git a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json index dcf7a6588..097dd37d0 100644 --- a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json +++ b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json @@ -1,10 +1,34 @@ [ - { "name": "OH_AVMuxer_Create" }, - { "name": "OH_AVMuxer_SetRotation" }, - { "name": "OH_AVMuxer_AddTrack" }, - { "name": "OH_AVMuxer_Start" }, - { "name": "OH_AVMuxer_WriteSample" }, - { "name": "OH_AVMuxer_WriteSampleBuffer" }, - { "name": "OH_AVMuxer_Stop" }, - { "name": "OH_AVMuxer_Destroy" } + { + "first_introduced": "10", + "name": "OH_AVMuxer_Create" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_SetRotation" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_AddTrack" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_Start" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_WriteSample" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_Stop" + }, + { + "first_introduced": "10", + "name": "OH_AVMuxer_Destroy" + }, + { + "first_introduced": "11", + "name": "OH_AVMuxer_WriteSampleBuffer" + } ] diff --git a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json index 3232f28e2..090ca1030 100644 --- a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json +++ b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json @@ -1,7 +1,22 @@ [ - { "name": "OH_AVSource_CreateWithURI" }, - { "name": "OH_AVSource_CreateWithFD" }, - { "name": "OH_AVSource_Destroy" }, - { "name": "OH_AVSource_GetSourceFormat" }, - { "name": "OH_AVSource_GetTrackFormat" } + { + "first_introduced": "10", + "name": "OH_AVSource_CreateWithURI" + }, + { + "first_introduced": "10", + "name": "OH_AVSource_CreateWithFD" + }, + { + "first_introduced": "10", + "name": "OH_AVSource_Destroy" + }, + { + "first_introduced": "10", + "name": "OH_AVSource_GetSourceFormat" + }, + { + "first_introduced": "10", + "name": "OH_AVSource_GetTrackFormat" + } ] diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 4ff2ee686..b47467470 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -1,84 +1,365 @@ [ - { "name": "OH_AVCODEC_MIMETYPE_VIDEO_AVC" }, - { "name": "OH_AVCODEC_MIMETYPE_AUDIO_AAC" }, - { "name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG4" }, - { "name": "OH_AVCODEC_MIMETYPE_VIDEO_HEVC" }, - { "name": "OH_AVCODEC_MIMETYPE_AUDIO_MPEG" }, - { "name": "OH_AVCODEC_MIMETYPE_IMAGE_JPG" }, - { "name": "OH_AVCODEC_MIMETYPE_IMAGE_PNG" }, - { "name": "OH_AVCODEC_MIMETYPE_IMAGE_BMP" }, - { "name": "OH_AVCODEC_MIMETYPE_AUDIO_FLAC" }, - { "name": "OH_AVCODEC_MIMETYPE_AUDIO_VORBIS" }, - { "name": "OH_ED_KEY_TIME_STAMP" }, - { "name": "OH_ED_KEY_EOS" }, - { "name": "OH_MD_KEY_TRACK_TYPE" }, - { "name": "OH_MD_KEY_CODEC_MIME" }, - { "name": "OH_MD_KEY_DURATION" }, - { "name": "OH_MD_KEY_BITRATE" }, - { "name": "OH_MD_KEY_MAX_INPUT_SIZE" }, - { "name": "OH_MD_KEY_WIDTH" }, - { "name": "OH_MD_KEY_HEIGHT" }, - { "name": "OH_MD_KEY_PIXEL_FORMAT" }, - { "name": "OH_MD_KEY_RANGE_FLAG" }, - { "name": "OH_MD_KEY_COLOR_PRIMARIES" }, - { "name": "OH_MD_KEY_TRANSFER_CHARACTERISTICS" }, - { "name": "OH_MD_KEY_MATRIX_COEFFICIENTS" }, - { "name": "OH_MD_KEY_AUDIO_SAMPLE_FORMAT" }, - { "name": "OH_MD_KEY_FRAME_RATE" }, - { "name": "OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE" }, - { "name": "OH_MD_KEY_PROFILE" }, - { "name": "OH_MD_KEY_AUD_CHANNEL_COUNT" }, - { "name": "OH_MD_KEY_AUD_SAMPLE_RATE" }, - { "name": "OH_MD_KEY_I_FRAME_INTERVAL" }, - { "name": "OH_MD_KEY_ROTATION" }, - { "name": "OH_MD_KEY_CODEC_CONFIG" }, - { "name": "OH_MD_KEY_REQUEST_I_FRAME" }, - { "name": "OH_MD_KEY_QUALITY" }, - { "name": "OH_MD_KEY_CHANNEL_LAYOUT" }, - { "name": "OH_MD_KEY_BITS_PER_CODED_SAMPLE" }, - { "name": "OH_MD_KEY_AAC_IS_ADTS" }, - { "name": "OH_MD_KEY_SBR" }, - { "name": "OH_MD_KEY_COMPLIANCE_LEVEL" }, - { "name": "OH_MD_KEY_IDENTIFICATION_HEADER" }, - { "name": "OH_MD_KEY_SETUP_HEADER" }, - { "name": "OH_MD_KEY_SCALING_MODE" }, - { "name": "OH_MD_MAX_INPUT_BUFFER_COUNT" }, - { "name": "OH_MD_MAX_OUTPUT_BUFFER_COUNT" }, - { "name": "OH_MD_KEY_TITLE" }, - { "name": "OH_MD_KEY_ARTIST" }, - { "name": "OH_MD_KEY_ALBUM" }, - { "name": "OH_MD_KEY_ALBUM_ARTIST" }, - { "name": "OH_MD_KEY_DATE" }, - { "name": "OH_MD_KEY_COMMENT" }, - { "name": "OH_MD_KEY_GENRE" }, - { "name": "OH_MD_KEY_COPYRIGHT" }, - { "name": "OH_MD_KEY_LANGUAGE" }, - { "name": "OH_MD_KEY_DESCRIPTION" }, - { "name": "OH_MD_KEY_LYRICS" }, - { "name": "OH_MD_KEY_TRACK_COUNT" }, - { "name": "OH_AVCodec_GetCapability" }, - { "name": "OH_AVCodec_GetCapabilityByCategory" }, - { "name": "OH_AVCapability_IsHardware" }, - { "name": "OH_AVCapability_GetName" }, - { "name": "OH_AVCapability_GetMaxSupportedInstances" }, - { "name": "OH_AVCapability_GetEncoderBitrateRange" }, - { "name": "OH_AVCapability_IsEncoderBitrateModeSupported" }, - { "name": "OH_AVCapability_GetEncoderQualityRange" }, - { "name": "OH_AVCapability_GetEncoderComplexityRange" }, - { "name": "OH_AVCapability_GetAudioSupportedSampleRates" }, - { "name": "OH_AVCapability_GetAudioChannelCountRange" }, - { "name": "OH_AVCapability_GetVideoWidthAlignment" }, - { "name": "OH_AVCapability_GetVideoHeightAlignment" }, - { "name": "OH_AVCapability_GetVideoWidthRangeForHeight" }, - { "name": "OH_AVCapability_GetVideoHeightRangeForWidth" }, - { "name": "OH_AVCapability_GetVideoWidthRange" }, - { "name": "OH_AVCapability_GetVideoHeightRange" }, - { "name": "OH_AVCapability_IsVideoSizeSupported" }, - { "name": "OH_AVCapability_GetVideoFrameRateRange" }, - { "name": "OH_AVCapability_GetVideoFrameRateRangeForSize" }, - { "name": "OH_AVCapability_AreVideoSizeAndFrameRateSupported" }, - { "name": "OH_AVCapability_GetVideoSupportedPixelFormats" }, - { "name": "OH_AVCapability_GetSupportedProfiles" }, - { "name": "OH_AVCapability_GetSupportedLevelsForProfile" }, - { "name": "OH_AVCapability_AreProfileAndLevelSupported" } + { + "first_introduced": "9", + "name": "OH_AVCODEC_MIMETYPE_VIDEO_AVC" + }, + { + "first_introduced": "9", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_AAC" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG4" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_VIDEO_HEVC" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_MPEG" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_IMAGE_JPG" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_IMAGE_PNG" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_IMAGE_BMP" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_FLAC" + }, + { + "first_introduced": "10", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_VORBIS" + }, + { + "first_introduced": "11", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_VIVID" + }, + { + "first_introduced": "11", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB" + }, + { + "first_introduced": "11", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB" + }, + { + "first_introduced": "11", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_OPUS" + }, + { + "first_introduced": "11", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_G711MU" + }, + { + "first_introduced": "9", + "name": "OH_ED_KEY_TIME_STAMP" + }, + { + "first_introduced": "9", + "name": "OH_ED_KEY_EOS" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_TRACK_TYPE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_CODEC_MIME" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_DURATION" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_BITRATE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_MAX_INPUT_SIZE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_WIDTH" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_HEIGHT" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_PIXEL_FORMAT" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_RANGE_FLAG" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_COLOR_PRIMARIES" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_TRANSFER_CHARACTERISTICS" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_MATRIX_COEFFICIENTS" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_AUDIO_SAMPLE_FORMAT" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_FRAME_RATE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_PROFILE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_AUD_CHANNEL_COUNT" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_AUD_SAMPLE_RATE" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_I_FRAME_INTERVAL" + }, + { + "first_introduced": "9", + "name": "OH_MD_KEY_ROTATION" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_CODEC_CONFIG" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_REQUEST_I_FRAME" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_QUALITY" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_CHANNEL_LAYOUT" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_BITS_PER_CODED_SAMPLE" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_AAC_IS_ADTS" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_SBR" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_COMPLIANCE_LEVEL" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_IDENTIFICATION_HEADER" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_SETUP_HEADER" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_SCALING_MODE" + }, + { + "first_introduced": "10", + "name": "OH_MD_MAX_INPUT_BUFFER_COUNT" + }, + { + "first_introduced": "10", + "name": "OH_MD_MAX_OUTPUT_BUFFER_COUNT" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_TITLE" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_ARTIST" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_ALBUM" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_ALBUM_ARTIST" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_DATE" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_COMMENT" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_GENRE" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_COPYRIGHT" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_LANGUAGE" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_DESCRIPTION" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_LYRICS" + }, + { + "first_introduced": "10", + "name": "OH_MD_KEY_TITLEOH_MD_KEY_TITLE" + }, + { + "first_introduced": "11", + "name": "OH_MD_KEY_AUDIO_COMPRESSION_LEVEL" + }, + { + "first_introduced": "11", + "name": "OH_MD_KEY_VIDEO_IS_HDR_VIVID" + }, + { + "first_introduced": "11", + "name": "OH_MD_KEY_AUDIO_OBJECT_NUMBER" + }, + { + "first_introduced": "11", + "name": "OH_MD_KEY_AUDIO_VIVID_METADATA" + }, + { + "first_introduced": "10", + "name": "OH_AVCodec_GetCapability" + }, + { + "first_introduced": "10", + "name": "OH_AVCodec_GetCapabilityByCategory" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_IsHardware" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetName" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetMaxSupportedInstances" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetEncoderBitrateRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_IsEncoderBitrateModeSupported" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetEncoderQualityRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetEncoderComplexityRange" + }, + { + "name": "OH_AVCapability_GetAudioSupportedSampleRates" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetAudioChannelCountRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoWidthAlignment" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoHeightAlignment" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoWidthRangeForHeight" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoHeightRangeForWidth" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoWidthRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoHeightRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_IsVideoSizeSupported" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoFrameRateRange" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoFrameRateRangeForSize" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_AreVideoSizeAndFrameRateSupported" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetVideoSupportedPixelFormats" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetSupportedProfiles" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_GetSupportedLevelsForProfile" + }, + { + "first_introduced": "10", + "name": "OH_AVCapability_AreProfileAndLevelSupported" + } ] diff --git a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json index a66078f3f..e39821e1a 100644 --- a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json +++ b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json @@ -1,23 +1,86 @@ [ - { "name": "OH_VideoDecoder_CreateByMime" }, - { "name": "OH_VideoDecoder_CreateByName" }, - { "name": "OH_VideoDecoder_Destroy" }, - { "name": "OH_VideoDecoder_SetCallback" }, - { "name": "OH_VideoDecoder_RegisterCallback" }, - { "name": "OH_VideoDecoder_SetSurface" }, - { "name": "OH_VideoDecoder_Configure" }, - { "name": "OH_VideoDecoder_Prepare" }, - { "name": "OH_VideoDecoder_Start" }, - { "name": "OH_VideoDecoder_Stop" }, - { "name": "OH_VideoDecoder_Flush" }, - { "name": "OH_VideoDecoder_Reset" }, - { "name": "OH_VideoDecoder_GetOutputDescription" }, - { "name": "OH_VideoDecoder_SetParameter" }, - { "name": "OH_VideoDecoder_PushInputData" }, - { "name": "OH_VideoDecoder_PushInputBuffer" }, - { "name": "OH_VideoDecoder_RenderOutputData" }, - { "name": "OH_VideoDecoder_RenderOutputBuffer" }, - { "name": "OH_VideoDecoder_FreeOutputData" }, - { "name": "OH_VideoDecoder_FreeOutputBuffer" }, - { "name": "OH_VideoDecoder_IsValid" } + { + "first_introduced": "9", + "name": "OH_VideoDecoder_CreateByMime" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_CreateByName" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Destroy" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_SetCallback" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_SetSurface" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Configure" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Prepare" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Start" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Stop" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Flush" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_Reset" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_GetOutputDescription" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_SetParameter" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_PushInputData" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_RenderOutputData" + }, + { + "first_introduced": "9", + "name": "OH_VideoDecoder_FreeOutputData" + }, + { + "first_introduced": "10", + "name": "OH_VideoDecoder_IsValid" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_PushInputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_FreeOutputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_RenderOutputBuffer" + } ] diff --git a/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json b/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json index 80e53bd90..412adb923 100644 --- a/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json +++ b/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json @@ -1,23 +1,86 @@ [ - { "name": "OH_VideoEncoder_CreateByMime" }, - { "name": "OH_VideoEncoder_CreateByName" }, - { "name": "OH_VideoEncoder_Destroy" }, - { "name": "OH_VideoEncoder_SetCallback" }, - { "name": "OH_VideoEncoder_RegisterCallback" }, - { "name": "OH_VideoEncoder_Configure" }, - { "name": "OH_VideoEncoder_Prepare" }, - { "name": "OH_VideoEncoder_Start" }, - { "name": "OH_VideoEncoder_Stop" }, - { "name": "OH_VideoEncoder_Flush" }, - { "name": "OH_VideoEncoder_Reset" }, - { "name": "OH_VideoEncoder_GetOutputDescription" }, - { "name": "OH_VideoEncoder_SetParameter" }, - { "name": "OH_VideoEncoder_GetSurface" }, - { "name": "OH_VideoEncoder_FreeOutputData" }, - { "name": "OH_VideoEncoder_FreeOutputBuffer" }, - { "name": "OH_VideoEncoder_NotifyEndOfStream" }, - { "name": "OH_VideoEncoder_PushInputData" }, - { "name": "OH_VideoEncoder_PushInputBuffer" }, - { "name": "OH_VideoEncoder_GetInputDescription" }, - { "name": "OH_VideoEncoder_IsValid" } + { + "first_introduced": "9", + "name": "OH_VideoEncoder_CreateByMime" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_CreateByName" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Destroy" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_SetCallback" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Configure" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Prepare" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Start" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Stop" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Flush" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_Reset" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_GetOutputDescription" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_SetParameter" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_GetSurface" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_FreeOutputData" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_NotifyEndOfStream" + }, + { + "first_introduced": "9", + "name": "OH_VideoEncoder_PushInputData" + }, + { + "first_introduced": "10", + "name": "OH_VideoEncoder_GetInputDescription" + }, + { + "first_introduced": "10", + "name": "OH_VideoEncoder_IsValid" + }, + { + "first_introduced": "11", + "name": "OH_VideoEncoder_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_VideoEncoder_PushInputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_VideoEncoder_FreeOutputBuffer" + } ] From d2fd1c61052c33c753fe105644fb1e4fcb86f285 Mon Sep 17 00:00:00 2001 From: peng Date: Tue, 2 Jan 2024 17:24:12 +0800 Subject: [PATCH 31/33] add audio layout gn Signed-off-by: peng --- multimedia/media_foundation/core/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn index b0bc5678e..001feefae 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -17,6 +17,7 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_core_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ + "../native_audio_channel_layout.h", "../native_avbuffer.h", "../native_avbuffer_info.h", "../native_averrors.h", @@ -38,5 +39,6 @@ ohos_ndk_library("libnative_media_core") { "multimedia/player_framework/native_averrors.h", "multimedia/player_framework/native_avformat.h", "multimedia/player_framework/native_avmemory.h", + "multimedia/player_framework/native_audio_channel_layout.h", ] } From 8bceb7c632e6bca14618fa300ab330c65562f0dd Mon Sep 17 00:00:00 2001 From: peng Date: Wed, 3 Jan 2024 11:21:30 +0800 Subject: [PATCH 32/33] modify audio layout gn Signed-off-by: peng --- multimedia/media_foundation/core/BUILD.gn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn index 001feefae..a8a410823 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -17,7 +17,6 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_core_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ - "../native_audio_channel_layout.h", "../native_avbuffer.h", "../native_avbuffer_info.h", "../native_averrors.h", @@ -26,6 +25,13 @@ ohos_ndk_headers("native_media_core_header") { ] } +ohos_ndk_headers("native_media_core_common_header") { + dest_dir = "$ndk_headers_out_dir/multimedia" + sources = [ + "../native_audio_channel_layout.h", + ] +} + ohos_ndk_library("libnative_media_core") { ndk_description_file = "./libnative_media_core.ndk.json" min_compact_version = "1" From fd13c8620cddba44755d9693d4e73d47c55b1ad9 Mon Sep 17 00:00:00 2001 From: peng Date: Wed, 3 Jan 2024 11:48:21 +0800 Subject: [PATCH 33/33] format gn Signed-off-by: peng --- multimedia/media_foundation/core/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn index a8a410823..25a6ff245 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -27,9 +27,7 @@ ohos_ndk_headers("native_media_core_header") { ohos_ndk_headers("native_media_core_common_header") { dest_dir = "$ndk_headers_out_dir/multimedia" - sources = [ - "../native_audio_channel_layout.h", - ] + sources = [ "../native_audio_channel_layout.h" ] } ohos_ndk_library("libnative_media_core") {