Attempt to open the QTKit CaptureDevice on Mac OS X with a video resolution appropriate for our purposes in case the default is too small.

cusax-fix
Lyubomir Marinov 16 years ago
parent 118e35e1de
commit e09dc4a4b4

@ -290,6 +290,24 @@ protected Format getFormat(int streamIndex, Format oldValue)
QTFormatDescription
.VideoEncodedPixelsSizeAttribute);
if (size != null)
{
/*
* If the actual capture device reports too small a
* resolution, we end up using it while it can actually
* be set to one with better quality. We've decided that
* DEFAULT_WIDTH and DEFAULT_HEIGHT make sense as the
* minimum resolution to request from the capture
* device.
*/
if ((size.width < DEFAULT_WIDTH)
&& (size.height < DEFAULT_HEIGHT))
{
double ratio = size.height / (double) size.width;
size.width = DEFAULT_WIDTH;
size.height = (int) (size.width * ratio);
}
format
= format
.intersects(
@ -299,6 +317,7 @@ protected Format getFormat(int streamIndex, Format oldValue)
videoFormat.getMaxDataLength(),
format.getDataType(),
videoFormat.getFrameRate()));
}
}
}
}

Loading…
Cancel
Save