Structure of the API

The JMF API (v2.1.1) comprises a total of 209 classes, of which 85 are interfaces, divided among 11 APIs.

In Java, APIs serve both to group related classes while also acting as a means of controlling the visibility of the attributes and methods of those classes. In order to employ a class that is the member of an API, it, or the entire API, must be imported.

The 11 APIs that comprise the JMF, together with their domain, are listed as follows:

javax.media— The main, top-level API comprising most of the classes and also most of the important ones such as Time, Manager, Processor, and Player.

javax.media.bean.playerbean— A collection of seven classes that provide Java Bean encapsulation for a Player. MediaPlayer is the most important class in the API.

javax.media.control— An API comprised of 18 Interfaces defining the different types of controls. Examples include FrameRateControl and FormatControl.

javax.media.datasink— An API of one interface and three events defining a listener for datasink events.

javax.media.format— An important API of 10 classes (one of which is an exception) defining the different formats that JMF is capable of processing. Examples of the classes include AudioFormat and H263Format.

javax.media.protocol— An important API of 25 classes (15 being interfaces) providing support for communication with datasources and capture devices. Among the important classes included in this API are DataSource and CaptureDevice.

javax.media.renderer— An API of two interfaces defining a renderer (for video content).

javax.media.rtp— The top-level of the three APIs dealing with RTP (Real-time Transport Protocol) it comprises 26 classes (most interfaces) dealing with streaming content with RTP.

javax.media.rtp.event— An API of 23 events that might result when using RTP.

javax.media.rtp.rtcp— An API of five classes (four being interfaces) defining usage of RTCP (RTP Control Protocol) within the JMF.

javax.media.util— An API of two highly useful classes: BufferToImage and ImageToBuffer for converting between JMF buffers and AWT images.

Similar to all the Java APIs, and indeed the larger APIs within the core Java Platform, it takes considerable time to gain a thorough familiarity with the entire structure of the API. However, each class and interface in the API has been created for a purpose, and time spent studying the API isn't wasted, and indeed can save considerable effort or frustration.

Further, if this and the following chapters on the JMF don't mention a particular class or functionality within JMF, it doesn't mean that such a class doesn't exist within the API. In three chapters, it is impossible to cover all 209 classes in the API while also providing sufficient coverage of the most important aspects of the API. When in doubt and no JMF-related resource appears to have an answer, one of the first places to start should be with the JMF API Specification: http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/.

Key Classes in the API

Although all classes in the API have a role to play, some are more central than others. These central classes can be found again and again in JMF programs and provide the backbone of those programs.

The next chapter discusses each of the classes in depth. However the following list serves as a reference to many of those backbone classes and what roles they serve in programs, without becoming overly cluttered with details.

AudioFormat— Information about an audio format including sampling rate and quantization level.

CaptureDevice— Interface defining behavior that all capture devices (for example, cameras) must possess.

CaptureDeviceInfo— Information about a particular capture device, including the formats supported.

CaptureDeviceManager— Manager aware of all the capture devices on the system and capable of providing information about them or, for example, a list that supports a particular format.

Clock— Interface defining JMF's fundamental time model. Key classes such as Players and Processors implement this interface.

Codec— Interface supporting the processing of media data from one format into (typically) another.

Controller— Interface built on Clock that defines the five states of stopped time (see the next section).

ControllerListener— Interface defining a listener for Controller generated events. Because Controllers include Players and Processors, this is a vital interface that is implemented somewhere in just about every JMF program.

Controls— An interface specifying a means of obtaining a control for an object.

DataSink— Interface for accepting data and rendering it to some source such as a file.

DataSource— Class providing a simple protocol for managing media arriving from a particular source (for example, a file).

Demultiplexer— Interface defining a processing unit that accepts a single input stream and outputs the demultiplexed tracks that composed the stream.

Effect— An interface defining a media processing unit that accepts a buffer of data, processes it in some way (but doesn't change its format), and outputs the processed buffer. The Effect interface supports many types of processing.

FileTypeDescriptor— Defines the different content type (architectures) supported.

Format— An abstraction of the format of a media object without all the encoding specific details.

Manager— Central manager or access point for obtaining resources such as Players, Processors, DataSources, and DataSinks.

MediaEvent— A Parent event class for all media events (for example, ControllerEvent).

MediaLocator— A means of specifying the location of media content. Used in the creation of players and data sources and sinks.

Multiplexer— A processing unit that accepts multiple input tracks and interleaves them to produce a single output container format.

Participant— A participant in an RTP session: a sender or receiver.

Player— An object for rendering (playing) and controlling (for example, stopping, changing rate of play) a media object.

PlugIn— An interface defining a generic plug-in that processes media data in some manner.

Processor— An extension to the Player interface, the Processor defines an object capable of processing and controlling a media object.

PullDataSource— A media source from which the data must be pulled (for example, a file).

PushDataSource— A media source from which the data is streaming (for example, an RTP session).

Time— An object that defines time to nanosecond precision.

TimeBase— A constantly ticking source of time.

VideoFormat— Format information about video data including frame rate.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset