1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Add low quality mode for juce CameraDevice

This commit is contained in:
hogliux 2016-08-03 12:09:19 +01:00
parent 26b6f01ce3
commit c21716499c
5 changed files with 22 additions and 12 deletions

View file

@ -22,8 +22,9 @@
==============================================================================
*/
CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHeight, int maxWidth, int maxHeight)
: name (nm), pimpl (new Pimpl (name, index, minWidth, minHeight, maxWidth, maxHeight))
CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHeight, int maxWidth, int maxHeight,
bool highQuality)
: name (nm), pimpl (new Pimpl (name, index, minWidth, minHeight, maxWidth, maxHeight, highQuality))
{
}
@ -77,10 +78,12 @@ StringArray CameraDevice::getAvailableDevices()
CameraDevice* CameraDevice::openDevice (int index,
int minWidth, int minHeight,
int maxWidth, int maxHeight)
int maxWidth, int maxHeight,
bool highQuality)
{
ScopedPointer<CameraDevice> d (new CameraDevice (getAvailableDevices() [index], index,
minWidth, minHeight, maxWidth, maxHeight));
minWidth, minHeight, maxWidth, maxHeight,
highQuality));
if (d->pimpl->openedOk())
return d.release();

View file

@ -58,10 +58,15 @@ public:
The size constraints allow the method to choose between different resolutions if
the camera supports this. If the resolution cam't be specified (e.g. on the Mac)
then these will be ignored.
On Mac, if highQuality is false, then the camera will be opened in preview mode
which will allow the OS to drop frames if the computer cannot keep up in processing
the frames.
*/
static CameraDevice* openDevice (int deviceIndex,
int minWidth = 128, int minHeight = 64,
int maxWidth = 1024, int maxHeight = 768);
int maxWidth = 1024, int maxHeight = 768,
bool highQuality = true);
//==============================================================================
/** Returns the name of this device */
@ -147,7 +152,7 @@ private:
friend struct ViewerComponent;
CameraDevice (const String& name, int index,
int minWidth, int minHeight, int maxWidth, int maxHeight);
int minWidth, int minHeight, int maxWidth, int maxHeight, bool highQuality);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CameraDevice)
};