• RRP: £19.99
  • You Save: £18.10 (91%)
FREE Delivery in the UK on orders over £10.
Only 1 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
QuickTime for Java: A Dev... has been added to your Basket
+ £2.80 UK delivery
Used: Very Good | Details
Sold by momox co uk
Condition: Used: Very Good
Comment: Please allow 1-2 weeks for delivery. For DVDs please check region code before ordering.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

QuickTime for Java: A Developer's Notebook Paperback – 24 Jan 2005

See all 2 formats and editions Hide other formats and editions
Amazon Price New from Used from
"Please retry"
£1.89 £0.01
£1.89 FREE Delivery in the UK on orders over £10. Only 1 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.

Product details

  • Paperback: 256 pages
  • Publisher: O'Reilly Media; 1 edition (24 Jan. 2005)
  • Language: English
  • ISBN-10: 0596008228
  • ISBN-13: 978-0596008222
  • Product Dimensions: 17.8 x 1.7 x 23.3 cm
  • Average Customer Review: 2.5 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 3,922,277 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

About the Author

Chris Adamson is an Associate Online Editor for O'Reilly's Java websites, ONJava and java.net. He is also a software consultant, in the form of Subsequently and Furthermore, Inc., specializing in Java, Mac OS X, and media development. He wrote his first Java applet in 1996 on a 16 MHz black-and-white PowerBook 160 with the little-seen Sun MacJDK 1.0. In a previous career, he was a Writer / Associate Producer at CNN Headline News. He has an MA in Telecommunication from Michigan State University, and a BA in English and BS in Symbolic Systems from Stanford University.

Excerpt. © Reprinted by permission. All rights reserved.

CHAPTER 5 Working with QuickDraw

And now, on to the oldest, cruftiest, yet can’t-live-without-it-iest part of QTJ: QuickDraw. QuickDraw is a graphics API that can be traced all the way back to that first Mac Steve Jobs pulled out of a bag and showed the press more than 20 years ago. You know—back when Mac supported all of two colors: black and white.

Don’t worry; it’s gotten a lot better since then.

To be fair, a native Mac OS X application being written today from scratch probably would use the shiny new "Quartz 2D" API. And as a Java developer, the included Java 2D API is at least as capable as QuickDraw, with extension packages like Java Advanced Imaging (JAI) only making things better.

The real advantage to understanding QuickDraw is that it’s what’s used to work with captured images (see Chapter 6) and individual video samples (see Chapter 8). It is also a reasonably capable graphics API in its own right, supporting import from and export to many formats (most of which J2SE lacked until 1.4), affine transformations, compositing, and more.

Getting and Saving Picts
If you had a Mac before Mac OS X, you probably are very familiar with picts, because they were the native graphics file format on the old Mac OS. Taking screenshots would create pict files, as would saving your work in graphics applications. Developers used pict resources in their applications to provide graphics, splash screens, etc.

Actually, a number of tightly coupled concepts relate to picts. The native structure for working with a series of drawing commands is called a Picture actually. This struct, along with the functions that use it, are wrapped bythe QTJ class quicktime.qd.Pict. There’s also a file format for storing picts, which can contain either drawing commands or bit-mapped images—files in this format usually have a .pct or .pict extension. QTJ’s Pict class has methods to read and write these files, and because it’s easy to create Picts from Movies, Tracks, GraphicsImporters, SequenceGrabbers (capture devices), etc., it’s a very useful class.

How do I do that?
The PictTour.java application, shown in Example 5-1, exercises the basics of getting, saving, and loading Picts.

Example 5-1. Opening and saving Picts

package com.oreilly.qtjnotebook.ch05;

import quicktime.*;
import quicktime.app.view.*;
import quicktime.std.*;
import quicktime.std.image.*;
import quicktime.io.*;
import quicktime.qd.*;
import java.awt.*;
import java.io.*;
import com.oreilly.qtjnotebook.ch01.QTSessionCheck;

