hyperion.ng/include/grabber/osx/OsxFrameGrabber.h
LordGrey 733aa662bf
Refactor Python for 3.12 integration (#1807)
* Correct JS requestConfig call

* Update requestWriteConfig to new API format

* Add hyperion-light and bare-minimum preset scenarios

* Refactor Python

* Windows add bcrypt until mbedtls  is fixed
(https://github.com/Mbed-TLS/mbedtls/pull/9554)

* Corrections

* Use ScreenCaptureKit under macOS 15 and above

* ReSigning macOS package

* Python 3.11.10 test

* Revert "Python 3.11.10 test"

This reverts commit ee921e4f1284fe3d984d9422b24a1c56c6916c21.

* Handle defined exits from python scripts

* Update change.log

* CodeQL findings

---------

Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2024-12-01 17:08:25 +01:00

62 lines
1.5 KiB
C++

#pragma once
// CoreGraphics
#include <CoreGraphics/CoreGraphics.h>
// Utils includes
#include <utils/ColorRgb.h>
#include <hyperion/Grabber.h>
///
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
///
class OsxFrameGrabber : public Grabber
{
public:
///
/// Construct a OsxFrameGrabber that will capture snapshots with specified dimensions.
///
/// @param[in] display The index of the display to capture
///
OsxFrameGrabber(int display=kCGDirectMainDisplay);
~OsxFrameGrabber() override;
///
/// @brief Setup a new capture screen, will free the previous one
/// @return True on success, false if no screen is found
///
bool setupDisplay();
///
/// Captures a single snapshot of the display and writes the data to the given image. The
/// provided image should have the same dimensions as the configured values (_width and
/// _height)
///
/// @param[out] image The snapped screenshot (should be initialized with correct width and
/// height)
///
int grabFrame(Image<ColorRgb> & image);
///
/// @brief Overwrite Grabber.h implementation
///
bool setDisplayIndex(int index) override;
///
/// @brief Discover OSX screens available (for configuration).
///
/// @param[in] params Parameters used to overwrite discovery default behaviour
///
/// @return A JSON structure holding a list of devices found
///
QJsonObject discover(const QJsonObject& params);
private:
/// display
int _screenIndex;
/// Reference to the captured display
CGDirectDisplayID _display;
};