implement osx grabber .... not tested! need testers!

tune usage hints in external grabbers


Former-commit-id: 816821dd773e90b8076e9b50ced9eb052f43c2f4
This commit is contained in:
redpanther
2016-03-09 11:03:20 +01:00
parent b4e244008f
commit 014a4288f9
14 changed files with 261 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ SET(OsxGrabberQT_HEADERS
)
SET(OsxGrabberHEADERS
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.h
${CURRENT_HEADER_DIR}/OsxFrameGrabber.h
)
SET(OsxGrabberSOURCES
@@ -17,9 +17,9 @@ SET(OsxGrabberSOURCES
)
if(ENABLE_QT5)
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
else(ENABLE_QT5)
QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
endif(ENABLE_QT5)
add_library(osx-grabber

View File

@@ -3,7 +3,7 @@
#include <iostream>
// Local includes
#include "OsxFrameGrabber.h"
#include <grabber/OsxFrameGrabber.h>
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height) :
_screenIndex(display),

View File

@@ -1,59 +0,0 @@
#pragma once
// OSX includes
#include <CoreGraphics/CoreGraphics.h>
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgb.h>
#include <utils/VideoMode.h>
#include <utils/ImageResampler.h>
///
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
///
class OsxFrameGrabber
{
public:
///
/// Construct a OsxFrameGrabber that will capture snapshots with specified dimensions.
///
/// @param[in] display The index of the display to capture
/// @param[in] width The width of the captured screenshot
/// @param[in] height The heigth of the captured screenshot
///
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
~OsxFrameGrabber();
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
void setVideoMode(const VideoMode videoMode);
///
/// 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)
///
void grabFrame(Image<ColorRgb> & image);
private:
/// display
const unsigned _screenIndex;
/// With of the captured snapshot [pixels]
const unsigned _width;
/// Height of the captured snapshot [pixels]
const unsigned _height;
/// Reference to the captured diaplay
CGDirectDisplayID _display;
/// Image resampler for downscaling the image
ImageResampler * _imgResampler;
};

View File

@@ -5,7 +5,7 @@
// Osx grabber includes
#include <grabber/OsxWrapper.h>
#include "OsxFrameGrabber.h"
#include <grabber/OsxFrameGrabber.h>
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
_updateInterval_ms(1000/updateRate_Hz),