public bool Selected {get; set;}
true to either select the video format or to indicate that the video format is currently selected; false otherwise.
If the format is currently selected, changing its selection state will have no effect. One format must be selected at any time.
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;// if we need to know the friendly name of the subtypeVideoFormat foundVideoFormat = videoformats[found];string subtypeFriendlyName = foundVideoFormat.SubTypeFriendlyName;// get the new selected formatselected = videoformats.Selection;// set our result based on what we expect_result = (count > 0 && selected == found && foundVideoFormat.SubTypeName == Constants.MEDIASUBTYPE_YUY2);}catch (Exception){_result = false;}}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
