Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Inside DVD


Dr. Dobb's Journal July 1998: Inside DVD

Linden is a software engineer at Oak Technology where he is currently working on the Interactive DVD Browser, the first publicly available DirectShow DVD environment. You can contact him at [email protected].


Sidebar: Region Management
Sidebar: Parental Levels

Although DVDs physically resemble CD-ROMs (five inches in diameter and 1.2 mm in thickness), DVD stores between seven and 25 times more data. This huge storage capacity makes it an ideal distribution vehicle for full-length movies (up to four hours long), high-quality audio (the contents of up to 13 CDs can be stored on one dual-layer DVD), and similar applications (not to mention data storage). DVD has garnered support from all major electronics and computer companies, and many major movie and music studios.

Even though DVD technology is promising, technical details about it are scarce -- in part because those details are still being worked out. Currently, specifications have been agreed upon for DVD-Video and DVD-ROM. As its name suggests, DVD-Video is for video programs and is played in DVD players connected to TVs. DVD-ROM, on the other hand, stores computer data and is read by DVD-ROM drives connected to computers. Variations on DVD-ROM include those that are recordable one time (DVD-R) or many times (DVD-RAM). Most computers with DVD-ROM drives can also play DVD-Videos. Finally, there's the DVD-Audio format, for which technical specs haven't yet been finalized.

In this article, I'll examine how a DVD-Video (or simply DVD) player operates, examine the features of a DVD title, and investigate the interactive capabilities in both computer and consumer DVD titles. (Also included with this article is a bare-bones, command-line DVD player, which is available electronically; see "Resource Center," page 3.)

DVD was conceived by the DVD Forum, a consortium of companies that includes Hitachi, JVC, Matsushita, Mitsubishi, Philips, Pioneer, Sony, Thomson, Time Warner, and Toshiba. Although no one "owns" DVD, companies making DVD products must license patented technology from a pool of companies.

