Java (TM)  Media Framework API Vladimir Sakhovski [email_address]
Intro <ul><li>Java Media Framework (JMF) is an API for manipulation and processing of time-based media in Java application...
Intro (cont) <ul><li>JMF 1.0 API  </li></ul><ul><ul><li>support for presenting of time-based media. </li></ul></ul><ul><li...
Intro (cont) <ul><li>JMF RTP APIs are not required by JMF specification </li></ul><ul><li>Reference implementation of JMF ...
Intro (cont) <ul><li>There are JMF versions for Windows, Solaris, Linux, and pure-Java version (works on any JVM) </li></u...
JMF data processing model <ul><li>Everyday-life model for operations with time-based media: </li></ul>
JMF data processing model (cont) <ul><li>JMF data processing model </li></ul>
JMF data processing model (cont) <ul><li>JMF data processing model, example </li></ul>
JMF input <ul><li>Input in JMF is generally represented by a  javax.media.MediaLocator  object. </li></ul><ul><li>MediaLoc...
JMF input (cont) <ul><li>From  MediaLocator  an instance of  javax.media.protocol. DataSource  object can be created. It r...
JMF processors <ul><li>Input data can be directly rendered to the output destination or some manipulations can be applied ...
JMF output <ul><li>The ouput of a  Processor  (just like the input) is presented with the instance of  DataSource.  This w...
JMF output (cont) <ul><li>Another way to represent output of the JMF process model is with  javax.media.DataSink  interfac...
Simple audio player <ul><li>Example for a simple program to play a local audio file through  a command-line interface </li...
Simple audio player (cont) <ul><li>Player </li></ul><ul><ul><li>private Player audioPlayer = null; </li></ul></ul><ul><ul>...
Simple audio player (cont) <ul><li>Player  processes an input media data stream and renders it at a precise time. </li></u...
Simple audio player (cont) <ul><li>A  Player  can be in one of the six states </li></ul>
Simple audio player (cont) <ul><li>To get an instance of the  Player  we use  Manager  class. It acts as a factory for cre...
Simple audio player (cont) <ul><li>Starting/stopping the player </li></ul><ul><li>public void play() { </li></ul><ul><li>a...
Simple audio player (cont) <ul><li>Creating a player in the main() </li></ul><ul><li>File audioFile = new File(args[0]); <...
Simple audio player (cont) <ul><li>Simple (just a few lines of code) </li></ul><ul><li>No need not to know anything about ...
Simple video player <ul><li>The main difference from the audio player – we must create a visual representation to display ...
Simple video player (cont) <ul><li>Player  has methods to get references to visual components </li></ul><ul><li>player.get...
Simple video player (cont) <ul><li>Controls returned are instances of the  java.awt.Component  class and may be added to t...
Resources <ul><li>http://java.sun.com/products/java-media/jmf/ </li></ul><ul><ul><li>2.0 API Guide  </li></ul></ul><ul><ul...
Upcoming SlideShare
Loading in …5
×

Java Media Framework API

3,845
-1

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,845
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
208
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Java Media Framework API

  1. 1. Java (TM) Media Framework API Vladimir Sakhovski [email_address]
  2. 2. Intro <ul><li>Java Media Framework (JMF) is an API for manipulation and processing of time-based media in Java applications and applets. </li></ul><ul><li>A key characteristic of time-based media: it requires timely delivery and processing. Strict timing deadlines must be met for receiving and presentation of the data. </li></ul>
  3. 3. Intro (cont) <ul><li>JMF 1.0 API </li></ul><ul><ul><li>support for presenting of time-based media. </li></ul></ul><ul><li>JMF 2.0 API extends by </li></ul><ul><ul><li>supporting capturing and storing of media data, </li></ul></ul><ul><ul><li>controlling of type of processing during playback, </li></ul></ul><ul><ul><li>custom processing on media data streams </li></ul></ul><ul><ul><li>plug-in API to customize and extend JMF functionality </li></ul></ul><ul><li>JMF 2.1.1 </li></ul><ul><ul><li>no changes to the API, updates to the Sun‘s implementation </li></ul></ul>
  4. 4. Intro (cont) <ul><li>JMF RTP APIs are not required by JMF specification </li></ul><ul><li>Reference implementation of JMF provided by Sun and IBM fully support JMF RTP APIs </li></ul><ul><li>RTP APIs enable developers to receive, transmit and play RTP streams using JMF </li></ul>
  5. 5. Intro (cont) <ul><li>There are JMF versions for Windows, Solaris, Linux, and pure-Java version (works on any JVM) </li></ul><ul><li>OS-specific versions should be used to increase performance </li></ul>
  6. 6. JMF data processing model <ul><li>Everyday-life model for operations with time-based media: </li></ul>
  7. 7. JMF data processing model (cont) <ul><li>JMF data processing model </li></ul>
  8. 8. JMF data processing model (cont) <ul><li>JMF data processing model, example </li></ul>
  9. 9. JMF input <ul><li>Input in JMF is generally represented by a javax.media.MediaLocator object. </li></ul><ul><li>MediaLocator is like an URL – it uniquely identifies a resource in a network </li></ul><ul><li>Example: media locator for an RTP session: </li></ul><ul><ul><li>rtp://address:port[:ssrc]/content-type/[ttl] </li></ul></ul>
  10. 10. JMF input (cont) <ul><li>From MediaLocator an instance of javax.media.protocol. DataSource object can be created. It represents input data, which is used in Player s , Processor s and DataSink s . </li></ul>
  11. 11. JMF processors <ul><li>Input data can be directly rendered to the output destination or some manipulations can be applied before this. </li></ul><ul><li>Processor (manipulation) component is represented by an instance of javax.media.Processor interface </li></ul>
  12. 12. JMF output <ul><li>The ouput of a Processor (just like the input) is presented with the instance of DataSource. This way: </li></ul><ul><ul><li>Processor s can be chained to perform multiple operations on the same media </li></ul></ul><ul><ul><li>Output from Processor can be used as an input to a Player or DataSink (for rendering to the output destination) </li></ul></ul>
  13. 13. JMF output (cont) <ul><li>Another way to represent output of the JMF process model is with javax.media.DataSink interface </li></ul><ul><li>DataSink reads media content and renders it to some destination </li></ul><ul><li>Example: output file, network </li></ul>
  14. 14. Simple audio player <ul><li>Example for a simple program to play a local audio file through a command-line interface </li></ul><ul><li>Import </li></ul><ul><ul><li>import javax.media.*; </li></ul></ul>
  15. 15. Simple audio player (cont) <ul><li>Player </li></ul><ul><ul><li>private Player audioPlayer = null; </li></ul></ul><ul><ul><li>public SimpleAudioPlayer(File file) throws IOException, NoPlayerException, CannotRealizeException { </li></ul></ul><ul><ul><li>audioPlayer = Manager. createRealizedPlayer(file.toUrl()); </li></ul></ul><ul><ul><li>} </li></ul></ul>
  16. 16. Simple audio player (cont) <ul><li>Player processes an input media data stream and renders it at a precise time. </li></ul><ul><li>DataSource is used to deliver the input to the Player </li></ul><ul><li>Rendering destination depends on the type of the media (example: speakers, display...) </li></ul>
  17. 17. Simple audio player (cont) <ul><li>A Player can be in one of the six states </li></ul>
  18. 18. Simple audio player (cont) <ul><li>To get an instance of the Player we use Manager class. It acts as a factory for creating many of the specific interface types in JMF, including the Player interface </li></ul><ul><li>audioPlayer = Manager.createRealizedPlayer(file.toUrl()); </li></ul>
  19. 19. Simple audio player (cont) <ul><li>Starting/stopping the player </li></ul><ul><li>public void play() { </li></ul><ul><li>audioPlayer.start(); </li></ul><ul><li>} </li></ul><ul><li>public void stop() { </li></ul><ul><li>audioPlayer.stop(); </li></ul><ul><li>audioPlayer.close(); </li></ul><ul><li>} </li></ul>
  20. 20. Simple audio player (cont) <ul><li>Creating a player in the main() </li></ul><ul><li>File audioFile = new File(args[0]); </li></ul><ul><li>SimpleAudioPlayer player = new SimpleAudioPlayer(audioFile); </li></ul><ul><li>player.play(); </li></ul><ul><li>... </li></ul><ul><li>player.stop(); </li></ul>
  21. 21. Simple audio player (cont) <ul><li>Simple (just a few lines of code) </li></ul><ul><li>No need not to know anything about the media file type to configure a player, everything is handled internally </li></ul>
  22. 22. Simple video player <ul><li>The main difference from the audio player – we must create a visual representation to display the video </li></ul>
  23. 23. Simple video player (cont) <ul><li>Player has methods to get references to visual components </li></ul><ul><li>player.getVisualComponent() </li></ul><ul><li>player.getGainControl() </li></ul><ul><li>player. </li></ul><ul><li>getControlPanelComponent() </li></ul>
  24. 24. Simple video player (cont) <ul><li>Controls returned are instances of the java.awt.Component class and may be added to the window frame. </li></ul><ul><li>They are tied directly to the Player – any manipulations on controls will have corresponding changes on the media played. </li></ul>
  25. 25. Resources <ul><li>http://java.sun.com/products/java-media/jmf/ </li></ul><ul><ul><li>2.0 API Guide </li></ul></ul><ul><ul><li>Code Samples and Apps </li></ul></ul><ul><li>http://www-106.ibm.com/developerworks/ </li></ul><ul><li>edu/j-dw-javajmf-i.html </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×