QuickTime for Java

Last updated

QuickTime for Java or QTJ is a software library that allows software written in the Java programming language to provide multimedia functionality, by making calls into the native QuickTime library. In practice, it allows Java applications on Mac OS, Mac OS X and Microsoft Windows to support the capture, editing, playback, and export of many different media formats and codecs.

Contents

QTJ has been deprecated by Apple. [1]

History

Owen W. Linzmayer, in Apple Confidential 2.0, traces QuickTime for Java's genesis back to Kaleida Labs, a spin-off company created by Apple Computer and IBM, noting that it and some Unicode text classes were the only Mac software salvaged from the four-year, $150 million disaster. [2] Ported to the Mac OS, it was developed under the code-name "Biscotti", and first released as a public beta in 1999.[ citation needed ] Later versions were installed by default with Mac OS and Mac OS X, and were an optional part of the QuickTime install for Windows.

QTJ 6.1

In 2003, Apple issued a Java 1.4.1 implementation that broke any QTJ applications that tried to run under 1.4.1 on Mac OS X. The underlying problem was Apple's move from Carbon to Cocoa for their AWT implementation, and the removal of a Java-to-native library called "JDirect" that QTJ relied on. QTJ applications could still run under Java 1.3.1, but apps that did not specify the version of Java they required, or that needed 1.4 features, were rendered unusable.

Later that year, Apple released a new version of QTJ that dealt with the incompatibilities, by offering a compatible but scaled-down version of the GUI classes. This 6.1 version of QTJ also radically changed the API, so that instead of having developers create GUI components and associate Movies or other renderable objects with them, the developers now needed to start with the Movie and request a suitable component from a factory. The new version also neglected to provide a component to show a visual preview of the input from a capture device, such as a webcam or camcorder. [3]

Design

QTJ lays an object-oriented API on top of the native C-based QuickTime library. It does this by associating common structs and the functions that work with them into classes. For example, the Movie struct is the basis of the class quicktime.std.movies.Movie, with functions like NewMovieFromFile and GetMovieTrackCount becoming the instance methods fromFile() and getTrackCount() respectively. The result is more like a genuine object-oriented API than other C-to-Java adaptations (such as JOGL, which dumps the OpenGL header files into classes with thousands of static methods). [4]

The Cocoa-based QTKit is a similar attempt to put an object-oriented layer atop the procedural QuickTime library, using Objective-C.

Apple's use of the top-level package name quicktime violates the Java Language's Specification convention that packages use a reverse-domain-name scheme, such as com.apple.quicktime. However, as Apple owns the "QuickTime" trademark, there is no realistic chance of a namespace collision, the prevention of which is the purpose of the package naming convention.

It is important to remember that QTJ is not a Java implementation of QuickTime, it is a Java wrapper around native QuickTime calls. For this reason, it can only run on systems that have the QuickTime libraries installed, namely the classic Mac OS (which is no longer supported), Mac OS X, and Windows.

Features

QTJ offers access to most of the native QuickTime library, including

As a wrapper around QuickTime, QTJ also inherits support for a vast collection of media formats and codecs, including MPEG-1, MPEG-4, H.264, AAC, Sorenson Video, Flash, 3GPP, WAV, AIFF, and more. Since QuickTime itself can be extended, QTJ can pick up support for formats such as DivX and Ogg Vorbis through the use of third-party QuickTime components.

Code Example

The following example shows an AWT file-selection dialog and then tries to import and play the selected media file.

importjava.io.File;importjava.awt.*;importquicktime.*;importquicktime.std.movies.Movie;importquicktime.app.view.QTFactory;importquicktime.io.*;publicclassTrivialQTJPlayerextendsFrame{publicstaticvoidmain(String[]args){try{QTSession.open();Framef=newTrivialQTJPlayer();f.pack();f.setVisible(true);}catch(Exceptione){e.printStackTrace();}}publicTrivialQTJPlayer()throwsQTException{FileDialogfd=newFileDialog(this,"TrivialJMFPlayer",FileDialog.LOAD);fd.setVisible(true);Filef=newFile(fd.getDirectory(),fd.getFile());OpenMovieFileomf=OpenMovieFile.asRead(newQTFile(f));Moviem=Movie.fromFile(omf);Componentc=QTFactory.makeQTComponent(m).asComponent();add(c);m.start();}}

