Basic Overview

Top  Previous  Next

All actions on DVD are driven by a special DVD command language also called virtual machine commands (VM). If you decided to create a DVD all by yourself (without an authoring application) it is simply not enough to place all the video files there, but you have to write a "program" or set of instructions to tell the DVD player how to start, what to do with the files, what to do when the files finish playing etc. And we didn't even started with menus yet....

Don't panic!

Knowledge of VM Commands is absolutely not required in order to work with DVD-lab PRO. You may simply skip all this nonsense and pretend VM Commands exist only in a parallel universe. In your nice and cozy universe, a DVD is built using only tiny boxes that you can link together in the Connections window using your mouse. Hey, if you believe in this long enough it even becomes the truth!

VM Introduction

The major task of any mainstream DVD authoring application is to hide as much as possible of this from the users. It is obvious why. Users would require a much deeper knowledge of the DVD structure to be able to do even simple task like playing a movie. A DVD authoring application has to create a flexible environment for the user yet it has to be smart enough to be able to translate all this flexibility into a playable VM command language. Because VM commands are a language, two similar DVD's that seems to behave the same way are very often created totally different way internally.

All the pages in this tutorial before this one talk about various way of linking "objects", "buttons" and various smart components. But what is hidden beneath this is in fact the difficult task of creating DVD structure and a "program" in DVD machine code that would perform what users visually designed.

A simple way of checking this is to open connection window, right click on a Menu to open the menu and select Edit VM Commands.

vm1

In the window that will open you will see in the DVD-lab dynamically added commands something like this:

1. GPRM12 = 1024

2. if (GPRM11 == 7) GPRM12 = 0

3. if (GPRM12 == 0) Goto 5

4. SetHL_BTN GPRM12

5. GPRM11 = 6

6. GPRM15 = 6

There are already some commands and we didn't make anything yet!

triangleAs you may see DVD-lab goes one step beyond standard DVD authoring. It allows you to not only see these commands but also add a new ones. For serious authors this is very important feature. No matter how smart you can make your authoring application, there is always something that it will not allow you to do easily or not at all. Having ability to edit VM commands opens a whole new range of possibilities. An example may be a DVD created for the testing of knowledge where you need to discover good and bad answers.

Places for VM commands

VM commands can be inserted in these places:

Any item in connection, (menu, movie, slideshow etc.), PRE and POST command
First Play
Title button
Button on menu (only one line)
VTS Root (PGCN 1 , invisible root menu)
Chapter of a movie (cell command)

VM language

The DVD VM language has less than 40 instructions that can also be combined. A need to combine instructions comes from the fact that at some places DVD allows only one line of VM commands. A typical example are the VM commands on menu buttons.

VM Blocks

A special aid to your vm scripting in DVD-lab PRO comes in a form of visual "block" language. This overcomes the problem with DVD VM code being static. For example a line if (G0==255) LinkPGC 2 in your vm code will link to a PGC 2 which may be Menu 1 at the time of writing, but later after you delete and add few menus or change their order, it may become a completelly different menu which requires you to change the code. In VM Blocks you visually specify what you want to do using few pre-defined bocks for Operator, Link, If-Goto, If-link and insert between these normal VM Script.

block1

This creates a dynamic VM code that is always actualized. You can switch between the VM Script and VM Blocks on the fly.

PRE and POST commands

Commands on DVD can be in many places, but in most cases you will look for PRE and POST commands. The PRE command is the place before the object (Movie, Menu) plays and POST is just after the object is played.

vm2

 

Abstraction Layer commands
DVD lab will enter its default PRE/POST commands (that we call Abstraction Layer commands) to make all the links and features work and you can insert your own commands in front of (A) and/or at the end of (B) them. If you don't want the DVD-lab commands to be executed, simply put a last line Break command in the Custom commands "A".

The structure of any object would be like this:

 

PRE command

Object

POST command

A

Your Custom Commands

MOVIE

MENU

SLIDESHOW

etc.

Your Custom Commands

B

Abstraction Layer commands

Abstraction layer commands

C

Your Custom Commands

Your Custom Commands

 
When commands [PRE or POST] are executed they go in the order A, B, C where the B are "dynamically added" commands that cannot be edited. This arrangement allows you to put your commands before and/or after the dynamically added.

