站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Wireless Java Developing with J2ME, Second Edition

MIDP 2.0 Media Concepts - Wireless Java Developing with J2ME, Second Edition

Previous Section Next Section

MIDP 2.0 Media Concepts

Audio data comes in a variety of content types. A content type is really just a file format, a specification that tells how each bit in the data contributes to the resulting sound. Common audio content types are MP3, AIFF, and WAV. In the MIDP 2.0 ABB, content types are specified using MIME types, which use a string to specify a primary and secondary type. For example, the MIME type for WAV audio is "audio/x-wav".

The content type tells how to translate bits into sound, but that's only half the battle. A protocol specifies how to get the data from its original location to the place where it will be rendered. You could use HTTP, for example, to transfer audio data from a server to a MIDP device.

In the ABB, a Player knows how to render audio data with a particular content type, while an associated data source handles transporting the data to the Player. In the Mobile Media API, the abstract DataSource class represents data sources. In the MIDP 2.0 ABB, data sources are not explicitly available, but implicitly associated with a Player. The path of the audio information is illustrated in Figure 12-2.

Click To expand
Figure 12-2: Audio data path

Manager doles out Players for content types and protocols requested via its createPlayer() methods. One or more controls may be associated with a Player to specify playback parameters like volume. In the ABB, javax.microedition.media.Control is an interface representing a control, while the javax.microedition.media.control package contains more specific subinterfaces. The relationship between the classes is shown in Figure 12-3.


Figure 12-3: Class relationships

Previous Section Next Section