Java Media Framework Matthew Mastracci

946 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
946
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java Media Framework Matthew Mastracci

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

×