libnx  v4.6.0
capssc.h
Go to the documentation of this file.
1 /**
2  * @file capssc.h
3  * @brief Screenshot control (caps:sc) service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../sf/service.h"
10 #include "vi.h"
11 
12 #define CAPSSC_JPEG_BUFFER_SIZE 0x80000
13 
14 /// Initialize caps:sc. Only available on [2.0.0+].
16 
17 /// Exit caps:sc.
18 void capsscExit(void);
19 
20 /// Gets the Service for caps:sc.
22 
23 /**
24  * @brief This takes a screenshot, with the screenshot being written into the output buffer.
25  * @note Not available with [5.0.0+] (stubbed).
26  * @note buffer_index and buffer_count correspond to buffers with size 0x384000(1280*720*4). These must not be negative.
27  * @param buf Output buffer containing the RGBA8 image.
28  * @param size Size of buf, should be 0x384000(1280*720*4) * buffer_count.
29  * @param layer_stack \ref ViLayerStack
30  * @param width Image width, must be 1280.
31  * @param height Image height, must be 720.
32  * @param buffer_count Total number of output image buffers.
33  * @param buffer_index Starting image buffer index. Must be < buffer_count.
34  * @param timeout Timeout in nanoseconds. A default value of 100000000 can be used.
35  */
36 Result capsscCaptureRawImageWithTimeout(void* buf, size_t size, ViLayerStack layer_stack, u64 width, u64 height, s64 buffer_count, s64 buffer_index, s64 timeout);
37 
38 /**
39  * @brief This takes a raw screenshot, with the screenshot being held until \ref capsscCloseRawScreenShotReadStream is called.
40  * @note Only available on [3.0.0+]. Requires debug mode.
41  * @param out_size Pointer to write the size of the captured raw image to. Always 0x384000(1280*720*4).
42  * @param out_width Pointer to write the width of the captured raw image to. Always 1280.
43  * @param out_height Pointer to write the height of the captured raw image to. Always 720.
44  * @param layer_stack \ref ViLayerStack
45  * @param timeout Timeout in nanoseconds.
46  */
47 Result capsscOpenRawScreenShotReadStream(u64 *out_size, u64 *out_width, u64 *out_height, ViLayerStack layer_stack, s64 timeout);
48 
49 /**
50  * @brief Discards a stream opened by \ref capsscOpenRawScreenShotReadStream.
51  * @note Only available on [3.0.0+]. Requires debug mode.
52  */
54 
55 /**
56  * @brief Reads from a stream opened by \ref capsscOpenRawScreenShotReadStream.
57  * @note Only available on [3.0.0+]. Requires debug mode.
58  * @param bytes_read Pointer to write the amounts of bytes written to buffer.
59  * @param buf Output buffer containing the RGBA8 image.
60  * @param size Size of buf.
61  * @param offset Offset in image where read should start.
62  */
63 Result capsscReadRawScreenShotReadStream(u64 *bytes_read, void* buf, size_t size, u64 offset);
64 
65 /**
66  * @brief This takes a screenshot, with the screenshot being written as jpeg into the output buffer.
67  * @note Only available on [9.0.0+]. Requires debug mode before [10.0.0].
68  * @param out_jpeg_size Pointer to write the size of the captured jpeg to.
69  * @param jpeg_buf Output buffer containing the JPEG image.
70  * @param jpeg_buf_size Size of jpeg_buf, official software uses 0x80000.
71  * @param layer_stack \ref ViLayerStack
72  * @param timeout Timeout in nanoseconds.
73  */
74 Result capsscCaptureJpegScreenShot(u64* out_jpeg_size, void* jpeg_buf, size_t jpeg_buf_size, ViLayerStack layer_stack, s64 timeout);
Result capsscOpenRawScreenShotReadStream(u64 *out_size, u64 *out_width, u64 *out_height, ViLayerStack layer_stack, s64 timeout)
This takes a raw screenshot, with the screenshot being held until capsscCloseRawScreenShotReadStream ...
Service * capsscGetServiceSession(void)
Gets the Service for caps:sc.
Result capsscCloseRawScreenShotReadStream(void)
Discards a stream opened by capsscOpenRawScreenShotReadStream.
Result capsscReadRawScreenShotReadStream(u64 *bytes_read, void *buf, size_t size, u64 offset)
Reads from a stream opened by capsscOpenRawScreenShotReadStream.
Result capsscCaptureJpegScreenShot(u64 *out_jpeg_size, void *jpeg_buf, size_t jpeg_buf_size, ViLayerStack layer_stack, s64 timeout)
This takes a screenshot, with the screenshot being written as jpeg into the output buffer.
Result capsscCaptureRawImageWithTimeout(void *buf, size_t size, ViLayerStack layer_stack, u64 width, u64 height, s64 buffer_count, s64 buffer_index, s64 timeout)
This takes a screenshot, with the screenshot being written into the output buffer.
void capsscExit(void)
Exit caps:sc.
Result capsscInitialize(void)
Initialize caps:sc. Only available on [2.0.0+].
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
Display (vi:*) service IPC wrapper.
ViLayerStack
Used as argument to many capture functions.
Definition: vi.h:61