←Select platform

TitleBreak Property

Summary

Gets or sets a value that determines whether a title is closed immediately after a write operation.

Syntax

C#
VB
C++
[DispIdAttribute(2)] 
bool TitleBreak {get; set;} 
             
  
<DispIdAttribute(2)> 
Property TitleBreak As Boolean 
             
[DispIdAttribute(2)] 
property bool TitleBreak { 
   bool get(); 
   void set (    bool ); 
} 
             

Property Value

True if the title will be closed immediately after the write operation.

False if the title will remain open immediately after the write operation.

Remarks

Gets or sets a value that determines whether a title is closed immediately after a write operation.

After all the chapters have been added to a title, close the title by setting this property to True. If TitleBreak is set to False, the current title stays open, and each conversion creates a chapter folder.

Temporary files are not copied to the DVD image folder until the TitleBreak property is set to True. If the conversion object is destroyed or the output type is changed before the TitleBreak property gets set to True, the temporary files are deleted and nothing gets written to the DVD image folder. Whenever the TitleBreak property is set to True each conversion creates a new title at the end of the conversion. Also, the moment TitleBreak is set to True, any temporary files created by previous conversions are merged into the same title. Each converted file appears as a different chapter in the same title.

For example, the following sequence:

TitleBreak = True Convert File 1 ' convert file 1 as Chapter 1 Convert File 2 ' convert file 2 as Chapter 2 TitleBreak = True ' Create Title 1 Destroy the converter object

creates a DVD with one title containing two chapters. But this next sequence:

TitleBreak = False Convert File 1 ' convert file 1 as Chapter 1 Convert File 2 ' convert file 2 as Chapter 2 Destroy the converter object

does not create anything.

Example

C#
VB
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
public bool _result = false; 
public ConvertCtrlForm _form = new ConvertCtrlForm(); 
 
private ConvertCtrl _convertCtrl = null; 
private LTDvdWriter _dvdWriter = null; 
 
public void DvdWriterExample() 
{ 
   // reference the convert control 
   _convertCtrl = _form.ConvertCtrl; 
 
   // source files for DVD content 
   string inFile1 = Path.Combine(LEAD_VARS.MediaDir, "DVDWriter_Source1.avi"); 
   string inFile2 = Path.Combine(LEAD_VARS.MediaDir, "DVDWriter_Source2.avi"); 
   string inFile3 = Path.Combine(LEAD_VARS.MediaDir, "DVDWriter_Source3.avi"); 
   string inFile4 = Path.Combine(LEAD_VARS.MediaDir, "DVDWriter_Source4.avi"); 
   string backgroundImageFile = Path.Combine(LEAD_VARS.MediaDir, "DVDWriter_Background.jpg"); 
   string outFile = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_DvdWriterExample_DVD"); 
 
   try 
   { 
      _dvdWriter = null; 
 
      _convertCtrl.Preview = true; 
      _convertCtrl.PreviewVisible = true; 
 
      // setup the converter 
      _convertCtrl.TargetFormat = TargetFormatType.DVD; 
      _convertCtrl.VideoCompressors.Mpeg2.Selected = true; 
      _convertCtrl.AudioCompressors.MpegAudio.Selected = true; 
 
      // Create a DVD image with 2 titles, each contains 2 chapters:  
      // Source video 
      _convertCtrl.SourceFile = inFile1; 
 
      // Destination image folder 
      _convertCtrl.TargetFile = outFile; 
 
      // Retrieve the DVD Writer interface  
      _dvdWriter = _convertCtrl.GetSubObject(ConvertObject.Sink) as LTDvdWriter; 
 
      _dvdWriter.RemoveAllMenuTitles(); 
      _dvdWriter.MenulessTitlePlay = false; 
 
      // Set the TitleBreak property to false.  
      // This will prevent the title from being written immediately after the conversion 
      _dvdWriter.TitleBreak = false; 
 
      _dvdWriter.AddMenuTitle("Title 1", -1); 
 
      // Write the first chapter in the first title 
      _convertCtrl.StartConvert(); 
 
      while (_convertCtrl.State != ConvertState.Stopped) 
         Application.DoEvents(); 
 
      _convertCtrl.ResetSource(); 
 
      int highPart = 0; 
      int lowPart = _dvdWriter.GetBytesWritten(out highPart); 
      Int64 written = highPart << 32 | lowPart; 
 
      _convertCtrl.SourceFile = inFile2; 
      _convertCtrl.StartConvert(); 
 
      while (_convertCtrl.State != ConvertState.Stopped) 
         Application.DoEvents(); 
 
      _convertCtrl.ResetSource(); 
 
      // Prepare for the second title 
      // Set the TitleBreak property to TRUE, so the the current title can be flushed 
      _dvdWriter.TitleBreak = true; 
 
      // Disable Overwrite so the title will be appended to an existing dvd image 
      _dvdWriter.Overwrite = false; 
      _dvdWriter.MenulessTitlePlay = false; 
 
      // Set the TitleBreak property to FALSE.  
      // This will prevent the title from being written immediately after the conversion 
      _dvdWriter.TitleBreak = false; 
      _dvdWriter.AddMenuTitle("Title 2", -1); 
 
      // Write the first chapter in the second title 
      _convertCtrl.SourceFile = inFile3; 
      _convertCtrl.StartConvert(); 
 
      while (_convertCtrl.State != ConvertState.Stopped) 
         Application.DoEvents(); 
 
      _convertCtrl.ResetSource(); 
 
      // Write the second chapter in the second title 
      _convertCtrl.SourceFile = inFile4; 
      _convertCtrl.StartConvert(); 
 
      while (_convertCtrl.State != ConvertState.Stopped) 
         Application.DoEvents(); 
 
      _convertCtrl.ResetSource(); 
 
      // Close the second title 
      _dvdWriter.TitleBreak = true; 
 
      _dvdWriter.TitleMenu = true; 
      _dvdWriter.MenuLoop = true; 
      _dvdWriter.MenulessTitlePlay = false; 
 
      // Write the second chapter in the second title 
      _convertCtrl.SourceFile = backgroundImageFile; 
      ChangeStillImageDuration(1.0); 
 
      _convertCtrl.StartConvert(); 
 
      while (_convertCtrl.State != ConvertState.Stopped) 
         Application.DoEvents(); 
 
      _convertCtrl.ResetSource(); 
 
      _dvdWriter.TitleMenu = false; 
      _dvdWriter.Overwrite = false; 
 
      _convertCtrl.ResetTarget(); 
      _convertCtrl.ResetSource(); 
 
      // done, free COM object 
      Marshal.ReleaseComObject(_dvdWriter); 
      _dvdWriter = null; 
 
      // set the result  
      _result = true; 
   } 
   catch (Exception ex) 
   { 
      _result = false; 
   } 
} 
 
