LEADTOOLS provides a variety of methods for handling DVD video playback. This topic describes the various options available to programmers for resuming and stopping playback; as well as more specialized methods such as forward/reverse playback, title/chapter playback, and time-based playback.
The DVD Playback control is available from either the PlayCtrl.DvdController or ConvertCtrl.DvdController properties. To use this object from the PlayCtrl, you must set the PlayCtrl.SourceFile property to a valid DVD VIDEO_TS.IFO file, and set the PlayCtrl.UseDVDSource property to true.
Resuming/Stopping Playback
There are several methods that apply to resuming or stopping DVD video playback. Depending on the situation, the programmer can call either the DVDControl.Pause, DVDControl.Resume, DVDControl.StillOff, or DVDControl.Stop methods. The DVDControl.Pause method is unique among them, as it is the only one that can both pause and resume playback. A Boolean value sets this method. Calling DVDControl.Pause with the State parameter set to False resumes the playback from the current location. Conversely, calling the DVDControl.Pause method with the State parameter set to True pauses the playback. Note that this method does support command synchronization. When resuming playback from a menu, the programmer should call the DVDControl.Resume method. Calling the Resume method exits the current menu and resumes playback at the point the user left off. This method resolves properly only when called in a menu the user accessed while in playback. Note that this method does not support command synchronization.
The DVDControl.StillOff method relates specifically to still images. If the DVD Navigator receives a still image, it will automatically pause the playback and go into still-store mode. To resume playback, the programmer must call the DVDControl.StillOff method, which immediately cancels still mode and resumes playback from the current location. This method does nothing if called while the DVD Navigator is not in still-store mode. Note that this method does support command synchronization.
To halt DVD playback altogether, the programmer should call the DVDControl.Stop method. Doing so immediately stops the playback of any title or menu by moving the DVD Navigator into the DVD Stop domain. Note that this method does support command synchronization.
Forward/Reverse Playback
The LEAD Multimedia .NET toolkit also includes methods that control both the playback speed and direction. Calling the DVDControl.PlayForwards method plays the DVD video forward at the speed the programmer passes into the method. Conversely, calling the DVDControl.PlayBackwards method reverses the playback direction, playing the DVD video backwards at the speed passed into the method. In both methods, the Speed parameter is a multiplier value. For example, passing in a value of 2.0 will play the DVD video back at twice normal speed, while passing in a value of 0.5 will play the DVD back at one half normal speed. These methods are useful in implementing a fast-forward or rewind feature in a DVD application. Note that neither the DVDControl.PlayForwards method nor the DVDControl.PlayBackwards method support command synchronization. Title/Chapter Playback
Programmers have multiple options for developing specialized title and chapter specific playback solutions. The LEAD Multimedia .NET toolkit provides several methods that pertain to DVD video playback within set chapters. The most basic of these is the DVDControl.PlayChapter method, which the programmer calls to play a specific chapter within the current title. The programmer calls the DVDControl.ReplayChapter method to restart the playback from the beginning of the current chapter. Calling the DVDControl.PlayNextChapter method starts the playback from the beginning of the next chapter within the current title. Likewise, calling the DVDControl.PlayPrevChapter method starts the playback from the beginning of the previous chapter within the current title. In addition to the methods above, the LEAD Multimedia .NET toolkit provides methods that control DVD video playback based upon titles. As above, the most basic of these is the DVDControl.PlayTitle method, which the programmer calls to start playback from the beginning of a specific title. Calling the DVDControl.PlayChapterInTitle method allows the programmer to specify both the title and the chapter within the title to begin playback from, effectively merging the functionality of the DVDControl.PlayChapter method and the DVDControl.PlayTitle method into a single method.
Finally, the programmer can play a specified number of chapters, beginning at a specified chapter within a specified title by calling the DVDControl.PlayChaptersAutoStop method. After the specified number of chapters have been played, the DVD Navigator halts playback by sending an Auto Stop notification to the application. Note that this method will only work with One_Sequential_PGC_Titles.
None of the above functions support command synchronization.
Time-based Playback
The LEAD Multimedia .NET toolkit includes methods related to time-based DVD video playback. Calling the DVDControl.PlayAtTime method allows the programmer to start the playback of the current title at the specified time. Similarly, the programmer can call the DVDControl.PlayAtTimeInTitle method to begin the video playback at the specified time within the specified title.
To play back a specific length of video within a specific title, the programmer should call the DVDControl.PlayPeriodInTitleAutoStop method. Calling this method allows the programmer to begin the video playback of a specified title at a specified start time and run it until a specified end time is reached. Note that the specified start time must precede the specified end time. Otherwise, the method will fail and return an error.
None of the above methods support command synchronization.
DVD Source Playback
The DVD Source object can be used as an alternative to the default DVD Navigator object when playing DVDs. This allows the DVD playback to function like normal file playback. For example, only selected titles/chapters are played without menus from beginning to end. This is referred to as the DVD playlist. The entire DVD playlist can be viewed, for all practical purposes, as a single multimedia file. Once a playlist is defined it has a fixed duration and all file positions are within this playlist.
To use the DVD Source object, instruct the convert or play module to use it by calling the ConvertCtrl.UseDVDSource property or the PlayCtrl.UseDVDSource property set to True. The next time a DVD image is selected for playback, the DVD Source object will be used.
An ISO image (.iso) is a disk image of a file system. It includes data files that are contained in the ISO image along with file system metadata. ISO images are an alternative to physical media for distribution of a "DVD" over the Internet. Most operating systems allow ISO images to be "played" as if they were physical discs.
The default playlist is usually the main movie contained on the DVD. However, this might not be the case for some specialized DVDs. In order to program a custom playlist call the ConvertCtrl.GetSubObject method or the PlayCtrl.GetSubObject method with the MediaInfo.SourceFilter or MediaInfo.SourceFilter ObjType parameters. Then it is possible to query the return value for the DVDSource object.
The first thing to do is enumerate through the available titles. Obtain the number of titles by checking the DVDSource.TitleCount Property. Use the DVDSource.GetTitle method to obtain a title. Next, enumerate through the chapters contained in the title. Obtain the number of chapters by calling the DVDTitle.ChapterCount property. Then retrieve information about any title by calling the DVDTitle.GetChapter method.
Use the DVDChapter.Selected property to determine whether a chapter is part of the current playlist or to make it one.
By default, no sub-picture streams are enabled in the playlist. Enumerate and enable sub-picture streams by using the DVDTitle.SubpictureStreamCount Property and the DVDTitle.GetSubpictureStream method. Similarly, select an alternative audio stream by using the DVDTitle.AudioStreamCount property and the DVDTitle.GetAudioStream method.
Note: The stream is the portion of the file holding the video/audio data. This data might be compressed to save disk space. The data has to be decompressed using a decompressor. It must be designed to work with DirectShow. Note that different compression methods require different decompressors. There is no universal decompressor capable of decoding all compressed streams. Once the playlist is set up, it can be played and converted just like any other multimedia file. The DVD Source object has the ability to import/export its playlists through the DVDSource.PlayList property. This is useful for copying files between objects.