Programming HD DVD and Blu-ray Diso The HD Cookbook

Michael Zink Philip C. Starner Bill Foote

Mc Gravu Hill

New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Table of Contents

Foreword vii Table of Figures and Tables xxii Table of Sample Codes xxvi Chapter 1 - Introduction 1-1 How This Book Is Organized 1-3 Conventions Used in This Book 1-4 Bits, Bytes, Units and Notations 1-6 Chapter 2 - Equipping Your HD Kitchen 2-1 Code Development Environments 2-4 Authoring Environments 2-5 Asset & Data Management 2-6 Timeline Editing 2-7 Disc Navagation Editor 2-7 Application Resource Management 2-8 Status Information 2-9 Chapter 3 - Getting Your HD Ingredients Together 3-1 Two Formats — Different Implementation 3-2 Two Formats — Same User Experience 3-3 Features for the HD Cookbook Sample Disc 3-5 Chapter 4 - Preparing Your Assets 4-1 Video Preparation 4-1 Audio Preparation 4-3 Graphics Preparation 4-6 Graphics Buffers 4-7 Bitrates and Bit Budgeting 4-9 Chapter 5 - Framework for HD DVD (AC) 5-1 Markup 5-3 Connecting Advanced Content Archive Elements 5-9 XMF Definition 5-10 XMU Definition 5-10 XPath Operators and Functions 5-13 JavaScript Definition 5-16 ü o XV Definition 5-16 Conclusion 5-19 Chapter 6 - HD DVD Application Models 6-1 File Cache 6-2 File Cache Budget 6-3 The Playlist 6-3 Playlist Application Resource 6-4 Application Resource 6-4 Title Resource 6-4 Application Activation 6-7 Timing of an Application 6-8 Multiplexing ACA into Video Stream 6-10 Conclusion 6-11 Chapter 7 - HD DVD AC Graphics and Animation 7-1 XMF 7-4 XMU 7-5 JavaScript 7-7 Animation 7-8 Defining the Animation 7-9 The Journey from Markup to JavaScript 7-9 Conclusion 7-17 Chapter 8 - HD DVD AC Text Rendering 8-1 Advanced 8-2 Input Element 8-4 Conclusion 8-5 Chapter 9 - HD DVD AC User Input 9-1 User Input to an Advanced Application 9-2 Conclusion 9-4 Chapter 10 - HD DVD AC Playback Control 10-1 Play, Pause, Resume 10-1 Scheduled Control List 10-2 Select Audio and Subtitle Stream 10-2 Set General Parameters (GPRMs) 10-3 Audio Mixing 10-4 Stop Propagation 10-5 Video Resizing 10-6 Conclusion 10-7

