QuickTime for Java: A Developer's Notebook
|
| List Price: | £22.99 |
| Price: | £19.54 & eligible for FREE Super Saver Delivery on orders over £5. Details |
Availability: Usually dispatched within 24 hours
Dispatched from and sold by Amazon.co.uk
25 new or used available from £6.89
Average customer review:Product Description
QuickTime Java (QJT) is a terrific multimedia toolkit, but it's also terrifying to the uninitiated. Java developers who need to add audio, video, or interactive media creation and playback to their applications find that QTJ is powerful, but not easy to get into. In fact, when it comes to class-count, QuickTime Java is nearly as large as all of Java 1.1. Once you learn the entire scope of Apple's QuickTime software, you really appreciate the problem. At its simplest, QuickTime allows Mac and Windows users to play audio and video on their computers. But QuickTime is many things: a file format, an environment for media authoring, and a suite of applications that includes browser plug-ins for viewing media within a web page, a PictureViewer for working with still pictures, QuickTime Streaming Server for delivering streaming media files on the Internet in real time, and QuickTime Broadcaster for delivering live events on the Internet. Among others. As if that weren't daunting enough, the javadocs on QJT are wildly incomplete, and other books on the topic are long out of date and not well regarded, making progress with QTJ extremely difficult. So what can you do? Our new hands-on guide, QuickTime Java: The Developer's Notebook, not only catches up with this technology, but de-mystifies it. This practical "all lab, no lecture" book is an informal, code-intensive workbook that offers the first real look at this important software. Like other titles in our Developer's Notebook series, QuickTime Java: The Developer's Notebook is for impatient early adopters who want get up to speed on what they can use right now. It's deliberately light on theory, emphasizing example over explanation and practice over concept, so you can focus on learning by doing. QuickTime Java: The Developer's Notebook gives you just the functionality you need from QTJ. Even if you come to realize that 95 per cent of the API is irrelevant to you, this book will help you master the 5 per cent that really counts.
Product Details
- Amazon Sales Rank: #484789 in Books
- Published on: 2005-01-14
- Original language: English
- Number of items: 1
- Binding: Paperback
- 233 pages
Editorial Reviews
About the Author
Chris Adamson the editor for O'Reilly's Java websites, ONJava and java.net. He is the author of QuickTime for Java: A Developer's Notebook and co-author of Swing Hacks. 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.
Excerpted from QuickTime for Java A Developer's Notebook by Chris Adamson. Copyright © 2005. 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,
"pict.pict");
// 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,
IOConstants.smSystemScript);
GraphicsImporter giPictImporter =
new GraphicsImporter (giPictQTFile);
showFrameForImporter (giPictImporter,
"gipict.pict");
} 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);
}
}
W A R N I N G
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
Good book.
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.


