A Java-Interface to Digital Cameras Yves Vandewoude David Urting Kristof Pelckmans Yolande Berbers Department of Computer Science KULeuven Celestijnenlaan 200A B-3001 Leuven, Belgium email: {Yves.Vandewoude, David.Urting, Yolande.Berbers}@cs.kuleuven.ac.be ABSTRACT In this article, lessons learned from the design of a Java interface to digital cameras are described. The interface allows programmers to interact with a FireWire digital camera directly from within their Java programs. Two types of applications were developed. The first uses the Java 2D API directly to display the information on screen. Java networking is used to transmit the images over a net- work. The second application implements a datasource for the Java Media Framework. Being integrated in the JMF, a wide range of features can be used, including sending images over the network with a real-time transfer proto- col. Both types of applications are compared, and their performance is evaluated. The usability of Java and the Java Media Framework to control digital cameras, and the possibilities of integrating the results from this paper in an embedded system are discussed. KEY WORDS Real Time and Embedded Systems, Performance Evalua- tion, IEEE-1394, Java Native Interface 1 Introduction Lately, the Java programming language is becoming more and more popular. The huge amount of available packages, its efficiency, platform independence and ease of use make it the platform of choice for many developers around the world. Although a very extensive API is available with classes encapsulating a large number of peripherals, it is not possible to provide an interface for every device that can be connected to a computer system. Therefore, the Java Native Interface (JNI) was introduced in Java 1.1 [1]. One specific category of devices for which Java lacks an interface, are those connected to an IEEE-1394 high performance bus (more commonly known under the names FireWire or i-link). The IEEE-1394 protocol pro- vides easy-to-use, low-cost and high-speed communica- tions. It is very scalable and supports both asynchronous and isochronous applications. The latter makes it very suit- able for sending time-critical, error-tolerant data (such as a video or audio stream) and it should be no surprise that since its conception in 1993, IEEE-1394 has been very pop- ular in this area. In the context of the IWT funded project SEESCOA, carried out by the KULeuven in cooperation with other Bel- gian universities, a Java interface called libJDC1394 was developed for a FireWire controlled digital camera. This camera complies to the IEEE-1394 digital camera specifi- cation ([2]), and was attached to a PC-104 architecture (see [3]) through an OHCI 1 compatible FireWire card. On this system, a debian linux operating system was installed. The interface that was developed enables software en- gineers to use a broad range of devices that comply to the digital camera specification (see [2]) in their applications. Because of the network orientation of the Java program- ming language, the interface has the potential of greatly in- creasing the usability of digital cameras. In this paper, we will discuss the implementation and performance of this in- terface, and we will evaluate to what extent it can be used on embedded systems with limited resources. When evalu- ating the performance of our system, the focus is not on a theoretical study of used technologies (e.g. the Java Native Interface). Rather, the emphasis is placed on the relative performance of the different methods and applications used to transfer information from the camera to the user. The remainder of this article is organized as follows: In section 2 we will give an overview of the FireWire sub- system and digital camera libraries under linux. We will describe some issues on interfacing these libraries to Java with JNI. Section 3 will consists of example applications that use the libJDC1394. The performance of these ap- plications is investigated in section 4. We summarize our results in 5. Future work is discussed in section 6. 2 The journey of an image The IEEE-1394 subsystem (abbreviated as linux1394) for linux can be included in linux kernels version 2.3.40 and above 2 . Its subsystem consists of a number of different modules, which are schematically shown in figure 1. The kernel portion of the subsystem is the ieee1394 module. Using a callback system, ieee1394 will notify interested drivers of activity on the IEEE-1394 bus. On top of the ieee1394 module, high level drivers are available. The most important one is raw1394 which 1 Open Host Controller Interface 2 Patches are available for the 2.2 series of the kernel.