TVFormat Property

Summary
Gets or sets the current analog video format.
Syntax
C#
C++/CLI
public AnalogVideoStandard TVFormat { get; set; } 
public: 
property AnalogVideoStandard TVFormat { 
   AnalogVideoStandard get(); 
   void set (    AnalogVideoStandard ); 
} 

Property Value

An AnalogVideoStandard enumeration value representing the current analog video format.

Remarks

For a list of possible values, refer to the AnalogVideoStandard enumeration. The AnalogVideoDecoder.AvailableTVFormats property contains information on all analog video formats that the video decoder supports.

For more detailed information, refer to the Microsoft documentation for IAMAnalogVideoDecoder.get_TVFormat.

Example
C#
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 control 
      CaptureCtrl 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 device 
      if (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 not 
      if (tvFormat != AnalogVideoStandard.NTSC_M_J 
         && (availableFormats & AnalogVideoStandard.NTSC_M_J) == AnalogVideoStandard.NTSC_M_J) 
      { 
         // set the analog video decoder TV format 
         analogvideodecoder.TVFormat = AnalogVideoStandard.NTSC_M_J; 
 
         // check the changed format 
         allResults &= (analogvideodecoder.TVFormat == AnalogVideoStandard.NTSC_M_J); 
      } 
 
      // check whether Horizontal Locked is enabled 
      bool 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 exceptions 
      try 
      { 
         // check whether VCR Horizontal Sync locking is enabled and set it if not 
         bool vcrLocked = capturectrl.AnalogVideoDecoder.VCRHorizontalLocking; 
         if (!vcrLocked) 
         { 
            // set VCR horzontal sync locking 
            capturectrl.AnalogVideoDecoder.VCRHorizontalLocking = true; 
 
            // include this as one of our checks 
            allResults &= capturectrl.AnalogVideoDecoder.VCRHorizontalLocking; 
         } 
 
         // check whether output enabled is set and set it if not 
         bool outputEnabled = capturectrl.AnalogVideoDecoder.OutputEnable; 
         if (!outputEnabled) 
         { 
            // enable output 
            capturectrl.AnalogVideoDecoder.OutputEnable = true; 
 
            // include this as one of our checks 
            allResults &= capturectrl.AnalogVideoDecoder.OutputEnable; 
         } 
      } 
      catch (COMException cex) 
      { 
         // if the device does not support the properties above 
         // skip it and do not fail 
         if (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 graph 
      while (lines != 525 && tries++ < 10) 
      { 
         // get the number of scan lines in the output format 
         lines = capturectrl.AnalogVideoDecoder.NumberOfLines; 
         System.Diagnostics.Debug.WriteLine("TV Format: " 
                                            + analogvideodecoder.TVFormat.ToString() 
                                            + ", Scan Lines: " 
                                            + lines.ToString()); 
      } 
 
      // include the line count check 
      allResults &= (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:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.