openharmony 鸿蒙 capi-moving-photo-capi-h

2025-06-12 浏览 (1)

moving_photo_capi.h

Overview

The moving_photo_capi.h 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

NameDescription
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

ParameterDescription
OH_MovingPhoto* movingPhotoPointer to the OH_MovingPhoto instance.
const char** uriDouble pointer to the URI of the moving photo obtained.

Return value

TypeDescription
MediaLibrary_ErrorCodeMEDIA_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

ParameterDescription
OH_MovingPhoto* movingPhotoPointer to the OH_MovingPhoto instance.
char* imageUriPointer to the URI of the file, to which the image data is written.
char* videoUriPointer to the URI of the file, to which the video data is written.

Return value

TypeDescription
MediaLibrary_ErrorCodeMEDIA_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

ParameterDescription
OH_MovingPhoto* movingPhotoPointer to the OH_MovingPhoto instance.
MediaLibrary_ResourceType resourceTypeResource type, which is specified by MediaLibrary_ResourceType.
char* uriPointer to the URI of the file, to which the data is written.

Return value

TypeDescription
MediaLibrary_ErrorCodeMEDIA_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

ParameterDescription
OH_MovingPhoto* movingPhotoPointer to the OH_MovingPhoto instance.
MediaLibrary_ResourceType resourceTypeResource type, which is specified by MediaLibrary_ResourceType.
const uint8_t** bufferDouble pointer to the buffer for storing the target file data.
uint32_t* sizePointer to the buffer size.

Return value

TypeDescription
MediaLibrary_ErrorCodeMEDIA_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

ParameterDescription
OH_MovingPhoto* movingPhotoPointer to the OH_MovingPhoto instance.

Return value

TypeDescription
MediaLibrary_ErrorCodeMEDIA_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.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Media Library Kit (Media File Management Service)

harmony 鸿蒙media_access_helper_capi.h

harmony 鸿蒙media_asset_base_capi.h

harmony 鸿蒙media_asset_capi.h

harmony 鸿蒙media_asset_change_request_capi.h

harmony 鸿蒙media_asset_manager_capi.h

harmony 鸿蒙MediaAssetManager

harmony 鸿蒙MediaLibrary_RequestId

harmony 鸿蒙MediaLibrary_RequestOptions

harmony 鸿蒙OH_MediaAsset

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