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



FileName
A character string that contains the file name to save the closed captioning data.
Flags
Value that represents the desired save options. For a list of possible values, refer to ClosedCaptioningFlags enumeration values.
FileName
A character string that contains the file name to save the closed captioning data.
Flags
Value that represents the desired save options. For a list of possible values, refer to ClosedCaptioningFlags enumeration values.
Sets a file name and options to save the closed captioning data as SRT or TEXT format.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub SetClosedCaptioningTargetFile( _
   ByVal FileName As String, _
   ByVal Flags As ClosedCaptioningFlags _
) 
Visual Basic (Usage)Copy Code
Dim instance As ConvertCtrl
Dim FileName As String
Dim Flags As ClosedCaptioningFlags
 
instance.SetClosedCaptioningTargetFile(FileName, Flags)
C# 
public virtual void SetClosedCaptioningTargetFile( 
   string FileName,
   ClosedCaptioningFlags Flags
)
C++/CLI 
public:
virtual void SetClosedCaptioningTargetFile( 
   String^ FileName,
   ClosedCaptioningFlags Flags
) 

Parameters

FileName
A character string that contains the file name to save the closed captioning data.
Flags
Value that represents the desired save options. For a list of possible values, refer to ClosedCaptioningFlags enumeration values.

Example

Visual BasicCopy Code
Public _result As Boolean = False
      Public _form As ConvertCtrlForm = New ConvertCtrlForm()
      Public Sub ClosedCaptioningTargetFile()
         ' reference the convert control
         Dim convertctrl As ConvertCtrl = _form.ConvertCtrl

         ' target file
         Dim targetFileCc As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_ClosedCaptioningTargetFile.srt")
         Dim flags As ClosedCaptioningFlags = ClosedCaptioningFlags.Default
         Dim testFile As String = String.Empty
         Dim testFlags As ClosedCaptioningFlags

         Try

            ' set target file name and save options
            convertctrl.SetClosedCaptioningTargetFile(targetFileCc, flags)

            convertctrl.GetClosedCaptioningTargetFile(testFile, testFlags)

            If testFile = targetFileCc AndAlso testFlags = flags Then
               _result = True
            Else
               _result = False
            End If
         Catch e1 As Exception
            _result = False
         End Try
      End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media"
End Class
C#Copy Code
public bool _result = false;
      public ConvertCtrlForm _form = new ConvertCtrlForm();
      public void ClosedCaptioningTargetFile()
      {
         // reference the convert control
         ConvertCtrl convertctrl = _form.ConvertCtrl;

         // target file
         string targetFileCc = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ClosedCaptioningTargetFile.srt");
         ClosedCaptioningFlags flags = ClosedCaptioningFlags.Default;
         string testFile;
         ClosedCaptioningFlags testFlags;

         try
         {
            // set target file name and save options
            convertctrl.SetClosedCaptioningTargetFile(targetFileCc, flags);

            convertctrl.GetClosedCaptioningTargetFile(out testFile, out testFlags);

            if (testFile == targetFileCc && testFlags == flags)
               _result = true;
            else
               _result = false;
         }
         catch (Exception)
         {
            _result = false;
         }
      }

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

Remarks

Use this method to save the decoded closed captioning data coming from LEAD MPEG2 decoder. Closed captioning data might be embedded inside MPEG2 Video Elementary stream. If so, then the convert object is able to decode this data and write it to SRT format using this method, were the closed captioning text and time are saved. For more information, refr to http://en.wikipedia.org/wiki/SubRip. Also the convert object can save the closed captioning data as text.

By default this method saves the data as SRT file; but if ClosedCaptioningFlags.Text is specified, the output will be as pure text file.

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