private void ChangeStillImageDuration(double duration) 
{ 
   ILTStlImgRd pStlImgRd; 
 
   try 
   { 
      pStlImgRd = _convertCtrl.GetSubObject(ConvertObject.SourceFilter) as ILTStlImgRd; 
      if (pStlImgRd != null) 
      { 
         // get the current menu duration 
         double currentDuration; 
         currentDuration = _convertCtrl.Duration; 
 
         if (currentDuration * 2 <= duration) 
            pStlImgRd.Loop = (int)(duration / currentDuration + 0.5); 
      } 
   } 
   catch 
   { 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"; 
} 
Imports Leadtools 
Imports Leadtools.Multimedia 
Imports LeadtoolsMultimediaExamples.Fixtures 
 
Public _result As Boolean = False 
Public _form As ConvertCtrlForm = New ConvertCtrlForm() 
 
Private _convertCtrl As ConvertCtrl = Nothing 
Private _dvdWriter As LTDvdWriter = Nothing 
 
Public Sub DvdWriterExample() 
   ' reference the convert control 
   _convertCtrl = _form.ConvertCtrl 
 
   ' source files for DVD content 
   Dim inFile1 As String = "mediafiles\input\DVDWriter_Source1.avi" 
   Dim inFile2 As String = "mediafiles\input\DVDWriter_Source2.avi" 
   Dim inFile3 As String = "mediafiles\input\DVDWriter_Source3.avi" 
   Dim inFile4 As String = "mediafiles\input\DVDWriter_Source4.avi" 
   Dim backgroundImageFile As String = "mediafiles\input\DVDWriter_Background.jpg" 
   Dim outFile As String = "mediafiles\output\ConvertCtrl_DvdWriterExample_DVD" 
 
   Try 
      _dvdWriter = Nothing 
 
      _convertCtrl.Preview = True 
      _convertCtrl.PreviewVisible = True 
 
      ' setup the converter 
      _convertCtrl.TargetFormat = TargetFormatType.DVD 
      _convertCtrl.VideoCompressors.Mpeg2.Selected = True 
      _convertCtrl.AudioCompressors.MpegAudio.Selected = True 
 
      ' Create a DVD image with 2 titles, each contains 2 chapters:  
      ' Source video 
      _convertCtrl.SourceFile = inFile1 
 
      ' Destination image folder 
      _convertCtrl.TargetFile = outFile 
 
      ' Retrieve the DVD Writer interface  
      _dvdWriter = TryCast(_convertCtrl.GetSubObject(ConvertObject.Sink), LTDvdWriter) 
 
      _dvdWriter.RemoveAllMenuTitles() 
      _dvdWriter.MenulessTitlePlay = False 
 
      ' Set the TitleBreak property to false.  
      ' This will prevent the title from being written immediately after the conversion 
      _dvdWriter.TitleBreak = False 
 
      _dvdWriter.AddMenuTitle("Title 1", -1) 
 
      ' Write the first chapter in the first title 
      _convertCtrl.StartConvert() 
 
      Do While _convertCtrl.State <> ConvertState.Stopped 
         Application.DoEvents() 
      Loop 
 
      _convertCtrl.ResetSource() 
 
      Dim highPart As Integer = 0 
      Dim lowPart As Integer = _dvdWriter.GetBytesWritten(highPart) 
      Dim written As Int64 = highPart << 32 Or lowPart 
 
      _convertCtrl.SourceFile = inFile2 
      _convertCtrl.StartConvert() 
 
      Do While _convertCtrl.State <> ConvertState.Stopped 
         Application.DoEvents() 
      Loop 
 
      _convertCtrl.ResetSource() 
 
      ' Prepare for the second title 
      ' Set the TitleBreak property to TRUE, so the the current title can be flushed 
      _dvdWriter.TitleBreak = True 
 
      ' Disable Overwrite so the title will be appended to an existing dvd image 
      _dvdWriter.Overwrite = False 
      _dvdWriter.MenulessTitlePlay = False 
 
      ' Set the TitleBreak property to FALSE.  
      ' This will prevent the title from being written immediately after the conversion 
      _dvdWriter.TitleBreak = False 
      _dvdWriter.AddMenuTitle("Title 2", -1) 
 
      ' Write the first chapter in the second title 
      _convertCtrl.SourceFile = inFile3 
      _convertCtrl.StartConvert() 
 
      Do While _convertCtrl.State <> ConvertState.Stopped 
         Application.DoEvents() 
      Loop 
 
      _convertCtrl.ResetSource() 
 
      ' Write the second chapter in the second title 
      _convertCtrl.SourceFile = inFile4 
      _convertCtrl.StartConvert() 
 
      Do While _convertCtrl.State <> ConvertState.Stopped 
         Application.DoEvents() 
      Loop 
 
      _convertCtrl.ResetSource() 
 
      ' Close the second title 
      _dvdWriter.TitleBreak = True 
 
      _dvdWriter.TitleMenu = True 
      _dvdWriter.MenuLoop = True 
      _dvdWriter.MenulessTitlePlay = False 
 
      ' Write the second chapter in the second title 
      _convertCtrl.SourceFile = backgroundImageFile 
      ChangeStillImageDuration(1.0) 
 
      _convertCtrl.StartConvert() 
 
      Do While _convertCtrl.State <> ConvertState.Stopped 
         Application.DoEvents() 
      Loop 
 
      _convertCtrl.ResetSource() 
 
      _dvdWriter.TitleMenu = False 
      _dvdWriter.Overwrite = False 
 
      _convertCtrl.ResetTarget() 
      _convertCtrl.ResetSource() 
 
      ' done, free COM object 
      Marshal.ReleaseComObject(_dvdWriter) 
      _dvdWriter = Nothing 
 
      ' set the result  
      _result = True 
   Catch ex As Exception 
      _result = False 
   End Try 
End Sub 
 
Private Sub ChangeStillImageDuration(ByVal duration As Double) 
   Dim pStlImgRd As ILTStlImgRd 
 
   Try 
      pStlImgRd = TryCast(_convertCtrl.GetSubObject(ConvertObject.SourceFilter), ILTStlImgRd) 
      If Not pStlImgRd Is Nothing Then 
         ' get the current menu duration 
         Dim currentDuration As Double 
         currentDuration = _convertCtrl.Duration 
 
         If currentDuration * 2 <= duration Then 
            pStlImgRd.Loop = CInt(duration / currentDuration + 0.5) 
         End If 
      End If 
   Catch 
   End Try 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.