290 likes | 341 Views
Learn about JMF for media acquisition, processing, and delivery in Java. Explore player controls, capturing, plugins, codecs/effects, mux/demux, and issues. Discover JMF's flexibility, promise, and current challenges. Consider JMF's potential in multimedia editing, streaming, and Linux support.
E N D
Java Media Framework Matthew Mastracci
Overview • What is JMF? • Players • Capturing • Plugins • Codecs/Effects • Mux/Demux
What Is JMF? • A method for working with time-based data in Java • Acquisition, processing and delivery of media • Handles real-time or stored audio and video
JMF Data Model Controls Duration Manages Datasource SourceStream Control
Player • Player object allows easy embedding of content • Create widget and catch realization events • Heavy-weight widget
Player [cont’d] public void init() { setLayout( new BorderLayout() ); String mediaFile = getParameter( "FILE" ); try { URL mediaURL = new URL( getDocumentBase(), mediaFile ); player = Manager.createPlayer( mediaURL ); player.addControllerListener( this ); } catch (Exception e) { System.err.println( "Got exception " + e ); } }
Player [cont’d] public synchronized void controllerUpdate( ControllerEvent event ) { if ( event instanceof RealizeCompleteEvent ) { Component comp; if ( (comp = player.getVisualComponent()) != null ) add ( "Center", comp ); if ( (comp = player.getControlPanelComponent()) != null ) add ( "South", comp ); validate(); } } Add the control panel to the bottom of the dialog Add the content to the center of the dialog
Player [cont’d] <APPLET CODE=PlayerApplet WIDTH=320 HEIGHT=300> <PARAM NAME=FILE VALUE="sprk.mpeg"> </APPLET>
Player [cont’d] <APPLET CODE=PlayerApplet WIDTH=320 HEIGHT=20> <PARAM NAME=FILE VALUE="etr.mp3"> </APPLET>
Capturing 1. Query the CaptureDeviceManager 2. Get a CaptureDeviceInfo object for the device 3. Get a MediaLocator to create a DataSource 4. Create a Player or Processor using the DataSource 5. Start the Player or Processor
Capturing for Display • One step: use a player and a content specifier URL • Example: vfw://0, rtp://ip-address/type/[ttl]
Plugins • Plugins can be dynamically loaded in system • Add functionality to the system • Codecs, Effects, Mux, Demux, Renderers • Media handlers
Plugins Interface Hierarchy Plugin Codec Demux Mux VideoRenderer Renderer Effect
Plugin Manager • Use addPlugin() to add a new plug-in to the list • commit() updates changes to the plug-in list on disk • Register with the manager at install-time
Codecs • Codec interface extends Plugin • Codecs have input and output, modifying the content Codec A Codec B Data 1 Format A Data 2 Format B Data 3 Format C
Effects • Effect interface extends Codec • Input format of Effect is same as output Effect A Effect B Data 1 Format A Data 2 Format A Data 3 Format A
Multiplexer • Merges multiple streams to a single stream Data 1A Audio Data 1 Compound Mux Data 1B Video
Demultiplexer • Takes a single buffer and outputs to many buffers Data 1A Audio Demux Data 1 Compound Data 1B Video
MediaHandler Demux • Outputs multiple stream formats Audio stream Video stream
Applications of JMF • Teleconferencing • Multimedia editing/sequencing • Streaming multimedia web content
Problems with JMF • JMF 2.0 is still beta • Crashes occasionally • Can lock up video capture devices • API well documented, but usage and examples not
Conclusions • JMF is highly flexible • Shows a lot of promise • Major stability and documentation issues • Video For Windows (VFW) support adds great value (no need for native drivers) • Currently difficult to use to create a complex program
Issues for Discussion • Can JMF help propel Java into the field of multimedia display and editing? • Will Sun develop a Linux-native "performance pack" for JMF, even though Linux competes with Solaris? • What changes need to be made to the current beta version of JMF to make it more usable/stable when it becomes a release?