MediaType Property

Summary
Gets the format of the media.
Syntax
C#
VB
C++
publicVCRControlMediaTypeMediaType {get; }
PublicReadOnlyPropertyMediaTypeAsVCRControlMediaType
public:propertyVCRControlMediaTypeMediaType {VCRControlMediaTypeget();}

Property Value

AVCRControlMediaTypevalue that represents the media format

Remarks

Gets the format of the media. The value is one of theVCRControlMediaTypeenumeration values.

Example
C#
VB
usingLeadtools;usingLeadtools.Multimedia;usingLeadtoolsMultimediaExamples.Fixtures;publicbool_result =false;publicConvertCtrlForm _form =newConvertCtrlForm();publicConvertCtrl _convertctrl;publicbool_testing;publicint_startTimeCode;publicint_stopTimeCode;publicvoidReadTimecodeExample(){// reference the convert control_convertctrl = _form.ConvertCtrl;// input filestringinFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi");try{// check to see if we have the desired target deviceif(_convertctrl.TargetDevices["Microsoft DV Camera and VCR"] ==null)thrownewException("No Microsoft DV Camera target devices available!");// set the video capture device, use your capture device name here_convertctrl。SourceFile = inFile;// select video and audio compressors to none_convertctrl。VideoCompressors.Selection = -1;_convertctrl。澳元ioCompressors.Selection = -1;// select the target format_convertctrl。TargetFormats[TargetFormatType.DVSD].Selected =true;// select only Audio for this example_convertctrl。AllowedStreams = StreamFormatType。澳元ioVideo;// set a target device_convertctrl。TargetDevices["Microsoft DV Camera and VCR"].Selected =true;// check the target device VCRControlif(_convertctrl.TargetVCRControl ==null|| (_convertctrl.TargetVCRControl.DeviceType == VCRControlDeviceType.NotPresent|| _convertctrl.TargetVCRControl.DeviceType == VCRControlDeviceType.Unknown))thrownewException("MS DV Camera's Target VCR control is not present!");// subscribe to convert control events for VCR control input_convertctrl。Started +=newEventHandler(ConvertCtrl_Started);_convertctrl。Complete +=newEventHandler(ConvertCtrl_Complete);_convertctrl。Progress +=newProgressEventHandler(ConvertCtrl_Progress);_convertctrl。KeyPress +=newLeadtools.188宝金博怎么下载Multimedia.KeyPressEventHandler(ConvertCtrl_KeyPress);// start the conversion_convertctrl。StartConvert();}catch(Exception){_result =false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while(_convertctrl.State == ConvertState.Running)Application.DoEvents();// switch to playback and test_testing =true;// again, we'll loop and pump messages for this example for// playback testing, (setting _testing == true will exit)while(_testing)Application.DoEvents();}voidConvertCtrl_Started(objectsender, EventArgs e){// start recordingif(_convertctrl.TargetVCRControl.Mode != VCRControlMode.Record){// pause the graph to prevent frame loss_convertctrl。PauseConvert();/ /开始记录录像机来讲ol_convertctrl。TargetVCRControl.Record();// resume graph now_convertctrl。RunConvert();}// get our VCR start timecode_startTimeCode = _convertctrl.TargetVCRControl.ReadTimecode();}voidConvertCtrl_Complete(objectsender, EventArgs e){// stop recordingif(_convertctrl.TargetVCRControl.Mode != VCRControlMode.Stop)_convertctrl。TargetVCRControl.Stop();// get our VCR start timecode_stopTimeCode = _convertctrl.TargetVCRControl.ReadTimecode();// set the result to what we expect_result = (_stopTimeCode > _startTimeCode);}voidConvertCtrl_KeyPress(objectsender, Leadtools.Multimedia.KeyPressEventArgs e){// if ok to perform playback functionsif(_testing && _convertctrl.TargetVCRControl !=null){// reference the target VCR controlVCRControl vcr = _convertctrl.TargetVCRControl;switch((char)e.keyAscii){case'*':// seek to the beginning of the captureif(vcr.Mode != VCRControlMode.Stop)vcr.Stop();vcr.SeekTimecode(_startTimeCode);break;case'~':// seek to the end of the captureif(vcr.Mode != VCRControlMode.Stop)vcr.Stop();vcr.SeekTimecode(_stopTimeCode);break;case'p':// start playbackif(vcr.Mode != VCRControlMode.Play)vcr.Play();break;case's':// skip ahead 1000 units from the current timecodevcr.Pause();inttc = vcr.ReadTimecode();vcr.SeekTimecode(tc + 1000);vcr.Play();break;case'+':// step forward one frameif(vcr.Mode != VCRControlMode.Pause)vcr.Pause();vcr.StepForward();break;case'-':// step backward one frameif(vcr.Mode != VCRControlMode.Pause)vcr.Pause();vcr.StepBackward();break;case'f':// slowest forwardvcr.SlowestForward();break;case'r':// slowest reversevcr.SlowestReverse();break;case'>':/ /快速est forwardvcr.FastestForward();break;case'<':/ /快速est reversevcr.FastestReverse();break;case'x':// stop playback and exitif(vcr.Mode != VCRControlMode.Stop)vcr.Stop();_testing =false;break;}}}voidConvertCtrl_Progress(objectsender, ProgressEventArgs e){if(_convertctrl.TargetVCRControl !=null){// reference the VCR controlVCRControl vcr = _convertctrl.TargetVCRControl;// get the current time codeinttimeCode = vcr.ReadTimecode();}}staticclassLEAD_VARS{publicconststringMediaDir =@"C:\LEADTOOLS21\Media";}
ImportsLeadtoolsImportsLeadtools.MultimediaImportsLeadtoolsMultimediaExamples.FixturesPublic_resultAsBoolean=FalsePublic_formAsConvertCtrlForm =NewConvertCtrlForm()Public_convertctrlAsConvertCtrlPublic_testingAsBooleanPublic_startTimeCodeAsIntegerPublic_stopTimeCodeAsIntegerPublicSubReadTimecodeExample()' reference the convert control_convertctrl = _form.ConvertCtrl' input fileDiminFileAsString= Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi")Try' check to see if we have the desired target deviceIf_convertctrl。TargetDevices("Microsoft DV Camera and VCR")IsNothingThenThrowNewException("No Microsoft DV Camera target devices available!")EndIf' set the video capture device, use your capture device name here_convertctrl。SourceFile = inFile' select video and audio compressors to none_convertctrl。VideoCompressors.Selection = -1_convertctrl。澳元ioCompressors.Selection = -1' select the target format_convertctrl。TargetFormats(TargetFormatType.DVSD).Selected =True' select only Audio for this example_convertctrl。AllowedStreams = StreamFormatType。澳元ioVideo' set a target device_convertctrl。TargetDevices("Microsoft DV Camera and VCR").Selected =True' check the target device VCRControlIf_convertctrl。TargetVCRControlIsNothingOrElse(_convertctrl.TargetVCRControl.DeviceType = VCRControlDeviceType.NotPresent _OrElse_convertctrl。TargetVCRControl.DeviceType = VCRControlDeviceType.Unknown)ThenThrowNewException("MS DV Camera's Target VCR control is not present!")EndIf' subscribe to convert control events for VCR control inputAddHandler_convertctrl。Started,AddressOfConvertCtrl_StartedAddHandler_convertctrl。Complete,AddressOfConvertCtrl_CompleteAddHandler_convertctrl。Progress,AddressOfConvertCtrl_ProgressAddHandler_convertctrl。KeyPress,AddressOfConvertCtrl_KeyPress' start the conversion_convertctrl。StartConvert()Catche1AsException_result =FalseEndTry' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.DoWhile_convertctrl。State = ConvertState.RunningApplication.DoEvents()Loop' switch to playback and test_testing =True' again, we'll loop and pump messages for this example for' playback testing, (setting _testing == true will exit)DoWhile_testingApplication.DoEvents()LoopEndSubPrivateSubConvertCtrl_Started(ByValsenderAsObject,ByValeAsEventArgs)' start recordingIf_convertctrl。TargetVCRControl.Mode <> VCRControlMode.RecordThen' pause the graph to prevent frame loss_convertctrl。PauseConvert()' start the record on the VCR control_convertctrl。TargetVCRControl.Record()' resume graph now_convertctrl。RunConvert()EndIf' get our VCR start timecode_startTimeCode = _convertctrl.TargetVCRControl.ReadTimecode()EndSubPrivateSubConvertCtrl_Complete(ByValsenderAsObject,ByValeAsEventArgs)' stop recordingIf_convertctrl。TargetVCRControl.Mode <> VCRControlMode.StopThen_convertctrl。TargetVCRControl.Stop()EndIf' get our VCR start timecode_stopTimeCode = _convertctrl.TargetVCRControl.ReadTimecode()' set the result to what we expect_result = (_stopTimeCode > _startTimeCode)EndSubPrivateSubConvertCtrl_KeyPress(ByValsenderAsObject,ByValeAsLeadtools.188宝金博怎么下载Multimedia.KeyPressEventArgs)' if ok to perform playback functionsIf_testingAndAlsoNot_convertctrl。TargetVCRControlIsNothingThen' reference the target VCR controlDimvcrAsVCRControl = _convertctrl.TargetVCRControlSelectCasee.keyAsciiCaseCShort("*")' seek to the beginning of the captureIfvcr.Mode <> VCRControlMode.StopThenvcr.Stop()EndIfvcr.SeekTimecode(_startTimeCode)CaseCShort("~")' seek to the end of the captureIfvcr.Mode <> VCRControlMode.StopThenvcr.Stop()EndIfvcr.SeekTimecode(_stopTimeCode)CaseCShort("p")' start playbackIfvcr.Mode <> VCRControlMode.PlayThenvcr.Play()EndIfCaseCShort("s")' skip ahead 1000 units from the current timecodevcr.Pause()DimtcAsInteger= vcr.ReadTimecode()vcr.SeekTimecode(tc + 1000)vcr.Play()CaseCShort("+")' step forward one frameIfvcr.Mode <> VCRControlMode.PauseThenvcr.Pause()EndIfvcr.StepForward()CaseCShort("-")' step backward one frameIfvcr.Mode <> VCRControlMode.PauseThenvcr.Pause()EndIfvcr.StepBackward()CaseCShort("f")' slowest forwardvcr.SlowestForward()CaseCShort("r")' slowest reversevcr.SlowestReverse()CaseCShort(">")' fastest forwardvcr.FastestForward()CaseCShort("<")' fastest reversevcr.FastestReverse()CaseCShort("x")' stop playback and exitIfvcr.Mode <> VCRControlMode.StopThenvcr.Stop()EndIf_testing =FalseEndSelectEndIfEndSubPrivateSubConvertCtrl_Progress(ByValsenderAsObject,ByValeAsProgressEventArgs)IfNot_convertctrl。TargetVCRControlIsNothingThen' reference the VCR controlDimvcrAsVCRControl = _convertctrl.TargetVCRControl' get the current time codeDimtimeCodeAsInteger= vcr.ReadTimecode()EndIfEndSubPublicNotInheritableClassLEAD_VARSPublicConstMediaDirAsString="C:\LEADTOOLS21\Media"EndClass
Requirements

Target Platforms

Leadtools.Multimedia Assembly
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2021LEAD Technologies, Inc.All Rights Reserved.