Programming DVD-register


One thing before we start. Just for the case that somebody would doubt the necessity of such interactive stuff on a Video-DVD, here are 2 arguments Iīd like to mention:


WHY WE DO IT ON A DVD

First: Multi-platform. A training or any other application on a DVD (talking strictly about DVD-Video here, and not about DVD-ROM for computers) runs on every platform which can play back DVDs, and this includes almost all multimedia-devices out there.

Second: No configuration-troubles. If it plays a Movie-DVD, then it also runs your app. You do not have to consider the right version of the Operating System or particular parts of it, like DirectX, "commom controls" or other libraries.

In simple words, you create your DVD-application once, and it runs on a PC, a Mac, also on a Playstation 2 and even on an X-Box with remote controller.


COMMAND SET

A command table can have 3 sorts of commands (max. 128 all together):

- PRE-COMMANDS: - are executed before the PGC-content is played
- POST-COMMANDS: - are executed after the whole PGC is played
- CELL-COMMANDS: - are executed after the cell is played

There is also a 4th sort, the BUTTON-COMMANDS, only 1 of them for each button in a menu. They are located in the menu-part of a VOB.

Pre-commands are executed before the PGC-content is played, usually to set the audio- or subtitle-stream, or to turn the subtitles on or off, with the "Set Stream"-command, or to redirect the playback if some predefined conditions are not given, with a conditional "Link"-command ("If reg1=2 then Link PGC 3"). They also can be used to highlight a specific button in a menu, with the "Set Button"-command.

Post-commands, which are executed after the whole PGC is played, are usually used to determine what is played next, by linking to other parts of the disc, or to loop the same PGC (mostly used for menus), with the "Link Title" or "Link PGC"--command. All those links can be bound on certain conditions, i.e. to jump only to sequences which have not already been vieved. Post-commands are also the best place to mark a PGC as "already viewed", by storing a value in a specific register, with the "Set"-command.

Cell-commands are executed after the Cell is played, and they need to be assigned to each Cell separately. There can be only 1 command per Cell. Cell-commands can be used for all purposes like the Pre- and Post-commands, their main advantage is that, when using them, one can "do things from the middle of the movie".

There is also a fourth kind of commands, Button-commands. They are used for buttons in a menu, every button can have only 1 command, but there are tricks to get several commands executed when pressing a button. In the most cases, Button-commands just link to another PGC or Program, although one can also use other commands. Button-commands are not in the Command Table, they are located in the Navigation-stream in the VOB-file.


MEMORY REGISTER

Just like any other computer, a DVD-player has its "memory", divided in 2 kinds of register, System Parameters (SPRM) and General Purpose Register (GPRM). There are 24 SPRMs, they are used to hold the settings for audio, subpictures, video mode and so on. One can access them only indirectly, using the "Set Stream"-commands group, i.e. the Navigation Timer uses SPRM 9 and SPRM 10.

GPRMs are a "different thing", they a used to store numerical values in them (0 - 65535) and then perform diverse comparisons and calculations with them. Every DVD-player has 16 GPRMs, but if needed, they can be divided into more, but smaller units (using bitwise access). It is GPRMs which make advanced interaction possible at all.

People often believe that 16 register are not enough to get "real" work done, but they often forget that one has them available AT THE SAME TIME, i.e. you can use 15 GPRMs for just one part of your project, and the 16th one to mark this particular part as "done". Then you can erase the first 15 Register and use them again. This fact, and the fact that you can access each one of the 16 bits in a single Register separately, should let us take DVD-programming seriously.


SYSTEM PARAMETER

The SPRMs (0-23) are used to store player settings for audio and subpicture (1+2 and 16-19), angle (3), number of title and chapter (4-7), selected menu-button (8), timer (9+10), karaoke (11+15), parental code and level (12+13), video mode (14) and region code (20). SPRMs 21-23 are reserved for I-donīt-know-what.

You change the content of the SPRMs when you change a setting (using the functions of your remote control or chosing a button in a menu) or when you select a chapter. It is also changed when the playback reaches a command (created during authoring) which affects these settings.

Well, I believe that the title of this page was "programming" DVD-register, not just explaining them, so letīs get back to work. (Details about the SPRMs and the command (instruction) set can be found at MPUCoderīs DVD-Info site.

The programming is done by using the "SetSystem" command group either in the command table of a PGC (up to 128 commands) or as a button command (only 1 per button, located in the nav-pack in the Vob). Example: if you want your PGC 4 to be played with the audio stream #2, you go to its command table (in IfoEdit), choose "Add PreCommand", then edit it from "NOP" to "(SetSTN) Set Audio Stream Nr", choose your stream number and youīre done (Iīm NOT going to write that you should save the IFO afterwards!).

If you didnīt get it, hereīs the step-by-step guide.

A few words about the Timer: itīs only good for the stills, videos and slides already have their limited durations, and if you use it for a still menu, you must set your buttons to a different title, otherwise your "timeout-PGC" (set in SPRM 10, must be in the same title) will still be played. That almost made me crush my keyboard before I found it out. So much for the SPRMs.


GENERAL PURPOSE REGISTER

Real programming is done using the GPRMs. They are empty by default and theyīre just waiting to be used by you. You can store values in them (0-65535) with the "Set GPreg(xx)"-command (71 00), make a counter out of them by adding 1 to their value (73 00) and, the hot one, you can perform all kinds of conditional jumps an links with them. You compare their current value with a constant number, or the value of another Register, and if it is equal (or less or more, if you like), then a certain operation gets executed. Here comes the example:

You want your PGC 3 to be played only if the PGC 7 has not already been viewed.

First, you go to the command table of the PGC 7 and "set a flag", this means you
write a post-command like this: 71 00 00 02 00 01 00 00. OK, iīll explain it:

All DVD-commands are 8 bytes long: b0 b1 b2 b3 b4 b5 b6 b7

First 2 bytes are the command-code (71 00 for setting a GPRM, 20 04 to link a PGC),
4th byte (b3) is the number of the GPRM, b5 is its value and b7 the number of the target PGC.

So, above you just wrote: set the content of GPRM nr.2 to the value of 1.
(you can also use the value of another register, but I never needed it)

Second, you go to the commands for the PGC 3 and create following pre-command:
if the value of the GPRM nr.2 equals 1 then play the next PGC (nr.4)
by writing: 20 a4 00 02 00 01 00 04. Thatīs all, folks.

It is also possible to do some basic mathematical ( +, -, *, / ) and logical (AND, OR) operations with the GPRMs, you can also set them in a counter-mode, generate some random numbers or even split them in more, but smaller register.


The final DISCLAIMER:


If you use the infos from this website, for whatsoever, you do it AT YOUR OWN RISK. I accept NO LIABILITY for any damage of any kind, which you may have caused after viewing this site.


A few last words at the end:
With the knowledge about DVD-commands and register (and a little bit of creativity) it is no problem to produce presentations, trainings or even games, and that is versatile enough for me. A DVD-player is not only a playback-device, it is a small computer and, if needed, also a game-console.

Thanks to the inventor(s) of the DVD-standard.


Lord of the Discs

© 2003 Josef Braunstein