JMF 學習筆記

來源:互聯網
上載者:User
 

JMF 簡述 JMF,Java Media Framework. JMF是Java中處理多媒體資源(audio,video,etc.)的一套API。 這個擴充包提供多媒體資源播放、傳輸、編碼解碼等功能。  JMF的架構結構:   JMF Architecture  Time ModelTime 對象表示一個時間點,精確道十億分之一妙(nanosecond)。Clock介面定義了基本的定時和同步操作,用來控制多媒體資料表現。TimeBase類似手錶的石英振蕩器。Clock的MediaTime記錄媒體資料當前的時間指標。  Clock介面Controller,Player,Processor實現了這個介面。每個Clock包含一個TimeBase,作為一個時間源,很想一個石英振蕩器。   ManagerBy using intermediary Objects called managers, JMF makes it easy to integrate new implements of key interface that can be used seamlessly with existing classes.JMF使用Manager作為媒介,整合關鍵介面的新實現和現有的JMF 類。 JMF有4個Manager:Manager,PackageManager,CaptureDeviceManager,PlugInManager. Manager,用來產生Player,Processor,DataSource,DataSink。這樣的Factory 方法有利於新實現的無縫整合到JMF中,使用統一的方式產生同樣介面的對象。 PackageManager,維護JMF類的登記。 CaptureDeviceManager,維護可用音訊輸入裝置的登記。 PlugInManager,維護JMF中可用的音頻處理組件的登記。例如,Multiplexer,Demultiplexer,Codec,Effect,Renderer  Event Mode無論什麼時候,JMF object 報告當前情形,都會傳遞出一個MediaEvent。不同特定的事件類型都是MeidaEvent的子類。Controller objects(such as Player,Processor)和某些Control對象(such as GainControl)發出MediaEvent。   Data ModeDataSource管理媒體資料的傳輸,它封裝了媒體的定位資訊、傳輸協議和傳輸軟體。一旦DataSource建立後,不能夠再用來傳輸其他媒體資料。 使用JMF MediaLocator 或者URL 標識DataSource。MediaLocator和URL相似,但是,即使對應的protocol handle沒裝到系統裡,MediaLocator還是能被建立的,而URL不行。 一個DataSource可以管理一組SourceStream對象。 標準的DataSource使用一個byte數組作為傳輸的單位。Buffer DataSource使用一個buffer對象作為傳輸單位。 JMF中有很多種DataSource。  DataSource按傳輸控制方式分為Pull,Push 2種。 JMF定義了2種特殊的DataSource:cloneable DataSource,merging DataSource。Cloneable DataSource通過Manager.createCloneableDataSource(DataSource source)建立。Cloneable DataSource和它的source,複製體使用時都是有關聯的。Merging DataSource通過Manager.createMergingDataSource(DataSource[])建立。用來合成多個DataSource中的SourceStream。它的Content-Type:application/mixed-media。  Data FormatsFormat描述媒體資料的格式。  ControlsJMF類通過實現Controls介面,提供Control objects,來修改和查詢它們的屬性。很多JMF類提供操作它們的Control,such as Controller,DataSource,DataSink,plug-ins。     UI Componets Control還能夠提供可視化組件來控制JMF對象。例如:Control.getControlComponent(),Player.getVisualComponent(),Player.getControlPaneComponent()  Extensibility可擴充性。參看:JMF GUIDE / Understanding JMF, jmf2_0-guide-html/JMFArchitecture.html  Presentation媒體表現。JMF Controller定義了媒體的表現機制和主要階段。Controller在狀態轉換時,發出MediaEvent 通知ControllerListener。 JMF API定義了2中Controller:Player,Processor。它們都建立自某個data source, 並且不能夠被其他媒體資源再次利用。    PlayerPlayer讀入媒體資料流,並渲染出來。一個DataSource要被用來傳輸輸入媒體流。渲染結果的輸出目標取決於媒體流的格式。 Player的6種狀態  Player的獲得使用Factory 方法Manager.createPlayer(),Manager.createRealizedPlayer()獲得對應媒體資源的Player。  Player的相關事件TransitionEvent, 進入Realizing或Prefetching狀態RealizeCompleteEvent, 退出Realizing狀態PrefetchCompleteEvent, 退出Prefetching 狀態。StartEvent, 進入Stated狀態。EndOfMediaEvent, 播放完畢StopByRequestEvent, 調用stop(),媒體停止播放DeallocateEvent, 調用deallocate()後,釋放資源完畢ControllerCloseEvent, 調用close()後  Processorextends Player     ControllerEventChange notification Events,such as RateChangeEvent, DurationUpdateEvent, FormatChangeEventTransitionEventsControllerCloseEvent,ControllerErrorEvent    JMF資源:l         JMF home page,http://www.javasoft.com/jmfl         JMF spec,http://java.sun.com/products/java-media/jmf/2.1.1/specdownload.htmll         JMF-supported file format, http://java.sun.com/products/java-media/jmf/2.1.1/formats.htmll         JMF 2.1.1 Solutions(Code Sample and Apps),http://java.sun.com/products/java-media/jmf/2.1.1/solutions/l         Sun Developer Forums/JMF 論壇專區,http://forum.java.sun.com/forum.jspa?forumID=28l         Exporing temporal media and JMF,http://lipas.uwasa.fi/~ksa/mm/mediatem.htm  VODVideo-On-Demand,ApsaraVideo for VOD  Pull protocol資料轉換器在用戶端初始化和控制, e.g., HTTP, FILE  Push protocol服務端初始化資料轉換器,控制資料流的傳輸, e.g., RTP, SGI MediaBase      

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.