QTCaptureView retain count problem and setting iSight's focus (macro)
QTCaptureView retain count problem and setting iSight's focus (macro)
- Subject: QTCaptureView retain count problem and setting iSight's focus (macro)
- From: email@hidden
- Date: Tue, 8 Jan 2008 00:53:50 +0900
Hello, all.
1st, I wondering why QTCaptureView does not retain sat session?
Retain count is still 1 after setCaptureSession: call.
Debugger console shows:
2008-01-08 00:23:51.646 QuickCap[33248:10b] retainCount 1 1
int retainCount = [session retainCount];
[captureView setCaptureSession:session];
NSLog(@"retainCount %d %d", retainCount, [session retainCount]);
2nd, how can I set iSight's (buit-in) focus?
With sequece grabber (SGChannel), I use following code, (from
MyBarcodeScanner.m, http://www.bruji.com/cocoa/barcode.html) but it
seems not works on my MacBook.
// Set the focus value helps with external iSights
// Thanks to Wil Shipley for the focus code:
// http://lists.apple.com/archives/quicktime-api/2004/Mar/msg00257.html
long quickTimeVersion = 0;
Gestalt(gestaltQuickTime, &quickTimeVersion);
if (video && (quickTimeVersion & 0xFFFFFF00) > 0x0708000) {
// What to set the focus of the external iSights to
const QTFloatSingle CAMERA_FOCUS = 0.35;
QTAtomContainer iidcFeaturesAtomContainer = NULL;
QTAtom featureAtom = 0;
QTAtom typeAndIDAtom = 0;
QTAtom featureSettingsAtom = 0;
QTNewAtomContainer(&iidcFeaturesAtomContainer);
QTInsertChild(iidcFeaturesAtomContainer, // QTAtomContainer container
kParentAtomIsContainer, // QTAtom parentAtom
vdIIDCAtomTypeFeature, // QTAtomType atomType
1, // QTAtomID id
0, // short index
0, // long dataSize
nil, // void *data
&featureAtom); // QTAtom *newAtom
VDIIDCFeatureAtomTypeAndID featureAtomTypeAndID = {
.feature = vdIIDCFeatureFocus, /* OSType of feature*/
.group = vdIIDCGroupMechanics, /* OSType of group that feature is
categorized into*/
.name = {5, 'F', 'o', 'c', 'u', 's'}, /* Str255, Name of this
feature*/
.atomType = vdIIDCAtomTypeFeatureSettings, /* Atom type which
contains feature's settings*/
.atomID = vdIIDCAtomIDFeatureSettings /* Atom ID which contains
feature's settings*/
};
QTInsertChild(iidcFeaturesAtomContainer,
featureAtom,
vdIIDCAtomTypeFeatureAtomTypeAndID,
vdIIDCAtomIDFeatureAtomTypeAndID,
0,
sizeof(featureAtomTypeAndID),
&featureAtomTypeAndID,
&typeAndIDAtom);
VDIIDCFeatureSettings featureSettings = {
.capabilities = {
.flags = 0, // UInt32
.rawMinimum = 0, // UInt16
.rawMaximum = 0, // UInt16
.absoluteMinimum = 0.0, // QTFloatSingle
.absoluteMaximum = 0.0 // QTFloatSingle
},
.state = {
.flags = vdIIDCFeatureFlagOn | vdIIDCFeatureFlagManual |
vdIIDCFeatureFlagRawControl, // UInt32
.value = CAMERA_FOCUS // QTFloatSingle
}
};
QTInsertChild(iidcFeaturesAtomContainer,
featureAtom,
vdIIDCAtomTypeFeatureSettings,
vdIIDCAtomIDFeatureSettings,
0,
sizeof(featureSettings),
&featureSettings,
&featureSettingsAtom);
/*
* VDIIDCSetFeatures()
*
* Availability:
* Mac OS X: in version 10.3 (or QuickTime 6.4) and later
in QuickTime.framework
*/
(void)VDIIDCSetFeatures(SGGetVideoDigitizerComponent(video),
iidcFeaturesAtomContainer);
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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