7dd6f12a创建于 2025年12月15日历史提交

moving_photo_capi.h

Overview

The file declares the APIs related to moving photos. You can use the APIs to obtain moving photo information.

Library: libmedia_asset_manager.so

File to include: <multimedia/media_library/moving_photo_capi.h>

System capability: SystemCapability.FileManagement.PhotoAccessHelper.Core

Since: 13

Related module: MediaAssetManager

Summary

Functions

Name Description
MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri) Obtains the URI of a moving photo.
MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri, char* videoUri) Requests the image data and video data of a moving photo and writes them to the specified URIs, respectively.
MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto, MediaLibrary_ResourceType resourceType, char* uri) Requests the moving photo content of the specified resource type and writes it to the specified URI.
MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto, MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size) Requests the moving photo content of the specified resource type and returns it in ArrayBuffer format.
MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto) Releases an OH_MovingPhoto instance.

Function Description

OH_MovingPhoto_GetUri()

MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri)

Description

Obtains the URI of a moving photo.

Since: 13

Parameters

Parameter Description
OH_MovingPhoto* movingPhoto Pointer to an OH_MovingPhoto instance.
const char** uri Double pointer to the URI of the moving photo obtained.

Return value

Type Description
MediaLibrary_ErrorCode MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.

OH_MovingPhoto_RequestContentWithUris()

MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri,char* videoUri)

Description

Requests the image data and video data of a moving photo and writes them to the specified URIs, respectively.

Required permissions: ohos.permission.READ_IMAGEVIDEO

Since: 13

Parameters

Parameter Description
OH_MovingPhoto* movingPhoto Pointer to an OH_MovingPhoto instance.
char* imageUri Pointer to the URI of the file, to which the image data is written.
char* videoUri Pointer to the URI of the file, to which the video data is written.

Return value

Type Description
MediaLibrary_ErrorCode MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.

OH_MovingPhoto_RequestContentWithUri()

MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, char* uri)

Description

Requests the moving photo content of the specified resource type and writes it to the specified URI.

Required permissions: ohos.permission.READ_IMAGEVIDEO

Since: 13

Parameters

Parameter Description
OH_MovingPhoto* movingPhoto Pointer to an OH_MovingPhoto instance.
MediaLibrary_ResourceType resourceType Resource type, which is specified by MediaLibrary_ResourceType.
char* uri Pointer to the URI of the file, to which the data is written.

Return value

Type Description
MediaLibrary_ErrorCode MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.

OH_MovingPhoto_RequestContentWithBuffer()

MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size)

Description

Requests the moving photo content of the specified resource type and returns it in ArrayBuffer format.

Required permissions: ohos.permission.READ_IMAGEVIDEO

Since: 13

Parameters

Parameter Description
OH_MovingPhoto* movingPhoto Pointer to an OH_MovingPhoto instance.
MediaLibrary_ResourceType resourceType Resource type, which is specified by MediaLibrary_ResourceType.
const uint8_t** buffer Double pointer to the buffer for storing the target file data.
uint32_t* size Pointer to the buffer size.

Return value

Type Description
MediaLibrary_ErrorCode MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.

OH_MovingPhoto_Release()

MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto)

Description

Releases an OH_MovingPhoto instance.

Since: 13

Parameters

Parameter Description
OH_MovingPhoto* movingPhoto Pointer to an OH_MovingPhoto instance.

Return value

Type Description
MediaLibrary_ErrorCode MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.