harmony 鸿蒙native_avscreen_capture.h

  • 2025-06-12
  • 浏览 (4)

native_avscreen_capture.h

Overview

The native_avscreen_capture.h file declares the APIs used to create an OH_AVScreenCapture instance.

Library: libnative_avscreen_capture.so

File to include:

System capability: SystemCapability.Multimedia.Media.AVScreenCapture

Since: 10

Related module: AVScreenCapture

Summary

Functions

Name Description
struct OH_AVScreenCapture * OH_AVScreenCapture_Create (void) Creates an OH_AVScreenCapture instance.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init (struct OH_AVScreenCapture *capture, OH_AVScreenCaptureConfig config) Initializes parameters related to an OH_AVScreenCapture instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture (struct OH_AVScreenCapture *capture) Starts screen capture and collects original streams.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCaptureWithSurface (struct OH_AVScreenCapture *capture, OHNativeWindow *window) Starts screen capture in surface mode.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture (struct OH_AVScreenCapture *capture) Stops screen capture. This function is used in pair with OH_AVScreenCapture_StartScreenCapture.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording (struct OH_AVScreenCapture *capture) Starts screen recording, with recordings saved in files.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording (struct OH_AVScreenCapture *capture) Stops screen recording. This function is used in pair with OH_AVScreenCapture_StartScreenRecording.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer (struct OH_AVScreenCapture *capture, OH_AudioBuffer **audiobuffer, OH_AudioCaptureSourceType type) Obtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer.
OH_NativeBuffer * OH_AVScreenCapture_AcquireVideoBuffer (struct OH_AVScreenCapture *capture, int32_t *fence, int64_t *timestamp, struct OH_Rect *region) Obtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer (struct OH_AVScreenCapture *capture, OH_AudioCaptureSourceType type) Releases an audio buffer.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer (struct OH_AVScreenCapture *capture) Releases a video buffer.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback (struct OH_AVScreenCapture *capture, struct OH_AVScreenCaptureCallback callback) Sets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release (struct OH_AVScreenCapture *capture) Releases an OH_AVScreenCapture instance. This function is used in pair with OH_AVScreenCapture_Create.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled (struct OH_AVScreenCapture *capture, bool isMicrophone) Enables or disables the microphone.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetStateCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnStateChange callback, void *userData) Sets a state change callback. This function must be called before screen capture starts.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDataCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnBufferAvailable callback, void *userData) Sets a data processing callback. This function must be called before screen capture starts.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnError callback, void *userData) Sets an error processing callback. This function must be called before screen capture starts.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCanvasRotation (struct OH_AVScreenCapture *capture, bool canvasRotation) Sets canvas rotation for screen capture.
struct OH_AVScreenCapture_ContentFilter * OH_AVScreenCapture_CreateContentFilter (void) Creates a content filter.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseContentFilter (struct OH_AVScreenCapture_ContentFilter *filter) Releases a content filter.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddAudioContent (struct OH_AVScreenCapture_ContentFilter *filter, OH_AVScreenCaptureFilterableAudioContent content) Adds audio content to a filter.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent (struct OH_AVScreenCapture *capture, struct OH_AVScreenCapture_ContentFilter *filter) Sets a content filter for an OH_AVScreenCapture instance.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddWindowContent (struct OH_AVScreenCapture_ContentFilter *filter, int32_t *windowIDs, int32_t windowCount) Adds a list of window IDs to a ContentFilter instance.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas (struct OH_AVScreenCapture *capture, int32_t width, int32_t height) Adjusts the screen resolution.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SkipPrivacyMode (struct OH_AVScreenCapture *capture, int32_t *windowIDs, int32_t windowCount) Exempts privacy windows during screen capture.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMaxVideoFrameRate (struct OH_AVScreenCapture *capture, int32_t frameRate) Sets the maximum frame rate for screen capture.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor (struct OH_AVScreenCapture *capture, bool showCursor) Sets whether to show the cursor.
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnDisplaySelected callback, void *userData) Sets a callback function for obtaining the display ID.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Media Kit

harmony 鸿蒙AVImageGenerator

harmony 鸿蒙AVMetadataExtractor

harmony 鸿蒙AVPlayer

harmony 鸿蒙AVPlayerCallback

harmony 鸿蒙AVRecorder

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙OH_AVRecorder_Config

harmony 鸿蒙OH_AVRecorder_EncoderInfo

harmony 鸿蒙OH_AVRecorder_Location

0  赞