Article extrait de ma chaîne zen .

introduction
Cet article est le début d'une série d'articles sur le traitement des médias en temps réel à l'aide du moteur Mediastreamer2. Au cours de la présentation, des compétences de travail minimales dans le terminal Linux et la programmation C seront utilisées.
Mediastreamer2 est le moteur VoIP qui sous-tend le populaire projet open-source du téléphone VoIP du logiciel Linphone . Dans Linphone Mediastreamer2 implémente toutes les fonctions associées à l'audio et à la vidéo. Une liste détaillée des fonctionnalités du moteur peut être consultée sur cette page de Mediastreamer. Le code source est ici: GitLab .
Plus loin dans le texte, pour plus de commodité, au lieu du mot Mediastreamer2, nous utiliserons sa notation russe: "media streamer".
, , Glib, , GStreamer. . Linphone 2001 , 20 .
"Data flow" ( ). .

, () , . .
, RTP- VoIP-.
, , , . , VoIP, .
, . , . :
- Alsa (Linux): MS_ALSA_WRITE, MS_ALSA_READ
- Android native sound (libmedia): MS_ANDROID_SOUND_WRITE, MS_ANDROID_SOUND_READ
- Audio Queue Service (Mac OS X): MS_AQ_WRITE, MS_AQ_READ
- Audio Unit Service (Mac OS X)
- Arts (Linux): MS_ARTS_WRITE, MS_ARTS_READ
- DirectSound (Windows): MS_WINSNDDS_WRITE, MS_WINSNDDS_READ
- (raw/wav/pcap ) (Linux): MS_FILE_PLAYER
- (raw/wav ) (Windows): MS_WINSND_READ
- (wav ) (Linux): MS_FILE_REC
- (wav ) (Windows): MS_WINSND_WRITE
- Mac Audio Unit (Mac OS X)
- MME (Windows)
- OSS (Linux): MS_OSS_WRITE, MS_OSS_READ
- PortAudio (Mac OS X)
- PulseAudio (Linux): MS_PULSE_WRITE, MS_PULSE_READ
- Windows Sound (Windows)
/
- G.711 a-: MS_ALAW_DEC, MS_ALAW_ENC
- G.711 µ-: MS_ULAW_DEC, MS_ULAW_ENC
- G.722: MS_G722_DEC, MS_G722_ENC
- G.726: MS_G726_32_ENC, MS_G726_24_ENC, MS_G726_16_ENC
- GSM: MS_GSM_DEC, MS_GSM_ENC
- : MS_L16_ENC, MS_L16_DEC
- Speex: MS_SPEEX_ENC, MS_SPEEX_DEC
- (->, ->): MS_CHANNEL_ADAPTER
- : MS_CONF
- DTMF: MS_DTMF_GEN
- (speex): MS_SPEEX_EC
- : MS_EQUALIZER
- : MS_MIXER
- (PLC): MS_GENERIC_PLC
- : MS_RESAMPLE
- : MS_TONE_DETECTOR
- : MS_VOLUME
- Android
- Android
- AV Foundation (iOS)
- AV Foundation (iOS)
- DirectShow (Windows)
- DrawDib (Windows)
- External —
- GLX (Linux): MS_GLXVIDEO
- Mire — Synthetic moving picture: MS_MIRE
- OpenGL (Mac OS X)
- OpenGL ES2 (Android)
- Quicktime (Mac OS X)
- SDL : MS_SDL_OUT
- : MS_STATIC_IMAGE
- Video For Linux (V4L) (Linux): MS_V4L
- Video For Linux 2 (V4L2) (Linux): MS_V4L2_CAPTURE
- Video4windows (DirectShow) (Windows)
- Video4windows (DirectShow) (Windows CE)
- Video For Windows (vfw) (Windows)
- XV (Linux)
/
- H.263, H.263-1998, MP4V-ES, JPEG, MJPEG, Snow: MS_MJPEG_DEC, MS_H263_ENC, MS_H263_DEC
- H.264 ( ): MS_H264_DEC
- Theora: MS_THEORA_ENC, MS_THEORA_DEC
- VP8: MS_VP8_ENC, MS_VP8_DEC
- JPEG snapshot
- Pixel format converter: MS_PIX_CONV
- : MS_ITC_SOURCE, MS_ITC_SINK
- : MS_JOIN
- RTP /: MS_RTP_SEND, MS_RTP_RECV
- : MS_TEE
- : MS_VOID_SINK
- : MS_VOID_SOURCE
AMR-NB /
G.729 /
iLBC /
SILK /
H.264
H.264 V4L2 /
, . .
Linux Ubuntu
.
Mediastremer2 Ubuntu . "$" shell . .. , .
, , .
:
$ sudo apt-get update
, . :
$ sudo apt-get install libmediastreamer-dev
.
deb- 35 . :
$ dpkg -s libmediastreamer-dev
:
Package: libmediastreamer-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 244
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Source: linphone
Version: 3.6.1-2.5
Depends: libmediastreamer-base3 (= 3.6.1-2.5), libortp-dev
Description: Linphone web phone's media library - development files
Linphone is an audio and video internet phone using the SIP protocol. It
has a GTK+ and console interface, includes a large variety of audio and video
codecs, and provides IM features.
.
This package contains the development libraries for handling media operations.
Original-Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
Homepage: http://www.linphone.org/
:
$ sudo apt-get install gcc
, :
$ gcc --version
:
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
home , mstutorial:
$ mkdir ~/mstutorial
- mstest.c :
#include "stdio.h"
#include <mediastreamer2/mscommon.h>
int main()
{
ms_init();
printf ("Mediastreamer is ready.\n");
}
, .
:
$ gcc mstest.c -o mstest `pkg-config mediastreamer --libs --cflags`
,
`pkg-config mediastreamer --libs --cflags`
, "".
, mstest. :
$ ./mstest
:
ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters 0
ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL default:0
ortp-warning-Could not attach mixer to card: Invalid argument
ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters 0
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default:0
ALSA lib conf.c:4738:(snd_config_expand) Unknown parameters 0
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default:0
ortp-warning-Strange, sound card HDA Intel PCH does not seems to be capable of anything, retrying with plughw...
Mediastreamer is ready.
, ALSA, . , . .
. , , , .
Dans le prochain article, nous allons créer une application qui collecte et commence à traiter un signal audio dans une chaîne de plusieurs filtres.