public class PictTour extends Object {

static final int[ ] imagetypes =$N202-1677793-2715858;

static int frameX = -1;
static int frameY = -1;

public static void main (String[ ] args) {
try {
QTSessionCheck.check( );

// import a graphic
QTSessionCheck.check( );
QTFile inFile = QTFile.standardGetFilePreview (imagetypes);
GraphicsImporter importer =
new GraphicsImporter (inFile);
showFrameForImporter (importer,
"Original Import");
// get a pict object and then save it
// then load again and show
Pict pict = importer.getAsPicture( );
String absPictPath = (new File ("pict.pict")).getAbsolutePath( );
File pictFile = new File (absPictPath);if (pictFile.exists( ))
pictFile.delete( );
try { Thread.sleep (1000); } catch (InterruptedException ie) { }
pict.writeToFile (pictFile);
QTFile pictQTFile = new QTFile (pictFile);
GraphicsImporter pictImporter =
new GraphicsImporter (pictQTFile);
showFrameForImporter (pictImporter,
// write to a pict file from importer
// then load and show it
String absGIPictPath = (new File ("gipict.pict")).getAbsolutePath( );
QTFile giPictQTFile = new QTFile (absGIPictPath);
if (giPictQTFile.exists( ))
giPictQTFile.delete( );
try { Thread.sleep (1000); } catch (InterruptedException ie) { }
importer.saveAsPicture (giPictQTFile,
GraphicsImporter giPictImporter =
new GraphicsImporter (giPictQTFile);
showFrameForImporter (giPictImporter,
} catch (Exception e) {
e.printStackTrace( );

public static void showFrameForImporter (GraphicsImporter gi,
String frameTitle)
throws QTException {
QTComponent qtc = QTFactory.makeQTComponent (gi);
Component c = qtc.asComponent( );
Frame f = new Frame (frameTitle);
f.add (c);
f.pack( );
if (frameX = = -1) {
frameX = f.getLocation( ).x;
frameY = f.getLocation( ).y;
} else {
Point location = new Point (frameX += 20,
frameY += 20);
f.setLocation (location);

f.setVisible (true);

The two Thread.sleep( ) calls are here only as a workaround to aproblem I saw while developing this example—reading a file I’d just written proved crashy (maybe the file wasn’t fully closed?). Because it’s unlikely you’ll write a file and immediately reread it, this isn’t something you’ll want or need to do in your code.

Customer Reviews

2.5 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

By Leo Layden on 24 Nov. 2009
Format: Paperback
This is a useful book. It allowed me to get started with Quicktime in Java and makes up for some of the shortcomings of the javadocs that are available from Apple.

At the end of the book, I can do the relatively simple tasks described in the book. However, there are still things I need to know and the book doesn't provide me with any way forward to find out more. I am still stuck with the inadequate javadocs or a mountain of daunting Mac related technical documentation. There is a gap for a book that will tell a 'pure' Java programmer how to use the features of Quicktime.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
By Martin Jacobson on 7 Mar. 2010
Format: Paperback
Unfortunately, QuickTime & Java have moved so far since this book was written that even the simple examples do not work. I couldn't recommend it in its present form, and I urge O'Reilly to commission an updated version. I would also urge Apple to try for an API that doesn't change all the time!
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 5 reviews
6 of 7 people found the following review helpful
if you do qtjava u need this book! 25 Oct. 2004
By Anthony Rogers - Published on Amazon.com
Format: Paperback
With Apple changing QuickTime for Java so anything you made when

use QTJava under MacOSX Java1.3 no longer worked under Java1.4 these required changes to most of your older QTJava code- if you wanted to have your code now run under Java1.4. Apple also moved classes to a new packages so to make the developers nightmare complete. BUT DONT WORRY! This book will show you workarounds for them missing classes (sequence grabbing is back! what a gem). Also covers all your needs as a new developer to the powers of QTJava. Time to make your very own QuickTime player in a few hours! You won't believe the stuff QuickTime can do under the hood. This books covers just more and more stuff as you go though it.

For me this QuickTime for Java book will be sitting next to the older most excellent book from Bill Stewart. I hope all books become as clear and well written as this one from Chris Adamson- top work. Sample code all over the shop; step by step stuff. Cuts to the tasks you will have to tackle without lengthy messing around. Brilliant buy if you want to do cool hardcore design media in java. Or just play a nice sound track in the background of your killer application - maybe u want to make the next video editing studio app, or your own media player, or a streaming server, or a image editor, or or or; you want ta take a ride?

Then again don't buy it! I wont have a job to go to in the morning! :).
3 of 3 people found the following review helpful
Thorough and surprisingly in-depth 27 Jan. 2005
By Jack D. Herrington - Published on Amazon.com
Format: Paperback
With this type of walkthrough book I usually expect to see just the basic features of the technology explored. This book goes surprisingly in-depth, covering topics like adding effects to playback, transforming movies during playback, overlays, and a wide variety of topics.

All that is crammed into a trim 200 page frame. This is achieved by concentrating mainly on the code, and effectively using a minimum of images. That's a trick given the graphics intensive nature of the topic.

This is not a book for beginners, it's a fast-paced walkthrough for experience developers who want something less referential than the JavaDocs.
2 of 2 people found the following review helpful
Wonderful Tutorial on Quicktime for Java 12 Sept. 2005
By calvinnme - Published on Amazon.com
Format: Paperback Verified Purchase
This book is the one that should have been written for Java Media Framework, if only that API had ever lived up to its expectations. If you want to add media to your application, and you are using Java, Quicktime is your best bet. However, note that if the Quicktime for Java API doesn't seem very Java-like or object-oriented at first glance, then that's probably because it's not. That is because with Quicktime for Java you are not working with pure Java. Instead, you're invoking a flat C API to create and manipulate C or Pascal data structures using a thin Java wrapper. If you can live with that and you still want to use Quicktime for Java, this book is the essential guide and tutorial you need to get up and running. The book does not waste your time with API printouts or a Java programming language tutorial. Instead, like all books in the Developer's Notebook series, it gets down to business quickly by demonstrating working Java code for a number of useful tasks when working with media.

First, it tutors you on how to set up Quicktime for Java on a Windows machine. This task is more complex than you would think, and this book hits the mark on the subject. Next, it shows you how to play movies and audio files from your Java program. Next, the book tackles the editing of movies from a Java application. This includes topics such as cutting, pasting, going to specific frames of a movie, and "flattening" a movie. In Chapter four, the programmer is introduced to working with Java components and importing and exporting graphics. In chapter five, the user is introduced to working with QuickDraw, the Apple-originated drawing API. This is essential, since QuickDraw is what is used to work with captured images. Thus in this chapter the reader is taught how to transfer data between images and a movie. Next, the art of capturing both video and audio is explored, including capturing audio and video to the same file. The chapter is rounded out with the code for a motion detector. Chapter seven is devoted entirely to audio media. There are particularly timely topics here, such as how to read information from MP3 and from iTunes AAC files, how to provide basic audio controls, and how to build an audio track from raw samples. Similar information is provided in a separate chapter for information specific to video media.The final chapter discusses the effects available in Quicktime for Java, as well as how to add text captions and timecodes to your media.

All in all, I think the Developer Notebook format works well for this subject. At the beginning of each chapter there is an outline of the topics to be covered. For each topic there is a "How Do I Do That?" section that includes a short piece of Java code that performs the specified task. There is also a sample of the output you would expect to see on the screen that should result from executing the code. Next there is a paragraph entitled "What Just Happened?" that explains the code just shown, and finally each topic usually ends with a "What about.." section that answers common questions you may have about extending the code just shown. All code in the book can be downloaded from the book's website at O'Reilly and Associates.

This book is essential reading for anybody who needs to understand how to code with Quicktime for Java, and it is far better than any other publication on the subject that I have encountered. Amazon does not show the table of contents for this book, so I do so for the purpose of completeness:
Setting Up QTJ on Windows
Embedding QuickTime in HTML
Preflighting a QTJ Installation
Compiling QTJ Code
Opening and Closing the QuickTime Session
Playing an Audio File from the Command Line
Building a Simple Movie Player
Adding a Controller
Getting a Movie-Playing JComponent
Controlling a Movie Programmatically
Showing a Movie's Current Time
Listening for Movie State-Changes
Moving Frame by Frame
Playing Movies from URLs
Preventing "Tasking" Problems
Copying and Pasting
Performing "Low-Level" Edits
Undoing an Edit
Undoing and Redoing Multiple Edits
Saving a Movie to a File
Flattening a Movie
Saving a Movie with Dependencies
Editing Tracks
Specifying a Component's Type
Exporting Movies
Exporting Movies to Any Installed Format
Importing and Exporting Graphics
Discovering All Installed Components
Getting and Saving Picts
Getting a Pict from a Movie
Converting a Movie Image to a Java Image
A Better Movie-to-Java Image Converter
Drawing with Graphics Primitives
Getting a Screen Capture
Matrix-Based Drawing
Compositing Graphics
Chapter 6. CAPTURE
Capturing and Previewing Audio
Selecting Audio Inputs
Capturing Audio to Disk
Capturing Video to Disk
Capturing Audio and Video to the Same File
Making a Motion Detector
Chapter 7. AUDIO MEDIA
Reading Information from MP3 Files
Reading Information from iTunes AAC Files
Providing Basic Audio Controls
Providing a Level Meter
Building an Audio Track from Raw Samples
Chapter 8. VIDEO MEDIA
Combining Video Tracks
Overlaying Video Tracks
Building a Video Track from Raw Samples
Creating Captions with Text Media
Creating Links with HREF Tracks
Adding Timecodes
Creating Zero-Source Effects
Creating One-Source Effects (Filters)
Creating Two-Source Effects (Transitions)
2 of 2 people found the following review helpful
An excellent, useful book 14 Mar. 2005
By Gary Thomas - Published on Amazon.com
Format: Paperback
While at first I thought O'Reilly's new "developer's notebook" series seemed a bit hokey, this book is extremely useful. It's concise and to the point, but full of good examples and information. A plus of the small size is that it's more to-the-point and cheaper than a typical O'Reilly book (which very often seem to ramble on and on about marginally useful information, seemingly in order to justify their $45+ price tags).
2 of 3 people found the following review helpful
Multimedia and Java made simple 15 Mar. 2005
By Eric Wuehler - Published on Amazon.com
Format: Paperback
This book is great!

This notebook makes all the QuickTime supported formats available to a Java developer. Like all the books in the notebook series, plenty of code, plenty of information to get up and running.

I really liked the information on reading the tag info from MP3s and AAC files, very useful.

Multimedia and Java made simple.
Were these reviews helpful? Let us know