From c1690cc83651d005179e72fc827997df261bae10 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 26 Oct 2024 15:56:06 +0800 Subject: [PATCH 01/10] avrecorder ndk interfaces Signed-off-by: Steven --- multimedia/player_framework/avrecorder.h | 27 ++++++++++++++ .../player_framework/avrecorder/BUILD.gn | 35 +++++++++++++++++++ .../avrecorder/libavplayer.ndk.json | 14 ++++++++ multimedia/player_framework/avrecorder_base.h | 21 +++++++++++ 4 files changed, 97 insertions(+) create mode 100644 multimedia/player_framework/avrecorder.h create mode 100644 multimedia/player_framework/avrecorder/BUILD.gn create mode 100644 multimedia/player_framework/avrecorder/libavplayer.ndk.json create mode 100644 multimedia/player_framework/avrecorder_base.h diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h new file mode 100644 index 000000000..36cd264db --- /dev/null +++ b/multimedia/player_framework/avrecorder.h @@ -0,0 +1,27 @@ +# Copyright(C) 2024 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 MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H + +#include +#include +#include +#include "avrecorder_base.h" +#include "native_averrors.h" +#include "native_window/external_window.h" +#include "oh_media_asset.h" + +#ifdef __cplusplus +extern "C" { +#endif \ No newline at end of file diff --git a/multimedia/player_framework/avrecorder/BUILD.gn b/multimedia/player_framework/avrecorder/BUILD.gn new file mode 100644 index 000000000..3ca4f1bce --- /dev/null +++ b/multimedia/player_framework/avrecorder/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (C) 2024 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") +import("//foundation/multimedia/player_framework/config.gni") + +ohos_ndk_headers("avrecorder_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" + sources = [ + "../avrecorder.h", + "../avrecorder_base.h", + ] +} + +ohos_ndk_library("libavrecorder") { + ndk_description_file = "./libavrecorder.ndk.json" + output_name = "avrecorder" + output_extension = "so" + system_capability = "SystemCapability.Multimedia.Media.AVRecorder" + system_capability_headers = [ + "multimedia/player_framework/avrecorder.h", + "multimedia/player_framework/avrecorder_base.h", + ] +} diff --git a/multimedia/player_framework/avrecorder/libavplayer.ndk.json b/multimedia/player_framework/avrecorder/libavplayer.ndk.json new file mode 100644 index 000000000..3a57a9178 --- /dev/null +++ b/multimedia/player_framework/avrecorder/libavplayer.ndk.json @@ -0,0 +1,14 @@ +[ + { + "first_introduced": "14", + "name": "OH_AVRecorder_Create" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Prepare" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Start" + } +] \ No newline at end of file diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h new file mode 100644 index 000000000..c0898fd42 --- /dev/null +++ b/multimedia/player_framework/avrecorder_base.h @@ -0,0 +1,21 @@ +# Copyright(C) 2024 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 MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif \ No newline at end of file -- Gitee From 3cac1ce12985da1f73e3fa8e404b8f0e2edcb7a8 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 26 Oct 2024 08:06:51 +0000 Subject: [PATCH 02/10] update multimedia/player_framework/avrecorder.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder.h | 250 +++++++++++++++++++++-- 1 file changed, 237 insertions(+), 13 deletions(-) diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h index 36cd264db..dca24383f 100644 --- a/multimedia/player_framework/avrecorder.h +++ b/multimedia/player_framework/avrecorder.h @@ -1,15 +1,40 @@ -# Copyright(C) 2024 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. +/* + * Copyright (C) 2024 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 AVRecorder + * @{ + * + * @brief Provides APIs of request capability for Recorder. + * + * @Syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ + + /** + * @file avrecorder.h + * + * @brief Defines the avrecorder APIs. Uses the Native APIs provided by Media AVRecorder + * to record media data. + * + * @kit MediaKit + * @library libavrecorder.so + * @since 14 + * @version 1.0 + */ #ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H #define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H @@ -24,4 +49,203 @@ #ifdef __cplusplus extern "C" { -#endif \ No newline at end of file +#endif + +/** + * @brief Create a recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @return Returns a pointer to an OH_AVRecorder instance for success, nullptr for failure + * @since 14 + * @version 1.0 +*/ +OH_AVRecorder *OH_AVRecorder_Create(void); + +/** + * @brief Prepare for recording with some parameters. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param config Pointer to an OH_AVRecorderConfig instance, see {@link OH_AVRecorderConfig} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder Prepare failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Prepare(OH_AVRecorder *recorder, OH_AVRecorderConfig *config); + +/** + * @brief Get current recording parameters, it must be called after prepare. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param config Double Pointer to an OH_AVRecorderConfig instance, see {@link OH_AVRecorderConfig} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or config is null. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_GetAVRecorderConfig(OH_AVRecorder *recorder, OH_AVRecorderConfig **config); + +/** + * @brief Get input surface, it must be called between prepare completed and start. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param window Double Pointer to an OHNativeWindow instance, see {@link OHNativeWindow} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_GetInputSurface(OH_AVRecorder *recorder, OHNativeWindow **window); + +/** + * @brief Update the video orientation before recorder start. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param rotation angle, should be [0, 90, 180, 270] + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or update rotation failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_UpdateRotation(OH_AVRecorder *recorder, int32_t rotation); + +/** + * @brief Start AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder start failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Start(OH_AVRecorder *recorder); + +/** + * @brief Pause AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder pause failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Pause(OH_AVRecorder *recorder); + +/** + * @brief Resume AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder resume failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Resume(OH_AVRecorder *recorder); + +/** + * @brief Stop AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder stop failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Stop(OH_AVRecorder *recorder); + +/** + * @brief Reset AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder reset failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Reset(OH_AVRecorder *recorder); + +/** + * @brief Release AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder release failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_Release(OH_AVRecorder *recorder); + +/** + * @brief Get available encoder and encoder info for AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param info Double Pointer to an OH_EncoderInfo instance, see {@link OH_EncoderInfo} + * @param length Length of available encoders + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder release failed. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_EncoderInfo **info, int32_t *length); + +/** + * @brief Set the state callback function so that your application can respond to the + * state change events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback State callback function, see {@link OH_AVRecorder_OnStateChange} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_SetStateCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnStateChange callback, void *userData); + +/** + * @brief Set the error callback function so that your application can respond to the + * error events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback Error callback function, see {@link OH_AVRecorder_OnError} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnError callback, void *userData); + +/** + * @brief Set the URI callback function so that your application can respond to the + * URI events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback Error callback function, see {@link OH_AVRecorder_OnURI} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 14 + * @version 1.0 + */ +OH_AVErrCode OH_AVRecorder_SetURICallback(OH_AVRecorder *recorder, OH_AVRecorder_OnURI callback, void *userData); + + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H \ No newline at end of file -- Gitee From f1c10b949f826257998840fc14d2ba870f0cc9c2 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 26 Oct 2024 08:10:14 +0000 Subject: [PATCH 03/10] update multimedia/player_framework/avrecorder_base.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder_base.h | 362 +++++++++++++++++- 1 file changed, 349 insertions(+), 13 deletions(-) diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h index c0898fd42..c6b541894 100644 --- a/multimedia/player_framework/avrecorder_base.h +++ b/multimedia/player_framework/avrecorder_base.h @@ -1,21 +1,357 @@ -# Copyright(C) 2024 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. +/* + * Copyright (C) 2024 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 AVRecorder + * @{ + * + * @brief Provides APIs of request capability for Recorder. + * + * @Syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ + +/** + * @file avrecorder_base.h + * + * @brief Defines the structure and enumeration for Media AVRecorder. + * + * @kit MediaKit + * @library libavrecorder.so + * @since 14 + * @version 1.0 + */ + #ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H #define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H +#include #include +#include "native_avbuffer.h" #ifdef __cplusplus extern "C" { -#endif \ No newline at end of file +#endif + +/** + * @brief Initialization of avrecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_AVRecorder OH_AVRecorder; + +/** + * @brief audio source type for recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderAudioSourceType { + /* Default audio source type. */ + DEFAULT = 0, + /* Source type mic. */ + MIC = 1, + /* Source type Voice recognition. */ + VOICE_RECOGNITION = 2, + /* Source type Voice communication. */ + VOICE_COMMUNICATION = 7, + /* Source type Voice message. */ + VOICE_MESSAGE = 10, + /* Source type Camcorder. */ + CAMCORDER = 13, +} OH_AVRecorderAudioSourceType; + +/** + * @brief video source type for recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderVideoSourceType { + /* Surface raw data. */ + SURFACE_YUV = 0, + /* Surface ES data. */ + SURFACE_ES = 1, +} OH_AVRecorderVideoSourceType; + +/** + * @brief Enumerates Codec MIME types + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderCodecMimeType { + /* H.264 codec MIME type. */ + VIDEO_AVC = 2, + /* AAC codec MIME type. */ + AUDIO_AAC = 3, + /* mp3 codec MIME type. */ + AUDIO_MP3 = 4, + /* G711-mulaw codec MIME type. */ + AUDIO_G711MU = 5, + /* MPEG4 codec MIME type. */ + VIDEO_MPEG4 = 6, + /* H.265 codec MIME type. */ + VIDEO_HEVC = 8, +} OH_AVRecorderCodecMimeType; + +/** + * @brief Enumerates container format type(The abbreviation for 'container format type' is CFT) + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderContainerFormatType { + /* A video container format type mp4. */ + CFT_MPEG_4 = 2, + /* A audio container format type m4a. */ + CFT_MPEG_4A = 6, + /* A audio container format type mp3. */ + CFT_MP3 = 9, + /* A audio container format type wav. */ + CFT_WAV = 10, +} OH_AVRecorderContainerFormatType; + +/** + * @brief Recorder States + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderState { + /* idle states */ + IDLE = 0, + /* prepared states */ + PREPARED = 1, + /* started states */ + STARTED = 2, + /* paused states */ + PAUSED = 3, + /* stopped states */ + STOPPED = 4, + /* released states */ + RELEASED = 5, + /* error states */ + ERROR = 6, +} OH_AVRecorderState; + +/** + * @brief reason of recorder state change + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_AVRecorderStateChangeReason { + /* State changed by user operation */ + USER = 0, + /* State changed by background action */ + BACKGROUND = 1, +} OH_AVRecorderStateChangeReason; + +/** + * @brief mode of creating recorder file + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef enum OH_FileGenerationMode { + /* Application Creation */ + APP_CREATE = 0, + /* System Creation. Valid only in camera scene */ + AUTO_CREATE_CAMERA_SCENE = 1, +} OH_FileGenerationMode; + +/** + * @brief Provides the media recorder configuration definitions + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_AVRecorderConfig { + /* Indicates the recording audio source type */ + OH_AVRecorderAudioSourceType audioSourceType; + /* Indicates the recording video source type */ + OH_AVRecorderVideoSourceType videoSourceType; + /* Contains the audio and video encoding profile settings */ + OH_AVRecorderProfile profile; + /* Defines the file URL */ + char *url; + /* Specifies the file generation mode for recording output */ + OH_FileGenerationMode fileGenerationMode; + /* Sets the video rotation angle for the recorded file */ + int32_t rotation; + /* Specifies the location metadata for the recording */ + OH_Location location; + /* Contains additional metadata for the recorded media */ + OH_AVRecorderMetadata metadata; +} OH_AVRecorderConfig; + +/** + * @brief Provides the media recorder profile definitions + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_AVRecorderProfile { + /* Indicates the audio bitrate */ + int32_t audioBitrate; + /* Indicates the number of audio channels */ + int32_t audioChannels; + /* Indicates the audio encoding format */ + OH_AVRecorderCodecMimeType audioCodec; + /* Indicates the audio sampling rate */ + int32_t audioSampleRate; + /* Indicates the output file format */ + OH_AVRecorderContainerFormatType fileFormat; + /* Indicates the video bitrate */ + int32_t videoBitrate; + /* Indicates the video encoding format */ + OH_AVRecorderCodecMimeType videoCodec; + /* Indicates the video width */ + int32_t videoFrameWidth; + /* Indicates the video height */ + int32_t videoFrameHeight; + /* Indicates the video frame rate */ + int32_t videoFrameRate; + /* Whether to record HDR video */ + bool isHdr; + /* Whether to encode the video in temporal scale mode */ + bool enableTemporalScale; +} OH_AVRecorderProfile; + +/** + * @brief Provides the geographical location definitions for media resources + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_Location { + /* Latitude */ + int32_t latitude; + /* Longitude */ + int32_t longitude; +} OH_Location; + +/** + * @brief Provides the container definition for media data + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_AVRecorderMetadata { + /* The metadata to retrieve the content type or genre of the data source */ + char *genre; + /* The metadata to retrieve the information about the video orientation */ + char *videoOrientation; + /* The geographical location info of the video */ + OH_Location location; + /* Custom parameter key-value map read from moov.meta.list */ + OH_MetadataTemplate customInfo; +} OH_AVRecorderMetadata; + +/** + * @brief define the basic template of metadata + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_MetadataTemplate { + /* key value of the matadata */ + char *key; + /* contents of the matadata */ + char *value; +} OH_MetadataTemplate; + +/** + * @brief Provides encoder info + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_EncoderInfo { + /* encoder format MIME */ + OH_AVRecorderCodecMimeType mimeType; + /* encoder type, audio or video */ + char *type; + /* audio or video encoder bitRate range */ + OH_Range bitRate; + /* video encoder frame rate range */ + OH_Range frameRate; + /* video encoder width range */ + OH_Range width; + /* video encoder height range */ + OH_Range height; + /* audio encoder channel range */ + OH_Range channels; + /* audio encoder sample rate collection */ + int32_t *sampleRate; + /* length of sampleRate list */ + int32_t sampleRateLen; +} OH_EncoderInfo; + +/** + * @brief Provides Range with lower and upper limit + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 14 + * @version 1.0 + */ +typedef struct OH_Range { + /* lower limit of the range */ + int32_t min; + /* upper limit of the range */ + int32_t max; +} OH_Range; + +/** + * @brief Called when the state changed of current recording. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder The pointer to an OH_AVRecorder instance. + * @param state Indicates the recorder state. For details, see {@link OH_AVRecorderState}. + * @param reason for recorder state change. For details, see {@link OH_AVRecorderStateChangeReason}. + * @since 14 + * @version 1.0 + */ +typedef void (*OH_AVRecorder_OnStateChange)(OH_AVRecorder *recorder, + OH_AVRecorderState state, OH_AVRecorderStateChangeReason reason); + +/** + * @brief Called when an error occurred during recording + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance. + * @param errorCode Error code. + * @param errorMsg Error message. + * @since 14 + * @version 1.0 + */ +typedef void (*OH_AVRecorder_OnError)(OH_AVRecorder *recorder, int32_t errorCode, const char *errorMsg); + +/** + * @brief Called when current recording is finished in OH_FileGenerationMode.AUTO_CREATE_CAMERA_SCENE + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance. + * @param asset Error code. + * @since 14 + * @version 1.0 + */ +typedef void (*OH_AVRecorder_OnURI)(OH_AVRecorder *recorder, OH_MediaAsset *asset); + + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H \ No newline at end of file -- Gitee From 1673718257976c4bd5c69ee0634bb34e12138e89 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 26 Oct 2024 08:24:39 +0000 Subject: [PATCH 04/10] update multimedia/player_framework/avrecorder/libavplayer.ndk.json. Signed-off-by: Steven --- .../avrecorder/libavplayer.ndk.json | 72 +++++++++++++++---- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/multimedia/player_framework/avrecorder/libavplayer.ndk.json b/multimedia/player_framework/avrecorder/libavplayer.ndk.json index 3a57a9178..ed0daa886 100644 --- a/multimedia/player_framework/avrecorder/libavplayer.ndk.json +++ b/multimedia/player_framework/avrecorder/libavplayer.ndk.json @@ -1,14 +1,62 @@ [ - { - "first_introduced": "14", - "name": "OH_AVRecorder_Create" - }, - { - "first_introduced": "14", - "name": "OH_AVRecorder_Prepare" - }, - { - "first_introduced": "14", - "name": "OH_AVRecorder_Start" - } + { + "first_introduced": "14", + "name": "OH_AVRecorder_Create" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Prepare" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_GetAVRecorderConfig" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_GetInputSurface" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_UpdateRotation" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Start" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Pause" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Resume" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Stop" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Reset" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_Release" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_GetAvailableEncoder" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_SetStateCallback" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_SetErrorCallback" + }, + { + "first_introduced": "14", + "name": "OH_AVRecorder_SetURICallback" + } ] \ No newline at end of file -- Gitee From f8a9962bd836ca0394f39cd941b2e5826db557a8 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 26 Oct 2024 10:21:02 +0000 Subject: [PATCH 05/10] update multimedia/player_framework/avrecorder_base.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder_base.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h index c6b541894..36f9b7d96 100644 --- a/multimedia/player_framework/avrecorder_base.h +++ b/multimedia/player_framework/avrecorder_base.h @@ -35,8 +35,8 @@ * @version 1.0 */ -#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H -#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H #include #include @@ -354,4 +354,4 @@ typedef void (*OH_AVRecorder_OnURI)(OH_AVRecorder *recorder, OH_MediaAsset *asse } #endif -#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASH_H \ No newline at end of file +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H \ No newline at end of file -- Gitee From fd04b368ff86b19715d5b5b927c30068f3760dd7 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 30 Oct 2024 02:55:09 +0000 Subject: [PATCH 06/10] update multimedia/player_framework/avrecorder.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h index dca24383f..c5b21b019 100644 --- a/multimedia/player_framework/avrecorder.h +++ b/multimedia/player_framework/avrecorder.h @@ -19,9 +19,10 @@ * * @brief Provides APIs of request capability for Recorder. * - * @Syscap SystemCapability.Multimedia.Media.AVRecorder + * @Syscap systemcapability.multimedia.media.avrecorder * @since 14 * @version 1.0 + * @} */ /** @@ -32,6 +33,7 @@ * * @kit MediaKit * @library libavrecorder.so + * @Syscap SystemCapability.Multimedia.Media.AVRecorder * @since 14 * @version 1.0 */ @@ -71,26 +73,26 @@ OH_AVRecorder *OH_AVRecorder_Create(void); * @since 14 * @version 1.0 */ -OH_AVErrCode OH_AVRecorder_Prepare(OH_AVRecorder *recorder, OH_AVRecorderConfig *config); +OH_AVErrCode OH_AVRecorder_Prepare(OH_AVRecorder *recorder, OH_AVRecorder_Config *config); /** * @brief Get current recording parameters, it must be called after prepare. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder Pointer to an OH_AVRecorder instance - * @param config Double Pointer to an OH_AVRecorderConfig instance, see {@link OH_AVRecorderConfig} + * @param config Pointer to an OH_AVRecorderConfig instance, see {@link OH_AVRecorderConfig} * @return Function result code. * {@link AV_ERR_OK} if the execution is successful. * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or config is null. * @since 14 * @version 1.0 */ -OH_AVErrCode OH_AVRecorder_GetAVRecorderConfig(OH_AVRecorder *recorder, OH_AVRecorderConfig **config); +OH_AVErrCode OH_AVRecorder_GetAVRecorderConfig(OH_AVRecorder *recorder, OH_AVRecorder_Config **config); /** * @brief Get input surface, it must be called between prepare completed and start. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder Pointer to an OH_AVRecorder instance - * @param window Double Pointer to an OHNativeWindow instance, see {@link OHNativeWindow} + * @param window Pointer to an OHNativeWindow instance, see {@link OHNativeWindow} * @return Function result code. * {@link AV_ERR_OK} if the execution is successful. * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. @@ -188,7 +190,7 @@ OH_AVErrCode OH_AVRecorder_Release(OH_AVRecorder *recorder); * @brief Get available encoder and encoder info for AVRecorder. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder Pointer to an OH_AVRecorder instance - * @param info Double Pointer to an OH_EncoderInfo instance, see {@link OH_EncoderInfo} + * @param info Double Pointer to an OH_EncoderInfo instance, see {@link OH_AVRecorder_EncoderInfo} * @param length Length of available encoders * @return Function result code. * {@link AV_ERR_OK} if the execution is successful. @@ -196,7 +198,7 @@ OH_AVErrCode OH_AVRecorder_Release(OH_AVRecorder *recorder); * @since 14 * @version 1.0 */ -OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_EncoderInfo **info, int32_t *length); +OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_AVRecorder_EncoderInfo **info, int32_t *length); /** * @brief Set the state callback function so that your application can respond to the @@ -211,7 +213,8 @@ OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_Encod * @since 14 * @version 1.0 */ -OH_AVErrCode OH_AVRecorder_SetStateCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnStateChange callback, void *userData); +OH_AVErrCode OH_AVRecorder_SetStateCallback( + OH_AVRecorder *recorder, OH_AVRecorder_OnStateChange callback, void *userData); /** * @brief Set the error callback function so that your application can respond to the @@ -233,7 +236,7 @@ OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecord * URI events generated by the av recorder. This interface must be called before Start is called. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder Pointer to an OH_AVRecorder instance - * @param callback Error callback function, see {@link OH_AVRecorder_OnURI} + * @param callback Error callback function, see {@link OH_AVRecorder_OnUri} * @param userData Pointer to user specific data * @return Function result code. * {@link AV_ERR_OK} if the execution is successful. @@ -241,7 +244,7 @@ OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecord * @since 14 * @version 1.0 */ -OH_AVErrCode OH_AVRecorder_SetURICallback(OH_AVRecorder *recorder, OH_AVRecorder_OnURI callback, void *userData); +OH_AVErrCode OH_AVRecorder_SetUriCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnUri callback, void *userData); #ifdef __cplusplus -- Gitee From a3b8097a82a82ec29978649021329b6714d195dd Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 30 Oct 2024 02:55:26 +0000 Subject: [PATCH 07/10] update multimedia/player_framework/avrecorder_base.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder_base.h | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h index 36f9b7d96..f9dd4ab9f 100644 --- a/multimedia/player_framework/avrecorder_base.h +++ b/multimedia/player_framework/avrecorder_base.h @@ -60,7 +60,7 @@ typedef struct OH_AVRecorder OH_AVRecorder; * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderAudioSourceType { +typedef enum OH_AVRecorder_AudioSourceType { /* Default audio source type. */ DEFAULT = 0, /* Source type mic. */ @@ -73,7 +73,7 @@ typedef enum OH_AVRecorderAudioSourceType { VOICE_MESSAGE = 10, /* Source type Camcorder. */ CAMCORDER = 13, -} OH_AVRecorderAudioSourceType; +} OH_AVRecorder_AudioSourceType; /** * @brief video source type for recorder @@ -81,12 +81,12 @@ typedef enum OH_AVRecorderAudioSourceType { * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderVideoSourceType { +typedef enum OH_AVRecorder_VideoSourceType { /* Surface raw data. */ SURFACE_YUV = 0, /* Surface ES data. */ SURFACE_ES = 1, -} OH_AVRecorderVideoSourceType; +} OH_AVRecorder_VideoSourceType; /** * @brief Enumerates Codec MIME types @@ -94,7 +94,7 @@ typedef enum OH_AVRecorderVideoSourceType { * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderCodecMimeType { +typedef enum OH_AVRecorder_CodecMimeType { /* H.264 codec MIME type. */ VIDEO_AVC = 2, /* AAC codec MIME type. */ @@ -107,7 +107,7 @@ typedef enum OH_AVRecorderCodecMimeType { VIDEO_MPEG4 = 6, /* H.265 codec MIME type. */ VIDEO_HEVC = 8, -} OH_AVRecorderCodecMimeType; +} OH_AVRecorder_CodecMimeType; /** * @brief Enumerates container format type(The abbreviation for 'container format type' is CFT) @@ -115,7 +115,7 @@ typedef enum OH_AVRecorderCodecMimeType { * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderContainerFormatType { +typedef enum OH_AVRecorder_ContainerFormatType { /* A video container format type mp4. */ CFT_MPEG_4 = 2, /* A audio container format type m4a. */ @@ -124,7 +124,7 @@ typedef enum OH_AVRecorderContainerFormatType { CFT_MP3 = 9, /* A audio container format type wav. */ CFT_WAV = 10, -} OH_AVRecorderContainerFormatType; +} OH_AVRecorder_ContainerFormatType; /** * @brief Recorder States @@ -132,7 +132,7 @@ typedef enum OH_AVRecorderContainerFormatType { * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderState { +typedef enum OH_AVRecorder_State { /* idle states */ IDLE = 0, /* prepared states */ @@ -147,7 +147,7 @@ typedef enum OH_AVRecorderState { RELEASED = 5, /* error states */ ERROR = 6, -} OH_AVRecorderState; +} OH_AVRecorder_State; /** * @brief reason of recorder state change @@ -155,12 +155,12 @@ typedef enum OH_AVRecorderState { * @since 14 * @version 1.0 */ -typedef enum OH_AVRecorderStateChangeReason { +typedef enum OH_AVRecorder_StateChangeReason { /* State changed by user operation */ USER = 0, /* State changed by background action */ BACKGROUND = 1, -} OH_AVRecorderStateChangeReason; +} OH_AVRecorder_StateChangeReason; /** * @brief mode of creating recorder file @@ -168,12 +168,12 @@ typedef enum OH_AVRecorderStateChangeReason { * @since 14 * @version 1.0 */ -typedef enum OH_FileGenerationMode { +typedef enum OH_AVRecorder_FileGenerationMode { /* Application Creation */ APP_CREATE = 0, /* System Creation. Valid only in camera scene */ AUTO_CREATE_CAMERA_SCENE = 1, -} OH_FileGenerationMode; +} OH_AVRecorder_FileGenerationMode; /** * @brief Provides the media recorder configuration definitions @@ -181,24 +181,24 @@ typedef enum OH_FileGenerationMode { * @since 14 * @version 1.0 */ -typedef struct OH_AVRecorderConfig { +typedef struct OH_AVRecorder_Config { /* Indicates the recording audio source type */ - OH_AVRecorderAudioSourceType audioSourceType; + OH_AVRecorder_AudioSourceType audioSourceType; /* Indicates the recording video source type */ - OH_AVRecorderVideoSourceType videoSourceType; + OH_AVRecorder_VideoSourceType videoSourceType; /* Contains the audio and video encoding profile settings */ - OH_AVRecorderProfile profile; + OH_AVRecorder_Profile profile; /* Defines the file URL */ char *url; /* Specifies the file generation mode for recording output */ - OH_FileGenerationMode fileGenerationMode; + OH_AVRecorder_FileGenerationMode fileGenerationMode; /* Sets the video rotation angle for the recorded file */ int32_t rotation; /* Specifies the location metadata for the recording */ - OH_Location location; + OH_AVRecorder_Location location; /* Contains additional metadata for the recorded media */ - OH_AVRecorderMetadata metadata; -} OH_AVRecorderConfig; + OH_AVRecorder_Metadata metadata; +} OH_AVRecorder_Config; /** * @brief Provides the media recorder profile definitions @@ -206,21 +206,21 @@ typedef struct OH_AVRecorderConfig { * @since 14 * @version 1.0 */ -typedef struct OH_AVRecorderProfile { +typedef struct OH_AVRecorder_Profile { /* Indicates the audio bitrate */ int32_t audioBitrate; /* Indicates the number of audio channels */ int32_t audioChannels; /* Indicates the audio encoding format */ - OH_AVRecorderCodecMimeType audioCodec; + OH_AVRecorder_CodecMimeType audioCodec; /* Indicates the audio sampling rate */ int32_t audioSampleRate; /* Indicates the output file format */ - OH_AVRecorderContainerFormatType fileFormat; + OH_AVRecorder_ContainerFormatType fileFormat; /* Indicates the video bitrate */ int32_t videoBitrate; /* Indicates the video encoding format */ - OH_AVRecorderCodecMimeType videoCodec; + OH_AVRecorder_CodecMimeType videoCodec; /* Indicates the video width */ int32_t videoFrameWidth; /* Indicates the video height */ @@ -231,7 +231,7 @@ typedef struct OH_AVRecorderProfile { bool isHdr; /* Whether to encode the video in temporal scale mode */ bool enableTemporalScale; -} OH_AVRecorderProfile; +} OH_AVRecorder_Profile; /** * @brief Provides the geographical location definitions for media resources @@ -239,12 +239,12 @@ typedef struct OH_AVRecorderProfile { * @since 14 * @version 1.0 */ -typedef struct OH_Location { +typedef struct OH_AVRecorder_Location { /* Latitude */ int32_t latitude; /* Longitude */ int32_t longitude; -} OH_Location; +} OH_AVRecorder_Location; /** * @brief Provides the container definition for media data @@ -252,16 +252,16 @@ typedef struct OH_Location { * @since 14 * @version 1.0 */ -typedef struct OH_AVRecorderMetadata { +typedef struct OH_AVRecorder_Metadata { /* The metadata to retrieve the content type or genre of the data source */ char *genre; /* The metadata to retrieve the information about the video orientation */ char *videoOrientation; /* The geographical location info of the video */ - OH_Location location; + OH_AVRecorder_Location location; /* Custom parameter key-value map read from moov.meta.list */ - OH_MetadataTemplate customInfo; -} OH_AVRecorderMetadata; + OH_AVRecorder_MetadataTemplate customInfo; +} OH_AVRecorder_Metadata; /** * @brief define the basic template of metadata @@ -269,12 +269,12 @@ typedef struct OH_AVRecorderMetadata { * @since 14 * @version 1.0 */ -typedef struct OH_MetadataTemplate { +typedef struct OH_AVRecorder_MetadataTemplate { /* key value of the matadata */ char *key; /* contents of the matadata */ char *value; -} OH_MetadataTemplate; +} OH_AVRecorder_MetadataTemplate; /** * @brief Provides encoder info @@ -282,9 +282,9 @@ typedef struct OH_MetadataTemplate { * @since 14 * @version 1.0 */ -typedef struct OH_EncoderInfo { +typedef struct OH_AVRecorder_EncoderInfo { /* encoder format MIME */ - OH_AVRecorderCodecMimeType mimeType; + OH_AVRecorder_CodecMimeType mimeType; /* encoder type, audio or video */ char *type; /* audio or video encoder bitRate range */ @@ -301,7 +301,7 @@ typedef struct OH_EncoderInfo { int32_t *sampleRate; /* length of sampleRate list */ int32_t sampleRateLen; -} OH_EncoderInfo; +} OH_AVRecorder_EncoderInfo; /** * @brief Provides Range with lower and upper limit @@ -309,24 +309,25 @@ typedef struct OH_EncoderInfo { * @since 14 * @version 1.0 */ -typedef struct OH_Range { +typedef struct OH_AVRecorder_Range { /* lower limit of the range */ int32_t min; /* upper limit of the range */ int32_t max; -} OH_Range; +} OH_AVRecorder_Range; /** * @brief Called when the state changed of current recording. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder The pointer to an OH_AVRecorder instance. - * @param state Indicates the recorder state. For details, see {@link OH_AVRecorderState}. - * @param reason for recorder state change. For details, see {@link OH_AVRecorderStateChangeReason}. + * @param state Indicates the recorder state. For details, see {@link OH_AVRecorder_State}. + * @param reason for recorder state change. For details, see {@link OH_AVRecorder_StateChangeReason}. + * @param userData Pointer to user specific data. * @since 14 * @version 1.0 */ typedef void (*OH_AVRecorder_OnStateChange)(OH_AVRecorder *recorder, - OH_AVRecorderState state, OH_AVRecorderStateChangeReason reason); + OH_AVRecorder_State state, OH_AVRecorder_StateChangeReason reason, void *userData); /** * @brief Called when an error occurred during recording @@ -334,20 +335,23 @@ typedef void (*OH_AVRecorder_OnStateChange)(OH_AVRecorder *recorder, * @param recorder Pointer to an OH_AVRecorder instance. * @param errorCode Error code. * @param errorMsg Error message. + * @param userData Pointer to user specific data. * @since 14 * @version 1.0 */ -typedef void (*OH_AVRecorder_OnError)(OH_AVRecorder *recorder, int32_t errorCode, const char *errorMsg); +typedef void (*OH_AVRecorder_OnError)(OH_AVRecorder *recorder, int32_t errorCode, const char *errorMsg, + void *userData); /** - * @brief Called when current recording is finished in OH_FileGenerationMode.AUTO_CREATE_CAMERA_SCENE + * @brief Called when current recording is finished in OH_AVRecorder_FileGenerationMode.AUTO_CREATE_CAMERA_SCENE * @syscap SystemCapability.Multimedia.Media.AVRecorder * @param recorder Pointer to an OH_AVRecorder instance. * @param asset Error code. + * @param userData Pointer to user specific data. * @since 14 * @version 1.0 */ -typedef void (*OH_AVRecorder_OnURI)(OH_AVRecorder *recorder, OH_MediaAsset *asset); +typedef void (*OH_AVRecorder_OnUri)(OH_AVRecorder *recorder, OH_MediaAsset *asset, void *userData); #ifdef __cplusplus -- Gitee From 3952608f8315a749d2bc60a1bdd1d05494f3bb87 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 4 Nov 2024 03:38:47 +0000 Subject: [PATCH 08/10] rename libavrecorder.ndk.json Signed-off-by: Steven --- .../avrecorder/{libavplayer.ndk.json => libavrecorder.ndk.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename multimedia/player_framework/avrecorder/{libavplayer.ndk.json => libavrecorder.ndk.json} (100%) diff --git a/multimedia/player_framework/avrecorder/libavplayer.ndk.json b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json similarity index 100% rename from multimedia/player_framework/avrecorder/libavplayer.ndk.json rename to multimedia/player_framework/avrecorder/libavrecorder.ndk.json -- Gitee From 50b6607e5e5008b73eaa0deaa95219ad4c1e5234 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 4 Nov 2024 12:14:05 +0000 Subject: [PATCH 09/10] update multimedia/player_framework/avrecorder_base.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h index f9dd4ab9f..e2bca15c5 100644 --- a/multimedia/player_framework/avrecorder_base.h +++ b/multimedia/player_framework/avrecorder_base.h @@ -241,9 +241,9 @@ typedef struct OH_AVRecorder_Profile { */ typedef struct OH_AVRecorder_Location { /* Latitude */ - int32_t latitude; + float latitude; /* Longitude */ - int32_t longitude; + float longitude; } OH_AVRecorder_Location; /** -- Gitee From d7f261ffe13ba81d0322f5665701ffe4821e40e5 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 6 Nov 2024 03:36:37 +0000 Subject: [PATCH 10/10] update multimedia/player_framework/avrecorder_base.h. Signed-off-by: Steven --- multimedia/player_framework/avrecorder_base.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h index e2bca15c5..e8e57fd76 100644 --- a/multimedia/player_framework/avrecorder_base.h +++ b/multimedia/player_framework/avrecorder_base.h @@ -192,10 +192,6 @@ typedef struct OH_AVRecorder_Config { char *url; /* Specifies the file generation mode for recording output */ OH_AVRecorder_FileGenerationMode fileGenerationMode; - /* Sets the video rotation angle for the recorded file */ - int32_t rotation; - /* Specifies the location metadata for the recording */ - OH_AVRecorder_Location location; /* Contains additional metadata for the recorded media */ OH_AVRecorder_Metadata metadata; } OH_AVRecorder_Config; -- Gitee