LEADTOOLS Multimedia (Leadtools.Multimedia assembly)
LEAD Technologies, Inc

StillCaptureLimit Property

Example 





Gets or sets the time limit for capturing a still image, in milliseconds.
Syntax
public virtual int StillCaptureLimit {get; set;}
'Declaration
 
Public Overridable Property StillCaptureLimit As Integer
'Usage
 
Dim instance As ConvertCtrl
Dim value As Integer
 
instance.StillCaptureLimit = value
 
value = instance.StillCaptureLimit
public virtual int StillCaptureLimit {get; set;}
 get_StillCaptureLimit();
set_StillCaptureLimit(value);
public:
virtual property int StillCaptureLimit {
   int get();
   void set (    int value);
}

Property Value

A value representing the time limit for still capture, in milliseconds.
Remarks
The time limit is the time after which no frames can be captured. For example, if this property value is set to be 5000ms, no frames can be captured after 5 seconds into the conversion. When setting a value for this property, if the media samples' time exceeds this value then calling the SaveStillBitmap method will return the last, previously captured image (old). The default value is 1000 milliseconds. Use the EnableStillCapture property to indicate whether still images can be captured during conversion. Use the SaveStillBitmap method to save a snapshot from the running stream to a file as a bitmap.
Example
Copy CodeCopy Code  
Public _result As Boolean = False
      Public _form As ConvertCtrlForm = New ConvertCtrlForm()
      Public _convertctrl As ConvertCtrl = Nothing
      Public _bmpFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_SaveStillBitmap.bmp")
      Public Sub SaveStillBitmapExample()
         ' input and output file names
         Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_Source.avi")
         Dim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_SaveStillBitmapExample.mpg")

         Try
            ' reference the convert control
            _convertctrl = _form.ConvertCtrl

            ' set a timer on the form to make the still bitmap
            _form.TestTimer.Interval = 5000
            AddHandler _form.TestTimer.Tick, AddressOf SaveStillBitmap_Helper

            ' enable still capture
            _convertctrl.EnableStillCapture = True

            ' set the time window limit for capture of stills (ms)
            _convertctrl.StillCaptureLimit = 100000

            ' set the compressor to DVVideo
            _convertctrl.VideoCompressors.DVVideo.Selected = True

            ' set the source and target files
            _convertctrl.SourceFile = inFile
            _convertctrl.TargetFile = outFile

            ' convert it now!
            _convertctrl.StartConvert()

            ' now start the test timer for the still capture
            _form.TestTimer.Start()
         Catch e1 As Exception
            _result = False
         End Try

         ' we'll loop on the state and pump messages for this example.
         ' but you should not need to if running from a Windows Forms application.
         Do While _convertctrl.State = ConvertState.Running
            Application.DoEvents()
         Loop
      End Sub

      Public Sub SaveStillBitmap_Helper(ByVal sender As Object, ByVal e As EventArgs)
         ' cancel the timer
         _form.TestTimer.Stop()

         ' try to simulate an error condition
         _convertctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1)

         ' check for the capture file and set the result
         If File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile)) Then
            _result = True
         End If
      End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
End Class
public bool _result = false;
      public ConvertCtrlForm _form = new ConvertCtrlForm();
      public ConvertCtrl _convertctrl = null;
      public string _bmpFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_SaveStillBitmap.bmp");
      public void SaveStillBitmapExample()
      {
         // input and output file names
         string inFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_Source.avi");
         string outFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_SaveStillBitmapExample.mpg");

         try
         {
            // reference the convert control
            _convertctrl = _form.ConvertCtrl;

            // set a timer on the form to make the still bitmap
            _form.TestTimer.Interval = 5000;
            _form.TestTimer.Tick += new EventHandler(SaveStillBitmap_Helper);

            // enable still capture
            _convertctrl.EnableStillCapture = true;

            // set the time window limit for capture of stills (ms)
            _convertctrl.StillCaptureLimit = 100000;

            // set the compressor to DVVideo
            _convertctrl.VideoCompressors.DVVideo.Selected = true;

            // set the source and target files
            _convertctrl.SourceFile = inFile;
            _convertctrl.TargetFile = outFile;

            // convert it now!
            _convertctrl.StartConvert();

            // now start the test timer for the still capture
            _form.TestTimer.Start();
         }
         catch (Exception)
         {
            _result = false;
         }

         // we'll loop on the state and pump messages for this example.
         // but you should not need to if running from a Windows Forms application.
         while (_convertctrl.State == ConvertState.Running)
            Application.DoEvents();
      }

      public void SaveStillBitmap_Helper(object sender, EventArgs e)
      {
         // cancel the timer
         _form.TestTimer.Stop();

         // try to simulate an error condition
         _convertctrl.SaveStillBitmap(_bmpFile, StillFormatType.BMP, 0, 0, -1);

         // check for the capture file and set the result
         if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _bmpFile)))
            _result = true;
      }

static class LEAD_VARS
{
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ConvertCtrl Class
ConvertCtrl Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

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