原文:http://www.linphone.org/eng/documentation/dev/mediastreamer2.html
Mediastreamer2 是一個功能強大且小巧的流引擎,專門為音視頻電話應用而開發。
這個庫為linphone中所有的接收、發送多媒體流提供處理,包括音/視頻捕獲,編碼和解碼,渲染。
特色
- Read/Write from to an alsa device, an oss device, a windows waveapi device
- Send and receive RTP packets
- Encode and decode the following formats: speex, G711, GSM, iLBC, AMR , H263, theora, MPEG4, and H264.
- Read and write from/to a wav file
- Read YUV pictures from a webcam (provided that it has video4linux v1 or v2 driver)
- Display YUV pictures (using SDL library or native apis on windows)
- Dual tones generation
- Echo cancelation, using the extraordinary echo canceler algorithm from the speex library
- Audio conferencing
- Audio parametric equalizer using a FIR filter
- Volume control, automatic gain control
Mediastreamer2可以使用動態外掛程式進行擴充,當前可用的外掛程式有H264,ILBCt和AMR
可移植性
- Linux/x86 Linux/x86_64
- Embedded Linux: ARM and Blackfin
- Windows XP, Vista and 7
- Mac OS X
- Google Android
設計理念
每一個處理實體都被封裝在MSFilter對像中。MSFilter使用inputs 和 outputs與其它MSFilter進行串連。
一個協助理解的小樣本:
- MSRtpRecv 是一個從網路接收RTP包的MSFilter,解包後將資料發送到output上
- MSSpeexDec的處理依賴於它的輸入,如果輸入的是speex編碼的包,就進行解碼並將結果發送到output上
- MSFileRec的處理也依賴於它的輸入,如果輸入的是16位的pcm資料則儲存為wav檔案.
MSFilters 可以串連在一起組成filter chain。如果我們把上面3個filter串連在一起,我們就可以得到一個處理鏈,接收RTP包,解碼並把結果寫入到wav檔案中。
ApsaraVideo for Media Processing任務通過“MSTicker”對像進行調度,線程每10ms處理一次MSFilter chains中的資料。可以同時存在幾個MSTicker對像,例如一個處理音頻filters,一個處理視頻filters.
使用簡單
如果你的目的是建立音視頻流,可以使用audiostream.h和videostream.h中定義的簡單的建立音視頻流的API
如果你的目的是添加新的功能,你將高興的發現,實現mediastreamer2 filter是非常容易的,mediastreamer2 filter是非常輕量級的封裝。
文檔
Mediastreamer2的doxygen文檔,http://download-mirror.savannah.gnu.org/releases/linphone/mediastreamer/doc/modules.html
適合嵌入式系統
- Mediastreamer2是輕量級的。例如,在linux/x86平台上,使用共用庫的時全功能大約只有800k。
- 純c開發
- 只需要oRTP、libc作為最小依賴庫,其它(ffmpeg,speex,alsa...)根據需要添加
- 提供外掛程式機制 ,mediastreamer2很容易擴充,如轉碼器
下載
Mediastreamer2 是
linphone 的一部分你也可能使用git擷取最新的源碼:
git clone git://git.linphone.org/mediastreamer2.git
採用GPL許可協議