One result of this collaboration is the multivolume series DVD 1.0 Specification for Read-Only Disc (ordering instructions are available at http://www.mpeg.org/ MPEG/DVD/General/Order.html). The most interesting book in this series is Volume Three, which focuses on DVD-Video -- a combination of a reference player design, optical media format, and multimedia data structures. The DVD-Video specification describes the required features to which a hardware-independent virtual machine must adhere. It also defines the assembly-language opcodes that have to be interpreted, the state diagrams the player must enforce, the system registers that can be manipulated, and the size and capabilities of user-accessible memory.

The DVD-Video Specification

The DVD-Video virtual machine contains a low-level, assembly-like, instruction set with the usual branch, compare, and set operations found in most processors. However, the specification also has unique opcodes specifically designed for interactive presentations. For example, there are instructions to monitor parental controls, jump to specific locations in a presentation, and dynamically switch audio and video tracks.

All DVD players have at least 20 system parameters (or registers) that can be accessed only by privileged opcodes. For instance, there are instructions to change the currently playing audio stream and update the system register, which monitors the currently playing audio stream number. The player also offers 16 general-purpose parameters that you can modify without special instructions.

Every DVD-Video disc contains a video_ts (or video title set) directory, which consists of files with IFO or VOB extensions. VOB files store multimedia data, whereas IFO files instruct the player how to play the content in VOB files. There are two types of IFO files -- Video Manager (VMG) and Video Titles Set (VTS).

DVD Video Manager

VMG is found in the video_ts.ifo file and it is the first file all DVD players read. This file is similar to a boot sector on a floppy disk -- it supplies the player with initialization information and then points the player to where it can obtain the remainder of the data necessary to continue playback.

VMG contains vital information such as the name of the disc, number of titles on the disc, and optional information such as parental controls (parental controls prevents little junior from looking at violent or explicit material). Although DVD defines eight numerical levels of parental protection, the name associated with each level may differ between countries (for instance, the Canadian rating system differs from the United States system). In all cases, higher parental level values always permit more content to be viewed (see the accompanying text box "Parental Levels"). For instance, Parental Level Seven ("NC-17" in the United States) enables you to see more movies than Level One ("G" in the U.S.).

A VMG may also contain a feature known as the "VMG Menu" (VMGM), which gives users an overview of the disc's contents and potentially lets users jump to specific points in the title. It is composed of a video stream and an optional audio stream and a subpicture stream. To avoid bugs in the first generation of players, most early menus used MPEG-2 still images and had minimal interactivity. Because newer players are more stable, innovative authors are including full-motion video and surround sound in their menus.

Interactive features in menus (such as background audio and video) are displayed and controlled by data structures called "Program Chains" (PGCs) -- arrays of programs, each of which normally represents a screen within a menu or chapter in a movie title. Each program contains one or more cells. Cells let you divide menus or chapters into more granular or logical subdivisions. They last a finite period of time, may have command instruction (or DVD assembly opcode) associated with them, and can enforce a delay when they complete playback. Although few titles take advantage of multiple cells per program, the DVD specification enables this feature to support effects such as slide shows in which playback must pause for a specific period of time after displaying a cell (or image).

Besides programs, PGCs may contain up to 256 navigational commands (128 of which may be executed before the programs in the PGC are presented, and 128 thereafter). These navigational commands are used for interactive purposes such as modifying the current video angle.

Every PGC also contains User OPerations (UOPs), which are stored in 32-bit fields where each bit (or individual UOP) represents the status of a unique interactive function on the player. Because these UOPs dictate which features in a PGC are legal (or usable), they have been almost as controversial as the region codes (see the accompanying text box entitled "Region Management"). To illustrate why this feature is so contentious, examine the Fast Forward UOP bit. If this bit is set, the DVD player cannot fast forward for the duration of that PGC. As a result, tricky content creators can embed commercials in DVD content and users will not be able to fast forward past them!

Attached to the tail of the VMG is the First Play PGC (FPGC). Once the DVD player is initialized, it searches for this PGC and executes the navigational commands inside of it. Most titles contain FPGCs that cause the player to display the VMGM, although it is possible for the FPGC to bypass the menu and jump directly into a movie scene (this is the technique that movies such as The Mask use to initiate immediate playback of a title).

Besides the video_ts.ifo file, the VMG also contains a Video OBject (VOB) file named video_ts.vob. VOB files are divided into packs each of which may contain a different media stream (packs are similar to a chunk in a WAV file). Although a pack may contain any data type, the DVD specification has stringent definition for video, audio, and subpicture packs.

Video packs in a VOB file normally contain MPEG-2 video. Although the MPEG-2 video format was defined by a standards body, it supports myriads of options that make it difficult to create a robust decoder. Therefore, to enhance compatibility and reliability, DVD places the restrictions of limited choice of resolution and maximum bit-rate guidelines on MPEG-2 video content.

For NTSC locales (North America and Japan), the MPEG-2 video stream resolution in DVD must be 720×480, 704×480, 352×480, or 352×240. PAL (or European) resolutions must be 720×576, 704×576, 352×576, or 352×288. Furthermore, whatever video resolution and audio compression routines are used, the content cannot exceed a sustained bit-rate greater than 10.08 Mbits/sec.

The designers of DVD also delineated what audio packs may appear in a DVD stream. The audio types supported in the initial DVD specification include: Pulse Code Modulation (PCM), Dolby Digital (AC-3), MPEG-2 audio, Digital Theater Sound (DTS), and Sony Dynamic Digital Sound (SDDS). PCM is commonly used in stereo sound tracks and is identical to PCM content found in Windows, UNIX, and Macintosh (although DVD supports higher PCM resolutions and sampling rates than these environments).

If the content contains multichannel sound, then for all practical purposes, it contains AC-3 packs. To explain, the DVD specification states that AC-3 is mandatory for multichannel audio content in North America. By contrast, European (or region two) content initially mandated that MPEG-2 audio be the default multichannel audio standard. Recently, the Region Two Specification was modified to require either AC-3 or MPEG-2 audio for multichannel content. Since every other region in the world requires AC-3, it is likely that AC-3 will become the dominant format in Europe also.

Besides video and audio, VOB files also support subpicture packs. In DVD terminology, a subpicture is a Run Length-compressed bitmap. Each bitmap has a palette of 16 colors, four of which can be active at once. Up to 32 subpicture streams can exist in a given VOB file (usually one stream per language). Unfortunately, since the subpicture palette is so limited, it is difficult to create realistic effects with subpicture alone. As a result, many vendors combine subpicture with high-resolution MPEG-2 video.

The most noticeable use of subpicture is for closed-caption text. Behind the scenes, DVD also uses subpicture in menus. When a menu is displayed, the DVD player modifies the color and contrast of the subpicture for a particular area in the menu, the location appears to be highlighted or selected. As users traverse the menu, the subpicture rectangle is changed so that a selected area moves with them; see Figure 1.

Unlike conventional bitmaps, subpicture data in the stream may be attached to display instructions (or opcodes) that manipulate the image. For instance, there are opcodes that cause the subpicture bitmap to fade or scroll. However, the most interesting opcode is forcedly start display. Users often turn off the decoding of a subpicture so that they don't have to view foreign subtitles. When the DVD player encounters forcedly display opcode, the subpicture must always be decoded regardless of user preferences (this is why subpictures in menus will always be displayed even if subpicture decoding is turned off).

Woven among the subpicture, audio, and video are highlight packs. These highlight packs contain user interface elements called buttons. Buttons are rectangular areas on the screen that monitor user input, and up to 36 buttons can be displayed at any single time. Each button contains associated highlight data structures, and these structures inform the player how to color a button when it is not selected, when it is selected, and when it is chosen (or activated). It also informs the player how long the buttons should remain on the screen and which numerical sequence on the player's remote control can select the button.

DVD Video Title Manager

Besides the VMG, every DVD Video disc contains one or more titles (or movies). These titles are stored in logical containers called "Video Title Sets" (VTS). Like the VMG, there is a strict naming convention for files in a VTS. All files in a VTS are in the form vts_xx_y where xx is the VTS number (up to a maximum of 99) and y is the index within the VTS.

Each VTS has a unique IFO file, vts_xx_y.ifo, and it uses the same data structures as the VMGM: PGCs, programs, and cells. Unlike VMG data structures, VTS data structures often use the exotic capabilities found in PGCs. For instance, title cells can have up to nine different video angles (an angle normally is an alternate camera angle of the presentation). Users can dynamically switch the viewing angle and the player will smoothly transition to a different location in the VOB file based on instructions in the cell.

Title PGCs can also utilize either simple or complex parental controls. Simple parental controls prevent a PGC from playing if users have not authorized its presentation. They will present users with a warning message indicating that the presentation cannot continue until users modify the parental setting for the player.

More sophisticated titles can dynamically select a different PGC depending on the current parental level. They have blocks of PGCs, only one of which will be displayed based on the parental setting. For example, if the player is set for G-rated movies, a nonviolent PGC will be chosen. By contrast, if the player has an R setting, an alternate PGC in the parental block with violent content will be displayed.

Unlike the VMG, a VTS categorizes menus into different topics: chapter, audio, angles, subpicture, and overall title control. These menus contain the same functionality as the VMGM including motion video, background audio, and interactivity via buttons.

Although interactivity has been the most hyped feature in DVD menus, they offer other intriguing options. For instance, DVD menus can be multilingual. To explain, when you create a logical menu screen, it can contain multiple versions of the menu, each in a different language. When the menu is displayed, the DVD player will check the current language system and pick the appropriate menu system for that language. Consequently, you can ship the same disc to different areas of the world, and the DVD players in each region will use the appropriate menu for that language.

Besides internationalization, DVD menus also support the same parental locking features found in title PGCs. You can use these parental controls to display completely different menus depending on the current parental rating system. For example, if the player's parental setting only permits G-rated movies, then the parental block would not show the default PG-13-rated menu, but instead show a special G-rated version that does not give viewers access to the chapters in the movie with sensitive content.

(Many early DVD developers wanted their titles to play on both Windows 95 and dedicated DVD Video machines. Because their programs used the Media Control Interface [which only uses VOB files and ignores the IFO required by DVD-Video], they had to create IFO files for DVD-Video compatibility. Unfortunately, they failed to follow the naming conventions for these files and were bitterly disappointed when they discovered that the content was unusable for DVD Video.)

The DVD specification also defines the minimum set of interactive functions (or operations) a player must provide to the user. Since these capabilities are found in Annex J of the specification, they are often referred to as "Annex J functions." These commands can be divided into the following categories: user interaction via buttons, stream controls, random access to presentations, and menu manipulation.

The specification offers commands to navigate through buttons (UpperButtonSelect(), LowerButtonSelect(), LeftButtonSelect(), and RightButtonSelect()). Once you've decided on a button, you can use ButtonSelect() or ButtonActivate() to make a selection.

While a title is playing, you can change the viewing angle via the Angle_Change() method. Audio_Stream_Change() and Subpicture_Stream_Change() let you change audio and subpicture streams (or languages). If you're in a still condition (such as a pause between slides in a slide show), Still_Off() causes normal playback to resume.

There are a number of methods that enable random access to content. If you wish to search through the title, you can search via time (Time_Search() or Time_Play()), by chapter (Chapter_Play() and Chapter_Search()), or by title (Title_Play()).

The MenuCall() function lets you display a menu. It has one parameter that dictates which type of menu is displayed (Chapter, Audio, Subpicture, or Title). There are also methods to select Subpicture or Audio streams (Subpicture_ Stream_Change() and Audio_Stream_ Change(), respectively), modify parental settings (Parental_Level_Select()), and change angles (Angle_Change()).

Although Annex J defines the minimum set of interactive functions a DVD player must provide, it is legal, and in some cases, necessary to provide additional functionality for a specific platform. For instance, Microsoft's DirectShow for Win32 (a standard interface and the software drivers required for writing Windows-based DVD applications; see http://www.microsoft. com/directx/) provides enhancements that are specific to the computer environment and not addressed in the specification (see Listings One and Two). It provides methods to process mouse input, finer control of the presentation, and support for asynchronous DVD events. Listing Two illustrates how you process DVD-related DirectShow events.

Conclusion

Unlike VHS, DVD is not simply a linear medium. It was designed to unite computer and consumer electronics users by offering high-quality video, multichannel audio, interactive functions, and a format that can adapt to future technologies. Furthermore, the DVD specification is hardware independent, so your content can run on a wide variety of devices. Once you begin to develop with DVD, you'll never again want to return to today's space constrained, postage-stamp-size multimedia world.

For More Information

Robert's DVD Info: http://www.unik.no/~robert/hifi/dvd/
Kilroy's DVD FAQs: http://www.CD-info.com/CDIC/Technology/DVD/dvd-faq.html
Chad Fogg's Technical Notes: http://www.mpeg.org/~tristan/MPEG/DVD/
DVD-Video Production Guidebook: http://www.nbdig.com/html/dvdmain.htm
Quantel Digital Fact Book: http://www.quantel.com/dfb/
Sonic DVD Primer: http://www.sonic.com/html/dvd/PDF/primer.pdf

DDJ

Listing One

// grab an interface to the Annex J methodshr = m_pgraph->QueryInterface(IID_IDvdControl, (void **) &m_pUserOperations);


</p>
if ( !(FAILED(hr)) )
{
    // start playing title 1, chapter 3
    hr = m_pUserOperations->ChapterPlay( 1, 3 );        


</p>
    // view the 2nd angle
    m_pUserOperations->AngleChange( 2);


</p>
    // turn off annoying foreign language subtitles    
    m_pUserOperations->SubpictureStreamChange( 1, FALSE );


</p>
    // release interface
    m_pUserOperations->Release();
}

Back to Article

Listing Two

switch (Event)    {
        case EC_DVD_BUTTON_CHANGE     :
            // lParam1 contains number of active buttons 
            // if there are ANY buttons alive--enable button manipulation
            if ( lParam1 > 0 ) 
            {
                bActiveButtons = TRUE; 
            }
            break;
        case EC_DVD_ANGLE_CHANGE      :
                    // lParam1 contains the current viewing angle
            break;
        case EC_DVD_TITLE_CHANGE      : 
            // lParam1 contains the currently playing title
            break;
        case EC_DVD_CHAPTER_START     :
            // lParam1 contains the currently playing chapter
            break;
        case EC_DVD_VALID_UOPS_CHANGE :
            // lParam1 contains the currently active user operations
            break;
    }

Back to Article


Copyright © 1998, Dr. Dobb's Journal

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.