#include #include #include #include #include #include #include #include #include #include static QTAtomSpec videoConfig; static IDHDeviceID deviceID; static IDHNotificationID notificationID; static void printP(const char *s) { int len = *s++; while(len--) printf("%c", *s++); } static void print4(const char *s, UInt32 val) { printf("%s'%c%c%c%c'(0x%x)", s, val>>24, val>>16, val>>8, val, val); } static OSStatus notificationProc(IDHGenericEvent* event, void* userData) { ComponentInstance theInst = userData; printf("Got notification for device 0x%x, notification 0x%x, event 0x%x, userdata 0x%x\n", event->eventHeader.deviceID, event->eventHeader.notificationID, event->eventHeader.event, userData); // Reenable notification IDHNotifyMeWhen(theInst, event->eventHeader.notificationID, kIDHEventEveryEvent); return noErr; } static void doControlTest(ComponentInstance theInst, QTAtomSpec *currentIsochConfig, UInt8 op1, UInt8 op2) { //Component control; ComponentInstance controlInst; ComponentResult result; IDHDeviceStatus devStatus; DVCTransactionParams pParams; char in[4], out[16]; int i; result = IDHGetDeviceControl(theInst, &controlInst); if(result) goto Exit; //controlInst = OpenComponent(control); // get the local node's fw ref id result = IDHGetDeviceStatus( theInst, currentIsochConfig, &devStatus); if(result) goto Exit; //result = FWClockPrivSetFWReferenceID(clockInst, (FWReferenceID) devStatus.localNodeID ); //if(result) // goto Exit; // set the clock's fw id //clockInst = OpenDefaultComponent(clockComponentType, systemMicrosecondClock); if(!controlInst) goto Exit; // fill up the avc frame in[0] = 0x00; //kAVCControlCommand; in[1] = 0x20; // for now in[2] = op1; in[3] = op2; // fill up the transaction parameter block pParams.commandBufferPtr = in; pParams.commandLength = sizeof(in); pParams.responseBufferPtr = out; pParams.responseBufferSize = sizeof(out); pParams.responseHandler = NULL; do { for(i=0; i 0) break; printf("Waiting for a camera...\n"); sleep(1); } while(true); QTLockContainer( deviceList); // find the cmp atom deviceAtom = QTFindChildByIndex( deviceList, kParentAtomIsContainer, kIDHUseCMPAtomType, 1, nil); if( deviceAtom == nil) goto error; // get the value of the cmp atom QTCopyAtomDataToPtr( deviceList, deviceAtom, true, sizeof( cmpFlag), &cmpFlag, &size); // find the version atom deviceAtom = QTFindChildByIndex( deviceList, kParentAtomIsContainer, kIDHIsochVersionAtomType, 1, nil); if( deviceAtom == nil) goto error; // get the value of the version atom QTCopyAtomDataToPtr( deviceList, deviceAtom, true, sizeof( isoversion), &isoversion, &size); printf("Version 0x%x. %d DV devices, use CMP flag is %d\n", isoversion, nDVDevices, cmpFlag); for( i=0; i