Vpproject

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 21

Mentor:

Team:
Ankit yadav (VII sem,CSE) Anshul mittal(VII sem,CSE) Naveen sachdeva(VII sem,CSE)
i

- 0731012707 - 0671012707 - 0681012707

Objective:

The objective of the project is to create a simple video player in j2me,the development platform used. This video player is highly flexible and has been designed to run with any protocol and format.

ii

Technical Details:
Platform Used:
J2ME: J2ME is a version of java that is designed for mobile devices and embedded systems and other resource limited devices.J2ME offers portability across a wide range of platforms including mobile phone,PDAs and smart phones.It also offers a wide range of APIs that allow the application to fulfill all the mandatory and discretionary requirements. MMAPI:The mobile media API(MMAPI) is an optional package that supports multimedia application on J2ME enabled devices.MMAPI has been designed to run on any J2ME-based virtual machine.

Operating system and Languages:


OS: All OS which supports java.
Languages/Tools: JAVA and J2ME wireless toolkit.

iii

J2ME:
Java Platform, Micro Edition, or Java ME, is a Java platform designed for embedded systems (mobile devices are one kind of such systems). Target devices range from industrial controls to mobile phones (especially feature phones) and set-top boxes. Java ME was formerly known as Java 2 Platform, Micro Edition (J2ME). Java ME was designed by Sun Microsystems, now a subsidiary of Oracle Corporation; the platform replaced a similar technology, PersonalJava. Originally developed under the Java Community Process as JSR 68, the different flavors of Java ME have evolved in separate JSRs. Sun provides a reference implementation of the specification, but has tended not to provide free binary implementations of its Java ME runtime environment for mobile devices, rather relying on third parties to provide their own. Java ME devices implement a profile. The most common of these are the Mobile Information Device Profile aimed at mobile devices, such as cell phones, and the Personal Profile aimed at consumer products and embedded devices like set-top boxes and PDAs. Profiles are subsets of configurations, of which there are currently two: the Connected Limited Device Configuration (CLDC) and the Connected Device Configuration (CDC).
iv

Abstract:
The Mobile Media API (MMAPI) is an optional package that supports multimedia applications on J2MEenabled devices. This standard Java specification, defined by the Java Community Process (JCP) in JSR 135, is highly flexible. It has been designed to run with any protocol and format; for example, it doesn't specify that the implementation must support particular transport protocols such as HTTP or RealTime Transport Protocol (RTP), or media formats such as MP3, MIDI, or MPEG-4

This article provides a technical overview of MMAPI's architecture and APIs, followed by a tutorial in which sample code demonstrates how MMAPI can be used to build multimedia-rich wireless Java applications. A complete media player is developed, and steps for testing it are provided.

Overview of MMAPI:
MMAPI has been designed to run on any J2ME-based virtual machine, including the CDC and CLDC VMs. Sun's reference implementation runs on CLDC/MIDP for Windows 2000. The mobile media API(MMAPI) is an optional package that supports multimedia application on J2ME enabled devices.MMAPI has been designed to run on any J2MEbased virtual machine. The J2ME Wireless Toolkit comes with the MMAPI. MMAPI's developers designed into it the following features: Support for Tone Generation, Playback, and Recording of Time-Based Media: The package supports any timebased audio or video content. Small Footprint: MMAPI works within the strict memory limits of CLDC devices. Protocol- and Content-Agnostic: The API is not biased towards any specific content type or protocol. Subsettable: Developers can limit support to particular types of content, basic audio for example.
vi

Extensible: New features can be added easily without breaking older functionality. ]More importantly, additional formats can be easily supported, and the framework is in place for additional controls. Options for Implementers: The API offers features for different purposes. The API is designed to allow implementers to leave some features unimplemented if they cannot be supported.

vii

Multimedia Processing:
There are two parts to multimedia processing: Protocol Handling: reading data from a source such as a file or a streaming server into a media-processing system. Content Handling: parsing or decoding the media data and rendering it to an output device such as an audio speaker or video display. To facilitate these operations, the API provides two highlevel object types: DataSource encapsulates protocol handling by hiding the details of how the data is read from its source. This object's utility methods enable the Player object to handle the content. Player reads the data from DataSource, processes it, and renders it to an output device. This object provides methods to control media playback, including methods for typespecific controls to access features for specific media types.

vii

MMAPI specifies a third object, a factory mechanism known as the Manager, to enable your application to create Players from DataSources, and also from InputStreams. The overall architecture of MMAPI is shown in Figure :

ix

The Manager object provides the method createPlayer(), which is the top-level entry point into the API. Here's an example:

... Player player = Manager.createPlayer(String url); ...

The url specifies the protocol and the content, using the format <protocol>:<content location>. The application uses the methods of the returned Player to control the retrieval and playback of time-based media. The player's life-cycle includes five states: UNREALIZED, REALIZED, PREFETCHED, STARTED, and CLOSED. Six of its methods result in state transitions: realize() prefetch() start() stop() deallocate() close()

When a player is created, it is in the UNREALIZED state. Calling realize() moves it to the REALIZED state and initializes the information the player needs to acquire media resources. Calling prefetch() moves it to PREFETCHED, establishes network connections for streaming data, and performs other initialization tasks. Calling start() causes a transition to the STARTED state, where the player can process data. When it finishes processing (reaches the end of a media stream), it returns to the PREFETCHED state. Calling close() moves the player to the CLOSED state. A Player provides controls specific to the particular types of media it processes. The application uses getControl() to obtain a single control, or getControls() to get an array of them. As an example, if a player for MIDI media invokes getControl() it gets back a MIDIControl.

