您的位置:首页 > 运维架构

DirectX.Capture

2004-07-03 20:01 1326 查看
DirectX.Capture
Capabilitiesoftheaudiodevicesuchasmin/maxsamplingrateandnumberofchannelsavailable.Minimumnumberofaudiochannels.Maximumnumberofaudiochannels.Granularityofthechannels.Forexample,channels2through4,instepsof2.Minimumnumberofbitspersample.Maximumnumberofbitspersample.Granularityofthebitspersample.Forexample,8bitspersamplethrough32bitspersample,instepsof8.Minimumsamplefrequency.Maximumsamplefrequency.Granularityofthefrequency.Forexample,11025Hzto44100Hz,instepsof11025Hz.RetrievecapabilitiesofanaudiodeviceRepresentsaphysicalconnectororsourceonanaudiodevice.ThisclassisusedonfiltersthatsupporttheIAMAudioInputMixerinterfacesuchassourcecards.Representsaphysicalconnectororsourceonanaudio/videodevice.ObtainstheStringrepresentationofthisinstance.Releaseunmanagedresources.Releaseunmanagedresources.Thenameofthesource.Read-only.Isthissourceenabled.Constructor.Thisclasscannotbecreateddirectly.RetrievethefriendlynameofaconnectorType.Releaseunmanagedresources.Enableordisablethissource.Foraudiosourcesitisusuallypossibletoenableseveralsources.WhensettingEnabled=true,setEnabled=falseonallotheraudiosources.UsetheCaptureclasstocaptureaudioandvideotoAVIfiles.ThisisthecoreclassoftheCaptureClassLibrary.ThefollowingsectionsintroducetheCaptureclassandhowtousethislibrary.

BasicUsage
TheCaptureclassonlyrequiresavideodeviceand/oraudiodevicetobegincapturing.Theclassprovideslistsoftheinstalledvideoandaudiodevices.

//RemembertoaddareferencetoDirectX.Capture.dllusingDirectX.Capture...Capturecapture=newCapture(Filters.VideoInputDevices[0],Filters.AudioInputDevices[0]);capture.Start();...capture.Stop();Thiswillcapturevideoandaudiousingthefirstvideoandaudiodevicesinstalledonthesystem.Tocapturevideoonly,passanullasthesecondparameteroftheconstructor.TheclassisinitializedtoavalidtemporaryfileintheWindowstempfolder.Tocapturetoadifferentfile,setthepropertybeforeyoubegincapturing.RemembertoaddDirectX.Capture.dlltoyourprojectreferences.

SettingCommonProperties
Theexamplebelowshowshowtochangevideoandaudiosettings.Propertiessuchasandallowyoutoprogrammaticallyadjustthecapture.Useandtodeterminevalidvaluesfortheseproperties.
Capturecapture=newCapture(Filters.VideoInputDevices[0],Filters.AudioInputDevices[1]);capture.VideoCompressor=Filters.VideoCompressors[0];capture.AudioCompressor=Filters.AudioCompressors[0];capture.FrameRate=29.997;capture.FrameSize=newSize(640,480);capture.AudioSamplingRate=44100;capture.AudioSampleSize=16;capture.Filename="C:/MyVideo.avi";capture.Start();...capture.Stop();

Theexampleabovealsoshowstheuseofvideoandaudiocompressors.Inmostcasesyouwillwanttousecompressors.Uncompressedvideocaneasilyconsumeovera1GBofdiskspaceperminute.Wheneverpossible,settheandpropertiesasearlyaspossible.Changingthemrequirestheinternalfiltergraphtoberebuiltwhichoftencausesmostoftheotherpropertiestoberesettodefaultvalues.

ListingDevices
 Usethecollectiontolistvideocapturedevicesinstalledonthesystem.
foreach(FilterfinFilters.VideoInputDevices){Debug.WriteLine(f.Name);}

Theclassalsoprovidescollectionsforaudiocapturedevices,videocompressorsandaudiocompressors.
Preview
Videopreviewiscontroledwiththeproperty.Settingthispropertytoavisiblecontrolwillimmediatelybeginpreview.Settonulltostopthepreview.

