Java Media Frameworks (JMF)
Total Page:16
File Type:pdf, Size:1020Kb
Die bunte Welt und die dunkle Seite des Java Media Frameworks (JMF) [email protected] © 10/2004 [email protected] Java Media Framework (JMF) 1 Agenda ● Die bunte Welt von JMF ● Architektur ● The Dark Side ● The Bright Side ● Dokumentation TV is chewing gum for the eyes. -- Frank Lloyd Wright © 10/2004 [email protected] Java Media Framework (JMF) 2 Was ist JMF? ● JMF = Java Media Framework ● Umgang mit Video- und Audio-Daten ● API für Audio-/Video-Player ● Streaming-API © 10/2004 [email protected] Java Media Framework (JMF) 3 Installation ● http://java.sun.com/products/java-media/jmf/index.jsp – akt. Version: 2.1.1e (v. 2003) ● Framework: lib – JARs und Nativ Libs ● Demos: bin – JMStudio, JMF-Registry ● Plugin für IE / Mozilla – Linux: Handarbeit notwendig © 10/2004 [email protected] Java Media Framework (JMF) 4 Medienformate ● Audio: – G723, GSM, WAV, ULAW – MP3: ab JMF 2.1.1b wieder entfernt (aus Lizenz-Gründen) ● Video: – CINEPAK, H263, MJPG, MPEG, MOV (QuickTime) – streamingfähig: ● QuickTime, MPEG, WMF – nicht streamingfähig ● AVI © 10/2004 [email protected] Java Media Framework (JMF) 5 JMStudio ● Audio-/Video-Player – Media lokal / über URL adressierbar ● auch als Streamer einsetzbar ● Achtung: läuft nicht unter JDK 1.5 – NullPointerException – ebenfalls anfällig: Sound SPI (MP3SPI v. javazoom) ● Doku-Ersatz bzw. -Ergänzung © 10/2004 [email protected] Java Media Framework (JMF) 6 JMStudio (Sender) © 10/2004 [email protected] Java Media Framework (JMF) 7 JMStudio (Empfänger) © 10/2004 [email protected] Java Media Framework (JMF) 8 Beispiel-Programme ● s. http://java.sun.com/products/java-media/jmf/ ● aber: – teilweise Mängel in der Programmierung – teilweise veraltet ● SessionManager durch RTPManager abgelöst © 10/2004 [email protected] Java Media Framework (JMF) 9 PlayerBean ● Beispiel für einen einfachen Video-Player: MediaPlayer1 = new javax.media.bean.playerbean.MediaPlayer(); MediaPlayer1.setMediaLocation("file://jvideo/media/Sample1.mov"); MediaPlayer1.start(); ● aus http://java.sun.com/products/java-media/jmf/2.1.1/playerbean.html © 10/2004 [email protected] Java Media Framework (JMF) 10 Buffer interface interface interface java.util.EventObject Error CaptureDeviceManager interface Exception interface PackageManager Control Clock Duration MediaEvent MediaError TimeBase MediaException ControllerListener +FLAG_EOM:int -cdm:CaptureDeviceManager -pm:PackageManager +FLAG_DISCARD:int +RESET:Time +DURATION_UNBOUNDED:Time -mGetDeviceList:Method -mGetProtocolPrefixList:Method +FLAG_SILENCE:int +DURATION_UNKNOWN:Time -mGetDevice:Method -mSetProtocolPrefixList:Method +MediaEvent +MediaError +MediaException +controllerUpdate:void +FLAG_SID:int +syncStart:void -mAddDevice:Method -mComm itProtocolPrefixList:Method +MediaError +MediaException +FLAG_KEY_FRAME:int -mRemoveDevice:Method -mGetContentPrefixList:Method controlComponent:Component +stop:void time:Time +FLAG_NO_DROP:int -mComm it:Method -mSetContentPrefixList:Method +mapToTimeBase:Tim e nanoseconds :long +FLAG_NO_WAIT:int +setRate:float duration:Time -mComm itContentPrefixList:Method +FLAG_NO_SYNC:int -runMethod:Object -sigNone:Clas s [] +FLAG_SYSTEM_TIME:int +getDevice:CaptureDeviceInfo -sigVector:Class [] timeBas e:TimeBas e java.util.EventListener +FLAG_RELATIVE_TIME:int +getDeviceLis t:Vector -protoPrefixList:Vector s topTim e:Time NotPrefetchedError ClockStartedError NotRealizedError StopTimeSetError NotConfiguredError IncompatibleSourceException ResourceUnavailableException UnsupportedPlugInException BadHeaderException NoDataSinkException IncompatibleTimeBaseExcep... CannotRealizeException NoPlayerException ClockStoppedException NoDataSourceException ControllerAdapter +FLAG_FLUSH:int mediaTime:Tim e +addDevice:boolean +FLAG_SYSTEM_MARKER:int mediaNanos econds :long +removeDevice:boolean SystemTimeBase Manager -runMethod:Object +FLAG_RTP_MARKER:int s yncTime:Time +commit:void +commitProtocolPrefixList:void +FLAG_RTP_TIME:int rate:float +NotPrefetchedError +ClockStartedError +NotRealizedError +StopTim eSetError +NotConfiguredError offset:long -VERSION:String +IncompatibleSourceException +ResourceUnavailableException +UnsupportedPlugInException +BadHeaderException +NoDataSinkException +IncompatibleTimeBas eException +CannotRealizeException +NoPlayerException +ClockStoppedException +NoDataSourceException +cachingControl:void +commitContentPrefixList:void +FLAG_BUF_OVERFLOWN:int +ClockStartedError +MAX_SECURITY:int +IncompatibleSourceException +UnsupportedPlugInException +BadHeaderException +NoDataSinkException +IncompatibleTimeBas eException +CannotRealizeException +NoPlayerException +ClockStoppedException +NoDataSourceException +controllerError:void getDeclaredMethod:Method +FLAG_BUF_UNDERFLOWN:int +CACHING:int +dataLos tError:void +FLAG_LIVE_DATA:int +LIGHTWEIGHT_RENDERER:int +dataStarved:void protocolPrefixList:Vector +TIME_UNKNOWN:long time:Time +PLUGIN_PLAYER:int +internalError:void contentPrefixList:Vector +SEQUENCE_UNKNOWN:long nanoseconds :long -num berOfHints:int +resourceUnavailable:void -sysTimeBase:Sys temTimeBase +durationUpdate:void +copy:void +UNKNOWN_CONTENT_NAME:String NoProcessorException +mediaTimeSet:void +copy:void interface interface interface interface interface java.io.Serializable interface ControllerEvent GainChangeEvent -jdkInit:boolean +rateChange:void +clone:Object Controls MediaHandler GainControl Controller CachingControl Time Track -forNam e3Args M:Method +stopTim eChange:void eventSrc:Controller eventSrc:GainControl +trans ition:void -getSys temClass LoaderM:Method +NoProces s orException format:Format +LATENCY_UNKNOWN:Time +LENGTH_UNKNOWN:long +ONE_SECOND:long +TIME_UNKNOWN:Time newMute:boolean +prefetchCom plete:void -systemClass Loader:Class Loader +NoProces s orException interface flags:int +Unrealized:int +TIME_UNKNOWN:Time +FRAME_UNKNOWN:int +ControllerEvent newDB:float +realizeComplete:void +getControl:Object +setDB:float -getContextClass LoaderM:Method DownloadProgressListener EOM:boolean +Realizing:int -NANO_TO_SEC:double +toString:String newLevel:float +start:void +setLevel:float -fileSeparator:String dis card:boolean +Realized:int +readFram e:void +stop:void controls:Object[] s ource:DataSource +addGainChangeListener:void -hintTable:Hashtable data:Object +Prefetching:int downloading:boolean +Time +mapTimeToFrame:int +GainChangeEvent +deallocate:void +removeGainChangeListener:void s ourceController:Controller DONE:int header:Object +Prefetched:int contentLength:long +Time +mapFram eToTime:Time s ource:Object SUCCESS:int +endOfMedia:void +downloadUpdate:void length:int +Started:int contentProgress :long #secondsToNanos econds:long source:Object +restarting:void offset:int mute:boolean progres sBarComponent:Component +stopAtTim e:void format:Format sourceGainControl:GainControl -Manager DB:float +stopByRequest:void tim eStam p:long +realize:void controlComponent:Component nanoseconds:long enabled:boolean DB:float +getVersion:String level:float +audioDeviceUnavailable:void duration:long +prefetch:void s econds:double startTim e:Time level:float +createPlayer:Player +configureComplete:void interface interface sequenceNumber:long +deallocate:void trackLis tener:TrackListener mute:boolean +createPlayer:Player +controllerClosed:void Prefetchable Drainable +close:void +createPlayer:Player +sizeChange:void +getControl:Control +createRealizedPlayer:Player +connectionError:void +addControllerListener:void +createRealizedPlayer:Player +formatChange:void +removeControllerListener:void +createRealizedPlayer:Player +drain:void +replaceURL:void +createProces sor:Process or +showDocument:void PlugInManager java.lang.Cloneable s tate:int +createProces sor:Process or prefetched:boolean +controllerUpdate:void java.io.Serializable targetState:int +createProces sor:Process or -pim:PlugInManager Format s tartLatency:Time +createRealizedProcessor:Process or +DEMULTIPLEXER:int controls:Control[] +createDataSource:DataSource +CODEC:int +NOT_SPECIFIED:int +createDataSource:DataSource interface bean +EFFECT:int +TRUE:int +createMergingDataSource:DataSource TrackListener playerbean +RENDERER:int +FALSE:int -reflectMDS:DataSource MCA +MULTIPLEXER:int +intArray:Clas s -reflectDS:DataSource -mGetPlugInList:Method +shortArray:Class +createCloneableDataSource:DataSource -mSetPlugInList:Method +byteArray:Class sync:boolean[] +readHasBlocked:void interface interface interface interface interface CachingControlEvent MediaTimeSetEvent StopTimeChangeEvent DurationUpdateEvent RateChangeEvent ControllerClosedEvent AudioDeviceUnavailableEvent TransitionEvent +getSystemTimeBase:Tim eBase -mCommit:Method 0..* +formatArray:Class state:int PlugIn DataSink M ediaProxy Player ExtendedCachingControl createPlayerForContent:Player -mAddPlugIn:Method #clz:Clas s createPlayerForSource:Player -mRemovePlugIn:Method -encodingCode:long control:CachingControl +MCA +BUFFER_PROCESSED_OK:int progres s:long createProcess orForContent:Proces sor -mGetSupportedInputFormats:Method +MediaTimeSetEvent +StopTimeChangeEvent +DurationUpdateEvent +RateChangeEvent +ControllerClos edEvent +AudioDeviceUnavailableEvent +TransitionEvent createProcess orForSource:Processor -succeed:void +BUFFER_PROCESSED_FAILED:int interface interface -mGetSupportedOutputFormats:Method +Format +start:void +start:void +pauseDownload:void +toString:String +toString:String +toString:String +toString:String +ControllerClos edEvent +toString:String +createDataSink:DataSink -fail:void +INPUT_BUFFER_NOT_CONSUMED:int +CachingControlEvent GainChangeListener Owned -emptyFormat:Format [] +Format +stop:void +addController:void