harmony 鸿蒙NativeDisplaySoloist

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

NativeDisplaySoloist

Overview

The NativeDisplaySoloist module provides the native service that control the frame rate in threads other than the UI thread.

Since: 12

Summary

Files

Name Description
native_display_soloist.h Declares the functions for obtaining and using native display soloist.

Structs

Name Description
struct  DisplaySoloist_ExpectedRateRange Describes the expected frame rate range.

Types

Name Description
typedef struct OH_DisplaySoloist OH_DisplaySoloist Provides the declaration of an OH_DisplaySoloist struct.
typedef void(* OH_DisplaySoloist_FrameCallback) (long long timestamp, long long targetTimestamp, void *data) Defines the pointer to an OH_DisplaySoloist callback function.
typedef struct DisplaySoloist_ExpectedRateRange DisplaySoloist_ExpectedRateRange Defines a struct for the expected frame rate range.

Functions

Name Description
OH_DisplaySoloist * OH_DisplaySoloist_Create (bool useExclusiveThread) Creates an OH_DisplaySoloist instance. A new OH_DisplaySoloist instance is created each time this API is called.
int32_t OH_DisplaySoloist_Destroy (OH_DisplaySoloist *displaySoloist) Destroys an OH_DisplaySoloist object and reclaims the memory occupied.
int32_t OH_DisplaySoloist_Start (OH_DisplaySoloist *displaySoloist, OH_DisplaySoloist_FrameCallback callback, void *data) Sets a callback function for each frame. The callback function is triggered each time a VSync signal arrives.
int32_t OH_DisplaySoloist_Stop (OH_DisplaySoloist *displaySoloist) Stops requesting the next VSync signal and triggering the callback function.
int32_t OH_DisplaySoloist_SetExpectedFrameRateRange (OH_DisplaySoloist *displaySoloist, DisplaySoloist_ExpectedRateRange *range) Sets the expected frame rate range.

Type Description

DisplaySoloist_ExpectedRateRange

typedef struct DisplaySoloist_ExpectedRateRange DisplaySoloist_ExpectedRateRange

Description

Defines a struct for the expected frame rate range.

Since: 12

OH_DisplaySoloist

typedef struct OH_DisplaySoloist OH_DisplaySoloist

Description

Provides the declaration of an OH_DisplaySoloist struct.

Since: 12

OH_DisplaySoloist_FrameCallback

typedef void(* OH_DisplaySoloist_FrameCallback) (long long timestamp, long long targetTimestamp, void *data)

Description

Defines the pointer to an OH_DisplaySoloist callback function.

Since: 12

Parameters

Name Description
timestamp VSync timestamp.
targetTimestamp Expected VSync timestamp of the next frame.
data User-defined data.

Function Description

OH_DisplaySoloist_Create()

OH_DisplaySoloist* OH_DisplaySoloist_Create (bool useExclusiveThread)

Description

Creates an OH_DisplaySoloist instance. A new OH_DisplaySoloist instance is created each time this API is called.

Since: 12

Parameters

Name Description
useExclusiveThread Whether the OH_DisplaySoloist instance exclusively occupies a thread. The value true means that the instance exclusively occupies a thread, and false means that the instance shares a thread with others.

Returns

Returns the pointer to the OH_DisplaySoloist instance created if the operation is successful; returns a null pointer otherwise. The failure cause may be out of memory.

OH_DisplaySoloist_Destroy()

int32_t OH_DisplaySoloist_Destroy (OH_DisplaySoloist* displaySoloist)

Description

Destroys an OH_DisplaySoloist object and reclaims the memory occupied.

Since: 12

Parameters

Name Description
displaySoloist Pointer to an OH_DisplaySoloist instance.

Returns

Returns 0 if the operation is successful; returns -1 otherwise.

OH_DisplaySoloist_SetExpectedFrameRateRange()

int32_t OH_DisplaySoloist_SetExpectedFrameRateRange (OH_DisplaySoloist* displaySoloist, DisplaySoloist_ExpectedRateRange* range )

Description

Sets the expected frame rate range.

Since: 12

Parameters

Name Description
displaySoloist Pointer to an OH_DisplaySoloist instance.
range Pointer to the expected frame rate range, which is a DisplaySoloist_ExpectedRateRange instance.

Returns

Returns 0 if the operation is successful; returns -1 otherwise.

OH_DisplaySoloist_Start()

int32_t OH_DisplaySoloist_Start (OH_DisplaySoloist* displaySoloist, OH_DisplaySoloist_FrameCallback callback, void* data )

Description

Sets a callback function for each frame. The callback function is triggered each time a VSync signal arrives.

Since: 12

Parameters

Name Description
displaySoloist Pointer to an OH_DisplaySoloist instance.
callback Callback function to be triggered when the next VSync signal arrives.
data Pointer to the user-defined data struct. The type is void*.

Returns

Returns 0 if the operation is successful; returns -1 otherwise.

OH_DisplaySoloist_Stop()

int32_t OH_DisplaySoloist_Stop (OH_DisplaySoloist* displaySoloist)

Description

Stops requesting the next VSync signal and triggering the callback function.

Since: 12

Parameters

Name Description
displaySoloist Pointer to an OH_DisplaySoloist instance.

Returns

Returns 0 if the operation is successful; returns -1 otherwise.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkGraphics 2D

harmony 鸿蒙BufferHandle

harmony 鸿蒙ColorSpacePrimaries

harmony 鸿蒙DisplaySoloist_ExpectedRateRange

harmony 鸿蒙_drawing

harmony 鸿蒙NativeColorSpaceManager

harmony 鸿蒙NativeVsync

harmony 鸿蒙NativeWindow

harmony 鸿蒙OH_Drawing_BitmapFormat

harmony 鸿蒙OH_Drawing_Font_Metrics

0  赞