//Enablepreviewcapture.PreviewWindow=myPanel;//Disablepreviewcapture.PreviewWindow=null;Thecontrolusedmusthaveawindowhandle(HWND),goodcontrolstousearethePanelortheformitself.Retrievingorchangingvideo/audiosettingssuchasFrameRate,FrameSize,AudioSamplingRate,andAudioSampleSizewillcausethepreviewwindowtoflash.Thisisbeacusethepreviewmustbetemporarilystopped.Disablethepreviewifyouneedtoaccessseveralpropertiesatthesametime.

PropertyPages
 Propertypagesexposedbythedevicesandcompressorsareavailablethroughthecollection.

//Displaythefirstpropertypagecapture.PropertyPages[0].Show();ThepropertypageswilloftenexposemoresettingsthantheCaptureclassdoesdirectly.Someexamplesarebrightness,colorspace,audiobalanceandbassboost.Thedisadvantagetousingthepropertypagesistheuser'schoicescannotbesavedandlaterrestored.Theexceptiontothisisthevideoandaudiocompressorpropertypages.Mostcompressorssupportthesavingandrestoringstate,seethepropertyformoreinformation.ChangesmadeinthepropertypagewillbereflectedimmediatelyintheCaptureclassproperties(e.g.Capture.FrameSize).However,thereverseisnotalwaystrue.AchangemadedirectlytoFrameSize,forexample,maynotbereflectedintheassociatedpropertypage.Fortunately,thefilterwilluserequestedFrameSizeeventhoughthepropertypageshowsotherwise.

SavingandRestoringSettings
 Tosavetheuser'schoiceofdevicesandcompressors,saveanduseritlatertorecreatetheFilterobject.Tosaveauser'schoicesfromapropertypageuse.However,onlytheaudioandvideocompressorpropertypagessupportthis.ThelastitemstosavearethevideoandaudiosettingssuchasFrameSizeandAudioSamplingRate.Whenrestoring,remembertorestorethesepropertiesaftersettingthevideoandaudiocompressors.

//Disablepreviewcapture.PreviewWindow=null;//SavesettingsstringvideoDevice=capture.VideoDevice.MonikerString;stringaudioDevice=capture.AudioDevice.MonikerString;stringvideoCompressor=capture.VideoCompressor.MonikerString;stringaudioCompressor=capture.AudioCompressor.MonikerString;doubleframeRate=capture.FrameRate;SizeframeSize=capture.FrameSize;shortaudioChannels=capture.AudioChannels;shortaudioSampleSize=capture.AudioSampleSize;intaudioSamplingRate=capture.AudioSamplingRate;ArrayListpages=newArrayList();foreach(PropertyPagepincapture.PropertyPages){if(p.SupportsPersisting)pages.Add(p.State);}//RestoresettingsCapturecapture=newCapture(newFilter(videoDevice),newFilter(audioDevice));capture.VideoCompressor=newFilter(videoCompressor);capture.AudioCompressor=newFilter(audioCompressor);capture.FrameRate=frameRate;capture.FrameSize=frameSize;capture.AudioChannels=audioChannels;capture.AudioSampleSize=audioSampleSize;capture.AudioSamplingRate=audioSamplingRate;foreach(PropertyPagepincapture.PropertyPages){if(p.SupportsPersisting){p.State=(byte[])pages[0]pages.RemoveAt(0);}}//Enablepreviewcapture.PreviewWindow=myPanel;
TVTuner
ToaccesstheTVTuner,usetheproperty.IfthedevicedoesnothaveaTVtuner,thispropertywillbenull.See,andformoreinformation.

//Changetochannel5capture.Tuner.Channel=5;
Troubleshooting
ThisclasslibraryusesCOMInteroptoaccessthefullcapabilitiesofDirectShow,soifthereisanotherapplicationthatcansuccessfullyuseahardwaredevicethenitshouldbepossibletomodifythisclasslibrarytousethedevice.TrytheAMCapsamplefromtheDirectXSDK(DX9/Samples/C++/DirectShow/Bin/AMCap.exe)orVirtualVCRfromhttp://www.DigTV.wsCreditsThisclasslibrarywouldnotbepossiblewithouttheDShowNETprojectbyNETMaster:http://www.codeproject.com/useritems/directshownet.aspDocumentationisgeneratedbynDocavailableathttp://ndoc.sourceforge.net

