harmony 鸿蒙NativeDisplaySoloist

2025-06-12 浏览 (1)

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

NameDescription
native_display_soloist.hDeclares the functions for obtaining and using native display soloist.

Structs

NameDescription
struct  DisplaySoloist_ExpectedRateRangeDescribes the expected frame rate range.

Types

NameDescription
typedef struct OH_DisplaySoloist OH_DisplaySoloistProvides 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_ExpectedRateRangeDefines a struct for the expected frame rate range.

Functions

NameDescription
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

NameDescription
timestampVSync timestamp.
targetTimestampExpected VSync timestamp of the next frame.
dataUser-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

NameDescription
useExclusiveThreadWhether 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

NameDescription
displaySoloistPointer 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

NameDescription
displaySoloistPointer to an OH_DisplaySoloist instance.
rangePointer 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

NameDescription
displaySoloistPointer to an OH_DisplaySoloist instance.
callbackCallback function to be triggered when the next VSync signal arrives.
dataPointer 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

NameDescription
displaySoloistPointer 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

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/GM1Ibf