320 likes | 531 Views
Java Media Framework JMF. Application program interface API JMF API 2.0. JMF API 2.0. Allows Java programmers to incorporate time based media Support applications and applets Developed by Sun, IBM and SGI Plug-in API to extend JMF functionality Downloadable library module. Design Goals 1.
E N D
Java Media Framework JMF Application program interface API JMF API 2.0
JMF API 2.0 • Allows Java programmers to incorporate time based media • Support applications and applets • Developed by Sun, IBM and SGI • Plug-in API to extend JMF functionality • Downloadable library module
Design Goals 1 • Easy to program • Supports media data capture • Enables development f streaming and conferencing applications in Java • Integrates with existing frameworks • Provides access to raw data • Compatible with JMF 1.0
Design Goals 2 • Enables the development of custom, downloadable, demultiplexers, codecs, effects processors, multiplexers and renderers • Use real time transport protocol RTP • RTP enables Tx and Rx of real-time of media streams across a network
Streaming Media • Supports RTP session manager • Important modules • Javax.media.rtp • Javax.media.event • Javax.media.rtp • Javax.media.rtp.rtcp
Useful JMF links • http://java.sun.com/java-media/jmf/ • www.software.ibm.com/net.media/ • JMF functions • MediaPlayer – plug-ins for media streams • Processor – converts media stream formats • Server – stream live data and files
JMF basic operation • Time based media • Input • Process • Output • Streaming media from – local files, acquired across a network, captured from a camera or microphone
Media locator • Media File • Type identification - audio • Format – wav • Media locator – identify media location when URL cannot be used • URL may be used if protocols installed and network enabled
Media Stream Types • Pull – initiated from client side, http and file • Push – server initiates data transfer RTP push protocol for streaming data • Media types all have different requirements • CPU load and bandwidth
Media Stream Types • Formats CPU load Bandwidth • H261 Low Medium • H263 Medium Low • JPEG Low High • A number of factors to be taken int account
Building blocks 1 • Multiplexer – merges tracks • Demultiplexer – demerges tracks • Framerate – typical 30 frames per sec • Codecs – perform compression and decompression • Codecs may be chained • Effects filter – echo or blur normally applied to raw data
Building blocks 2 • Renderer – audio sent to sound card and video to vdu screen • Capture devices • Still camera – pull source • Live stream – push source (microphone) • Output – raw or processed • Raw – high data rate • Processed – loads CPU
Capture Controls • Main control • Data rates • Encoding type • Start • Stop
High level JMF architecture • 1 JMF presentation and processor API • 2 JMF plugins • 3 JMF low level modules • Demultiplexers • Codecs • Effects • Multiplexer • Renderer
Time Object • Specifies time in nano seconds • Clock orivides timing and basic synchronisation • MediaTime = MediaStartTime + • Rate(TimeBaseTime – TimeBaseStartTime) • Rate 1.0 normal rate forward • Rate -1.0 run backwards • Rate 2.0 fast forward
Managers 1 • Manager handle the construnction of players and processors • Package manager – maintains registry of Players, Processors, DataSources and DataSinks • Cature Device Manager – maintains registry of avaible capture devices
Managers 2 • PlugInManager – manages registry for • multiplexers, • demultiplexers (demux), • codecs, • effect and • renderer (objects)
Event model • Events are created by Players and Processors • Event model • Strutured event reporting model • State of the media system .e.g. • Out of data • Resource unavailable
Listener interface • Register listener class with addListener() method
Data Model • Media locator • URL if protocol installed • Datasource manager transfers media • DataSource BufferedDataSource allows for latency in network • Pull or push • Disable reverse option if media from remote server
Control 1 • Important controls • Gain • Start/Stop • Monitor control – preview media during capture • Bitrate • Framerate • Frameposition • Portcontrol • Quality control
User Interface Components • Interface uses AWT component • Methods • getVisualComponent • getControlPanelComponent
Extensibility • Extend system with plug-ins • 1 - K lite codec pack • 2 – XP codec pack • Link • http://www.free-codecs.com/download/K_Lite_Codec_Pack.htm
Player States • Primary States • Stopped and started • Stopped (standby states) • Unrealized – media unknown • Realizing – acquire resources • Realized – hardware (audio card) • Prefetching – preload data ready to play • Prefetched – change rates • and configure buffers
Real-Time Transport Protocol • End to end networ delivery services for the tranmissin of real-time data. • Defined in IETF RFC 1889 • RTP is transport independent • Is often used over UDP • Unicast and multicast modes • RTCP – real time control protocol
RTP Protocol Stack • Real time media framework applications • Real time control protocol RTCP • Real time transport protocol RTP • UDP and IP
RTCP • RTCP – enables the programmer to monitor the quality of the data distributon • RTCP also provides control and identifcatoin mechanisms for RTP transmission • RTP may also be used over resource reservation protocol
Example Source Code • Applet • JavaMediaPlayerApplet.java • TVApplet.java • Applications • AVTransmit2.java • AVReceive2.java
JMStudio • Java Media Studio • Player and • Server • Unicast • File IP address port number • File.ext 157.228.x.y 4444 • Multicast • File.ext 224.0.0.1 4444 • Portnumber must be even