A VM Command window that appears when you select "Edit VM Commands" reflects this situation

clip0089

The numbers 1,2,3 on the image above shows the position of the commands. The 1 and 3 are custom commands editable by user the B are Abstraction commands that DVD-lab creates.

triangle Note about menus. Menus always execute PRE command when you go to the menu, but if you get out of the menu with a button, the POST command of menu is not executed, instead a Button VM Command (one line) assigned with the button is used. The POST command of menu is executed only if menu times out (or for non-looping motion or audio menu).

Show Commands in Connections
You can also display VM commands of a particular object in Connections view. Abstraction Layer commands are grayed out, custom commands are on a white background.

clip0152
 

Chapter Commands

A movie can have a VM command on each chapter. These are also called cell commands. When you are in movie window, right click on a chapter point and from menu select Chapter VM Command...

skipch

Chapter command can be only one line.

Technical Note: If chapter has a VM command a short pause may occur on that spot during playback.

Menu Cell Commands
Commands associated with cells on menu. Each cell can have one line of command.

Domain Commands
Various domains (such as first play) can have its own VM commands. These can be accessed by the right-click menu on Project window:

clip0090

(1) - VTS Root VM - commands that are in the ROOT menu of each VTS. This is associated with menus and with the "Menu" button on remote.
(2) - First Play VM - commands associated with First Play
(3) - Title VM - commands associated with VMG menus and the 'Title" button on remote.

The domain Commands can be edited also from Project Window by doubleclicking on these items under Commands sections.

clip0091

DVD Domains:

Objects and commands on DVD can be in a few different places called domains. We have:

First-play (FP)
Video Manager (VMG)
Video Title Set (VTS)
Video Title Set Menu (VTSM)

If you want to know more about the structure, see appendix.

Variables (registers, GPRM, SPRM)

As with any language, VM commands have a few registers (or variables if you will) that can be used to read or store temporary values.

There are 16 GPRM registers (General Parameter) that can be freely used by DVD programmer and 24 SPRM registers (System Parameters) that are used to access information specific to DVD player (for example region of the player). You can't write to SPRM registers.

There are 16 registers GPRM0 - GPRM15, but as described before, DVD-lab creates its own VM code so the actions you design visually will work on DVD. In DVD-lab we tried to use the minimum number of registers for our internal purposes. These are registers GPRM11 to GPRM15 inclusive. Writing to these registers will make other parts of DVD-lab code (abstraction layer) not work correctly. In other words: DON'T touch!

We were very careful to use as few registers as possible so you can use the rest for your own programming needs.

DVD-lab reserved GPRM registers

GPRM10

Used as a temporary in HUB object. If you use Link HUB then the GPRM10 value will be changed by the HUB

GPRM11

Node, used to link Movie to particular VTS menu and for Menu button highlighting

GPRM12

Used for temporary in-command sequence data storage

GPRM13

Used to identify currently playing play lists*

GPRM14

Used as a counter in a Counter and Random list

GPRM15

Used for Return to last menu object

* GPRM13 is also used as a one-time flag to make sure DVD player starts with subtitles OFF.

You can freely use the registers GPRM0 ... GPRM10 for your own VM programming creations.

trianglePGC Numbers

We will mention this on the following pages as well but it is vital to remember:

For VM Commands add 1 to the PGC number for all menus (VTS and VMG)

The first VTS menu that will shows in connections as ROOT is in DVD-lab PGCN 2.

There is always a shadow (hidden) menu for each VTS (PGCN 1) that has a special purpose*. To see its VM commands, right click in the Project window and from menu select VTS Root VM...

The first VMG menu that will shows in connections as TITLE is in DVD-lab PGCN 2.

There is always a shadow (hidden) menu (PGCN 1) before other visible VMG menus that has a special purpose*. To see its commands, in Connections right click on the Title Button and select Edit VM Commands.

showpgc

You can instruct the Connection window to display the true PGC number above all objects instead of the item order by checking the Show PGC Number button. The PGC number appears in red in top left corner of object.

You can then use this number directly in VM Commands as PGC number

*This doesn't apply if you plan to Compile without Abstraction Layer. Without AL there will be no shadow menu created and therefore the first visible menu in DVD-lab will also become PGC 1 as expected