Поделиться через


ACAs are Your Friend

As you have noticed, every resource that you use - script, markup, images, audio, etc - must be listed as a resource in both the playlist and the manifest.  As you can imagine, this quickly becomes painful as your applications grow in size.  This is where ACA files come in very handy.

ACAs are simply archive files.  There's no compression, just grouping.  There are several benefits in using ACAs for you project.  First, you don't have to list out all the resources individually.  Instead, you will have only one resource - the aca file itself - listed in your playlist and manifest.  Second, the player will have a lot fewer seek operations to perform because it only needs to load your aca as a resource and not all the individual files, so your application will load faster.  Third, the player will be able to make better use of its available storage because rather than assigning individual assets to blocks and wasting space, there is only one aca file to load, so less wasted space.

Referencing an ACA as a Resource
Lets' suppose we want to change the Hello World application (C:\Program Files\HD DVD Interactivity Jumpstart\Samples\HelloWorld\ADV_OBJ) to use an ACA that we've created called hello.aca (more on creation later) which contains all the files needed for the Hello World application (font.ttf, manifest.xmf, markup.xmu). 

Our playlist (VPLST000.XPL) title application reference used to be:

      <ApplicationSegment autorun="true" titleTimeBegin="00:00:00:01" titleTimeEnd="23:59:59:59" src="file:///dvddisc/ADV_OBJ/manifest.xmf" zOrder="0" sync="hard">

        <ApplicationResource loadingBegin="00:00:00:00" priority="1" size="763" src="file:///dvddisc/ADV_OBJ/manifest.xmf" multiplexed="false" />

        <ApplicationResource loadingBegin="00:00:00:00" priority="1" size="78072" src="file:///dvddisc/ADV_OBJ/font.ttf" multiplexed="false" />

        <ApplicationResource loadingBegin="00:00:00:00" priority="1" size="1214" src="file:///dvddisc/ADV_OBJ/markup.xmu" multiplexed="false" />

      </ApplicationSegment>

Will be changed to:

      <ApplicationSegment autorun="true" titleTimeBegin="00:00:00:01" titleTimeEnd="23:59:59:59" src="file:///dvddisc/ADV_OBJ/hello.aca/manifest.xmf" zOrder="0" sync="hard">

        <ApplicationResource loadingBegin="00:00:00:00" priority="1" size="99999" src="file:///dvddisc/ADV_OBJ/hello.aca" multiplexed="false" />

      </ApplicationSegment>

Our manifest (manifest.xmf) resource list used to be:

      <Resource src="file:///dvddisc/ADV_OBJ/markup.xmu" />
      <Resource src="file:///dvddisc/ADV_OBJ/font.ttf" />

Will be changed to:

      <Resource src="file:///dvddisc/ADV_OBJ/hello.aca" />

Referencing Files in the ACA

Notice that when you reference a file within the aca - like the manifest reference in the title application from the playlist above - you treat it as if it were a folder.  When you want to reference the manifest.xmf file with in hello.aca, you use file:///dvddisc/ADV_OBJ/hello.aca/manifest.xmf.

ACAs contain files, not directories.  All files within your aca must be at the same level.

Correct: file:///dvddisc/ADV_OBJ/hello.aca/manifest.xmf

Wrong: file:///dvddisc/ADV_OBJ/hello.aca/subdirectory/manifest.xmf

Before you create your ACA, you will want to make sure your references within your manifests and markup files are correct.  One of the easiest ways to ensure your references are correct is to use relative references instead of absolute whenever possible.  In the Hello World application, notice that the reference to the markup file "markup.xmu" within the manifest is relative and so is the reference to the font "font.ttf" within the markup.  The reference that must be absolute, however, is the reference to the ACA as a Resource within the manifest.

Correct:
<Resource src="file:///dvddisc/ADV_OBJ/hello.aca" />

Wrong:
<Resource src="hello.aca" />

The references to the manifest for the application and aca resource in the playlist must be absolute as well.

Creating an ACA

There are several different tools that you can use to create an ACA.  For development purposes, you can use the CreateACA.exe command line tool that comes with the HD DVD Interactivity Jumpstart.  This tool doesn't support AACS, so you probably won't want to use it for final aca, but it's very helpful for development.  You can find this tool in C:\Program Files\HD DVD Interactivity Jumpstart\Tools.

There are two ways you can use this tool to create an ACA.  As part of the command line arguments, you can list out the files that should be included inside the aca.  Alternatively, you can pass a text file with the list of files to be included.

To create an aca using the list of files as command line arguments, open a command line prompt in the HelloWorld\ADV_OBJ directory and enter the following...

"C:\Program Files\HD DVD Interactivity Jumpstart\Tools\CreateACA.exe" -c hello.aca markup.xmu font.ttf manifest.xmf

To create an aca by passing in a text file, put the following in a text file called temp.txt in the ADV_OBJ directory

markup.xmu
font.ttf
manifest.xmf

And run the following from the command line:

"C:\Program Files\HD DVD Interactivity Jumpstart\Tools\CreateACA.exe" -f hello.aca temp.txt

Using a Batch File

Of course, we don't want to hand type this temporary text file for every project and then have to update it for each new resource.  Instead, we're going to use a batch file to create this temp.txt file and generate our aca for us.

In the HelloWorld\ADV_OBJ directory create a folder called "hello".  I like to use a folder with the same name as my aca.

Move your application files (manifest.xmf, markup.xmu, and font.ttf) into the hello directory.

Open manifest.xmf and change the resource tags as show above.

Open up your text editor and enter the following (or download the file at the end of this post):

@ECHO OFF

::******************************

::

::SET YOUR DIRECTORY NAME HERE

::

set DIR_NAME=hello

::

::******************************

:loop through that directory to create a list of files

FOR %%f in (%DIR_NAME%\*.*) DO echo %%f>> temp.txt

:create an aca that matches your directory name

"C:\Program Files\HD DVD Interactivity Jumpstart\Tools\CreateACA.exe" -f %DIR_NAME%.aca temp.txt

:delete the temp text file

DEL temp.txt

 

Save this as CREATE_ACA.bat in your HelloWorld\ADV_OBJ directory.

Now you can double click on this file to quickly generate an aca. 

Just copy this file to your other projects and change the "DIR_NAME" setting at the top to generate ACAs for those projects too.

 

CREATE_ACA.bat

Comments

  • Anonymous
    October 17, 2007
    General Why is Microsoft involved in HD DVD? Microsoft supports HD DVD because the mandatory player features