Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame^] | 1 | #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 | |
| 11 | namespace android { |
| 12 | namespace 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. |
| 16 | class 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_ |