|Page (1) of 3 - 11/23/04||email article||print page|
Scripting in DVD Studio Pro, Series 2Part 1: The basics of working with SPRMs
Before we get started, if you're a beginner at DVD scripting, I urge you to go back and read our first series on scripting in DVD Studio Pro, dealing with the bare basics of creating commands and working with various operations. The following are links to the first four articles in our DVD Studio Pro scripting series. You should read at least the first two articles to give yourself a decent foundation in the principles of scripting.
DVD Studio Pro Scripting, Series 1
Part 1: General scripting information
Part 2: Creating an interactive quiz
Part 3: Keeping track of time
Part 4: Pausing and resuming a timer
Because what we're getting at here might be a bit overwhelming at first, I'm going to break up this series (as I did with the first series) into general information, followed by project-specific examples and expansions on the basic information. This first part covers some of the basics of SPRMs, as well as some not-so-basic aspects of working with SPRMs. This is fundamental background information that you'll need before moving on to Part 2 in this series, which will deal with the more complex process or working with bit-wise operations to parse data contained in the bits of some SPRMs.
What's an SPRM, and why do I care?
SPRMs (System Parameter Register Memories) store information about a DVD player. This information includes things like the region of a player, a player's audio capabilities (DTS, Dolby Digital, etc.), parental management controls, default languages and aspect ratio/letterbox preferences, among many others. Some of this information is set in the DVD player at the factory and is unalterable by the user, such as the player's region code and audio capabilities. (Region code is sometimes alterable by the user, of course, but not usually.) Other types of information might be set by the user when setting up the DVD player, such as parental management or default language.
In either case, there are many instances where you'd want to use the information stored in an SPRM to make certain things in your DVD presentation automatic, like a censored audio track for people who don't like icky words or a censored video track for people who don't like to see images of naughty body parts (as represented by parental management settings). Or maybe you want to check the audio capabilities of a player to make sure that the highest-quality track in your presentation plays by default, eliminating the need to have the user choose between DTS, AC-3 or stereo.
You get the idea.
The problem, as with so much having to do with DVD scripting, is that there's no immediately obvious (or intuitive) way to make this happen. And, in fact, DVD Studio Pro's documentation on using SPRMs probably doesn't make any sense to you at all, unless you already know how to work with SPRMs, in which case it's no use to you at all.
Ideally, if I were designing a front end for scripting, I'd make these sorts of things obvious for the novice user and let the application handle everything under the hood. Something like: "If the player's parental management is set to a G rating, play audio stream 2." Wouldn't that be nice? But that's not how it works. Instead, you're stuck working with scripting commands and operator, converting binaries to decimals and trying to figure out how all of these things relate to what you're trying to accomplish, which, again, is not something you can simply intuit on your own.
That's the knowledge plateau we're dealing with.
How can I integrate SPRMs into my scripts?
There are three things you need to know about SPRMs before you get started. The first is what each SPRM does. The second is what each part (or "bit") of a given SPRM means. (For example, which bit in SPRM 14--"Video Player Configuration"--tells you whether a player is set to a 4:3 or 16:9 aspect ratio?) The third is what all of the values are for these bits so that you can use this information in your script. All of these things are listed in your DVD Studio Pro manual (and help file) beginning on page 457. No trick there.
The real trick is in figuring out how to integrate this information into a script. And this involves knowing how to extract the bit information stored in SPRMs and manipulate it to suit your needs.
Well, there's no direct way to say, "If SPRM 16 (language code for the DVD player) is set to English, then play Audio Stream 2." Instead, you have to pull the value out of the SPRM, stick it in a GPRM and then get your value from the GPRM. And, of course, you also need to know the numeric code that stands for the language you're looking for--or for whatever piece of information you're looking for, as it's all numeric. These values, again, are listed in your manual, though they can also be calculated based on the type of information you're looking for. A language code, for example, is a number based on the ASCII value of the first two letters of the particular language. You can figure this out using a calculator designed for this purpose. I recommend Haxor, which can be downloaded free from http://gamma.nic.fi/~eraiha-s/products/haxor/haxor.html. Haxor can also convert binaries to decimals, which is also critical for this kind of work. I'll get to examples of ASCII conversion below; we'll get into binaries for bit-wise operations next week in Part 2 of this series.
So, just to move momentarily from the abstract to the concrete, let's take a look at an example where we want to find out which audio language a player is currently set to and then place that value into a GPRM.
Related Keywords:apple dvd studio pro, scripting, dvdsp, sprm, gprm
Source:Digital Media Online. All Rights Reserved