Creating Your Own Blu-Ray Java Discs
Total Page:16
File Type:pdf, Size:1020Kb
JavaTM Technology for Blu-ray and TV: Creating your own Blu-ray Java Discs The Blu-ray Java Authoring Team: Bill Foote, Chihiro Saito, A. Sundararajan, Jaya Hangal TS-5449 Talk Outline HD Cookbook Community Overview • Target: Blu-ray Disc, OCAP and MHP • Free, open-source resources Animation Framework • Drawing Optimization GRIN Scene Graph • Declarative Graphics and Animation • Scene Graph and Asset Compilation Disc Creation Tools • Netbeans Plugin • Security and Signing JavaFX and BD-J • In authoring and at runtime Demos 2008 JavaOneSM Conference | java.com.sun/javaone | 2 HD Cookbook Community Animation Framework Bill Foote 2008 JavaOneSM Conference | java.com.sun/javaone | 3 HD Cookbook Community We want to spur creativity and innovation in new media • “Televisual” media – in the living room • Innovation comes from the grassroots • A bit of production infrastructure needed • Some prosumer tools are needed too • To make a Blu-ray disc from scratch, you need: • HD Camera • Video Editing Suite • Disc Image Creation Tool • Media Format Conversion (transcoding, ...) • Java programming “elbow grease” • A computer with a Blu-ray drive and a BD-RW disc Targeted platforms: PBP-class TV devices • Blu-ray Disc, OCAP, MHP • IPTV devices Streaming Video devices • 2008 JavaOneSM Conference | java.com.sun/javaone | 4 HD Cookbook Community Open-source Project • https://hdcookbook.dev.java.net • Source Code Repository • Authoring Guidelines Wiki • Discussion Forum • One of the most active ME forums • e-mail gateway, too! Disc Production Tools • disc packaging, signing • Asset preparation (e.g. sound file builder, cpistrip) packet[0] = (byte) (packet[0] & 0x3f); Frameworks and Code for BD-J on-disc Applications • Animation Framework • Scene Graph • Sample Disc • menu, game, bonus features 2008 JavaOneSM Conference | java.com.sun/javaone | 5 Talk Outline HD Cookbook Community Overview • Target: Blu-ray Disc, OCAP and MHP • Free, open-source resources Animation Framework • Drawing Optimization GRIN Scene Graph • Declarative Graphics and Animation • Scene Graph and Asset Compilation Disc Creation Tools • Netbeans Plugin • Security and Signing JavaFX and BD-J • In authoring and at runtime Demos 2008 JavaOneSM Conference | java.com.sun/javaone | 6 Animation Framework Updates screen regularly (e.g. 24 frames/second) Provides time-based animation • If animation falls behind, frames are discarded Provides Double-buffering Optimizes Drawing Minimizes Object Allocation (avoids GC) Provides threading model for animated application 2008 JavaOneSM Conference | java.com.sun/javaone | 7 2008 JavaOneSM Conference | java.com.sun/javaone | 8 Animation Framework: Drawing Optimization Only draw pixels that have changed... private DrawRecord drawRecord; private boolean changed; public void addDisplayAreas(RenderContext context) { drawRecord.setArea(x, y, width, height); if (changed) { drawRecord.setChanged(); } context.addArea(drawRecord); } 2008 JavaOneSM Conference | java.com.sun/javaone | 9 2008 JavaOneSM Conference | java.com.sun/javaone | 10 2008 JavaOneSM Conference | java.com.sun/javaone | 11 2008 JavaOneSM Conference | java.com.sun/javaone | 12 2008 JavaOneSM Conference | java.com.sun/javaone | 13 GRIN Scene Graph Chihiro Saito 2008 JavaOneSM Conference | java.com.sun/javaone | 14 Talk Outline HD Cookbook Community Overview • Target: Blu-ray Disc, OCAP and MHP • Free, open-source resources Animation Framework • Drawing Optimization GRIN Scene Graph • Declarative Graphics and Animation • Scene Graph and Asset Compilation Disc Creation Tools • Netbeans Plugin • Security and Signing JavaFX and BD-J • In authoring and at runtime Demos 2008 JavaOneSM Conference | java.com.sun/javaone | 15 What is a Scene Graph? ““CollectionCollection ofof nodesnodes inin aa treetree structurestructure representingrepresenting aa graphicalgraphical scene.”scene.” AllowsAllows usus toto organizeorganize andand displaydisplay visualvisual assetsassets basedbased onon scenes,scenes, withwith useruser inputinput handlinghandling andand logiclogic forfor transitioningtransitioning betweenbetween scenes.scenes. 2008 JavaOneSM Conference | java.com.sun/javaone | 16 Scene Graph Example using GRIN: Disc Main Menu Rollout Transition Menu Menu Showing Rolling Segment Segment Still Still Main Spinning Rolling Ying Menu Menu Ying Menu yang Items RCHandler yang Items RollingMenu Ying-yang Ying-yang FixedImage Main ImageSequence Translator Menu Assembly SetupNornal PlayNormal Setup FixedImage FixedImage Play Highlighted Nornal FixedImage FixedImage BonusNormal Bonus SceneNormal FixedImage Scene Normal FixedImage Normal FixedImage FixedImage 2008 JavaOneSM Conference | java.com.sun/javaone | 17 GRIN Scene Graph: Our Answer to the BD-J AWT Programming TargettedTargetted forfor BD-JBD-J :: RunsRuns onon PersonalPersonal BasisBasis ProfileProfile (!!)(!!) GreatGreat focusfocus onon runtimeruntime efficiencyefficiency • SmallSmall codecode sizesize (on(on thethe orderorder ofof 80K80K obfuscated)obfuscated) • QuickQuick loadingloading timetime • AvoidanceAvoidance ofof floatingfloating pointpoint operationsoperations • MinimalMinimal generationgeneration ofof heapheap objectsobjects • EfficientEfficient screenscreen redrawredraw optimizationoptimization (Animation(Animation Framework)Framework) • SomeSome complexitycomplexity forfor developersdevelopers asas aa consequenceconsequence EasyEasy toto extendextend –– usersusers cancan addadd theirtheir ownown featuresfeatures DeclaritiveDeclaritive syntax,syntax, moremore designerdesigner orientedoriented comparedcompared toto thethe traditionaltraditional desktop-orienteddesktop-oriented WidgetWidget developmentdevelopment forfor JavaJava ComesComes withwith GrinView,GrinView, ourour SceneScene GraphGraph2008 JavaOne viewerviewerSM Conference forfor | java.com.sun/javaone thethe | 18 desktopdesktop GRINCompiler: Off-line Compilation of a “Show” ScenesScenes shouldshould bebe writtenwritten inin aa descriptivedescriptive wayway atat aa designdesign time,time, butbut shouldshould runrun efficientlyefficiently onon aa disc.disc. DoDo off-lineoff-line compilationcompilation -- taketake aa human-readablehuman-readable ShowShow file,file, createcreate ShowShow graphgraph structure,structure, applyapply optimization,optimization, thenthen writewrite itit outout asas aa binarybinary file.file. 2008 JavaOneSM Conference | java.com.sun/javaone | 19 GRIN Off-line Compilation Workflow Constructs Show GRIN show Images, fonts, Xlet code text file other resources Applies Node transformation Applies resource optimization GrinCompiler javac Output GRIN binary show file Class files Compiled resources • • Image mosaic files Xlet.jar • Possibly .java file(s) • Possibly other resources GrinView supports both uncompiled and compiled Show file viewing 2008 JavaOneSM Conference | java.com.sun/javaone | 20 GRIN Show Node Types: Built-ins and Extensions Four major node types: • Features, Modifiers, Commands, RCHandlers Build-in features • Graphical primitives • Box, Text, FixedImage, ImageSequence • Grouping nodes • Assembly, Group • GrinCompiler and runtime helpers • SetTarget, “MosaicHint”, MenuAssembly Built-in modifiers (Feature subclasses) • Clipped, Fade, Timer, SrcOver, InterporatedModel Commands – triggered during state or scene transition RCHandlers – handles user input Extension supported for Features(+modifiers) and Commands 2008 JavaOneSM Conference | java.com.sun/javaone | 21 Extensions: Customize GRIN To Suit Your Need! Extension mechanism supported for Feature(+modifier) and Command types • Can be a new graphical primitive, transformation logic, a way to call into to your BD-J library functionality, etc. • GRIN show text file also supports lightweight extension mechanism via “java_commands” syntax • Our external partner is building multiple independent extension "plug-ins" around GRIN. See HDCookbook xlets (BOOK:PlayVideo and BOOK:BioImage) and grin/samples/Scripts/CustomFeature (Oval) for an example. 2008 JavaOneSM Conference | java.com.sun/javaone | 22 Disc Creation Tools and Security Jaya Hangal 2008 JavaOneSM Conference | java.com.sun/javaone | 23 Talk Outline HD Cookbook Community Overview • Target: Blu-ray Disc, OCAP and MHP • Free, open-source resources Animation Framework • Drawing Optimization GRIN Scene Graph • Declarative Graphics and Animation • Scene Graph and Asset Compilation Disc Creation Tools • Netbeans Plugin • Security and Signing JavaFX and BD-J • In authoring and at runtime Demos 2008 JavaOneSM Conference | java.com.sun/javaone | 24 Blu-ray Disk Creation Tools BDCertGenerator (creates certificates for signing) BDSigner (signs the jars and other files) BDCredentialSigner (creates credentials and signs jars) BDJO Converter (XML to binary converter) Netbeans Plugin (enables easy development of BD-J apps) 2008 JavaOneSM Conference | java.com.sun/javaone | 25 BDCertGenerator Required Args Optional Args Tool Name Tool Output Organization ID Disc Root Cert Keystore BDCertGenerator Application Cert Certificate Type BU Root Cert Names in Certificate net.java.bd.tools.security.BDCertGenerator -cp <jars> 7fff1111 2008 JavaOneSM Conference | java.com.sun/javaone | 26 BDSigner Required Args Optional Args Tool Name Tool Output Jarfile / BUMF Signed Jarfile BDSigner Keystore Signed BUMF Key Attributes net.java.bd.tools.security.BDSigner -cp <jars> 00000.jar 2008 JavaOneSM Conference | java.com.sun/javaone | 27 Certificates and signing BDCertGenerator: Creates certificates for disc root and applications. • Generates a keystore and root certificate