Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Java Media Framework

From Wikipedia, the free encyclopedia
Java library for multimedia processing
Java Media Framework
DeveloperSun Microsystems
Stable release
2.1.1e / May 23, 2003 (2003-05-23)
Written inJava
Operating systemCross-platform
TypeLibrary for multimedia
WebsiteJava Media Framework API (JMF), on Oracle.com

TheJava Media Framework (JMF) is aJavalibrary that enables audio, video and other time-based media to be added to Java applications and applets. This optional package, which can capture, play, stream, and transcode multiplemedia formats, extends theJava Platform, Standard Edition (Java SE) and allows development of cross-platform multimedia applications.

Versions and licensing

[edit]

An initial, playback-only version of JMF was developed bySun Microsystems,Silicon Graphics, andIntel, and released as JMF 1.0 in 1997. JMF 2.0, developed by Sun andIBM, came out in 1999 and added capture, streaming, pluggablecodecs, and transcoding. JMF is branded as part of Sun's "Desktop" technology of J2SE opposed to the Java server-side and client-side application frameworks. The notable exceptions areJava applets andJava Web Start, which have access to the full JMF in the web browser's or appletviewer's underlying JRE.[1][2]

JMF 2.0 originally shipped with an MP3 decoder and encoder. This was removed in 2002, and a new MP3 playback-only plug-in was posted in 2004.

JMF binaries are available under a custom license, and the source is available under theSCSL.

The current version ships with fourJAR files, and shell scripts to launch four JMF-based applications:

  • JMStudio - A simple player GUI
  • JMFRegistry - A GUI for managing the JMF "registry," which manages preferences, plug-ins, etc.
  • JMFCustomizer - Used for creating a JAR file that contains only the classes needed by a specific JMF application, which allows developers to ship a smaller application.
  • JMFInit

JMF is available in an all-Java version and as platform-specific "performance packs", which can contain native-code players for the platform, and/or hooks into a multimedia engine specific to that platform. JMF 2.0 offers performance packs for Linux, Solaris (on SPARC) and Windows.[1]

In January 2011, Tudor Holton of Bentokit Project released aDebian package for the JMF to alleviate difficulties that had arisen over time when installing the JMF onDebian andUbuntu Linux. This package does not contain the JMF, but presents the user with the JMF License, retrieves it from the Oracle website, and then installs it.[3] A similarDebian package installer for the JMF MP3 Plugin was also built in February 2011.[4]

Design concepts

[edit]

JMF abstracts the media it works with intoDataSources (for media being read into JMF) andDataSinks (for data being exported out). It does not afford the developer significant access to the particulars of any given format; rather, media is represented as sources (themselves obtained from URL's) that can be read in and played, processed, and exported (though not all codecs support processing and transcoding).

AManager class offers static methods that are the primary point-of-contact with JMF for applications.

Criticism and alternatives

[edit]

Many JMF developers have complained that the JMF implementation supplied in up-to-date JRE's supports relatively few up-to-date codecs and formats. Its all-Java version, for example, cannot playMPEG-2,MPEG-4,Windows Media,RealMedia, mostQuickTime movies,Flash content newer than Flash 2, and needs a plug-in to play the ubiquitousMP3 format.[5] While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. In particular, MS Windows-based JMF developers new to JMF often expect support for some newer formats on all platforms when such formats are only, in fact, supported on MS Windows.

While JMF is considered a very useful framework, the freely available implementation provided by Oracle is suffering from a lack of updates and maintenance. JMF does not get much maintenance effort from Oracle; the API has not been enhanced since 1999, and the last news item on JMF's home page was posted in September 2008. While JMF is built for extensibility, there are few such third-party extensions. Furthermore, content editing functionality in JMF is effectively non-existent. You can do simple recording and playback for audio and video, but the implementation provided by Oracle can do little else.[6]

Platforms beyond those that Oracle provides support to are left to their corresponding JRE vendors.[7] While Sun still provides a forum for discussion of its implementation, there have been several efforts to implement open-source alternatives.[8][9][10][11][12]

Alternatives

[edit]

Depending on a developer's needs, several other libraries may be more suitable than JMF. These include:

  • Freedom for Media in Java (FMJ) An API-compatible with JMF open source alternative
  • QuickTime for Java
  • IBM Toolkit for MPEG-4
  • Jffmpeg
  • vlcj
  • gstreamer-java
  • Cortado, a complete player for Ogg Vorbis and Theora in a Java applet
  • DirectShow <> Java wrapper
  • JLayer MP3 library
  • Video4Linux4Java
  • Java MP4 ParserJava MP4 Parser

Code example

[edit]

The following example shows anAWT file-selection dialog, and attempts to load and play the media file selected by the user.

packageorg.wikipedia.examples;importjava.awt.Component;importjava.awt.FileDialog;importjava.awt.Frame;importjava.io.File;importjava.io.IOException;importjava.net.MalformedURLException;importjavax.media.Manager;importjavax.media.Player;importjavax.media.MediaException;publicclassTrivialJMFPlayerextendsFrame{publicTrivialJMFPlayer()throwsIOException,MalformedURLException,MediaException{FileDialogfd=newFileDialog(this,"TrivialJMFPlayer",FileDialog.LOAD);fd.setVisible(true);Filef=newFile(fd.getDirectory(),fd.getFile());Playerp=Manager.createRealizedPlayer(f.toURI().toURL());Componentc=p.getVisualComponent();add(c);p.start();}publicstaticvoidmain(String[]args){try{Framef=newTrivialJMFPlayer();f.pack();f.setVisible(true);}catch(Exceptione){e.printStackTrace();}}}

Much of the example is involved with the building of the AWT GUI. Only two lines touch JMF. Manager.createRealizedPlayer() implicitly creates aDataSource from a URL representation of the file, creates aPlayer, andrealizes it, meaning that all resources necessary for playback are allocated and initialized. ThegetVisualComponent() asks thePlayer for an AWTComponent suitable for use in a GUI. If a control component were desired, it would be obtained withgetControlPanelComponent() and added to the GUI separately. Note that the developer is not concerned with the format of the media - this code works equally well for any media format that JMF can import and read.

References

[edit]
  1. ^abJMF FAQ
  2. ^Java Media Framework API
  3. ^"Ubuntu installer for JMF".Launchpad. 5 January 2011. Retrieved4 March 2011.
  4. ^"JMF Plugin installer for Debian". 23 February 2011. Retrieved4 March 2011.
  5. ^JMF 2.1.1 - Supported Formats
  6. ^JMF: A Mistake Asking to Be Re-Made by Chris Adamson, December 13, 2005
  7. ^Installation Instructions for JMF on Mac OS X
  8. ^JMF-Interest, the official discussion listArchived 2006-04-27 at theWayback Machine
  9. ^Jffmpeg: A JMF open-source plugin to support additional codecs
  10. ^Fobs4JMF: Another JMF open source plugin to support additional codecs
  11. ^FMJ: An open-source replacement for/alternative to/implementation of JMF
  12. ^Xuggler: An open-source java plugin that supports additional codecs and is automatically kept up to date withFFMPEG
Platforms
Technologies
Oracle
Platform
Major
third-party
History
JVM
languages
Community
Conferences
Organizations
People
Portal:
Retrieved from "https://en.wikipedia.org/w/index.php?title=Java_Media_Framework&oldid=1317902893"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp