Blu-ray is a replacement for DVD video, with high definition video and audio. In addition, Blu-ray also includes a solution for more interactive content; Java! The built-in Java platform gives more opportunities than ever ever before. Let us take a look at Blu-ray and Java. The article contains a description of the execution model and contains some sample code.
The Java platform for Blu-ray players is called BD-J. The BD-J platform is based on Java ME and uses the Personal Basis Profile (PBP) v 1.1. The profile is spiced up with additional APIs such as Java TV and a special Blu-ray API. The PBP v 1.1 is based on a subset of Java v1.4.2. It should be noted that a standard JVM is used, compared to some flavours of Java ME where reflection is not available. Other features include such things as Vector graphics, network support and file system access. The network connectivity is particularly interesting, since it gives opportunities for creating new on-line based applications. Note that a network connection is mandatory for Blu-ray profile 2 (see fast facts). The standard network classes are available, with support for TCP/IP and HTTP. For your security you have the packages for secure connections available, Java Secure Socket Extension. A Blu-ray player could include flash disks, a hard-disc or maybe a USB port for extra memory. The Java file system classes are available for you to access these types of file systems. The GUI toolkit that is used on the BD-J platform is based on AWT, with special components for remote control navigation. The Java Media Framework (JMF) is used for playback of the content on the Blu-ray disc. Last, but not least, we have our beloved Java security sandbox to play in. For example, you are only allowed to access servers that are allowed by the publisher of the disc. All in all you have a rather competent Java platform in your Blu-ray player.
One interesting aspect to consider is the types of applications that could be developed with BD-J. Here are some examples of application types:
- Interactive menus
- In-movie interactivity
- New content downloading
- On-line shopping
The main reason for incorporating Java in Blu-ray players it to get better possibilities when creating menus, in contrast to DVD players which uses a simple MPEG based technology. Another basic feature is the possibility to add interactivity while playing the movie. Many BD-J applications would probably be games. These Java games could be far more advanced than those included on DVD discs today. But there are other types of applications that could be more interesting. Imagine that you have bought your new Sci-fi movie “Intergalactic Wars III – Special Edition”. You could easily access the library of all movie related downloads, such as games, slideshows, sneak previews of the sequel etc. You could of course also have access to an on-line shop where you could buy your “Intergalactic Wars” action figures etc. All this could be done from your living room, right at your fingertips. Compare it to a DVD where you have to pull out the DVD, start your computer, insert the DVD and start it to access the links to the movie related site.
Ok, that is fine. But what if I want to start develop BD-J applications? What programming environment could be used? In theory you should be able to use Eclipse or NetBeans. The biggest problem is the Blu-ray APIs. Unfortunately, these are not publicly available. If you are willing to pay, you could of course buy a license of a professional Blu-ray authoring tool. These tools seems to be aimed at big production companies, such as the big Hollywood studios, at least when looking at the prices. Another solution is to do a little bit of reverse engineering. There are some people that have made it, see references below. The solution is that you use a PC based Blu-ray player with the appropriate software, such as WinDVD or Power DVD. The software contains the necessary JAR files that you could import into your favourite IDE. This will make it possible to compile your BD-J applications. If you want to buy a book on the subject of programming Blu-ray disc, you do not have that many opportunities. At the time of writing this article, there is ONE book available on the subject and one more announced.
Another tool that is valuable when developing embedded devices is a simulator. There are no Blu-ray simulators available on the market today. There are some environments that are used for Personal Basis Profile development that could be used. As you might imagine, this is not a perfect solution. If you finally have managed to set up a development environment, there is another important thing to take into consideration; performance. The best solution is to make up a set of benchmark and execute them on the target player(s). The best performance you can get today is on a Sony Playstation 3.
Fast Facts: The Blu-ray Profiles
Each Blu-ray player must adhere to a specific profile. These specifies such things as the memory requirement. All profile with video requires a full BD-J implementation. This is a short summary of the current profiles:
- 1.0 – This is the profile that is used today. It requires that the player has at least 64 KB persistent memory.
- 1.1 – This becomes mandatory on all players that are manufactured after November 2007. The memory requirement is increased to 256 MB. The players must have a secondary video decoder and a secondary audio decoder. The secondary video decoder is used for picture in picture, whereas the secondary audio could be used for audio commentary etc.
- 2 – This is called BD-Live and this requires the player to have network connectivity. The memory requirements are set to at least 1 GB. The memory is not limited to built-in memory, but could also be an external memory, such as an USB memory stick.
- 3 – This is an audio only profile. This does not require BD-J.
Since we use the Personal Basis Profile, the Xlet execution model is used. It is almost the same as the Applet or MIDlet execution model. The difference is that an Xlet does not need an UI. The figure below shows the state machine for the Xlet execution model. When the Xlet has been loaded, the initXlet() method is called. The Xlet then enters the paused state. The startXlet() method is called whenever the Xlet shall start. When the Xlet has started it enters the active state. If the Xlet shall be paused, the pauseXlet() method is called. The destroyXlet() method is called if the user stops the Xlet, and then it enters the destroyed state.
The sample code shows an Xlet class. It contains callback methods for each of the states that an Xlet could be in. The initXlet() method is called the first time the Xlet is executed. This is where you should do your one time initialisations. Next up is the the startXlet() method, where you should have your start-up code. For example, you start your threads here. If you shall have a GUI running, start it in a separate thread. The pauseXlet() is typically used for pausing your threads. The destroyXlet() is called when the Xlet is stopped. This method is used for releasing all the resource that have been allocated, e.g. your file(s) should be closed here.
public class JayViewXlet
* Initialise the Xlet.
public void initXlet(javax.tv.xlet.XletContext context)
// Initialisation code, e.g. GUI components and threads.
* Start the Xlet.
public void startXlet()
// This is where it all starts, like threads.
* Pause the Xlet.
public void pauseXlet()
// Pause the Xlet, like pausing your threads,
* Destroy the Xlet.
public void destroyXlet(boolean unconditional)
// Destroy the Xlet. Release such things as your file resources.
The Java platform that is included in Blu-ray players brings new possibilities to the publishers of movies. They could bring more added value, such as on-line shopping. There are many obstacles when trying to develop BD-J applications for Blu-ray, but none of them are impossible to solve. Let us hope that we will see many interesting BD-J applications in the future.
h3. The Links