Most of the code in this example involves itself with setting up the GUI. The only calls to QTJ are the calls to OpenMovieFile.asRead() and Movie.fromFile(), which create a QuickTime movie from the specified file, and the calls to create an AWT component from the QTFactory. This example puts the movie into the frame and immediately starts playing it; if a control bar (aka a "scrubber") were desired, you would create a MovieController from the Movie and then create a component from the controller, rather than from the movie.

Status and Outlook

QTJ's acceptance is limited by its nature as a wrapper around Apple's proprietary QuickTime library. It does not exist for any platform other than Mac and Windows, and cannot until and unless Apple ports QuickTime to another platform, such as Linux.

Currently most of QTJ is broken on recent Windows-running computers. Windows machines that use the no-execute (NX) page-protection security feature of recent CPUs cannot run even the demos without changing the configuration. This can be easily verified by a developer via a test-run of one of the demos coming with QTJ. An "execution protection violation" is reported and the program is aborted by Windows. This renders QTJ unsuitable for end-user application development due to the necessary complicated configuration of the NX feature.

Following the 2003 release of QTJ 6.1, Apple has made few updates to QTJ, mostly fixing bugs. Notably, QuickTime 7 was the first version of QuickTime not to be accompanied or followed by a QTJ release that wrapped the new native API's. QuickTime 7's new API's, such as those for working with metadata and with frame-reordering codecs, are not available to QTJ programmers. Apple has also not offered new classes to provide the capture preview functionality that was present in versions of QTJ prior to 6.1. Indeed, QTJ is dependent on some native API's that Apple no longer recommends, most notably QuickDraw.

See also

Related Research Articles

Java (programming language) Object-oriented programming language

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities that are typically not available in traditional compiled languages. As of 2019, Java was one of the most popular programming languages in use according to GitHub, particularly for client–server web applications, with a reported 9 million developers.

QuickTime Extensible multimedia framework by Apple Inc.

QuickTime is an extensible multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. Created in 1991, the latest Mac version, QuickTime X, is available for Mac OS X Snow Leopard up to macOS Mojave. Apple ceased support for the Windows version of QuickTime in 2016, and ceased support for QuickTime 7 on macOS in 2018.

GNUstep

GNUstep is a free software implementation of the Cocoa Objective-C frameworks, widget toolkit, and application development tools for Unix-like operating systems and Microsoft Windows. It is part of the GNU Project.

Carbon was one of two primary C-based application programming interfaces (APIs) developed by Apple for the macOS operating system. Carbon provided a good degree of backward compatibility for programs that ran on Mac OS 8 and 9. Developers could use the Carbon APIs to port (“carbonize”) their “classic” Mac applications and software to the Mac OS X platform with little effort, compared to porting the app to the entirely different Cocoa system, which originated in OPENSTEP. With the release of macOS 10.15 Catalina, the Carbon API was officially discontinued and removed, leaving Cocoa as the sole primary API for developing macOS applications.

In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations that are often referred to by their own names ; see the versions section. Almost all Windows programs interact with the Windows API. On the Windows NT line of operating systems, a small number use the Native API.

Swing (Java) Java-based GUI toolkit

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.

Standard Widget Toolkit

The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by Stephen Northover at IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alternative to the Abstract Window Toolkit (AWT) and Swing Java graphical user interface (GUI) toolkits provided by Sun Microsystems as part of the Java Platform, Standard Edition (J2SE).

Mac OS X Tiger Fifth major release of Mac OS X

