blob: b6fc859701503c0626c22444a99b3dd45674f1bb [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#ifndef ANDROID_DVR_SCREENSHOT_CLIENT_H_
2#define ANDROID_DVR_SCREENSHOT_CLIENT_H_
3
4#include <memory>
5#include <vector>
6
7#include <pdx/client.h>
8#include <private/dvr/display_rpc.h>
9#include <system/graphics.h>
10
11namespace android {
12namespace dvr {
13
14// Represents a connection to the screenshot service, which allows capturing an
15// upcoming frame as it is being rendered to the display.
16class ScreenshotClient : public pdx::ClientBase<ScreenshotClient> {
17 public:
18 int format() const { return format_; }
19
20 // Attempts to take a screenshot. If successful, sets *data to the contents
21 // of the screenshot and returns zero. Otherwise, returns a negative error
22 // code.
23 // |index| is used to match the requested buffer with various buffer layers.
24 int Take(std::vector<uint8_t>* data, int index, int* return_width,
25 int* return_height);
26
27 private:
28 friend BASE;
29
30 ScreenshotClient();
31
32 // Layout information for screenshots.
33 int format_;
34
35 ScreenshotClient(const ScreenshotClient&) = delete;
36 void operator=(const ScreenshotClient&) = delete;
37};
38
39} // namespace dvr
40} // namespace android
41
42#endif // ANDROID_DVR_SCREENSHOT_CLIENT_H_