From 759a49ea91ec19538f0dfaac9585b5ea129677f6 Mon Sep 17 00:00:00 2001 From: li-jianchao1993 Date: Tue, 16 Jan 2024 19:22:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E3=80=91=20=E5=9B=9E=E9=80=80sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-jianchao1993 --- multimedia/av_codec/audio_codec/BUILD.gn | 31 -- .../libnative_media_acodec.ndk.json | 62 --- multimedia/av_codec/audio_decoder/BUILD.gn | 3 +- .../libnative_media_adec.ndk.json | 75 +-- multimedia/av_codec/audio_encoder/BUILD.gn | 3 +- .../libnative_media_aenc.ndk.json | 75 +-- .../av_codec/avcodec_audio_channel_layout.h | 24 +- multimedia/av_codec/avdemuxer/BUILD.gn | 2 +- .../libnative_media_avdemuxer.ndk.json | 34 +- multimedia/av_codec/avmuxer/BUILD.gn | 2 +- .../avmuxer/libnative_media_avmuxer.ndk.json | 39 +- multimedia/av_codec/avsource/BUILD.gn | 2 +- .../libnative_media_avsource.ndk.json | 25 +- multimedia/av_codec/codec_base/BUILD.gn | 6 +- .../libnative_media_codecbase.ndk.json | 444 ++++-------------- .../core/BUILD.gn | 17 +- .../core/libnative_media_core.ndk.json | 11 +- .../av_codec/native_avcodec_audiocodec.h | 207 -------- .../av_codec/native_avcodec_audiodecoder.h | 35 +- .../av_codec/native_avcodec_audioencoder.h | 34 +- multimedia/av_codec/native_avcodec_base.h | 259 +++++----- .../av_codec/native_avcodec_videodecoder.h | 66 +-- .../av_codec/native_avcodec_videoencoder.h | 49 +- multimedia/av_codec/native_avdemuxer.h | 19 +- .../native_averrors.h | 0 .../native_avformat.h | 0 .../native_avmemory.h | 11 +- multimedia/av_codec/native_avmuxer.h | 28 +- multimedia/av_codec/video_decoder/BUILD.gn | 3 +- .../libnative_media_vdec.ndk.json | 101 +--- multimedia/av_codec/video_encoder/BUILD.gn | 3 +- .../libnative_media_venc.ndk.json | 102 +--- .../native_audio_channel_layout.h | 350 -------------- multimedia/media_foundation/native_avbuffer.h | 130 ----- .../media_foundation/native_avbuffer_info.h | 62 --- 35 files changed, 365 insertions(+), 1949 deletions(-) delete mode 100644 multimedia/av_codec/audio_codec/BUILD.gn delete mode 100644 multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json rename multimedia/{media_foundation => av_codec}/core/BUILD.gn (72%) rename multimedia/{media_foundation => av_codec}/core/libnative_media_core.ndk.json (71%) delete mode 100644 multimedia/av_codec/native_avcodec_audiocodec.h rename multimedia/{media_foundation => av_codec}/native_averrors.h (100%) rename multimedia/{media_foundation => av_codec}/native_avformat.h (100%) rename multimedia/{media_foundation => av_codec}/native_avmemory.h (89%) delete mode 100644 multimedia/media_foundation/native_audio_channel_layout.h delete mode 100644 multimedia/media_foundation/native_avbuffer.h delete mode 100644 multimedia/media_foundation/native_avbuffer_info.h diff --git a/multimedia/av_codec/audio_codec/BUILD.gn b/multimedia/av_codec/audio_codec/BUILD.gn deleted file mode 100644 index 4f5ca4be6..000000000 --- a/multimedia/av_codec/audio_codec/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# 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 = [ "../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 deleted file mode 100644 index 47dfd626d..000000000 --- a/multimedia/av_codec/audio_codec/libnative_media_acodec.ndk.json +++ /dev/null @@ -1,62 +0,0 @@ -[ - { - "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/BUILD.gn b/multimedia/av_codec/audio_decoder/BUILD.gn index af55b57f8..bee0a5e69 100644 --- a/multimedia/av_codec/audio_decoder/BUILD.gn +++ b/multimedia/av_codec/audio_decoder/BUILD.gn @@ -15,7 +15,8 @@ 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 = [ "../native_avcodec_audiodecoder.h" ] + sources = + [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audiodecoder.h" ] } ohos_ndk_library("libnative_media_adec") { 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 2f11d9276..1b4472c05 100644 --- a/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json +++ b/multimedia/av_codec/audio_decoder/libnative_media_adec.ndk.json @@ -1,62 +1,17 @@ [ - { - "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" - } + { "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" } ] diff --git a/multimedia/av_codec/audio_encoder/BUILD.gn b/multimedia/av_codec/audio_encoder/BUILD.gn index c19086740..8ecb69c8a 100644 --- a/multimedia/av_codec/audio_encoder/BUILD.gn +++ b/multimedia/av_codec/audio_encoder/BUILD.gn @@ -15,7 +15,8 @@ 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 = [ "../native_avcodec_audioencoder.h" ] + sources = + [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_audioencoder.h" ] } ohos_ndk_library("libnative_media_aenc") { 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 12d102305..830a103a7 100644 --- a/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json +++ b/multimedia/av_codec/audio_encoder/libnative_media_aenc.ndk.json @@ -1,62 +1,17 @@ [ - { - "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" - } + { "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" } ] diff --git a/multimedia/av_codec/avcodec_audio_channel_layout.h b/multimedia/av_codec/avcodec_audio_channel_layout.h index 32826229b..4b6354d2b 100644 --- a/multimedia/av_codec/avcodec_audio_channel_layout.h +++ b/multimedia/av_codec/avcodec_audio_channel_layout.h @@ -24,8 +24,6 @@ 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 { @@ -93,8 +91,6 @@ 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 { @@ -150,14 +146,18 @@ enum AudioChannelLayout : uint64_t { AudioChannelSet::TOP_FRONT_LEFT | AudioChannelSet::TOP_FRONT_RIGHT), STEREO_DOWNMIX = (AudioChannelSet::STEREO_LEFT | AudioChannelSet::STEREO_RIGHT), - 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, + 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, }; #ifdef __cplusplus } diff --git a/multimedia/av_codec/avdemuxer/BUILD.gn b/multimedia/av_codec/avdemuxer/BUILD.gn index c8a28ddc3..54e236d9f 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 = [ "../native_avdemuxer.h" ] + sources = [ "//interface/sdk_c/multimedia/av_codec/native_avdemuxer.h" ] } ohos_ndk_library("libnative_media_avdemuxer") { diff --git a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json index 0f1551246..bf9ca16b8 100644 --- a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json +++ b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json @@ -1,30 +1,8 @@ [ - { - "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" - } + { "name": "OH_AVDemuxer_CreateWithSource" }, + { "name": "OH_AVDemuxer_Destroy" }, + { "name": "OH_AVDemuxer_SelectTrackByID" }, + { "name": "OH_AVDemuxer_UnselectTrackByID" }, + { "name": "OH_AVDemuxer_ReadSample" }, + { "name": "OH_AVDemuxer_SeekToTime" } ] diff --git a/multimedia/av_codec/avmuxer/BUILD.gn b/multimedia/av_codec/avmuxer/BUILD.gn index 97edfd594..5002afe02 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 = [ "../native_avmuxer.h" ] + sources = [ "//interface/sdk_c/multimedia/av_codec/native_avmuxer.h" ] } ohos_ndk_library("libnative_media_avmuxer") { diff --git a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json index 097dd37d0..b831c325d 100644 --- a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json +++ b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json @@ -1,34 +1,9 @@ [ - { - "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" - } + { "name": "OH_AVMuxer_Create" }, + { "name": "OH_AVMuxer_SetRotation" }, + { "name": "OH_AVMuxer_AddTrack" }, + { "name": "OH_AVMuxer_Start" }, + { "name": "OH_AVMuxer_WriteSample" }, + { "name": "OH_AVMuxer_Stop" }, + { "name": "OH_AVMuxer_Destroy" } ] diff --git a/multimedia/av_codec/avsource/BUILD.gn b/multimedia/av_codec/avsource/BUILD.gn index 388dfe852..395fc8474 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 = [ "../native_avsource.h" ] + sources = [ "//interface/sdk_c/multimedia/av_codec/native_avsource.h" ] } ohos_ndk_library("libnative_media_avsource") { diff --git a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json index 090ca1030..3232f28e2 100644 --- a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json +++ b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json @@ -1,22 +1,7 @@ [ - { - "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" - } + { "name": "OH_AVSource_CreateWithURI" }, + { "name": "OH_AVSource_CreateWithFD" }, + { "name": "OH_AVSource_Destroy" }, + { "name": "OH_AVSource_GetSourceFormat" }, + { "name": "OH_AVSource_GetTrackFormat" } ] diff --git a/multimedia/av_codec/codec_base/BUILD.gn b/multimedia/av_codec/codec_base/BUILD.gn index 30ff2ef20..99e9bf280 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 = [ - "../avcodec_audio_channel_layout.h", - "../native_avcapability.h", - "../native_avcodec_base.h", + "//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", ] } 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 a15497419..3e19fb31d 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -1,365 +1,83 @@ [ - { - "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_TRACK_COUNT" - }, - { - "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" - } + { "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_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" } ] + diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/av_codec/core/BUILD.gn similarity index 72% rename from multimedia/media_foundation/core/BUILD.gn rename to multimedia/av_codec/core/BUILD.gn index 25a6ff245..8d047d2eb 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/av_codec/core/BUILD.gn @@ -13,23 +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 = [ - "../native_avbuffer.h", - "../native_avbuffer_info.h", - "../native_averrors.h", - "../native_avformat.h", - "../native_avmemory.h", + "//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", ] } -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" @@ -38,11 +30,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", - "multimedia/player_framework/native_audio_channel_layout.h", ] } diff --git a/multimedia/media_foundation/core/libnative_media_core.ndk.json b/multimedia/av_codec/core/libnative_media_core.ndk.json similarity index 71% rename from multimedia/media_foundation/core/libnative_media_core.ndk.json rename to multimedia/av_codec/core/libnative_media_core.ndk.json index 06942afd5..f7ceabdb5 100644 --- a/multimedia/media_foundation/core/libnative_media_core.ndk.json +++ b/multimedia/av_codec/core/libnative_media_core.ndk.json @@ -21,13 +21,6 @@ { "name": "OH_AVMemory_GetAddr" }, { "name": "OH_AVMemory_GetSize" }, { "name": "OH_AVMemory_Destroy" }, - { "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" } + { "name": "OH_AVCodec_GetCapability" }, + { "name": "OH_AVCodec_GetCapabilityByCategory" } ] diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h deleted file mode 100644 index cc34cd037..000000000 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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_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, const 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 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, - * 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, const 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 e834aa233..bb62e8a8c 100644 --- a/multimedia/av_codec/native_avcodec_audiodecoder.h +++ b/multimedia/av_codec/native_avcodec_audiodecoder.h @@ -18,6 +18,9 @@ #include #include +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus @@ -29,8 +32,6 @@ 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 */ @@ -42,8 +43,6 @@ 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 */ @@ -55,8 +54,6 @@ 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 */ @@ -71,8 +68,6 @@ 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 */ @@ -80,14 +75,12 @@ 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 OH_AVSource. This interface must be called before Prepare is called. + * audio track, which can be extracted from the container. 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 */ @@ -100,8 +93,6 @@ 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 */ @@ -114,8 +105,6 @@ 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 */ @@ -129,8 +118,6 @@ 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 */ @@ -144,8 +131,6 @@ 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 */ @@ -158,8 +143,6 @@ 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 */ @@ -174,8 +157,6 @@ 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 */ @@ -189,8 +170,6 @@ 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 */ @@ -209,8 +188,6 @@ 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 */ @@ -223,8 +200,6 @@ 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 */ @@ -239,8 +214,6 @@ 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 b990c4857..7493f69e0 100644 --- a/multimedia/av_codec/native_avcodec_audioencoder.h +++ b/multimedia/av_codec/native_avcodec_audioencoder.h @@ -18,8 +18,10 @@ #include #include +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" #include "native_avcodec_base.h" - #ifdef __cplusplus extern "C" { #endif @@ -29,8 +31,6 @@ 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,8 +42,6 @@ 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 */ @@ -55,8 +53,6 @@ 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 */ @@ -71,8 +67,6 @@ 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 */ @@ -86,8 +80,6 @@ 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 */ @@ -100,8 +92,6 @@ 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 */ @@ -114,8 +104,6 @@ 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 */ @@ -127,8 +115,6 @@ 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 */ @@ -142,8 +128,6 @@ 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 */ @@ -156,8 +140,6 @@ 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 */ @@ -171,8 +153,6 @@ 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 */ @@ -186,8 +166,6 @@ 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 */ @@ -204,8 +182,6 @@ 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 */ @@ -218,8 +194,6 @@ 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 */ @@ -234,8 +208,6 @@ 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 b26dc2454..4d43427ca 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -18,7 +18,8 @@ #include #include -#include "native_avbuffer.h" +#include "native_averrors.h" +#include "native_avformat.h" #include "native_avmemory.h" #ifdef __cplusplus @@ -28,6 +29,41 @@ 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. @@ -61,8 +97,6 @@ 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 */ @@ -79,37 +113,11 @@ 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); - -/** - * @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); + OH_AVCodecBufferAttr *attr, void *userData); /** * @brief A collection of all asynchronous callback function pointers in OH_AVCodec. Register an instance of this @@ -119,9 +127,7 @@ typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, O * @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 onNeedOutputData Monitor codec to generate output data, refer to {@link OH_AVCodecOnNewOutputData} - * @deprecated since 11 - * @useinstead OH_AVCodecCallback + * @param onNeedInputData Monitor codec to generate output data, refer to {@link onNeedInputData} * @since 9 * @version 1.0 */ @@ -132,24 +138,6 @@ 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 @@ -168,34 +156,14 @@ 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 - * @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; - -/** - * @brief Enumerates the MIME types of audio codecs - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 - */ -extern const char *OH_AVCODEC_MIMETYPE_AUDIO_VIVID; +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 @@ -209,7 +177,7 @@ extern const char *OH_ED_KEY_TIME_STAMP; extern const char *OH_ED_KEY_EOS; /** - * @brief Provides the uniform key for storing the media description. + * @brief Provides the uniform container for storing the media description. * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 9 * @version 1.0 @@ -248,7 +216,7 @@ extern const char *OH_MD_KEY_I_FRAME_INTERVAL; extern const char *OH_MD_KEY_ROTATION; /** - * @brief Provides the uniform key for storing the media description. + * @brief Provides the uniform container for storing the media description. * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ @@ -291,6 +259,18 @@ 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 */ @@ -311,20 +291,32 @@ 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; +/* 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; /** - * @brief Provides the uniform key for storing the media description. + * @brief File type. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 11 + * @since 10 + * @version 1.0 */ -/* Key for audio codec compression level, value type is uint32_t */ -extern const char *OH_MD_KEY_AUDIO_COMPRESSION_LEVEL; -/* 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 */ -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; +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. @@ -361,19 +353,6 @@ typedef enum OH_AVCProfile { AVC_PROFILE_MAIN = 8, } OH_AVCProfile; -/** - * @brief HEVC Profile - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_HEVCProfile { - HEVC_PROFILE_MAIN = 0, - HEVC_PROFILE_MAIN_10 = 1, - HEVC_PROFILE_MAIN_STILL = 2, - HEVC_PROFILE_MAIN_10_HDR10 = 3, - HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4, -} OH_HEVCProfile; - /** * @brief Enumerates the muxer output file format * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -400,33 +379,38 @@ typedef enum OH_AVSeekMode { } OH_AVSeekMode; /** - * @brief Scaling Mode + * @brief HEVC Profile * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 10 */ -typedef enum OH_ScalingMode { - SCALING_MODE_SCALE_TO_WINDOW = 1, - SCALING_MODE_SCALE_CROP = 2, -} OH_ScalingMode; +typedef enum OH_HEVCProfile { + HEVC_PROFILE_MAIN = 0, + HEVC_PROFILE_MAIN_10 = 1, + HEVC_PROFILE_MAIN_STILL = 2, + HEVC_PROFILE_MAIN_10_HDR10 = 3, + HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4, +} OH_HEVCProfile; /** - * @brief enum Audio Bits Per Coded Sample + * @brief HEVC Level * @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; +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 Color Primary @@ -494,6 +478,49 @@ typedef enum OH_MatrixCoefficient { MATRIX_COEFFICIENT_ICTCP = 14, } OH_MatrixCoefficient; +/** + * @brief Chroma Location + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +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, +}; + +/** + * @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/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 46dc45b8c..3bc557751 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -18,6 +18,9 @@ #include #include +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus @@ -65,26 +68,11 @@ 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 @@ -100,7 +88,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 OH_AVSource. This interface must be called before Prepare is called. + * video track, which can be extracted from the container. 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 @@ -210,8 +198,6 @@ 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 */ @@ -226,8 +212,6 @@ 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 */ @@ -240,53 +224,11 @@ 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 fa0abea85..86b8750d6 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -18,6 +18,9 @@ #include #include +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" #include "native_avcodec_base.h" #ifdef __cplusplus @@ -58,33 +61,18 @@ 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 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. @@ -187,8 +175,7 @@ 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}, the application is responsible for - * managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done. + * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} * @since 9 @@ -203,8 +190,6 @@ 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 */ @@ -230,34 +215,10 @@ 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 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 c5935a2e0..cdcff0914 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -18,6 +18,8 @@ #include #include "native_avcodec_base.h" +#include "native_averrors.h" +#include "native_avmemory.h" #include "native_avsource.h" #ifdef __cplusplus @@ -90,28 +92,11 @@ OH_AVErrCode OH_AVDemuxer_UnselectTrackByID(OH_AVDemuxer *demuxer, uint32_t trac * @param info The OH_AVCodecBufferAttr handle pointer to the buffer storing sample information. * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} - * @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/media_foundation/native_averrors.h b/multimedia/av_codec/native_averrors.h similarity index 100% rename from multimedia/media_foundation/native_averrors.h rename to multimedia/av_codec/native_averrors.h diff --git a/multimedia/media_foundation/native_avformat.h b/multimedia/av_codec/native_avformat.h similarity index 100% rename from multimedia/media_foundation/native_avformat.h rename to multimedia/av_codec/native_avformat.h diff --git a/multimedia/media_foundation/native_avmemory.h b/multimedia/av_codec/native_avmemory.h similarity index 89% rename from multimedia/media_foundation/native_avmemory.h rename to multimedia/av_codec/native_avmemory.h index 489a4ff49..a165d290a 100644 --- a/multimedia/media_foundation/native_avmemory.h +++ b/multimedia/av_codec/native_avmemory.h @@ -30,8 +30,6 @@ 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); @@ -41,8 +39,6 @@ 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 */ @@ -53,22 +49,17 @@ 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 */ 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, * 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); diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index 2e622508c..ec7e647dc 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -19,6 +19,10 @@ #include #include #include "native_avcodec_base.h" +#include "native_averrors.h" +#include "native_avformat.h" +#include "native_avmemory.h" + #ifdef __cplusplus extern "C" { @@ -86,28 +90,12 @@ 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, 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. - * @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, - const OH_AVBuffer *sample); +OH_AVErrCode OH_AVMuxer_WriteSample(OH_AVMuxer *muxer, + uint32_t trackIndex, + OH_AVMemory *sample, + OH_AVCodecBufferAttr info); /** * @brief Stop the muxer. diff --git a/multimedia/av_codec/video_decoder/BUILD.gn b/multimedia/av_codec/video_decoder/BUILD.gn index 2f7b753b0..ed160ae96 100644 --- a/multimedia/av_codec/video_decoder/BUILD.gn +++ b/multimedia/av_codec/video_decoder/BUILD.gn @@ -15,7 +15,8 @@ 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 = [ "../native_avcodec_videodecoder.h" ] + sources = + [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videodecoder.h" ] } ohos_ndk_library("libnative_media_vdec") { 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 e39821e1a..7e6fd7d7a 100644 --- a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json +++ b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json @@ -1,86 +1,19 @@ [ - { - "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" - } + { "name": "OH_VideoDecoder_CreateByMime" }, + { "name": "OH_VideoDecoder_CreateByName" }, + { "name": "OH_VideoDecoder_Destroy" }, + { "name": "OH_VideoDecoder_SetCallback" }, + { "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_RenderOutputData" }, + { "name": "OH_VideoDecoder_FreeOutputData" }, + { "name": "OH_VideoDecoder_IsValid" } ] diff --git a/multimedia/av_codec/video_encoder/BUILD.gn b/multimedia/av_codec/video_encoder/BUILD.gn index 9878bd444..e3d3000a0 100644 --- a/multimedia/av_codec/video_encoder/BUILD.gn +++ b/multimedia/av_codec/video_encoder/BUILD.gn @@ -15,7 +15,8 @@ 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 = [ "../native_avcodec_videoencoder.h" ] + sources = + [ "//interface/sdk_c/multimedia/av_codec/native_avcodec_videoencoder.h" ] } ohos_ndk_library("libnative_media_venc") { 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 412adb923..28febaa45 100644 --- a/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json +++ b/multimedia/av_codec/video_encoder/libnative_media_venc.ndk.json @@ -1,86 +1,20 @@ [ - { - "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" - } + { "name": "OH_VideoEncoder_CreateByMime" }, + { "name": "OH_VideoEncoder_CreateByName" }, + { "name": "OH_VideoEncoder_Destroy" }, + { "name": "OH_VideoEncoder_SetCallback" }, + { "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_NotifyEndOfStream" }, + { "name": "OH_VideoEncoder_PushInputData" }, + { "name": "OH_VideoEncoder_GetInputDescription" }, + { "name": "OH_VideoEncoder_IsValid" } ] diff --git a/multimedia/media_foundation/native_audio_channel_layout.h b/multimedia/media_foundation/native_audio_channel_layout.h deleted file mode 100644 index 1ec2a4da3..000000000 --- a/multimedia/media_foundation/native_audio_channel_layout.h +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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. - */ - -/** - * @addtogroup MediaFoundation - * @{ - * - * @brief Provides APIs for media foundation. - * - * @since 11 - */ - -/** - * @file native_audio_channel_layout.h - * - * @brief The channel layout indicates the appearance and order of the speakers for recording or playback. - * - * @library NA - * @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 diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h deleted file mode 100644 index 19ec2be46..000000000 --- a/multimedia/media_foundation/native_avbuffer.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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" -#include "native_avbuffer_info.h" - -#ifdef __cplusplus -extern "C" { -#endif -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}. - * @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 - * @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 - * @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_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 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, 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 {@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, - * otherwise returns nullptr - * @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 - * @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); - -/** - * @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,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}. - * @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 - * @since 11 - */ -OH_NativeBuffer *OH_AVBuffer_GetNativeBuffer(OH_AVBuffer *buffer); - -#ifdef __cplusplus -} -#endif - -#endif // NATIVE_AVBUFFER_H diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h deleted file mode 100644 index 78ec7c3e8..000000000 --- a/multimedia/media_foundation/native_avbuffer_info.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_INFO_H -#define NATIVE_AVBUFFER_INFO_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @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; - -#ifdef __cplusplus -} -#endif - -#endif // NATIVE_AVBUFFER_INFO_H -- Gitee