Gets the VideoCaptureFormats object that contains all the video formats available for the current capture device.
public virtual Leadtools.Mediafoundation.VideoFormats VideoCaptureFormats {get;} Public Overridable ReadOnly Property VideoCaptureFormats As Leadtools.Mediafoundation.VideoFormats public:virtual property Leadtools.Mediafoundation.VideoFormats^ VideoCaptureFormats {Leadtools.Mediafoundation.VideoFormats^ get();}
A VideoFormats object.
The VideoFormats indexer obtains a VideoFormat object for each of the supported video formats. The VideoFormat properties of each video format contain information about the specific video format.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public CaptureCtrlForm _form = new CaptureCtrlForm();public bool _result = false;public void VideoFormatExample(){// reference the capture controlCaptureCtrl capturectrl = _form.CaptureCtrl;int count, compression = 0, bits = 0, width = 0, height = 0;int found, selected = -1;// set a video device, use the name of your device hereif (capturectrl.VideoDevices["USB"] != null)capturectrl.VideoDevices["USB"].Selected = true;// reference the videoformats propertyVideoFormats videoformats = capturectrl.VideoCaptureFormats;try{// get count of available video formatscount = videoformats.Count;// enumerate formats and select oneforeach (VideoFormat vf in videoformats){// get the propertiesbits = vf.BitCount;compression = vf.Compression;width = vf.Width;height = vf.Height;// select the format if it matches some criteriaif (bits == 16 && width == 640 && height == 480){vf.Selected = true;break;}}// get the currently selected formatselected = videoformats.Selection;// find a format based on subtype name, width and height (YUY2 320 x 240 video)found = videoformats.IndexOf(Constants.MEDIASUBTYPE_YUY2, 320, 240);// our found format is not selected, so select itif (found != selected)videoformats.Selection = found;// get the new selected formatselected = videoformats.Selection;// set our result based on what we expect_result = (count > 0 && selected == found);}catch (Exception){_result = false;}}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _result As Boolean = FalsePublic Sub VideoFormatExample()' reference the capture controlDim capturectrl As CaptureCtrl = _form.CaptureCtrlDim count As Integer, compression As Integer = 0, bits As Integer = 0, width As Integer = 0, height As Integer = 0Dim found As Integer, selected As Integer = -1' set a video device, use the name of your device hereIf Not capturectrl.VideoDevices("USB") Is Nothing Thencapturectrl.VideoDevices("USB").Selected = TrueEnd If' reference the videoformats propertyDim videoformats As VideoFormats = capturectrl.VideoCaptureFormatsTry' get count of available video formatscount = videoformats.Count' enumerate formats and select oneFor Each vf As VideoFormat In videoformats' get the propertiesbits = vf.BitCountcompression = vf.Compressionwidth = vf.Widthheight = vf.Height' select the format if it matches some criteriaIf bits = 16 AndAlso width = 640 AndAlso height = 480 Thenvf.Selected = TrueExit ForEnd IfNext vf' get the currently selected formatselected = videoformats.Selection' find a format based on subtype name, width and height (YUY2 320 x 240 video)found = videoformats.IndexOf(Leadtools.MediaFoundation.Constants.MEDIASUBTYPE_YUY2, 320, 240)' our found format is not selected, so select itIf found <> selected Thenvideoformats.Selection = foundEnd If' get the new selected formatselected = videoformats.Selection' set our result based on what we expect_result = (count > 0 AndAlso selected = found)Catch e1 As Exception_result = FalseEnd TryEnd Sub
|
Products |
Support |
Feedback: VideoCaptureFormats Property - Leadtools.MediaFoundation |
Introduction |
Help Version 19.0.2017.6.16
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.