New XBMC checker functionality: 3D video detection (filename based) and screensaver detection

Former-commit-id: ea95e4ecde3ab9378bdf9c4c60950713947bd0ac
This commit is contained in:
johan
2013-12-21 14:32:30 +01:00
parent e1a60e6944
commit 78795b9fa8
12 changed files with 347 additions and 110 deletions

View File

@@ -61,10 +61,29 @@ void DispmanxFrameGrabber::setFlags(const int vc_flags)
_vc_flags = vc_flags;
}
void DispmanxFrameGrabber::setVideoMode(const VideoMode videoMode)
{
switch (videoMode) {
case VIDEO_3DSBS:
vc_dispmanx_rect_set(&_rectangle, 0, 0, _width/2, _height);
break;
case VIDEO_3DTAB:
vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height/2);
break;
case VIDEO_2D:
default:
vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height);
break;
}
}
void DispmanxFrameGrabber::grabFrame(Image<ColorRgba> & image)
{
// Sanity check of the given image size
assert(image.width() == _width && image.height() == _height);
// resize the given image if needed
if (image.width() != unsigned(_rectangle.width) || image.height() != unsigned(_rectangle.height))
{
image.resize(_rectangle.width, _rectangle.height);
}
// Open the connection to the display
_vc_display = vc_dispmanx_display_open(0);
@@ -74,7 +93,7 @@ void DispmanxFrameGrabber::grabFrame(Image<ColorRgba> & image)
// Read the snapshot into the memory
void* image_ptr = image.memptr();
const unsigned destPitch = _width * sizeof(ColorRgba);
const unsigned destPitch = _rectangle.width * sizeof(ColorRgba);
vc_dispmanx_resource_read_data(_vc_resource, &_rectangle, image_ptr, destPitch);
// Close the displaye

View File

@@ -10,6 +10,7 @@
// Utils includes
#include <utils/Image.h>
#include <utils/ColorRgba.h>
#include <utils/VideoMode.h>
///
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
@@ -34,6 +35,12 @@ public:
///
void setFlags(const int vc_flags);
///
/// 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
@@ -58,8 +65,7 @@ private:
int _vc_flags;
/// With of the captured snapshot [pixels]
unsigned _width;
const unsigned _width;
/// Height of the captured snapshot [pixels]
unsigned _height;
const unsigned _height;
};

View File

@@ -81,3 +81,8 @@ void DispmanxWrapper::setGrabbingMode(const GrabbingMode mode)
break;
}
}
void DispmanxWrapper::setVideoMode(const VideoMode mode)
{
_frameGrabber->setVideoMode(mode);
}