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

PreviewingClosedCaption Property

Example 





Gets or sets a value that indicates whether closed captioning is previewed.
Syntax
public virtual bool PreviewingClosedCaption {get;}
'Declaration
 
Public Overridable ReadOnly Property PreviewingClosedCaption As Boolean
'Usage
 
Dim instance As CaptureCtrl
Dim value As Boolean
 
value = instance.PreviewingClosedCaption
public virtual bool PreviewingClosedCaption {get;}
 get_PreviewingClosedCaption(); 
public:
virtual property bool PreviewingClosedCaption {
   bool get();
}

Property Value

true if Closed Captioning is previewed; false, otherwise.
Example
Copy CodeCopy Code  
Public _result As Boolean = False
      Public _form As CaptureCtrlForm = New CaptureCtrlForm()
      Public _capturectrl As CaptureCtrl
      Public Sub ClosedCaptioningExample()
         ' reference the capture control
         _capturectrl = _form.CaptureCtrl

         ' output file names
         Dim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_ClosedCaptioningExample_DVD")

         Try
            ' try to find a Digital tuner, use your device name here
            If _capturectrl.VideoDevices("Analog") Is Nothing Then
               Throw New Exception("No Analog video device available")
            End If

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

            ' select video and audio compressors
            _capturectrl.VideoCompressors.Mpeg2.Selected = True
            _capturectrl.AudioCompressors.AC3.Selected = True

            ' set the target format to MPEG2 program
            _capturectrl.TargetFormat = TargetFormatType.MPEG2Program

            If _capturectrl.HasDialog(CaptureDlg.TargetFormat) Then
               _capturectrl.ShowDialog(CaptureDlg.TargetFormat, _form)
            End If

            ' tune to a channel with closed captions
            _capturectrl.TVTuner.SetChannel(28, -1, -1)

            ' set the target file
            _capturectrl.TargetFile = outFile

            ' enable the preview
            _capturectrl.Preview = True

            ' check if closed captioning is enabled
            If _capturectrl.ClosedCaptionAvailable AndAlso _capturectrl.ClosedCaptioning = False Then
               ' try to toggle closed captioning 
               _capturectrl.ToggleClosedCaptioning()

               ' set the result to what we expect
               If _capturectrl.ClosedCaptioning Then
                  _result = True
               End If

               ' get the previewing cc state
               Dim _previewCC As Boolean = _capturectrl.PreviewingClosedCaption
            End If

            ' check if we have can capture video
            If _capturectrl.IsModeAvailable(CaptureMode.VideoAndAudio) Then
               _capturectrl.TimeLimit = 30 ' just 30 seconds of capture time
               _capturectrl.UseTimeLimit = True

               ' start the capture process
               _capturectrl.StartCapture(CaptureMode.VideoAndAudio)

               ' 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 _capturectrl.State = CaptureState.Running
                  Application.DoEvents()
               Loop

               _result = True
            End If
         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 _capturectrl.State = CaptureState.Running
            Application.DoEvents()
         Loop
      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 CaptureCtrlForm _form = new CaptureCtrlForm();
      public CaptureCtrl _capturectrl;
      public void ClosedCaptioningExample()
      {
         // reference the capture control
         _capturectrl = _form.CaptureCtrl;

         // output file names
         string outFile = Path.Combine(LEAD_VARS.MediaDir,"CaptureCtrl_ClosedCaptioningExample_DVD");

         try
         {
            // try to find a Digital tuner, use your device name here
            if (_capturectrl.VideoDevices["Analog"] == null)
               throw new Exception("No Analog video device available");

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

            // select video and audio compressors
            _capturectrl.VideoCompressors.Mpeg2.Selected = true;
            _capturectrl.AudioCompressors.AC3.Selected = true;

            // set the target format to MPEG2 program
            _capturectrl.TargetFormat = TargetFormatType.MPEG2Program;

            if (_capturectrl.HasDialog(CaptureDlg.TargetFormat))
               _capturectrl.ShowDialog(CaptureDlg.TargetFormat, _form);

            // tune to a channel with closed captions
            _capturectrl.TVTuner.SetChannel(28, -1, -1);

            // set the target file
            _capturectrl.TargetFile = outFile;

            // enable the preview
            _capturectrl.Preview = true;

            // check whether closed captioning is enabled
            if (_capturectrl.ClosedCaptionAvailable
               && _capturectrl.ClosedCaptioning == false)
            {
               // try to toggle closed captioning 
               _capturectrl.ToggleClosedCaptioning();

               // set the result to what we expect
               if (_capturectrl.ClosedCaptioning)
                  _result = true;

               // get the previewing cc state
               bool _previewCC = _capturectrl.PreviewingClosedCaption;
            }

            // check whether we can capture video
            if (_capturectrl.IsModeAvailable(CaptureMode.VideoAndAudio))
            {
               _capturectrl.TimeLimit = 30;      // just 30 seconds of capture time
               _capturectrl.UseTimeLimit = true;

               // start the capture process
               _capturectrl.StartCapture(CaptureMode.VideoAndAudio);

               // 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 (_capturectrl.State == CaptureState.Running)
                  Application.DoEvents();

               _result = true;
            }
         }
         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 (_capturectrl.State == CaptureState.Running)
            Application.DoEvents();
      }

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

CaptureCtrl Class
CaptureCtrl 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