public bool GetCameraProperty(CameraControlProperty property, out int value, out CameraControlFlags controlFlags)
{
bool ret = true;
// check if source was set
if ((deviceMoniker == null) || (string.IsNullOrEmpty(deviceMoniker)))
{
throw new ArgumentException("Video source is not specified.");
}
lock (sync)
{
object tempSourceObject = null;
// create source device's object
try
{
tempSourceObject = FilterInfo.CreateFilter(deviceMoniker);
}
catch
{
throw new ApplicationException("Failed creating device object for moniker.");
}
if (!(tempSourceObject is IAMCameraControl))
{
throw new NotSupportedException("The video source does not support camera control.");
}
IAMCameraControl pCamControl = (IAMCameraControl)tempSourceObject;
int hr = pCamControl.Get(property, out value, out controlFlags);
ret = (hr >= 0);
Marshal.ReleaseComObject(tempSourceObject);
}
return ret;
}