openharmony 鸿蒙 capi-media-asset-change-request-capi-h

2025-06-12 浏览 (1)

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: <multimedia/media_library/media_asset_change_request_capi.h>

System capability: SystemCapability.FileManagement.PhotoAccessHelper.Core

Since: 12

Related module: MediaAssetManager

Summary

Functions

NameDescription
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

ParameterDescription
OH_MediaAsset* mediaAssetPointer to an OH_MediaAsset instance.

Return value

TypeDescription
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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest instance.
MediaLibrary_ResourceType resourceTypeType of the resource to add, which is specified by MediaLibrary_ResourceType.
char* fileUriPointer to the URI of the file.

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_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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest instance.
MediaLibrary_ResourceType resourceTypeType of the resource to add.
uint8_t* bufferPointer to the data buffer.
uint32_t lengthLength of the data buffer.

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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest instance.
int32_t* fdPointer to the file descriptor (FD) 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.
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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest instance.
MediaLibrary_ImageFileType imageFileTypeType of the image file of the photo.

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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest 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.
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

ParameterDescription
OH_MediaAssetChangeRequest* changeRequestPointer to the OH_MediaAssetChangeRequest 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_manager_capi.h

harmony 鸿蒙MediaAssetManager

harmony 鸿蒙MediaLibrary_RequestId

harmony 鸿蒙MediaLibrary_RequestOptions

harmony 鸿蒙moving_photo_capi.h

harmony 鸿蒙OH_MediaAsset

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