Feedback
Feelfreetosendcommentsandquestionstomeatmportobello@hotmail.com.Ifthethetopicmaybeofinteresttoothers,postyourquestiononthewww.codeproject.compageforDirectX.Capture.CreateanewCaptureobject.videoDeviceandaudioDevicecanbenullifyoudonotwishtocapturebothaudioandvideo.Howeveratleastonemustbeavaliddevice.Usetheclasstolistavailabledevices.Destructor.Disposeofresources.Prepareforcapturing.Usethismethodwhencapturingmustbeginasquicklyaspossible.Thiswillcreate/overwriteazerobytefilewiththenamesetintheFilenameproperty.Thiswilldisablepreview.Previewwillresumeoncecapturebegins.Thisproblemcanbefixedifsomeoneiswillingtomakethechange.Thismethodisoptional.IfCue()isnotcalled,Start()willcallitbeforecapturing.Thismethodcannotbecalledwhilecapturing.Begincapturing.Stopthecurrentcapturecapture.Ifthereisnocurrentcapture,thismethodwillsucceed.CallsStop,releasesallreferences.Ifacaptureisinprogressitwillbestopped,buttheCaptureCompleteeventwillNOTfire.Createanewfiltergraphandaddfilters(devices,compressors,misc),butleavethefiltersunconnected.CallrenderGraph()toconnectthefilters.Connectsthefiltersofapreviouslycreatedgraph(createdbycreateGraph()).Oncerenderedthegraphisreadytobeused.Thismethodmayalsodestroystreamsifwehavestreamswenolongerwant.Setupandstartthepreviewwindowiftheuserhasrequestedit(bysettingPreviewWindow).Disconnectandremoveallfiltersexceptthedeviceandcompressorfilters.ThisistheoppositeofrenderGraph().SoempropertiessuchasFrameRatecanonlybesetwhenthedeviceoutputpinsarenotconnected.Removesallfiltersdownstreamfromafilterfromthegraph.ThisiscalledonlybyderenderGraph()toremoveeverythingfromthegraphexceptthedevicesandcompressors.Theparameter"removeFirstFilter"isusedtokeepacompressor(thatshouldbeimmediatelydownstreamofthedevice)ifoneisbeginused.Completelyteardownafiltergraphandreleaseallassociatedresources.ResizethepreviewwhenthePreviewWindowisresizedGetavalidtemporaryfilename(withpath).Wearen'tusingPath.GetTempFileName()becauseitcreatesa0-bytefileRetrievesthevalueofonememberoftheIAMStreamConfigformatblock.Helperfunctionforseveralpropertiesthatexposevideo/audiosettingsfromIAMStreamConfig.GetFormat().IAMStreamConfig.GetFormat()returnsaAMMediaTypestruct.AMMediaType.formatPtrpointstoaformatblockstructure.Thisformatblockstructuremaybeoneofseveraltypes,thetypebeingdeterminedbyAMMediaType.formatType.SetthevalueofonememberoftheIAMStreamConfigformatblock.Helperfunctionforseveralpropertiesthatexposevideo/audiosettingsfromIAMStreamConfig.GetFormat().IAMStreamConfig.GetFormat()returnsaAMMediaTypestruct.AMMediaType.formatPtrpointstoaformatblockstructure.Thisformatblockstructuremaybeoneofseveraltypes,thetypebeingdeterminedbyAMMediaType.formatType.AssertthattheclassisinaStoppedstate.Istheclasscurrentlycapturing.Read-only.Hastheclassbeencuedtobegincapturing.Read-only.Istheclasscurrentlystopped.Read-only.Nameoffiletocaptureto.Initiallysettoavalidtemporaryfile.Ifthefiledoesnotexist,itwillbecreated.Ifitdoesexist,itwillbeoverwritten.Anoverwrittenfilewillnotbeshortenedifthecaptureddataissmallerthantheoriginalfile.Thefilewillbevalid,itwilljustcontainextra,unused,dataaftertheaudio/videodata.Afutureversionofthisclasswillprovideamethodtocopyonlythevalidaudio/videodatatoanewfile.Thispropertycannotbechangedwhilecapturingorcued.Thecontrolthatwillhostthepreviewwindow.Settingthispropertywillbeginvideopreviewimmediately.Setthispropertyaftersettingallotherpropertiestoavoidunnecessarychangestotheinternalfiltergraph(somepropertieslikeFrameSizerequiretheinternalfiltergraphtobestoppedanddisconnectedbeforethepropertycanberetrievedorset).Tostopvideopreview,setthispropertytonull.Thecapabilitiesofthevideodevice.Itmayberequiredtocuethecapture(see)beforeallcapabilitiesarecorrectlyreported.Ifyouhavesuchadevice,thedeveloperwouldbeinterestedtohearfromyou.Theinformationcontainedinthispropertyisretrievedandcachedthefirsttimethispropertyisaccessed.Futurecallstothispropertyusethecachedresults.Thiswasdoneforperformance.However,thismeansyoumaygetdifferentresultsdependingonwhenyouaccessthispropertyfirst.Ifyouareexperiencingproblems,tryaccessingthepropertyimmediatelyaftercreatingtheCaptureclassorimmediatelyaftersettingthevideoandaudiocompressors.Also,informthedeveloper.Thecapabilitiesoftheaudiodevice.Itmayberequiredtocuethecapture(see)beforeallcapabilitiesarecorrectlyreported.Ifyouhavesuchadevice,thedeveloperwouldbeinterestedtohearfromyou.Theinformationcontainedinthispropertyisretrievedandcachedthefirsttimethispropertyisaccessed.Futurecallstothispropertyusethecachedresults.Thiswasdoneforperformance.However,thismeansyoumaygetdifferentresultsdependingonwhenyouaccessthispropertyfirst.Ifyouareexperiencingproblems,tryaccessingthepropertyimmediatelyaftercreatingtheCaptureclassorimmediately
c364
aftersettingthevideoandaudiocompressors.Also,informthedeveloper.Thevideocapturedevicefilter.Read-only.Touseadifferentdevice,disposeofthecurrentCaptureinstanceandcreateanewinstancewiththedesireddevice.Theaudiocapturedevicefilter.Read-only.Touseadifferentdevice,disposeofthecurrentCaptureinstanceandcreateanewinstancewiththedesireddevice.Thevideocompressionfilter.Whenthispropertyischangedtheinternalfiltergraphisrebuilt.Thismeansthatsomepropertieswillbereset.Setthispropertyasearlyaspossibletoavoidlosingchanges.Thispropertycannotbechangedwhilecapturing.Theaudiocompressionfilter.Whenthispropertyischangedtheinternalfiltergraphisrebuilt.Thismeansthatsomepropertieswillbereset.Setthispropertyasearlyaspossibletoavoidlosingchanges.Thispropertycannotbechangedwhilecapturing.Thecurrentvideosource.UseCapture.VideoSourcestolistavailablesources.Settonulltodisableallsources(mute).Thecurrentaudiosource.UseCapture.AudioSourcestolistavailablesources.Settonulltodisableallsources(mute).Collectionofavailablevideosources/physicalconnectorsonthecurrentvideodevice.Inmostcases,ifthedevicehasonlyonesource,thiscollectionwillbeempty.Theinformationcontainedinthispropertyisretrievedandcachedthefirsttimethispropertyisaccessed.Futurecallstothispropertyusethecachedresults.Thiswasdoneforperformance.However,thismeansyoumaygetdifferentresultsdependingonwhenyouaccessthispropertyfirst.Ifyouareexperiencingproblems,tryaccessingthepropertyimmediatelyaftercreatingtheCaptureclassorimmediatelyaftersettingthevideoandaudiocompressors.Also,informthedeveloper.Collectionofavailableaudiosources/physicalconnectorsonthecurrentaudiodevice.Inmostcases,ifthedevicehasonlyonesource,thiscollectionwillbeempty.Foraudiothereare2differentmethodsforenumeratingaudiosourcesanaudiocrossbar(usuallyTVtuners?)oranaudiomixer(usuallysoundcards?).Thisclasswillfirstlookforanaudiocrossbar.Ifnosourcesoronlyonesourceisavailableonthecrossbar,thisclasswillthenlookforanaudiomixer.Thisclassdoesnotsupportbothmethods.Theinformationcontainedinthispropertyisretrievedandcachedthefirsttimethispropertyisaccessed.Futurecallstothispropertyusethecachedresults.Thiswasdoneforperformance.However,thismeansyoumaygetdifferentresultsdependingonwhenyouaccessthispropertyfirst.Ifyouareexperiencingproblems,tryaccessingthepropertyimmediatelyaftercreatingtheCaptureclassorimmediatelyaftersettingthevideoandaudiocompressors.Also,informthedeveloper.Availablepropertypages.ThesearepropertypagesexposedbytheDirectShowfilters.Thesepropertypagesallowusersmodifysettingsonthefiltersdirectly.Theinformationcontainedinthispropertyisretrievedandcachedthefirsttimethispropertyisaccessed.Futurecallstothispropertyusethecachedresults.Thiswasdoneforperformance.However,thismeansyoumaygetdifferentresultsdependingonwhenyouaccessthispropertyfirst.Ifyouareexperiencingproblems,tryaccessingthepropertyimmediatelyaftercreatingtheCaptureclassorimmediatelyaftersettingthevideoandaudiocompressors.Also,informthedeveloper.TheTVTunerornullifthecurrentvideodevicedoesnothaveaTVTuner.Getsandsetstheframerateusedtocapturevideo.Commonframerates:24fpsforfilm,25forPAL,29.997forNTSC.NotallNTSCcapturecardscancaptureatexactly29.997fps.Notallframeratesaresupported.Whenchangingtheframerate,theclosestsupportedframeratewillbeused.Notalldevicessupportgetting/settingthisproperty.Ifthispropertyisnotsupported,accessingitwillthrowandexception.Thispropertycannotbechangedwhilecapturing.Changingthispropertywhilepreviewisenabledwillcausesomefickeringwhiletheinternalfiltergraphispartiallyrebuilt.Changingthispropertywhilecuedwillcancelthecue.CallCue()againtore-cuethecapture.Getsandsetstheframesizeusedtocapturevideo.Tochangetheframesize,assignanewSizeobjecttothisproperty
capture.Size=newSize(w,h);
ratherthanmodifyingthesizeinplace(capture.Size.Width=w;).Notallframeratesaresupported.Notalldevicessupportgetting/settingthisproperty.Ifthispropertyisnotsupported,accessingitwillthrowandexception.Thispropertycannotbechangedwhilecapturing.Changingthispropertywhilepreviewisenabledwillcausesomefickeringwhiletheinternalfiltergraphispartiallyrebuilt.Changingthispropertywhilecuedwillcancelthecue.CallCue()againtore-cuethecapture.Getorsetthenumberofchannelsinthewaveform-audiodata.Monauraldatausesonechannelandstereodatausestwochannels.Notalldevicessupportgetting/settingthisproperty.Ifthispropertyisnotsupported,accessingitwillthrowandexception.Thispropertycannotbechangedwhilecapturing.Changingthispropertywhilepreviewisenabledwillcausesomefickeringwhiletheinternalfiltergraphispartiallyrebuilt.Changingthispropertywhilecuedwillcancelthecue.CallCue()againtore-cuethecapture.Getorsetthenumberofaudiosamplestakenpersecond.Commonsamplingratesare8.0kHz,11.025kHz,22.05kHz,and44.1kHz.Notallsamplingratesaresupported.Notalldevicessupportgetting/settingthisproperty.Ifthispropertyisnotsupported,accessingitwillthrowandexception.Thispropertycannotbechangedwhilecapturing.Changingthispropertywhilepreviewisenabledwillcausesomefickeringwhiletheinternalfiltergraphispartiallyrebuilt.Changingthispropertywhilecuedwillcancelthecue.CallCue()againtore-cuethecapture.Getorsetthenumberofbitsrecordedpersample.Commonsamplesizesare8bitand16bit.Notallsamplessizesaresupported.Notalldevicessupportgetting/settingthisproperty.Ifthispropertyisnotsupported,accessingitwillthrowandexception.Thispropertycannotbechangedwhilecapturing.Changingthispropertywhilepreviewisenabledwillcausesomefickeringwhiletheinternalfiltergraphispartiallyrebuilt.Changingthispropertywhilecuedwillcancelthecue.CallCue()againtore-cuethecapture.Firedwhenacaptureiscompleted(manuallyorautomatically).PossiblestatesoftheinteralfiltergraphRepresentsaphysicalconnectororsourceonanaudio/videodevice.ThisclassisusedonfiltersthatsupporttheIAMCrossbarinterfacesuchasTVTuners.Constructor.Thisclasscannotbecreateddirectly.RetrievethefriendlynameofaconnectorType.Releaseunmanagedresources.Enabledordisablethissource.Exceptionthrownwhenthedevicecannotberenderedorstarted.PropertypagesforaDirectShowfilter(e.g.hardwaredevice).Thesepropertypagesdonotsupportpersistingtheirsettings.Abaseclassforrepresentingpropertypagesexposedbyfilters.Nameofpropertypage.ThisnamemaynotbeuniqueDoesthispropertypagesupportsavingandloadingtheuser'schoices.ConstructorShowthepropertypage.Somepropertypagescannotbedisplayedwhilepreviewingand/orcapturing.Thismethodwillblockuntilthepropertypageisclosedbytheuser.ReleaseunmanagedresourcesGetorsetthestateofthepropertypage.Thisisusedtosaveandrestoretheuser'schoiceswithoutredisplayingthepropertypage.Aftershowingthispropertypage,readandstorethevalueofthisproperty.Atalatertime,theuser'schoicescanbereloadedbysettingthispropertywiththevaluestoredearlier.Notethatsomepropertypages,aftersettingthisproperty,willnotreflectthenewstate.However,thefilterwillusethenewsettings.Whenreadingthisproperty,copytheentirearrayatoncethenmanipulateyourlocalcopy(e..gbyte[]myState=propertyPage.State).Whensettingthispropertysettheentirearrayatonce(e.g.propertyPage=myState).Notallpropertypagessupportsaving/loadingstate.Checkthepropertytodetermineifthispropertypagesupportsit.COMISpecifyPropertyPagesinterfaceConstructorShowthepropertypage.Somepropertypagescannotbedisplayedwhilepreviewingand/orcapturing.ReleaseunmanagedresourcesRepresentsaDirectShowfilter(e.g.videocapturedevice,compressioncodec).TosaveachosenfilerforlaterrecallsavetheMonikerStringpropertyonthefilter:
stringsavedMonikerString=myFilter.MonikerString;
TorecallthefiltercreateanewFilterclassandpassthestringtotheconstructor:
FiltermySelectedFilter=newFilter(savedMonikerString);
Human-readablenameofthefilterUniquestringreferencingthisfilter.Thisstringcanbeusedtorecreatethisfilter.Createanewfilterfromitsmonikerstring.CreateanewfilterfromitsmonikerRetrievetheamoniker'sdisplayname(i.e.it'suniquestring)Retrievethehuman-readablenameofthefilterGetamoniker'shuman-readablenamebasedonamonikerstring.ThismethodgetsaUCOMIMonikerobject.HACK:TheonlywaytocreateaUCOMIMonikerfromamonikerstringistouseUCOMIMoniker.ParseDisplayName().SoIneedANYUCOMIMonikerobjectsothatIcancallParseDisplayName().Doesanyonehaveabettersolution?Thisassumesthereisatleastonevideocompressorfilterinstalledonthesystem.Comparesthecurrentinstancewithanotherobjectofthesametype.AcollectionofFilterobjects(DirectShowfilters).Thisisusedbytheclasstoprovidelistsofcapturedevicesandcompressionfilters.Thisclasscannotbecreateddirectly.Populatethecollectionwithalistoffiltersfromaparticularcategory.PopulatetheInnerListwithalistoffiltersfromaparticularcategoryGetthefilteratthespecifiedindex.Providescollectionsofdevicesandcompressioncodecsinstalledonthesystem.DevicesandcompressioncodecsareimplementedinDirectShowasfilters,seetheclassformoreinformation.Tolisttheavailablevideodevices:
Filtersfilters=newFilters();foreach(Filterfinfilters.VideoInputDevices){Debug.WriteLine(f.Name);}
Collectionofavailablevideocapturedevices.Collectionofavailableaudiocapturedevices.Collectionofavailablevideocompressors.Collectionofavailableaudiocompressors.AcollectionofavailablePropertyPagesinaDirectShowfiltergraph.Itisuptothedrivermanufacturertoimplementapropertypagesontheirdrivers.Thelistofsupportedpropertypageswillvaryfromdrivertodriver.Initializecollectionwithnopropertypages.Initializecollectionwithpropertypagesfromexistinggraph.Destructor.Releaseunmanagedresources.Emptythecollection.ReleaseunmanagedresourcesPopulatethecollectionbylookingforcommonlyimplementedpropertypages.ReturnstheobjectasanISpecificPropertyPageiftheobjectsupportstheISpecificPropertyPageinterfaceandhasatleastonepropertypage.Getthefilteratthespecifiedindex.Acollectionofsources(orphysicalconnectors)onanaudioorvideodevice.Thisisusedbytheclasstoprovidealistofavailablesourcesonthecurrentlyselectedaudioandvideodevices.Thisclasscannotbecreateddirectly.Thisclassassumesthereisonly1videoand1audiocrossbarandallinputpinsroutetoasingleoutputpinoneachcrossbar.Initializecollectionwithnosources.Initializecollectionwithsourcesfromgraph.Destructor.Releaseunmanagedresources.Emptythecollection.Releaseunmanagedresources.Populatethecollectionfromafiltergraph.Retrievealistofcrossbarfiltersinthegraph.Mosthardwaredevicesshouldhaveamaximumof2crossbars,oneforvideoandanotherforaudio.PopulatetheinternalInnerListwithsources/physicalconnectorsfoundonthecrossbars.Eachinstanceofthisclassislimitedtovideoonlyoraudioonlysources(specifiedbytheisVideoDeviceparameterontheconstructor)sowecheckeachsourcebeforeaddingittothelist.Getthesourceatthespecifiedindex.Getsorsetsthesource/physicalconnectorcurrentlyinuse.ThisismarkedinternalsothattheCaptureclasscancontrolhowandwhenthesourceischanged.SpecifythefrequencyoftheTVtuner.CablefrequencyAntennafrequencyControlandqueryahardwareTVTuner.InitializethisobjectwithaDirectShowtunerGetorsettheTVTunerchannel.Getorsetthetunerfrequency(cableorantenna).Indicateswhetherasignalispresentonthecurrentchannel.Ifthesignalstrengthcannotbedetermined,aNotSupportedExceptionisthrown.ThepropertypagetoconfigureaVideoforWindowscompliantcompressioncodec.MostcompressorssupportthispropertypageratherthanaDirectShowpropertypage.Also,mostcompressorsdonotsupporttheIAMVideoCompressioninterfacesothispropertypageistheonlymethodtoconfigureacompressor.VideoforWindowscompressiondialoginterfaceConstructorShowthepropertypage.Somepropertypagescannotbedisplayedwhilepreviewingand/orcapturing.Getorsetthestateofthepropertypage.Thisisusedtosaveandrestoretheuser'schoiceswithoutredisplayingthepropertypage.Thispropertywillbenullifunabletoretrievethepropertypage'sstate.Aftershowingthispropertypage,readandstorethevalueofthisproperty.Atalatertime,theuser'schoicescanbereloadedbysettingthispropertywiththevaluestoredearlier.Notethatsomepropertypages,aftersettingthisproperty,willnotreflectthenewstate.However,thefilterwillusethenewsettings.Capabilitiesofthevideodevicesuchasmin/maxframesizeandframerate.Nativesizeoftheincomingvideosignal.Thisisthelargestsignalthefiltercandigitizewitheverypixelremainingunique.Read-only.Minimumsupportedframesize.Read-only.Maximumsupportedframesize.Read-only.Granularityoftheoutputwidth.ThisvaluespecifiestheincrementsthatarevalidbetweenMinFrameSizeandMaxFrameSize.Read-only.Granularityoftheoutputheight.ThisvaluespecifiestheincrementsthatarevalidbetweenMinFrameSizeandMaxFrameSize.Read-only.Minimumsupportedframerate.Read-only.Maximumsupportedframerate.Read-only.Retrievecapabilitiesofavideodevice
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息