LEADTOOLS Multimedia (Leadtools.MediaFoundation assembly)

SubTypeFriendlyName Property

Show in webframe
Example 



This property is updated with a string that represents the video format type's friendly name.
Syntax
'Declaration
 
Public ReadOnly Property SubTypeFriendlyName As String
'Usage
 
Dim instance As VideoFormat
Dim value As String
 
value = instance.SubTypeFriendlyName
public string SubTypeFriendlyName {get;}
public:
property String^ SubTypeFriendlyName {
   String^ get();
}

Property Value

A string that represents the video format type's friendly name.
Remarks

This property is updated with a string that represents the video format type's friendly name. Use the CaptureCtrl.VideoCaptureFormats property to update the VideoFormats object with all of the video formats available for the current capture device. The VideoFormats indexer obtains a VideoFormat object for each of the supported video formats. The VideoFormat properties of each VideoFormat object, obtained using the VideoFormats indexer, are updated with information about that specific video format. This information includes the following information:

The height and width of the video format are contained in the Height property and the Width property, respectively. The Compression property is updated with the video compression information for the video format. The SubTypeName property is updated with the GUID of the video format type.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.MediaFoundation
Imports LeadtoolsMediaFoundationExamples.Fixtures

Public _form As CaptureCtrlForm = New CaptureCtrlForm()
Public _result As Boolean = False
Public Sub VideoFormatExample()
   ' reference the capture control
   Dim capturectrl As CaptureCtrl = _form.CaptureCtrl

   Dim count As Integer, compression As Integer = 0, bits As Integer = 0, width As Integer = 0, height As Integer = 0
   Dim found As Integer, selected As Integer = -1

   ' set a video device, use the name of your device here
   If Not capturectrl.VideoDevices("USB") Is Nothing Then
      capturectrl.VideoDevices("USB").Selected = True
   End If

   ' reference the videoformats property
   Dim videoformats As VideoFormats = capturectrl.VideoCaptureFormats

   Try
      ' get count of available video formats
      count = videoformats.Count

      ' enumerate formats and select one
      For Each vf As VideoFormat In videoformats
         ' get the properties
         bits = vf.BitCount
         compression = vf.Compression
         width = vf.Width
         height = vf.Height

         ' select the format if it matches some criteria
         If bits = 16 AndAlso width = 640 AndAlso height = 480 Then
            vf.Selected = True
            Exit For
         End If
      Next vf

      ' reset the current item
      videoformats.Reset()

      ' get the currently selected format
      selected = 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 it
      If found <> selected Then
         videoformats.Selection = found
      End If

      ' get the new selected format
      selected = videoformats.Selection

      ' set our result based on what we expect
      _result = (count > 0 AndAlso selected = found)
   Catch e1 As Exception
      _result = False
   End Try
End Sub
using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;

public CaptureCtrlForm _form = new CaptureCtrlForm();
public bool _result = false;
public void VideoFormatExample()
{
   // reference the capture control
   CaptureCtrl 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 here
   if (capturectrl.VideoDevices["USB"] != null)
      capturectrl.VideoDevices["USB"].Selected = true;

   // reference the videoformats property
   VideoFormats videoformats = capturectrl.VideoCaptureFormats;

   try
   {
      // get count of available video formats
      count = videoformats.Count;

      // enumerate formats and select one
      foreach (VideoFormat vf in videoformats)
      {
         // get the properties
         bits = vf.BitCount;
         compression = vf.Compression;
         width = vf.Width;
         height = vf.Height;

         // select the format if it matches some criteria
         if (bits == 16 && width == 640 && height == 480)
         {
            vf.Selected = true;
            break;
         }
      }

      // reset the current item
      videoformats.Reset();

      // get the currently selected format
      selected = 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 it
      if (found != selected)
         videoformats.Selection = found;

      // get the new selected format
      selected = videoformats.Selection;

      // set our result based on what we expect
      _result = (count > 0 && selected == found);
   }
   catch (Exception)
   {
      _result = false;
   }
}
Requirements

Target Platforms

See Also

Reference

VideoFormat Class
VideoFormat Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.MediaFoundation requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features