📄 qtliveutils.cpp
字号:
VideoDigitizerError vid_err; vid_err = VDSetInputStandard (vdig, palIn); result = SGVideoDigitizerChanged( gVideoChannel); result = SGGetSrcVideoBounds ( gVideoChannel, &gActiveVideoRect); osg::notify(osg::NOTICE) << "SrcVideoBounds: " << gActiveVideoRect.right << " " << gActiveVideoRect.bottom << std::endl; // Out out_width = gActiveVideoRect.right; out_height = gActiveVideoRect.bottom; memcpy(out_deviceIDStr, deviceNameRec.name, sizeof(Str63)); } } SetGWorld(origPort, origDevice); DisposeGWorld(gw); } } } SGDisposeChannel(gSeqGrabber, gVideoChannel); CloseComponent(gSeqGrabber); } } while (0 != aComponent); } // End QuickTime }}void get_sound_device_idstr(short soundDeviceID, short soundDeviceInputID, Str63& out_soundDeviceIDStr){ // Extra scopes for DEBUG and breakpoint/stack checking plus QT init/destroy { // Begin QuickTime QTScopedQTMLInitialiser qt_init; QTScopedMovieInitialiser qt_movie_init; // #define videoDigitizerComponentType = 'vdig' ComponentDescription sg_component_description; sg_component_description.componentType = SeqGrabComponentType; /* A unique 4-byte code indentifying the command set */ sg_component_description.componentSubType = 0L; /* Particular flavor of this instance */ sg_component_description.componentManufacturer = 0L; /* Vendor indentification */ sg_component_description.componentFlags = 0L; /* 8 each for Component,Type,SubType,Manuf/revision */ sg_component_description.componentFlagsMask = 0L; /* Mask for specifying which flags to consider in search, zero during registration */ long num_sg_components = CountComponents (&sg_component_description); if (num_sg_components) { Component aComponent = 0; do { ComponentDescription full_sg_component_description = sg_component_description; aComponent = FindNextComponent(aComponent, &full_sg_component_description); if (aComponent) { SeqGrabComponent gSeqGrabber; SGChannel gSoundChannel; gSeqGrabber = OpenComponent (aComponent); // If we got a sequence grabber, set it up if (gSeqGrabber != 0L) { ComponentResult result = noErr; // Initialize the sequence grabber result = SGInitialize (gSeqGrabber); if (result == noErr) { // Check capability and setting of Sequence Grabber // Get a sound channel result = SGNewChannel (gSeqGrabber, SoundMediaType, &gSoundChannel); if ((gSoundChannel != nil) && (result == noErr)) { result = SGSetChannelUsage (gSoundChannel, seqGrabPreview); Str255 deviceName; Str255 inputName; short inputNumber; result = SGGetChannelDeviceAndInputNames( gSoundChannel, deviceName, inputName, &inputNumber); SGDeviceList deviceList; result = SGGetChannelDeviceList( gSoundChannel, sgDeviceListIncludeInputs, &deviceList); short count = (*deviceList)->count; if (soundDeviceID >= count) osg::notify(osg::FATAL) << "DeviceID : " << soundDeviceID << " too large - we only have " << count << " devices" << std::endl; SGDeviceName deviceNameRec = (*deviceList)->entry[soundDeviceID]; SGDeviceInputList deviceInputList = deviceNameRec.inputs; short inputCount = (*deviceInputList)->count; if (soundDeviceInputID >= inputCount) osg::notify(osg::FATAL) << "DeviceInputID : " << soundDeviceInputID << " too large - we only have " << inputCount << " inputs for device" << std::endl; // Ok Str63 deviceNameStr; memcpy(deviceNameStr, deviceNameRec.name, sizeof(Str63)); // Set result = SGSetChannelDevice ( gSoundChannel, deviceNameStr); result = SGSetChannelDeviceInput( gSoundChannel, soundDeviceInputID); // Out memcpy(out_soundDeviceIDStr, deviceNameRec.name, sizeof(Str63)); SGDisposeChannel(gSeqGrabber, gSoundChannel); } } CloseComponent(gSeqGrabber); } } } while (0 != aComponent); } // End QuickTime }}// Getting Information About Video Digitizer Components// You can use the VDGetDigitizerInfo function in your application to retrieve// information about the capabilities of a video digitizer component. You can use// the VDGetCurrentFlags function to obtain current status information from a video digitizer component.// Setting Source Characteristics// You can use the VDGetMaxSrcRect function in your application to get the size and location of the maximum// source rectangle. Similarly, the VDGetActiveSrcRect function allows you to get this information about// the active source rectangle, and the VDGetVBlankRect function enables you to obtain information about the vertical blanking rectangle.// You can use the VDSetDigitizerRect function to set the size and location of the digitizer rectangle.// The VDGetDigitizerRect function lets you retrieve the size and location of this rectangle.// Imput Source // Some of these functions provide information about the available video inputs. Applications can use// the VDGetNumberOfInputs function to determine the number of video inputs supported by the digitizer component.// The VDGetInputFormat function allows applications to find out the video format (composite, s-video, or component) employed by a specified input.// You can use the VDSetInput function in your application to specify the input to be used by the digitizer component.// The VDGetInput function returns the currently selected input.// The VDSetInputStandard function allows you to specify the video signaling standard to be used by the video digitizer component./*QTVideoOutputRestoreState QTVideoOutputSaveState Selecting an Input SourceVDGetInput VDGetInputFormat VDGetNumberOfInputs VDSetInput VDSetInputStandard Setting Source CharacteristicsVDGetActiveSrcRect VDGetDigitizerRect VDGetMaxSrcRect VDGetVBlankRect VDSetDigitizerRect Setting Video DestinationsVDGetMaxAuxBuffer VDGetPlayThruDestination VDPreflightDestination VDPreflightGlobalRect VDSetPlayThruDestination VDSetPlayThruGlobalRect Video ClippingVDClearClipRgn VDGetClipState VDSetClipRgn VDSetClipState *//*QTVideoOutputCopyIndAudioOutputDeviceUID QTVideoOutputGetIndImageDecompressor VDGetInputGammaRecord VDGetInputName VDGetPreferredImageDimensions VDIIDCGetCSRData VDIIDCGetDefaultFeatures VDIIDCGetFeatures VDIIDCGetFeaturesForSpecifier VDIIDCSetCSRData VDIIDCSetFeatures VDSetDestinationPort VDSetInputGammaRecord VDSetPreferredImageDimensions VDUseSafeBuffers *///void test ()//{//if ((i == count-1) && (inp == inputCount-1))//{// osg::notify(osg::NOTICE) << " * TEST SGSetChannelDevice(..) : " << pstr_printable(deviceNameRec.name) << std::endl; // result = SGSetChannelDevice (gVideoChannel, deviceNameStr);// if (result == noErr)// {// result = SGSetChannelDeviceInput( gVideoChannel, 0 );// result = SGGetSrcVideoBounds (gVideoChannel, &gActiveVideoRect);// osg::notify(osg::NOTICE) << "SrcVideoBounds: " << gActiveVideoRect.right << " " << gActiveVideoRect.bottom << std::endl;// Str255 deviceName2;// Str255 inputName2;// short inputNumber2;// result = SGGetChannelDeviceAndInputNames( gVideoChannel, deviceName2, inputName2, &inputNumber2);// osg::notify(osg::NOTICE) << "ChannelDeviceAndInputNamesNumber: " << pstr_printable(deviceName2) << " : " << pstr_printable(inputName2) << " : " << inputNumber2 << std::endl;// result = SGGetChannelDeviceList( gVideoChannel, sgDeviceListIncludeInputs, &deviceList);// if (result != noErr)// {// osg::notify(osg::NOTICE) << "Could not get DeviceList from Video SG" << std::endl; // }// else// {// osg::notify(osg::NOTICE) << "DeviceList from Video SG ok" << std::endl; // short count = (*deviceList)->count;// short selectedIndex = (*deviceList)->selectedIndex;// osg::notify(osg::NOTICE) << "DeviceList : " << count << " devices in total" << std::endl; // osg::notify(osg::NOTICE) << "DeviceList : " << selectedIndex << " is current device" << std::endl; // }// }// else// {// osg::notify(osg::NOTICE) << "SGSetChannelDevice - failed!" << std::endl; // }// osg::notify(osg::NOTICE) << " * TEST SGSetChannelDevice(..) end" << std::endl;//}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -