libnx  v4.8.0
capsu.h
Go to the documentation of this file.
1 /**
2  * @file capsu.h
3  * @brief Application Album (caps:u) service IPC wrapper.
4  * This is only usable with AlbumFiles associated with the current host Application.
5  * @author yellows8
6  * @copyright libnx Authors
7  */
8 #pragma once
9 #include "../types.h"
10 #include "../sf/service.h"
11 #include "../services/caps.h"
12 #include "../services/acc.h"
13 
14 /// Initialize caps:u. Only available on [5.0.0+].
16 
17 /// Exit caps:u.
18 void capsuExit(void);
19 
20 /// Gets the Service for caps:u.
22 
23 /// Gets the Service for IAlbumAccessorApplicationSession, only initialized after \ref capsuOpenAlbumMovieStream was used (unaffected by using \ref capsuCloseAlbumMovieStream).
25 
26 /**
27  * @brief Gets a listing of \ref CapsApplicationAlbumFileEntry.
28  * @note On [6.0.0+] this uses GetAlbumFileList1AafeAruidDeprecated, otherwise this uses GetAlbumFileList0AafeAruidDeprecated.
29  * @note This is an old version of \ref capsuGetAlbumFileList3.
30  * @param[out] entries Output array of \ref CapsApplicationAlbumFileEntry.
31  * @param[in] count Max size of the output array in entries.
32  * @param[in] type \ref CapsContentType
33  * @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
34  * @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
35  * @param[out] total_entries Total output entries.
36  */
37 Result capsuGetAlbumFileListDeprecated1(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries);
38 
39 /**
40  * @brief Gets a listing of \ref CapsApplicationAlbumFileEntry, where the AlbumFile has an UserId which matches the input one. See also \ref capssuSaveScreenShotWithUserIds.
41  * @note Only available on [6.0.0+].
42  * @note This is an old version of \ref capsuGetAlbumFileList4.
43  * @param[out] entries Output array of \ref CapsApplicationAlbumFileEntry.
44  * @param[in] count Max size of the output array in entries.
45  * @param[in] type \ref CapsContentType
46  * @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
47  * @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
48  * @param[in] uid \ref AccountUid
49  * @param[out] total_entries Total output entries.
50  */
51 Result capsuGetAlbumFileListDeprecated2(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries);
52 
53 /**
54  * @brief Gets a listing of \ref CapsApplicationAlbumEntry.
55  * @note Only available on [7.0.0+], on prior sysvers use \ref capsuGetAlbumFileListDeprecated1 instead.
56  * @param[out] entries Output array of \ref CapsApplicationAlbumEntry.
57  * @param[in] count Max size of the output array in entries.
58  * @param[in] type \ref CapsContentType
59  * @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
60  * @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
61  * @param[out] total_entries Total output entries.
62  */
63 Result capsuGetAlbumFileList3(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries);
64 
65 /**
66  * @brief Gets a listing of \ref CapsApplicationAlbumEntry, where the AlbumFile has an UserId which matches the input one. See also \ref capssuSaveScreenShotWithUserIds.
67  * @note Only available on [7.0.0+], on prior sysvers use \ref capsuGetAlbumFileListDeprecated2 instead.
68  * @param[out] entries Output array of \ref CapsApplicationAlbumEntry.
69  * @param[in] count Max size of the output array in entries.
70  * @param[in] type \ref CapsContentType
71  * @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
72  * @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
73  * @param[in] uid \ref AccountUid
74  * @param[out] total_entries Total output entries.
75  */
76 Result capsuGetAlbumFileList4(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries);
77 
78 /**
79  * @brief Deletes the specified AlbumFile.
80  * @param[in] type \ref CapsContentType, must match ::CapsContentType_ExtraMovie.
81  * @param[in] entry \ref CapsApplicationAlbumFileEntry
82  */
84 
85 /**
86  * @brief Gets the filesize for the entire specified AlbumFile.
87  * @param[in] entry \ref CapsApplicationAlbumFileEntry
88  * @param[out] size Output filesize.
89  */
91 
92 /**
93  * @brief Load the ScreenShotImage for the specified AlbumFile.
94  * @param[out] width Output image width. Optional, can be NULL.
95  * @param[out] height Output image height. Optional, can be NULL.
96  * @param[out] attr \ref CapsScreenShotAttributeForApplication
97  * @param[out] userdata Output buffer containing the UserData. Optional, can be NULL. This buffer is cleared to 0 using userdata_maxsize, prior to doing the memcpy.
98  * @param[in] userdata_maxsize Max size of the userdata buffer. Optional, can be 0.
99  * @param[out] userdata_size Userdata size field, clamped to max size sizeof(CapsApplicationData::userdata) when needed.
100  * @param[out] image RGBA8 image output buffer.
101  * @param[in] image_size Image buffer size, should be at least large enough for RGBA8 1280x720.
102  * @param[out] workbuf Work buffer, cleared to 0 by the cmd before it returns.
103  * @param[in] workbuf_size Work buffer size, must be at least the size of the JPEG within the AlbumFile.
104  * @param[in] entry \ref CapsApplicationAlbumFileEntry
105  * @param[in] option \ref CapsScreenShotDecodeOption
106  */
107 Result capsuLoadAlbumScreenShotImage(s32 *width, s32 *height, CapsScreenShotAttributeForApplication *attr, void* userdata, size_t userdata_maxsize, u32 *userdata_size, void* image, size_t image_size, void* workbuf, size_t workbuf_size, const CapsApplicationAlbumFileEntry *entry, const CapsScreenShotDecodeOption *option);
108 
109 /**
110  * @brief Load the ScreenShotThumbnailImage for the specified AlbumFile.
111  * @param[out] width Output image width. Optional, can be NULL.
112  * @param[out] height Output image height. Optional, can be NULL.
113  * @param[out] attr \ref CapsScreenShotAttributeForApplication
114  * @param[out] userdata Output buffer containing the UserData. Optional, can be NULL. This buffer is cleared to 0 using userdata_maxsize, prior to doing the memcpy.
115  * @param[in] userdata_maxsize Max size of the userdata buffer. Optional, can be 0.
116  * @param[out] userdata_size Userdata size field, clamped to max size sizeof(CapsApplicationData::userdata) when needed.
117  * @param[out] image RGBA8 image output buffer.
118  * @param[in] image_size Image buffer size, should be at least large enough for RGBA8 320x180.
119  * @param[out] workbuf Work buffer, cleared to 0 by the cmd before it returns.
120  * @param[in] workbuf_size Work buffer size, must be at least the size of the JPEG within the AlbumFile.
121  * @param[in] entry \ref CapsApplicationAlbumFileEntry
122  * @param[in] option \ref CapsScreenShotDecodeOption
123  */
124 Result capsuLoadAlbumScreenShotThumbnailImage(s32 *width, s32 *height, CapsScreenShotAttributeForApplication *attr, void* userdata, size_t userdata_maxsize, u32 *userdata_size, void* image, size_t image_size, void* workbuf, size_t workbuf_size, const CapsApplicationAlbumFileEntry *entry, const CapsScreenShotDecodeOption *option);
125 
126 /**
127  * @brief PrecheckToCreateContents. Official sw only uses this with ::CapsContentType_ExtraMovie.
128  * @param[in] type \ref CapsContentType
129  * @param[in] unk Unknown.
130  */
132 
133 /**
134  * @brief Opens an AlbumMovieStream.
135  * @note This opens IAlbumAccessorApplicationSession if not previously opened, it's closed during \ref capsuExit.
136  * @note Up to 4 streams can be open at the same time. Multiple streams can be open at the same time for the same \ref CapsApplicationAlbumFileEntry.
137  * @param[out] stream Stream handle.
138  * @param[in] entry \ref CapsApplicationAlbumFileEntry
139  */
141 
142 /**
143  * @brief Closes an AlbumMovieStream.
144  * @param[in] stream Stream handle.
145  */
147 
148 /**
149  * @brief Gets the data size of an AlbumMovieStream.
150  * @param[in] stream Stream handle.
151  * @param[out] size Size of the actual MP4, without the JPEG at the end.
152  */
154 
155 /**
156  * @brief Reads data from an AlbumMovieStream.
157  * @note offset(+size) must not be negative. offset and size must be aligned to 0x40000-bytes.
158  * @note When offset(+size) goes beyond the size from \ref capsuGetAlbumMovieStreamSize, the regions of the buffer which goes beyond that are cleared to 0, and actual_size is still set to the input size.
159  * @param[in] stream Stream handle.
160  * @param[in] offset Offset.
161  * @param[out] Output data buffer.
162  * @param[in] size Data buffer size.
163  * @param[out] actual_size Actual read size.
164  */
165 Result capsuReadAlbumMovieStream(u64 stream, s64 offset, void* buffer, size_t size, u64 *actual_size);
166 
167 /**
168  * @brief Gets the BrokenReason for an AlbumMovieStream.
169  * @note Official sw doesn't use this.
170  * @param[in] stream Stream handle.
171  */
173 
CapsContentType
ContentType.
Definition: caps.h:31
Result capsuGetAlbumFileListDeprecated1(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries)
Gets a listing of CapsApplicationAlbumFileEntry.
Result capsuReadAlbumMovieStream(u64 stream, s64 offset, void *buffer, size_t size, u64 *actual_size)
Reads data from an AlbumMovieStream.
void capsuExit(void)
Exit caps:u.
Result capsuGetAlbumFileListDeprecated2(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries)
Gets a listing of CapsApplicationAlbumFileEntry, where the AlbumFile has an UserId which matches the ...
Result capsuDeleteAlbumFile(CapsContentType type, const CapsApplicationAlbumFileEntry *entry)
Deletes the specified AlbumFile.
Service * capsuGetServiceSession(void)
Gets the Service for caps:u.
Result capsuCloseAlbumMovieStream(u64 stream)
Closes an AlbumMovieStream.
Result capsuOpenAlbumMovieStream(u64 *stream, const CapsApplicationAlbumFileEntry *entry)
Opens an AlbumMovieStream.
Result capsuGetAlbumFileList4(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries)
Gets a listing of CapsApplicationAlbumEntry, where the AlbumFile has an UserId which matches the inpu...
Service * capsuGetServiceSession_Accessor(void)
Gets the Service for IAlbumAccessorApplicationSession, only initialized after capsuOpenAlbumMovieStre...
Result capsuInitialize(void)
Initialize caps:u. Only available on [5.0.0+].
Result capsuLoadAlbumScreenShotImage(s32 *width, s32 *height, CapsScreenShotAttributeForApplication *attr, void *userdata, size_t userdata_maxsize, u32 *userdata_size, void *image, size_t image_size, void *workbuf, size_t workbuf_size, const CapsApplicationAlbumFileEntry *entry, const CapsScreenShotDecodeOption *option)
Load the ScreenShotImage for the specified AlbumFile.
Result capsuGetAlbumMovieStreamBrokenReason(u64 stream)
Gets the BrokenReason for an AlbumMovieStream.
Result capsuPrecheckToCreateContents(CapsContentType type, u64 unk)
PrecheckToCreateContents.
Result capsuGetAlbumMovieStreamSize(u64 stream, u64 *size)
Gets the data size of an AlbumMovieStream.
Result capsuLoadAlbumScreenShotThumbnailImage(s32 *width, s32 *height, CapsScreenShotAttributeForApplication *attr, void *userdata, size_t userdata_maxsize, u32 *userdata_size, void *image, size_t image_size, void *workbuf, size_t workbuf_size, const CapsApplicationAlbumFileEntry *entry, const CapsScreenShotDecodeOption *option)
Load the ScreenShotThumbnailImage for the specified AlbumFile.
Result capsuGetAlbumFileList3(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries)
Gets a listing of CapsApplicationAlbumEntry.
Result capsuGetAlbumFileSize(const CapsApplicationAlbumFileEntry *entry, u64 *size)
Gets the filesize for the entire specified AlbumFile.
Account UserId.
Definition: acc.h:25
AlbumFileDateTime. This corresponds to each field in the Album entry filename, prior to the "-": "YYY...
Definition: caps.h:80
ApplicationAlbumEntry.
Definition: caps.h:108
ApplicationAlbumFileEntry.
Definition: caps.h:129
ScreenShotAttributeForApplication. Only unk_x0 is used by official sw.
Definition: caps.h:47
ScreenShotDecodeOption.
Definition: caps.h:74
Service object structure.
Definition: service.h:14
int64_t s64
64-bit signed integer.
Definition: types.h:28
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21