LEADTOOLS Multimedia (Leadtools.Multimedia assembly) Send comments on this topic. | Back to Introduction | Help Version 17.0.3.22
UseFilterCache Property
See Also 
Leadtools.Multimedia Namespace > TargetFormat Class : UseFilterCache Property



Gets or sets a value that determines whether the toolkit is currently caching filters.

Syntax

Visual Basic (Declaration) 
Public Property UseFilterCache As Boolean
Visual Basic (Usage)Copy Code
Dim instance As TargetFormat
Dim value As Boolean
 
instance.UseFilterCache = value
 
value = instance.UseFilterCache
C# 
public bool UseFilterCache {get; set;}
C++/CLI 
public:
property bool UseFilterCache {
   bool get();
   void set (    bool value);
}

Property Value

true to enable caching filters; otherwise, false to disable caching filters. The default value is false.

Example

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

   Try
      ' set a video device first, you should use your video device name here
      If capturectrl.VideoDevices("Analog") Is Nothing Then
         Throw New Exception("No Analog audio device available")
      End If

      capturectrl.VideoDevices("Analog").Selected = True

      ' set the video compressor
      capturectrl.VideoCompressors.Mpeg2.Selected = True

      ' reference the target formats collection
      Dim fmt As TargetFormat = capturectrl.TargetFormats.MPEG2Program

      ' enumerate through the list of formats
      For Each af As TargetFormat In capturectrl.TargetFormats
         ' check the formats valid compressor and stream type
         Dim isValid As Boolean = (af.IsValidCompressor(capturectrl.VideoCompressors.Mpeg2.Name) = TargetFormatCompressor.Valid)
         Dim types As StreamFormatType = af.Streams

         ' if valid, select it
         If isValid AndAlso ((types And StreamFormatType.Video) = StreamFormatType.Video) Then
            fmt = af
            fmt.Selected = True
            Exit For
         End If
      Next af

      ' check to see if the current target format has a cache dialog
      If Not fmt Is Nothing AndAlso fmt.HasCacheDialog(TargetFormatDlg.VideoCompressor) Then
         ' show the dialog
         fmt.ShowCacheDialog(TargetFormatDlg.VideoCompressor, _form)

         ' set the result
         _result = True
      End If
   Catch e1 As Exception
      _result = False
   End Try
End Sub
C#Copy Code
public bool _result = false;
public CaptureCtrlForm _form = new CaptureCtrlForm();
public void HasCacheDialogExample()
{
   // reference the capture control
   CaptureCtrl capturectrl = _form.CaptureCtrl;

   try
   {
      // set a video device first, you should use your video device name here
      if (capturectrl.VideoDevices["Analog"] == null)
         throw new Exception("No Analog audio device available");

      capturectrl.VideoDevices["Analog"].Selected = true;

      // set the video compressor
      capturectrl.VideoCompressors.Mpeg2.Selected = true;

      // reference the target formats collection
      TargetFormat fmt = capturectrl.TargetFormats.MPEG2Program;

      // enumerate through the list of formats
      foreach (TargetFormat af in capturectrl.TargetFormats)
      {
         // check the formats valid compressor and stream type
         bool isValid = (af.IsValidCompressor(capturectrl.VideoCompressors.Mpeg2.Name) == TargetFormatCompressor.Valid);
         StreamFormatType types = af.Streams;

         // if valid, select it
         if (isValid && ((types & StreamFormatType.Video) == StreamFormatType.Video))
         {
            fmt = af;
            fmt.Selected = true;
            break;
         }
      }

      // check to see if the current target format has a cache dialog
      if (fmt != null && fmt.HasCacheDialog(TargetFormatDlg.VideoCompressor))
      {
         // show the dialog
         fmt.ShowCacheDialog(TargetFormatDlg.VideoCompressor, _form);

         // set the result
         _result = true;
      }
   }
   catch (Exception)
   {
      _result = false;
   }
}

Remarks

Setting this property to true will enable caching for the current target format object. The target format object is the format to be used for the converted file. This includes the file format, any special settings used by the format, which audio/video codec that is to be used for the conversion and any special settings used by the codec. Additionally, setting this property to true will force the toolkit to preload and reuse the filters specified for the particular format. If there isn't any currently created object, one will be created. Setting the value of this property to FALSE will disable the caching for the current target format object. If an object currently exists, it will destroy it. Use the TargetFormat.GetCacheObject method to retrieve the caching filter object. Use the TargetFormat.ShowCacheDialog method to display a specific property dialog for the caching filter. Use the TargetFormat.HasCacheDialog method to query whether the specified property dialog for the caching filter is available.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also