1# avrecorder_base.h 2 3 4## Overview 5 6The **avrecorder_base.h** file declares the struct and enums used by the AVRecorder. 7 8**Library**: libavrecorder.so 9 10**File to include**: <multimedia/player_framework/avrecorder_base.h> 11 12**System capability**: SystemCapability.Multimedia.Media.AVRecorder 13 14**Since**: 18 15 16**Related module**: [AVRecorder](_a_v_recorder.md) 17 18 19## Summary 20 21 22### Structs 23 24| Name| Description| 25| -------- | -------- | 26| struct [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) | Describes the parameters used for audio and video recording.<br>You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to 0, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to 0, video recording is disabled.| 27| struct [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) | Describes the geographical location information about a media asset.| 28| struct [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) | Describes the basic template of metadata.| 29| struct [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) | Describes the metadata.| 30| struct [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) | Describes the AVRecorder configuration.| 31| struct [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) | Describes the range.| 32| struct [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) | Describes the encoder information.| 33 34 35### Types 36 37| Name| Description| 38| -------- | -------- | 39| typedef struct [OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) [OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) | Defines a struct for the AVRecorder.| 40| typedef enum [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype-1) [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype) | Defines an enum for the audio source types of the AVRecorder.| 41| typedef enum [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype-1) [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype) | Defines an enum for the video source types of the AVRecorder.| 42| typedef enum [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype-1) [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype) | Defines an enum for the MIME types of the encoder.| 43| typedef enum [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype-1) [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype) | Defines an enum for the Container Format Types (CFTs).| 44| typedef enum [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state-1) [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state) | Defines an enum for the AVRecorder states.| 45| typedef enum [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason-1) [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason) | Defines an enum for the reasons for AVRecorder state changes.| 46| typedef enum [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode-1) [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode) | Defines an enum for the modes available for creating a recording file.| 47| typedef struct [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) [OH_AVRecorder_Profile](_a_v_recorder.md#oh_avrecorder_profile) | Defines a struct for the parameters used for audio and video recording.<br>You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to 0, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to 0, video recording is disabled.| 48| typedef struct [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) [OH_AVRecorder_Location](_a_v_recorder.md#oh_avrecorder_location) | Defines a struct for the geographical location information about a media asset.| 49| typedef struct [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) [OH_AVRecorder_MetadataTemplate](_a_v_recorder.md#oh_avrecorder_metadatatemplate) | Defines a struct for the basic template of metadata.| 50| typedef struct [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) [OH_AVRecorder_Metadata](_a_v_recorder.md#oh_avrecorder_metadata) | Defines a struct for the metadata.| 51| typedef struct [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) [OH_AVRecorder_Config](_a_v_recorder.md#oh_avrecorder_config) | Defines a struct for the AVRecorder configuration.| 52| typedef struct [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [OH_AVRecorder_Range](_a_v_recorder.md#oh_avrecorder_range) | Defines a struct for the range.| 53| typedef struct [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) [OH_AVRecorder_EncoderInfo](_a_v_recorder.md#oh_avrecorder_encoderinfo) | Defines a struct for the encoder information.| 54| typedef void(\* [OH_AVRecorder_OnStateChange](_a_v_recorder.md#oh_avrecorder_onstatechange)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state) state, [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason) reason, void \*userData) | Defines a callback invoked when the AVRecorder state changes.| 55| typedef void(\* [OH_AVRecorder_OnError](_a_v_recorder.md#oh_avrecorder_onerror)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines a callback invoked when an error occurs during recording.| 56| typedef void(\* [OH_AVRecorder_OnUri](_a_v_recorder.md#oh_avrecorder_onuri)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, OH_MediaAsset \*asset, void \*userData) | Defines a callback invoked when the recording is in OH_AVRecorder_FileGenerationMode.AVRECORDER_AUTO_CREATE_CAMERA_SCENE mode.| 57 58 59### Enums 60 61| Name| Description| 62| -------- | -------- | 63| [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype-1) {<br>AVRECORDER_DEFAULT = 0,<br>AVRECORDER_MIC = 1,<br>AVRECORDER_VOICE_RECOGNITION = 2,<br>AVRECORDER_VOICE_COMMUNICATION = 7,<br>AVRECORDER_VOICE_MESSAGE = 10,<br>AVRECORDER_CAMCORDER = 13<br>} | Enumerates the audio source types of the AVRecorder.| 64| [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype-1) {<br>AVRECORDER_SURFACE_YUV = 0,<br>AVRECORDER_SURFACE_ES = 1<br>} | Enumerates the video source types of the AVRecorder.| 65| [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype-1) {<br>AVRECORDER_VIDEO_AVC = 2,<br>AVRECORDER_AUDIO_AAC = 3,<br>AVRECORDER_AUDIO_MP3 = 4,<br>AVRECORDER_AUDIO_G711MU = 5,<br>AVRECORDER_VIDEO_MPEG4 = 6,<br>AVRECORDER_VIDEO_HEVC = 8,<br>AVRECORDER_AUDIO_AMR_NB = 9,<br>AVRECORDER_AUDIO_AMR_WB = 10<br>} | Enumerates the MIME types of the encoder.| 66| [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype-1) {<br>AVRECORDER_CFT_MPEG_4 = 2,<br>AVRECORDER_CFT_MPEG_4A = 6,<br>AVRECORDER_CFT_AMR = 8,<br>AVRECORDER_CFT_MP3 = 9,<br>AVRECORDER_CFT_WAV = 10<br>} | Enumerates the CFTs.| 67| [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state-1) {<br>AVRECORDER_IDLE = 0,<br>AVRECORDER_PREPARED = 1,<br>AVRECORDER_STARTED = 2,<br>AVRECORDER_PAUSED = 3,<br>AVRECORDER_STOPPED = 4,<br>AVRECORDER_RELEASED = 5,<br>AVRECORDER_ERROR = 6<br>} | Enumerates the AVRecorder states.| 68| [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason-1) {<br>AVRECORDER_USER = 0,<br>AVRECORDER_BACKGROUND = 1<br>} | Enumerates the reasons for AVRecorder state changes.| 69| [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode-1) {<br>AVRECORDER_APP_CREATE = 0,<br>AVRECORDER_AUTO_CREATE_CAMERA_SCENE = 1<br>} | Enumerates the modes available for creating a recording file.| 70