harmony 鸿蒙NativeVsync

  • 2023-10-30
  • 浏览 (515)

NativeVsync

Overview

The NativeVsync module provides the capabilities of native virtual synchronization (VSync).

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Since

9

Summary

Files

Name Description
native_vsync.h Declares the functions for obtaining and using native VSync.
File to include: <native_vsync/native_vsync.h>
Library: libnative_vsync.so

Types

Name Description
OH_NativeVSync Provides the declaration of an OH_NativeVSync struct.
(*OH_NativeVSync_FrameCallback) (long long timestamp, void *data) Defines the pointer to a VSync callback function.

Functions

Name Description
OH_NativeVSync_Create (const char *name, unsigned int length) Creates an OH_NativeVSync instance. A new OH_NativeVSync instance is created each time this function is called.
OH_NativeVSync_Destroy (OH_NativeVSync *nativeVsync) Destroys an OH_NativeVSync instance.
OH_NativeVSync_RequestFrame (OH_NativeVSync *nativeVsync, OH_NativeVSync_FrameCallback callback, void *data) Requests the next VSync signal. When the signal arrives, a callback function is invoked.
OH_NativeVSync_GetPeriod (OH_NativeVSync *nativeVsync, long long *period) Obtains the VSync period.

Type Description

OH_NativeVSync

typedef struct OH_NativeVSync OH_NativeVSync

Description

Provides the declaration of an OH_NativeVSync struct.

OH_NativeVSync_FrameCallback

typedef void(* OH_NativeVSync_FrameCallback) (long long timestamp, void *data)

Description

Defines the pointer to a VSync callback function.

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Parameters

Name Description
timestamp VSync timestamp.
data User-defined data.

Function Description

OH_NativeVSync_GetPeriod()

int OH_NativeVSync_GetPeriod (OH_NativeVSync * nativeVsync, long long * period )

Description

Obtains the VSync period.

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Parameters

Name Description
nativeVsync Pointer to an OH_NativeVSync instance.
period Pointer to the VSync period.

Returns

Returns 0 if the operation is successful.

Since

10

OH_NativeVSync_Create()

OH_NativeVSync* OH_NativeVSync_Create (const char * name, unsigned int length )

Description

Creates an OH_NativeVSync instance. A new OH_NativeVSync instance is created each time this function is called.

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Parameters

Name Description
name Pointer to the name that associates with an OH_NativeVSync instance.
length Length of the name.

Returns

Returns the pointer to an OH_NativeVSync instance.

OH_NativeVSync_Destroy()

void OH_NativeVSync_Destroy (OH_NativeVSync * nativeVsync)

Description

Destroys an OH_NativeVSync instance.

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Parameters

Name Description
nativeVsync Pointer to an OH_NativeVSync instance.

OH_NativeVSync_RequestFrame()

int OH_NativeVSync_RequestFrame (OH_NativeVSync * nativeVsync, OH_NativeVSync_FrameCallback callback, void * data )

Description

Requests the next VSync signal. When the signal arrives, a callback function is invoked.

\@syscap SystemCapability.Graphic.Graphic2D.NativeVsync

Parameters

Name Description
nativeVsync Pointer to an OH_NativeVSync instance.
callback Function pointer of the OH_NativeVSync_FrameCallback type. This function pointer will be called 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.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Native APIs

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙AVSource

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

0  赞