Gets the analog video formats that the decoder supports.
public AnalogVideoStandard AvailableTVFormats { get; } Public ReadOnly Property AvailableTVFormats As AnalogVideoStandard public:property AnalogVideoStandard AvailableTVFormats {AnalogVideoStandard get();}
An AnalogVideoStandard value representing the analog video formats that the video decoder supports.
The AnalogVideoDecoder.TVFormat property contains the current analog video format. For a list of possible values, refer to the AnalogVideoStandard enumeration.
These enumeration values may be combined using the bitwise OR operator.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public void AvailableTVFormatsExample(){try{// reference the forms capture controlCaptureCtrl capturectrl = _form.CaptureCtrl;string outFile = Path.Combine(LEAD_VARS.MediaDir, "AnalogVideoDecoder_AvailableTVFormatsExample.avi");int lines = 0;bool allResults = true;// select the first device with the word "analog" in its name// Replace "Analog" with the name of your tuner deviceif (capturectrl.VideoDevices["Analog"] == null)throw new Exception("No analog video capture device available");capturectrl.VideoDevices["Analog"].Selected = true;AnalogVideoDecoder analogvideodecoder = capturectrl.AnalogVideoDecoder;AnalogVideoStandard availableFormats = analogvideodecoder.AvailableTVFormats;AnalogVideoStandard tvFormat = analogvideodecoder.TVFormat;// check whether the format is NTSC and set it if notif (tvFormat != AnalogVideoStandard.NTSC_M_J&& (availableFormats & AnalogVideoStandard.NTSC_M_J) == AnalogVideoStandard.NTSC_M_J){// set the analog video decoder TV formatanalogvideodecoder.TVFormat = AnalogVideoStandard.NTSC_M_J;// check the changed formatallResults &= (analogvideodecoder.TVFormat == AnalogVideoStandard.NTSC_M_J);}// check whether Horizontal Locked is enabledbool vLocked = capturectrl.AnalogVideoDecoder.HorizontalLocked;// Some video device's Analog Decoder implementations do not// support the following properties, so we wrap these property// accesses with a special try block to catch possible exceptionstry{// check whether VCR Horizontal Sync locking is enabled and set it if notbool vcrLocked = capturectrl.AnalogVideoDecoder.VCRHorizontalLocking;if (!vcrLocked){// set VCR horzontal sync lockingcapturectrl.AnalogVideoDecoder.VCRHorizontalLocking = true;// include this as one of our checksallResults &= capturectrl.AnalogVideoDecoder.VCRHorizontalLocking;}// check whether output enabled is set and set it if notbool outputEnabled = capturectrl.AnalogVideoDecoder.OutputEnable;if (!outputEnabled){// enable outputcapturectrl.AnalogVideoDecoder.OutputEnable = true;// include this as one of our checksallResults &= capturectrl.AnalogVideoDecoder.OutputEnable;}}catch (COMException cex){// if the device does not support the properties above// skip it and do not failif (cex.ErrorCode != (int)ErrorCode.E_PROP_ID_UNSUPPORTED&& cex.ErrorCode != (int)ErrorCode.E_PROP_SET_UNSUPPORTED)throw cex;}int tries = 0;// check scan line count a few times// initial frames may differ from format spec, until frame data// has propogated through the capture graphwhile (lines != 525 && tries++ < 10){// get the number of scan lines in the output formatlines = capturectrl.AnalogVideoDecoder.NumberOfLines;System.Diagnostics.Debug.WriteLine("TV Format: "+ analogvideodecoder.TVFormat.ToString()+ ", Scan Lines: "+ lines.ToString());}// include the line count checkallResults &= (lines == 525 && tries < 10);System.Diagnostics.Debug.WriteLine("Tries: " + tries.ToString());// test results_result = allResults;}catch (Exception){_result = false;}}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public Sub AvailableTVFormatsExample()Try' reference the forms capture controlDim capturectrl As CaptureCtrl = _form.CaptureCtrlDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "AnalogVideoDecoder_AvailableTVFormatsExample.avi")Dim lines As Integer = 0Dim allResults As Boolean = True' select the first device with analog in it's name' Replace "Analog" with your tuner device nameIf capturectrl.VideoDevices("Analog") Is Nothing ThenThrow New Exception("No analog video capture device available")End Ifcapturectrl.VideoDevices("Analog").Selected = TrueDim analogvideodecoder As AnalogVideoDecoder = capturectrl.AnalogVideoDecoderDim availableFormats As AnalogVideoStandard = analogvideodecoder.AvailableTVFormatsDim tvFormat As AnalogVideoStandard = analogvideodecoder.TVFormat' Check if format is NTSC and set it if notIf tvFormat <> AnalogVideoStandard.NTSC_M_J AndAlso (availableFormats AndAnalogVideoStandard.NTSC_M_J) =AnalogVideoStandard.NTSC_M_J Then' set the analog video decoder TV formatanalogvideodecoder.TVFormat = AnalogVideoStandard.NTSC_M_J' check the changed formatallResults = allResults And (analogvideodecoder.TVFormat = AnalogVideoStandard.NTSC_M_J)End If' Check if Horizontal Locked is enabledDim vLocked As Boolean = capturectrl.AnalogVideoDecoder.HorizontalLocked' Some video device's Analog Decoder implementations do not' support the following properties, so we wrap these property' accesses with a special try block to catch possible exceptionsTry' Check if VCR Horizontal Sync locking is enabled and set if notDim vcrLocked As Boolean = capturectrl.AnalogVideoDecoder.VCRHorizontalLockingIf (Not vcrLocked) Then' set VCR horzontal sync lockingcapturectrl.AnalogVideoDecoder.VCRHorizontalLocking = True' include this as one of our checksallResults = allResults And capturectrl.AnalogVideoDecoder.VCRHorizontalLockingEnd If' Check if output enabled is set and set if notDim outputEnabled As Boolean = capturectrl.AnalogVideoDecoder.OutputEnableIf (Not outputEnabled) Then' enable outputcapturectrl.AnalogVideoDecoder.OutputEnable = True' include this as one of our checksallResults = allResults And capturectrl.AnalogVideoDecoder.OutputEnableEnd IfCatch cex As COMException' if the device does not support the properties above' skip it and dont failIf cex.ErrorCode <> CInt(ErrorCode.E_PROP_ID_UNSUPPORTED) AndAlso cex.ErrorCode <> CInt(ErrorCode.E_PROP_SET_UNSUPPORTED) ThenThrow cexEnd IfEnd TryDim tries As Integer = 0' check scan line count a few times' initial frames may differ from format spec, until frame data' has propogated through the capture graphDo While lines <> 525 AndAlso tries < 10' get the number of scan lines in the output formatlines = capturectrl.AnalogVideoDecoder.NumberOfLinesSystem.Diagnostics.Debug.WriteLine("TV Format: " & analogvideodecoder.TVFormat.ToString() & ", Scan Lines: " & lines.ToString())tries += 1Loop' include the line count checkallResults = allResults And (lines = 525 AndAlso tries < 10)System.Diagnostics.Debug.WriteLine("Tries: " & tries.ToString())' test results_result = allResultsCatch e1 As Exception_result = FalseEnd TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
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
