Re: can't set focus feature on IIDC isight camera
Re: can't set focus feature on IIDC isight camera
- Subject: Re: can't set focus feature on IIDC isight camera
- From: Morgan Hibbert <email@hidden>
- Date: Mon, 18 Jun 2007 10:19:19 -0700
It is an external iSight. I also forgot to mention I am on an intel mac.
John Stiles wrote:
I believe the built-in iSights no longer have the ability to change
their focus. Only the external Firewire-based one could do this.
On Jun 13, 2007, at 4:03 PM, Morgan Hibbert wrote:
I am trying to set the focus, gain and other features on my isight
but I am not having much luck. I am able to set it in Auto or Manual
mode, but when setting in Manual mode I am not able to set the value.
Regardless of what value I provide (0.1, 50, 12800) the focus is
always set to 1 (out of 100).
I don't appear to be getting any error messages. Can anyone see that
is wrong?
- (ComponentResult) ConfigureFeature:(OSType)feature value:(int)value
{
QTAtomContainer atomContainer;
QTAtom featureAtom;
VDIIDCFeatureSettings settings;
VideoDigitizerComponent vd;
ComponentDescription desc;
ComponentResult result = paramErr;
int tval;
if (NULL == mChan) goto bail;
// get the digitizer and make sure it's legit
vd = SGGetVideoDigitizerComponent(mChan);
if (NULL == vd) goto bail;
GetComponentInfo((Component)vd, &desc, NULL, NULL, NULL);
//NSLog(@"componentSubType %@", desc.componentSubType);
if (vdSubtypeIIDC != desc.componentSubType) goto bail;
// *** now do the real work ***
// return the gain feature in an atom container
result = VDIIDCGetFeaturesForSpecifier(vd, feature, &atomContainer);
if (noErr == result) {
// find the feature atom
featureAtom = QTFindChildByIndex(atomContainer,
kParentAtomIsContainer,
vdIIDCAtomTypeFeature, 1, NULL);
if (0 == featureAtom) { result = cannotFindAtomErr; goto bail; }
// find the gain settings from the feature atom and copy the data
// into our settings
result = QTCopyAtomDataToPtr(atomContainer,
QTFindChildByID(atomContainer,
featureAtom,
vdIIDCAtomTypeFeatureSettings,
vdIIDCAtomIDFeatureSettings, NULL),
true, sizeof(settings),
&settings, NULL);
if (noErr == result) {
// When indicating capabilities, the flag being set
indicates that the
// feature can be put into the given state.
// When indicating/setting state, the flag represents
the current/desired
// state. Note that certain combinations of flags are
valid for capabilities
// (i.e. vdIIDCFeatureFlagOn | vdIIDCFeatureFlagOff)
but are mutually
// exclusive for state.
// is the setting supported?
if (EndianU32_NtoB(settings.capabilities.flags) &
(vdIIDCFeatureFlagOn |
vdIIDCFeatureFlagManual |
vdIIDCFeatureFlagRawControl)) {
// set state flags
settings.state.flags =
EndianU32_BtoL(vdIIDCFeatureFlagOn |
vdIIDCFeatureFlagManual |
vdIIDCFeatureFlagRawControl);
// set value -
will be between min or the max value supported by
// the camera represented in a float between 0 and 1.0
printf("raw max = %d\n",
settings.capabilities.rawMaximum);
printf("raw min = %d\n",
settings.capabilities.rawMinimum);
//tval = (value > settings.capabilities.rawMaximum) ?
settings.capabilities.rawMaximum : value;
//tval = (tval < settings.capabilities.rawMinimum) ?
settings.capabilities.rawMinimum : tval;
//settings.state.value = (1.0 /
settings.capabilities.rawMaximum) * tval;
settings.state.value = 0.5;
// store the result back in the container
result = QTSetAtomData(atomContainer,
QTFindChildByID(atomContainer,
featureAtom,
vdIIDCAtomTypeFeatureSettings,
vdIIDCAtomIDFeatureSettings,
NULL),
sizeof(settings),
&settings);
if (noErr == result) {
// set it on the device
result = VDIIDCSetFeatures(vd, atomContainer);
}
} else {
// can't do it!
result = featureUnsupported;
}
}
}
bail:
return result;
}
cheers,
morgan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden