• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# moving_photo_capi.h
2
3## Overview
4
5The file declares the APIs related to moving photos. You can use the APIs to obtain moving photo information.
6
7**Library**: libmedia_asset_manager.so
8
9**File to include**: <multimedia/media_library/moving_photo_capi.h>
10
11**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
12
13**Since**: 13
14
15**Related module**: [MediaAssetManager](capi-mediaassetmanager.md)
16
17## Summary
18
19### Functions
20
21| Name| Description|
22| -- | -- |
23| [MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri)](#oh_movingphoto_geturi) | Obtains the URI of a moving photo.|
24| [MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri,char* videoUri)](#oh_movingphoto_requestcontentwithuris) | Requests the image data and video data of a moving photo and writes them to the specified URIs, respectively.|
25| [MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, char* uri)](#oh_movingphoto_requestcontentwithuri) | Requests the moving photo content of the specified resource type and writes it to the specified URI.|
26| [MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size)](#oh_movingphoto_requestcontentwithbuffer) | Requests the moving photo content of the specified resource type and returns it in ArrayBuffer format.|
27| [MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto)](#oh_movingphoto_release) | Releases an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
28
29## Function Description
30
31### OH_MovingPhoto_GetUri()
32
33```
34MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri)
35```
36
37**Description**
38
39Obtains the URI of a moving photo.
40
41**Since**: 13
42
43
44**Parameters**
45
46| Parameter| Description|
47| -- | -- |
48| [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md)* movingPhoto | Pointer to an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
49| const char** uri | Double pointer to the URI of the moving photo obtained.|
50
51**Return value**
52
53| Type| Description|
54| -- | -- |
55| [MediaLibrary_ErrorCode](capi-media-asset-base-capi-h.md#medialibrary_errorcode) | **MEDIA_LIBRARY_OK**: operation success.<br>**MEDIA_LIBRARY_PARAMETER_ERROR**: incorrect parameters. Possible causes:<br>                                      1. A mandatory parameter is not specified.<br>                                      2. A parameter type is incorrect.<br>                                      3. Parameter verification fails.<br>**MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: internal system error.|
56
57### OH_MovingPhoto_RequestContentWithUris()
58
59```
60MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri,char* videoUri)
61```
62
63**Description**
64
65Requests the image data and video data of a moving photo and writes them to the specified URIs, respectively.
66
67**Required permissions**: ohos.permission.READ_IMAGEVIDEO
68
69**Since**: 13
70
71
72**Parameters**
73
74| Parameter| Description|
75| -- | -- |
76| [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md)* movingPhoto | Pointer to an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
77| char* imageUri | Pointer to the URI of the file, to which the image data is written.|
78| char* videoUri | Pointer to the URI of the file, to which the video data is written.|
79
80**Return value**
81
82| Type| Description|
83| -- | -- |
84| [MediaLibrary_ErrorCode](capi-media-asset-base-capi-h.md#medialibrary_errorcode) | **MEDIA_LIBRARY_OK**: operation success.<br>**MEDIA_LIBRARY_PARAMETER_ERROR**: incorrect parameters. Possible causes:<br>                                      1. A mandatory parameter is not specified.<br>                                      2. A parameter type is incorrect.<br>                                      3. Parameter verification fails.<br>**MEDIA_LIBRARY_PERMISSION_DENIED**: no access permission.<br>**MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: internal system error.|
85
86### OH_MovingPhoto_RequestContentWithUri()
87
88```
89MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, char* uri)
90```
91
92**Description**
93
94Requests the moving photo content of the specified resource type and writes it to the specified URI.
95
96**Required permissions**: ohos.permission.READ_IMAGEVIDEO
97
98**Since**: 13
99
100
101**Parameters**
102
103| Parameter| Description|
104| -- | -- |
105| [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md)* movingPhoto | Pointer to an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
106| [MediaLibrary_ResourceType](capi-media-asset-base-capi-h.md#medialibrary_resourcetype) resourceType | Resource type, which is specified by [MediaLibrary_ResourceType](capi-media-asset-base-capi-h.md#medialibrary_resourcetype).|
107| char* uri | Pointer to the URI of the file, to which the data is written.|
108
109**Return value**
110
111| Type| Description|
112| -- | -- |
113| [MediaLibrary_ErrorCode](capi-media-asset-base-capi-h.md#medialibrary_errorcode) | **MEDIA_LIBRARY_OK**: operation success.<br>**MEDIA_LIBRARY_PARAMETER_ERROR**: incorrect parameters. Possible causes:<br>                                      1. A mandatory parameter is not specified.<br>                                      2. A parameter type is incorrect.<br>                                      3. Parameter verification fails.<br>**MEDIA_LIBRARY_PERMISSION_DENIED**: no access permission.<br>**MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: internal system error.|
114
115### OH_MovingPhoto_RequestContentWithBuffer()
116
117```
118MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto,MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size)
119```
120
121**Description**
122
123Requests the moving photo content of the specified resource type and returns it in ArrayBuffer format.
124
125**Required permissions**: ohos.permission.READ_IMAGEVIDEO
126
127**Since**: 13
128
129
130**Parameters**
131
132| Parameter| Description|
133| -- | -- |
134| [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md)* movingPhoto | Pointer to an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
135| [MediaLibrary_ResourceType](capi-media-asset-base-capi-h.md#medialibrary_resourcetype) resourceType | Resource type, which is specified by [MediaLibrary_ResourceType](capi-media-asset-base-capi-h.md#medialibrary_resourcetype).|
136| const uint8_t** buffer | Double pointer to the buffer for storing the target file data.|
137| uint32_t* size | Pointer to the buffer size.|
138
139**Return value**
140
141| Type| Description|
142| -- | -- |
143| [MediaLibrary_ErrorCode](capi-media-asset-base-capi-h.md#medialibrary_errorcode) | **MEDIA_LIBRARY_OK**: operation success.<br>**MEDIA_LIBRARY_PARAMETER_ERROR**: incorrect parameters. Possible causes:<br>                                      1. A mandatory parameter is not specified.<br>                                      2. A parameter type is incorrect.<br>                                      3. Parameter verification fails.<br>**MEDIA_LIBRARY_PERMISSION_DENIED**: no access permission.<br>**MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: internal system error.|
144
145### OH_MovingPhoto_Release()
146
147```
148MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto)
149```
150
151**Description**
152
153Releases an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.
154
155**Since**: 13
156
157
158**Parameters**
159
160| Parameter| Description|
161| -- | -- |
162| [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md)* movingPhoto | Pointer to an [OH_MovingPhoto](capi-mediaassetmanager-oh-movingphoto.md) instance.|
163
164**Return value**
165
166| Type| Description|
167| -- | -- |
168| [MediaLibrary_ErrorCode](capi-media-asset-base-capi-h.md#medialibrary_errorcode) | **MEDIA_LIBRARY_OK**: operation success.<br>**MEDIA_LIBRARY_PARAMETER_ERROR**: incorrect parameters. Possible causes:<br>                                      1. A mandatory parameter is not specified.<br>                                      2. A parameter type is incorrect.<br>                                      3. Parameter verification fails.|
169