harmony 鸿蒙media_asset_change_request_capi.h

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

media_asset_change_request_capi.h

Overview

The media_asset_change_request_capi.h file declares the APIs related to media asset change requests. You can use the APIs to change media assets.

Library: libmedia_asset_manager.so

File to include:

System capability: SystemCapability.FileManagement.PhotoAccessHelper.Core

Since: 12

Related module: MediaAssetManager

Summary

Functions

|Name|Description| |–|–| |OH_MediaAssetChangeRequest* OH_MediaAssetChangeRequest_Create(OH_MediaAsset* mediaAsset)|Creates an OH_MediaAssetChangeRequest instance.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithUri(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ResourceType resourceType, char* fileUri)|Adds a resource of the given URI.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithBuffer(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ResourceType resourceType, uint8_t* buffer, uint32_t length)|Adds a resource using ArrayBuffer data.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_GetWriteCacheHandler(OH_MediaAssetChangeRequest* changeRequest,int32_t* fd)|Obtains the handler used for writing a file to cache.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_SaveCameraPhoto(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ImageFileType imageFileType)|Saves the photo taken by the camera.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_DiscardCameraPhoto(OH_MediaAssetChangeRequest* changeRequest)|Discards the photo taken by the camera.| |MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_Release(OH_MediaAssetChangeRequest* changeRequest)|Releases an OH_MediaAssetChangeRequest instance.|

Function Description

OH_MediaAssetChangeRequest_Create()

OH_MediaAssetChangeRequest* OH_MediaAssetChangeRequest_Create(OH_MediaAsset* mediaAsset)

Description

Creates an OH_MediaAssetChangeRequest instance.

Since: 12

Parameters

|Parameter|Description| |–|–| |OH_MediaAsset* mediaAsset|Pointer to an OH_MediaAsset instance.|

Return value

|Type|Description| |–|–| |OH_MediaAssetChangeRequest*|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_MediaAssetChangeRequest_AddResourceWithUri()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithUri(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ResourceType resourceType, char* fileUri)

Description

Adds a resource of the given URI.

Since: 13

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest instance.| |MediaLibrary_ResourceType resourceType|Type of the resource to add, which is specified by MediaLibrary_ResourceType.| |char* fileUri|Pointer to the URI of the file.|

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_NO_SUCH_FILE: The file does not exist.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.|

OH_MediaAssetChangeRequest_AddResourceWithBuffer()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithBuffer(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ResourceType resourceType, uint8_t* buffer, uint32_t length)

Description

Adds a resource using ArrayBuffer data.

Since: 12

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest instance.| |MediaLibrary_ResourceType resourceType|Type of the resource to add.| |uint8_t* buffer|Pointer to the data buffer.| |uint32_t length|Length of the data buffer.|

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.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.|

OH_MediaAssetChangeRequest_GetWriteCacheHandler()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_GetWriteCacheHandler(OH_MediaAssetChangeRequest* changeRequest,int32_t* fd)

Description

Obtains the handler used for writing a file to cache.

Required permissions: ohos.permission.WRITE_IMAGEVIDEO

Since: 13

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest instance.| |int32_t* fd|Pointer to the file descriptor (FD) 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.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.|

OH_MediaAssetChangeRequest_SaveCameraPhoto()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_SaveCameraPhoto(OH_MediaAssetChangeRequest* changeRequest,MediaLibrary_ImageFileType imageFileType)

Description

Saves the photo taken by the camera.

Since: 12

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest instance.| |MediaLibrary_ImageFileType imageFileType|Type of the image file of the photo.|

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.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.|

OH_MediaAssetChangeRequest_DiscardCameraPhoto()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_DiscardCameraPhoto(OH_MediaAssetChangeRequest* changeRequest)

Description

Discards the photo taken by the camera.

Since: 12

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest 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.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.|

OH_MediaAssetChangeRequest_Release()

MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_Release(OH_MediaAssetChangeRequest* changeRequest)

Description

Releases an OH_MediaAssetChangeRequest instance.

Since: 12

Parameters

|Parameter|Description| |–|–| |OH_MediaAssetChangeRequest* changeRequest|Pointer to the OH_MediaAssetChangeRequest 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.|

你可能感兴趣的鸿蒙文章

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_manager_capi.h

harmony 鸿蒙MediaAssetManager

harmony 鸿蒙MediaLibrary_RequestId

harmony 鸿蒙MediaLibrary_RequestOptions

harmony 鸿蒙moving_photo_capi.h

harmony 鸿蒙OH_MediaAsset

0  赞