XVI Chapter 11 - HD DVD AC File I/O and Persistent Storage 11-1 Persistent Storage 11-2 File I/O 11-4 Callbacks 11-5 Asynchronous Functions 11-6 XML Parser 11-8 Conclusion 11-9 Chapter 12 - HD DVD AC Networking 12-1 Download Model 12-2 Streaming Model 12-5 Chapter 13 - HD DVD AC Putting It All Together 13-1 The Game Introduction 13-1 The Game Rules 13-2 The Game Pieces 13-2 The Playlist File 13-3 The Manifest File 13-3 The Markup File 13-4 The JavaScript File 13-10 Conclusion 13-13 Chapter 14 - Finishing the HD DVD Disc 14-1 Project Integration 14-1 The Playlist File 14-2 Streaming Buffer 14-2 ACA File Size 14-2 Title Time End 14-2 AACS 14-3 DISCID.DAT 14-4 Encapsulation 14-5 Shipping to Replication 14-5 Chapter 15 - Framework for BD-J 15-1 PBP, MHP, and GEM...Oh, my! 15-2 Everywhere 15-3 History of Personal Basis Profile 15-5 Java APIs for Broadcast TV, the Early Days — JMF, Java TV, MHP and DASE 15-6 Java APIs for Broadcast TV — GEM and The Great Union 15-8 Disc-specific APIs — BD-ROM, part 3-2 15-11 Media Formats 15-11 Putting it All Together — Guidelines & Unified API Documents 15-12 Overview of Platform APIs 15-13 GEM/MHP 15-17 BD-ROM Specification, Part 3-2 15-19 Summary of Specifications — A Map to the Stars' Home 15-21 Why Libraries Matter 15-22 Chapter 16 - BD-J Application Model 16- What's in an ? 16-1 Jva Classloaders 16-2 Xlet Lifecycle 16-3 Xlet Launching 16-3 Xlet Termination 16-3 Dealing with Optionally Present APIs 16-5 Inter-Xlet Communication 16-7 When Does an Xlet Get Launched? When Is It Killed? 16-7 Xlet Lifecycle Examples 16-8 Title Navigator 16-8 Disc or Multidisc Volume Navigator 16-9 3rd Party Add-on or Standalone Game 16-9 Game Tied to the Movie 16-10 Chapter 17 - BD-J Graphics and Animation 17- Setting the Graphics Mode 17-1 Using Java's Drawing API 17-2 Double Buffering 17-5 Platform Double Buffering of HScenes 17-6 Alpha Blending 17-6 Working with Images 17-9 Combining Small Images 17-10 Adding Sound 17-11 Example — Popup Menü 17-11 Drawing Models and Animation 17-12 Repaint Draw 17-13 Direct Draw 17-13 Frame Accurate Animation 17-15 Java Threads 17-17 Sprites Collision Detection 17-19 Examples 17-20 Animated Popup Menüs — Translation 17-20 Animate Popup Menüs — Fade-in 17-21 Motion Tracking 17-21 Chapter 18 - BD-J Text Rendering 18-1 Subtitles 18-1 BD-J Text 18-2 Putting Fonts on the Disc 18-2 Font Memory 18-3 Font Rendering Performance 18-4 Font Metrics 18-4 Logical Pixel Resolution 18-4 High Score and Progress Bar Examples 18-5 Character Biography Examples 18-5 Chapter 19 - BD-J User Input 19-1 The Blu-ray Remote Control 19-1 Those Crazy Color Keys 19-4 Systematic Remote Control Handling 19-6 Handling Mouse Input 19-7 Text Input 19-8 Masking User Operations 19-8 Top Menü Key 19-9 Chapter 20 - BD-J Playback Control 20-1 Getting JMF Controls 20-1 Video Controls 20-3 Picture in Picture 20-4 Audio Controls 20-4 Title Selection 20-5 Controlling Trick Play 20-7 Synchronizing to Video 20-8 Example Use — White Rabbit 20-9 Chapter 21 - BD-J File I/O 21-1 Reading Files from a JAR File 21-1 Reading Files Directly from the Disc 21-2 Virtual File System Support 21-2 Persistent Storage 21-2 Chapter 22 - BD-J Networking and VFS 22-1 Basic Networking Features 22-1 A Word About SSL 22-2 Virtual Files System 22-3 Accessing Files in the Binding Unit Data Area 22-4 Binding Files into the Virtual File System 22-5 Progressive 22-6 Chapter 23 - BD-J Putting It All Together 23-1 Building the Disc Layout 23-1 Playlists 23-2 Font Index 23-2 Sound Clips 23-3 Subtitles and the Audio Track 23-3 Compiling the 23-4 Finishing the Disc Image 23-6 Gun Bunny Xlet 23-6 Monitor Xlet 23-8 Making Menüs with GRIN (GRaphical INteractivity) 23-10 GRIN Show, Features and Segments 23-11 Remote Control Handling in GRIN 23-12 Creating and Debugging Show Files 23-14 GRIN Summary 23-15 Menü Xlet 23-15 Initialization 23-15 Playing the Feature Video 23-18 Audio and Subtitle Selection 23-19 Scene Selection 23-20 Running the Game 23-20 Bunny Bio and the Network 23-21 Unlocking the Bonus Content 23-22 Conclusion 23-23 Chapter 24 - Finishing the BD-J Disc 24-1 Compiling the Code 24-1 Marrying AV Content and Applications 24-2 Application Signing 24-4 AACS Processing 24-7 Code Obfuscation 24-7 BD-ROM Mark and BD+ Content Protection 24-7 BD-ROM Mark 24-7 BD+ 24-8 Shipping to Replication 24-9 Chapter 25 - Benchmarking 25-1 Playback Environments 25-1 Player Performance 25-2 Benchmark Tests 25-3 Example Scenarios 25-7 xx O o Scenario 1 25-7 Scenario 2 25-9 Benchmarks Targeted for Specific Applications 25-9 Chapter 26 - Testing and Verification 26-1 Application Testing 26-3 AV Quality and Compliancy Testing 26-5 Navigation Testing 26-6 Code and Format Verification 26-8 Chapter 27 - Replication 27-1 Formats Overview 27-1 Delivery Methods 27-2 Replication Workflow 27-2 Adding Content Protection 27-3 Chapter 28 - AACS Managed Copy 28-1 Managed Copy Overview 28-1 Licensed Player 28-3 Managed Copy Machine (MCM) 28-4 Managed Copy Application 28-5 Communication between MCM and MCS 28-5 Appendix A - About The Disc A-l Glossary G-l

Index 1-1