|Page (2) of 4 - 11/30/04||email article||print page|
Scripting in DVD Studio Pro, Series 2Part 2: Bit-wise operations and binary number conversion
How do I know this?
There are 16 bits in SPRM 15 (0 to 15), and each one is worth a certain numerical value, starting with 1 at bit 0 and doubling all the way up to 32768 at bit 15. Each individual bit represents a different possible audio capability (things like DTS karaoke and other options). If you look at your DVD Studio Pro manual (or online help file) on page 465, you'll see a list of what all the different bits represent. Bits 12 and 13 are for MPEG audio, and bit 14 is for AC-3. Their numerical values are as follows:
Bit 12: 4096
Bit 13: 8192
Bit 14: 16384
Add those together, and you get 28672, and so, by cross-referencing, you know what Simulator's audio capabilities are. If it were also DTS-capable, the numerical value of bit 11 (which corresponds to DTS capability and has a numerical value of 2048) would also be added in, for a total of 30720. If a DVD player has a particular audio capability, the numerical value of the bit corresponding to that capability is added in to the total of SPRM 15. So really it's much less complicated than it seems at first.
However, just knowing this doesn't help you at all. What you need to do is to run a bit-wise operation to parse out this information so that your script will know which audio track to play based on the player's capabilities.
The bit-wise operation
So what you want to do now is add a second command to your script that will do just that. This is accomplished with another Set GPRM command. But this time, instead of using the standard "mov" operation, we're going to use the "and" operation.
Then, since we're looking for specific values, we're going to set the Source Type to "Immediate."
Which leaves us with the problem of choosing a Source Value for determining a player's capabilities. In this case, we want to know two things: "Does the player have DTS capability?" and "Does the player have AC-3 capability?" These two questions can be asked by inserting "18432" into the Source Value box for this script command. (Also set the Target to "GPRM 7" at this point.)
Here's the short, dumbed-down answer: If you refer back to your DVD Studio Pro manual (page 465), you'll see that the value of bit 11 (DTS) and bit 14 (AC-3) added together is 18432. These two bits are all we're interested in knowing about. So, by placing their combined values into our command, and not including the values of any of the other bits, the player will know that we're only interested in finding out whether those bits are on or off--or, in plain English, whether the player has DTS and AC-3 capabilities, or any combination thereof.
The longer, more accurate answer is a bit complicated, so I thought I'd break it out into a separate section for those of you who are really interested. If you're not interested, you can skip the following interlude and move on to the section after that to continue your script.
Related Keywords:apple dvd studio pro, scripting, sprm, gprm, bit-wise operations, binary numbers
Source:Digital Media Online. All Rights Reserved