Mac OS X Tiger is the fifth major release of macOS, Apple's desktop and server operating system for Mac computers. Tiger was released to the public on April 29, 2005 for US$129.95 as the successor to Mac OS X 10.3 Panther. Some of the new features included a fast searching system called Spotlight, a new version of the Safari web browser, Dashboard, a new 'Unified' theme, and improved support for 64-bit addressing on Power Mac G5s. Mac OS X 10.4 Tiger offered a number of features, such as fast file searching and improved graphics processing, that Microsoft had spent several years struggling to add to Windows with acceptable performance.

The Java Foundation Classes (JFC) are a graphical framework for building portable Java-based graphical user interfaces (GUIs). JFC consists of the Abstract Window Toolkit (AWT), Swing and Java 2D. Together, they provide a consistent user interface for Java programs, regardless of whether the underlying user interface system is Windows, macOS or Linux.

Windows Forms Graphical user interface software library

Windows Forms (WinForms) is a free and open-source graphical (GUI) class library included as a part of Microsoft .NET, .NET Framework or Mono Framework, providing a platform to write client applications for desktop, laptop, and tablet PCs. While it is seen as a replacement for the earlier and more complex C++ based Microsoft Foundation Class Library, it does not offer a comparable paradigm and only acts as a platform for the user interface tier in a multi-tier solution.

Rhapsody was the code name given to Apple Computer's next-generation operating system during the period of its development between Apple's purchase of NeXT in late 1996 and the announcement of Mac OS X in 1998. At first more than an operating system, Rhapsody represented a new strategy for Apple, who intended the operating system to run on x86-based PCs and DEC Alpha workstations as well as on PowerPC-based Macintosh hardware. In addition, the underlying API frameworks would be ported to run natively on Windows NT. Eventually, the non-Apple platforms were dropped, and later versions consisted primarily of the OPENSTEP operating system ported to the Power Macintosh, along with a new GUI to make it appear more Mac-like. Several existing "classic" Mac OS technologies were also ported to Rhapsody, including QuickTime and AppleSearch. Rhapsody could also run Mac OS 8 in a "Blue Box" emulation layer.

Core Foundation is a C application programming interface (API) in macOS and iOS, and is a mix of low-level routines and wrapper functions. Most Core Foundation routines follow a certain naming convention that deal with opaque objects, for example CFDictionaryRef for functions whose names begin with CFDictionary, and these objects are often reference counted (manually) through CFRetain and CFRelease. Internally, Core Foundation forms the base of the types in the Objective-C standard library and the Carbon API.

The Visual Component Framework (VCF) is an abandoned open source project for development under Microsoft Windows and Apple Macintosh that is distributed under the BSD license. It is an advanced C++ application framework that makes it easier to produce GUI-based C++ applications. The framework is C++ design and has built in support for rapid application development. The framework is designed to be portable over multiple platforms and compilers.

Java Media Framework

The Java Media Framework (JMF) is a Java library that enables audio, video and other time-based media to be added to Java applications and applets. This optional package, which can capture, play, stream, and transcode multiple media formats, extends the Java Platform, Standard Edition and allows development of cross-platform multimedia applications.

The Apple Developer Tools are a suite of software tools from Apple to aid in making software dynamic titles for the macOS and iOS platforms. The developer tools were formerly included on macOS install media, but are now exclusively distributed over the Internet. As of macOS 10.12, Xcode is available as a free download from the Mac App Store.

Perian is a discontinued open-source QuickTime component that enabled Apple Inc.’s QuickTime to play several popular video formats not supported natively by QuickTime on macOS. It was a joint development of several earlier open source components based on the multiplatform FFmpeg project's libavcodec and libavformat, as well as liba52 and libmatroska.

Abstract Window Toolkit Java-based GUI toolkit

The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support the Abstract Window Toolkit.

Mono (software) Computer software project

Mono is a free and open-source .NET Framework-compatible software framework. Originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft and the .NET Foundation. Mono can be run on many software systems.

References

  1. QTJava will be depreciated next year.
  2. Owen W. Linzmayer, Apple Confidential 2.0
  3. The Return of the Blue Q
  4. Chris Adamson, QuickTime for Java: A Developer's Notebook