xi

The MMAPI Packages:


MMAPI comprises three packages: javax.microedition.media provides some interfaces, an exception, and the Manager class, which is the access point for obtaining system-dependent resources such as Players for multimedia processing. javax.microedition.media.control defines the specific control types that can be used with a Player: VolumeControl, VideoControl, and others. javax.microedition.media.protocol defines the protocols for handling custom controls. For example, it includes the DataSource class, which is an abstraction for media-control handlers. The classes, interfaces, and exceptions contained in these packages are shown in Tables 1, 2, and 3, respectively.

xii

Table 1: MMAPI Classes:


Package javax.microedition.media Class Manager Description Access point for obtaining systemdependent resources, such as Players for multimedia processing

javax.microedition.media.protocol ContentDescriptor Describes media-type containers javax.microedition.media.protocol DataSource Represents an abstraction for media protocol handlers by hiding the details of how the data is read from a media file or a streaming server; provides methods for the Player to access the input data

xii

Table 2: MMAPI Interfaces:


Package javax.microedition.media Interface Control Description

Used to control some mediaprocessing related functions; obtained from the Controllable interface, which is extended by Player; enables a Player to expose, for example, a VolumeControl to allow the user to set volume level Provides an interface for obtaining the Controls from a Player or other object Used to control the rendering of media data; provides methods to manage the Player's life-cycle Receives events generated by Players A continuous source of time ticks; used to measure the progress of time, so as to synchronize media playback by multiple players Controls the precise positioning of a video frame for a Player Should be implemented by any control that supports a GUI component Used to retrieve metadata information included in media streams Provides access to MIDI rendering and transmitting devices Controls the playback pitch of audio output without

javax.microedition.media

Controllable

javax.microedition.media

Player

javax.microedition.media javax.microedition.media

PlayerListener TimeBase

javax.microedition.media.control

FramePositionControl

javax.microedition.media.control

GUIControl

javax.microedition.media.control

MetaDataControl

javax.microedition.media.control

MIDIControl

javax.microedition.media.control

PitchControl

xiv

changing the playback speed


javax.microedition.media.control javax.microedition.media.control javax.microedition.media.control javax.microedition.media.control RateControl RecordControl StopTimeControl TempoControl

Controls the playback rate of a player Controls the recoding of media from a player Used to specify a preset stop time for a player Controls the tempo of a song; implemented in players for MIDI files Enables playback of a userdefined sequence of single tones Controls the display of video, for example its location relative to the canvas where it's displayed Controls the volume of a player Used in conjunction with a DataSource to provide the input interface to a Player; extends the Controllable interface and therefore may provide type-specific controls

javax.microedition.media.control

ToneControl

javax.microedition.media.control

VideoControl

javax.microedition.media.control

VolumeControl

javax.microedition.media.protocol SourceStream

Table 3: MMAPI Exceptions:


xv

Package

Exception

Description

javax.microedition.media MediaException

Reports an unexpected error in a mediaprocessing method

Using MMAPI
xvi

This section demonstrates how to use the multimedia APIs, but provides only short snippets of sample code. To see working examples, look at the mmademo project that comes with the J2ME Wireless Toolkit. You'll find it in <j2me-toolkit>/wtk20/apps/mmademo. Tone Generation Tone generation is a characterized by frequency and duration. This type of media is important for games and other audio applications, especially on small devices, where it might be the only form of multimedia capability available. The Manager.playTone() method generates tones. Its implementation can be mapped to the hardware's tone generator. You specify the note, duration, and volume.

xvi

The J2ME Wireless Toolkit and MMAPI:


The J2ME Wireless Toolkit 2.0 supports MMAPI. It provides demo applications and a MediaControlSkin an emulator capable of playing audio and video content. To experiment with the demos, open the mmademo project and run it. You should see a list like the one shown in Figure 2.

Figure 2: J2ME Wireless Toolkit MMAPI Demo Project

Try one of the sample MIDlets. Note that some of the applications require an Internet connection, because they download the content from a remote server, such as java.sun.com.

xvi

Supported Formats:
MMAPI supports several audio and video formats, of which the J2ME Wireless Toolkit supports:

Audio: PCM and WAV MIDI: Type 0 (single track), Type 1 (multiple tracks), and SP-MIDI Video: MPEG-1

xix

Limitations on Using MMAPI in the Toolkit:

An application can create multiple players, but can realize only one MIDI player or one tone-sequence player. Any attempt to realize a second player of either type will throw a MediaException. In other words, only one MIDI or tone sequence player can be in use at any time. The toolkit allows any number of simultaneous playTone() calls for a single note, but guarantees only that at least four will actually work. The playTone() method can be called while a MIDI or tone-sequence player is playing. The number of video players is limited by the size of the heap, as specified in the -Xheapsize option of the emulator command if you are using the command line utilities, or from KToolBar by choosing Edit -> Preferences -> Storage. The number of WAV audio players is also limited by the heap size. Only one audio capture can be in use at one time.

xx

xxi

You might also like