mediastreamer2
2.12.1
|
Audio streaming API - Easily run audio streams from soundcard or wav files to RTP. More...
Data Structures | |
struct | _MSMediaResource |
struct | _MSMediaStreamIO |
Typedefs | |
typedef struct _MSMediaResource | MSMediaResource |
typedef struct _MSMediaStreamIO | MSMediaStreamIO |
typedef struct _AudioStream | AudioStream |
Functions | |
bool_t | media_stream_secured (const MediaStream *stream) |
bool_t | media_stream_avpf_enabled (const MediaStream *stream) |
uint16_t | media_stream_get_avpf_rr_interval (const MediaStream *stream) |
RtpSession * | media_stream_get_rtp_session (const MediaStream *stream) |
int | media_stream_set_target_network_bitrate (MediaStream *stream, int target_bitrate) |
int | media_stream_get_target_network_bitrate (const MediaStream *stream) |
float | media_stream_get_up_bw (const MediaStream *stream) |
float | media_stream_get_down_bw (const MediaStream *stream) |
float | media_stream_get_rtcp_up_bw (const MediaStream *stream) |
float | media_stream_get_rtcp_down_bw (const MediaStream *stream) |
void | media_stream_reclaim_sessions (MediaStream *stream, MSMediaStreamSessions *sessions) |
bool_t | media_stream_alive (MediaStream *stream, int timeout_seconds) |
MSStreamState | media_stream_get_state (const MediaStream *stream) |
int | audio_stream_start_from_io (AudioStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const MSMediaStreamIO *io) |
int | audio_stream_start_full (AudioStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload, int jitt_comp, const char *infile, const char *outfile, MSSndCard *playcard, MSSndCard *captcard, bool_t use_ec) |
AudioStream * | audio_stream_new (int loc_rtp_port, int loc_rtcp_port, bool_t ipv6) |
AudioStream * | audio_stream_new2 (const char *ip, int loc_rtp_port, int loc_rtcp_port) |
AudioStream * | audio_stream_new_with_sessions (const MSMediaStreamSessions *sessions) |
int | audio_stream_start_now (AudioStream *stream, RtpProfile *prof, const char *remip, int remport, int rem_rtcp_port, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echo_cancel) |
void | audio_stream_iterate (AudioStream *stream) |
void | audio_stream_enable_echo_limiter (AudioStream *stream, EchoLimiterType type) |
void | audio_stream_enable_gain_control (AudioStream *stream, bool_t val) |
void | audio_stream_enable_automatic_gain_control (AudioStream *stream, bool_t val) |
void | audio_stream_set_echo_canceller_params (AudioStream *st, int tail_len_ms, int delay_ms, int framesize) |
void | audio_stream_enable_echo_canceller (AudioStream *st, bool_t enabled) |
void | audio_stream_set_mic_gain_db (AudioStream *stream, float gain_db) |
void | audio_stream_set_mic_gain (AudioStream *stream, float gain) |
void | audio_stream_mute_rtp (AudioStream *stream, bool_t val) |
void | audio_stream_set_sound_card_input_gain (AudioStream *stream, float gain) |
float | audio_stream_get_sound_card_input_gain (const AudioStream *stream) |
void | audio_stream_set_sound_card_output_gain (AudioStream *stream, float volume) |
float | audio_stream_get_sound_card_output_gain (const AudioStream *stream) |
void | audio_stream_enable_noise_gate (AudioStream *stream, bool_t val) |
void | audio_stream_enable_equalizer (AudioStream *stream, bool_t enabled) |
void | audio_stream_stop (AudioStream *stream) |
int | audio_stream_send_dtmf (AudioStream *stream, char dtmf) |
MSFilter * | audio_stream_open_remote_play (AudioStream *stream, const char *filename) |
bool_t | audio_stream_zrtp_enabled (const AudioStream *stream) |
Audio streaming API - Easily run audio streams from soundcard or wav files to RTP.
typedef struct _MSMediaResource MSMediaResource |
Structure describing the input or the output of a MediaStream. type must be set to one the member of the MSResourceType enum, and the correspoding resource argument must be set: the file name (const char*) for MSResourceFile, the RtpSession for MSResourceRtp, an MSWebCam for MSResourceCamera, an MSSndCard for MSResourceSoundcard.
typedef struct _MSMediaStreamIO MSMediaStreamIO |
Structure describing the input/output of a MediaStream. Input and output are described as MSMediaResource.
typedef struct _AudioStream AudioStream |
The AudioStream holds all resources to create and run typical VoIP audiostream.
bool_t media_stream_secured | ( | const MediaStream * | stream | ) |
[in] | stream | MediaStream object |
bool_t media_stream_avpf_enabled | ( | const MediaStream * | stream | ) |
Tells whether AVPF is enabled or not.
[in] | stream | #MediaStream object. |
uint16_t media_stream_get_avpf_rr_interval | ( | const MediaStream * | stream | ) |
Gets the AVPF Regular RTCP report interval.
[in] | stream | #MediaStream object. |
RtpSession* media_stream_get_rtp_session | ( | const MediaStream * | stream | ) |
Gets the RTP session of the media stream.
[in] | stream | #MediaStream object. |
int media_stream_set_target_network_bitrate | ( | MediaStream * | stream, |
int | target_bitrate | ||
) |
For multirate codecs like OPUS, encoder output target bitrate must be set.
Encoder will compute output codec bitrate from this value.
default value is the value corresponding the rtp PayloadType
stream | stream to apply parameter on |
target_bitrate | in bit per seconds |
int media_stream_get_target_network_bitrate | ( | const MediaStream * | stream | ) |
get the stream target bitrate.
stream | stream to apply parameter on |
float media_stream_get_up_bw | ( | const MediaStream * | stream | ) |
get current stream upload bitrate. Value is updated every seconds
stream |
float media_stream_get_down_bw | ( | const MediaStream * | stream | ) |
get current stream download bitrate. Value is updated every seconds
stream |
float media_stream_get_rtcp_up_bw | ( | const MediaStream * | stream | ) |
get current stream rtcp upload bitrate. Value is updated every seconds
stream |
float media_stream_get_rtcp_down_bw | ( | const MediaStream * | stream | ) |
get current stream rtcp download bitrate. Value is updated every seconds
stream |
void media_stream_reclaim_sessions | ( | MediaStream * | stream, |
MSMediaStreamSessions * | sessions | ||
) |
Returns the sessions that were used in the media stream (RTP, SRTP, ZRTP...) so that they can be re-used. As a result of calling this function, the media stream no longer owns the sessions and thus will not free them.
bool_t media_stream_alive | ( | MediaStream * | stream, |
int | timeout_seconds | ||
) |
Returns TRUE if stream was still actively receiving packets (RTP or RTCP) in the last period specified in timeout_seconds.
MSStreamState media_stream_get_state | ( | const MediaStream * | stream | ) |
int audio_stream_start_from_io | ( | AudioStream * | stream, |
RtpProfile * | profile, | ||
const char * | rem_rtp_ip, | ||
int | rem_rtp_port, | ||
const char * | rem_rtcp_ip, | ||
int | rem_rtcp_port, | ||
int | payload_type, | ||
const MSMediaStreamIO * | io | ||
) |
Start an audio stream according to the specified AudioStreamIO.
[in] | stream | AudioStream object previously created with audio_stream_new(). |
[in] | profile | RtpProfile object holding the PayloadType that can be used during the audio session. |
[in] | rem_rtp_ip | The remote IP address where to send the encoded audio to. |
[in] | rem_rtp_port | The remote port where to send the encoded audio to. |
[in] | rem_rtcp_ip | The remote IP address for RTCP. |
[in] | rem_rtcp_port | The remote port for RTCP. |
[in] | payload_type | The payload type number used to send the audio stream. A valid PayloadType must be available at this index in the profile. |
[in] | io | A MSMediaStreamIO describing the local input/output of the audio stream. |
<This sound card has built-in echo cancellation
int audio_stream_start_full | ( | AudioStream * | stream, |
RtpProfile * | profile, | ||
const char * | rem_rtp_ip, | ||
int | rem_rtp_port, | ||
const char * | rem_rtcp_ip, | ||
int | rem_rtcp_port, | ||
int | payload, | ||
int | jitt_comp, | ||
const char * | infile, | ||
const char * | outfile, | ||
MSSndCard * | playcard, | ||
MSSndCard * | captcard, | ||
bool_t | use_ec | ||
) |
Starts an audio stream from/to local wav files or soundcards.
This method starts the processing of the audio stream, that is playing from wav file or soundcard, voice processing, encoding, sending through RTP, receiving from RTP, decoding, voice processing and wav file recording or soundcard playback.
stream | an AudioStream previously created with audio_stream_new(). |
profile | a RtpProfile containing all PayloadType possible during the audio session. |
rem_rtp_ip | remote IP address where to send the encoded audio. |
rem_rtp_port | remote IP port where to send the encoded audio. |
rem_rtcp_ip | remote IP address for RTCP. |
rem_rtcp_port | remote port for RTCP. |
payload | payload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile. |
jitt_comp | Nominal jitter buffer size in milliseconds. |
infile | path to wav file to play out (can be NULL) |
outfile | path to wav file to record into (can be NULL) |
playcard | The soundcard to be used for playback (can be NULL) |
captcard | The soundcard to be used for catpure. (can be NULL) |
use_ec | whether echo cancellation is to be performed. |
AudioStream* audio_stream_new | ( | int | loc_rtp_port, |
int | loc_rtcp_port, | ||
bool_t | ipv6 | ||
) |
Creates an AudioStream object listening on a RTP port.
loc_rtp_port | the local UDP port to listen for RTP packets. |
loc_rtcp_port | the local UDP port to listen for RTCP packets |
ipv6 | TRUE if ipv6 must be used. |
AudioStream* audio_stream_new2 | ( | const char * | ip, |
int | loc_rtp_port, | ||
int | loc_rtcp_port | ||
) |
Creates an AudioStream object listening on a RTP port for a dedicated address.
loc_ip | the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses |
loc_rtp_port | the local UDP port to listen for RTP packets. |
loc_rtcp_port | the local UDP port to listen for RTCP packets |
AudioStream* audio_stream_new_with_sessions | ( | const MSMediaStreamSessions * | sessions | ) |
Creates an AudioStream object from initialized MSMediaStreamSessions.
sessions | the MSMediaStreamSessions |
int audio_stream_start_now | ( | AudioStream * | stream, |
RtpProfile * | prof, | ||
const char * | remip, | ||
int | remport, | ||
int | rem_rtcp_port, | ||
int | payload_type, | ||
int | jitt_comp, | ||
MSSndCard * | playcard, | ||
MSSndCard * | captcard, | ||
bool_t | echo_cancel | ||
) |
Starts an audio stream from local soundcards.
This method starts the processing of the audio stream, that is capture from soundcard, voice processing, encoding, sending through RTP, receiving from RTP, decoding, voice processing and soundcard playback.
stream | an AudioStream previously created with audio_stream_new(). |
prof | a RtpProfile containing all PayloadType possible during the audio session. |
remip | remote IP address where to send the encoded audio. |
remport | remote IP port where to send the encoded audio |
rem_rtcp_port | remote port for RTCP. |
payload_type | payload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile. |
jitt_comp | Nominal jitter buffer size in milliseconds. |
playcard | The soundcard to be used for playback |
captcard | The soundcard to be used for catpure. |
echo_cancel | whether echo cancellation is to be performed. |
void audio_stream_iterate | ( | AudioStream * | stream | ) |
Executes background low priority tasks related to audio processing (RTP statistics analysis). It should be called periodically, for example with an interval of 100 ms or so.
void audio_stream_enable_echo_limiter | ( | AudioStream * | stream, |
EchoLimiterType | type | ||
) |
enable echo-limiter dispositve: one MSVolume in input branch controls a MSVolume in the output branch
void audio_stream_enable_gain_control | ( | AudioStream * | stream, |
bool_t | val | ||
) |
enable gain control, to be done before start()
void audio_stream_enable_automatic_gain_control | ( | AudioStream * | stream, |
bool_t | val | ||
) |
enable automatic gain control, to be done before start()
void audio_stream_set_echo_canceller_params | ( | AudioStream * | st, |
int | tail_len_ms, | ||
int | delay_ms, | ||
int | framesize | ||
) |
to be done before start
void audio_stream_enable_echo_canceller | ( | AudioStream * | st, |
bool_t | enabled | ||
) |
to be done before start
void audio_stream_set_mic_gain_db | ( | AudioStream * | stream, |
float | gain_db | ||
) |
Apply a software gain on the microphone. Be note that this method neither changes the volume gain of the sound card nor the system mixer one. If you intends to control the volume gain at sound card level, you should use audio_stream_set_sound_card_input_gain() instead.
stream | The stream. |
gain | Gain to apply in dB. |
void audio_stream_set_mic_gain | ( | AudioStream * | stream, |
float | gain | ||
) |
Like audio_stream_set_mic_gain_db() excepted that the gain is specified in percentage.
stream | The stream. |
gain | Gain to apply in percetage of the max supported gain. |
void audio_stream_mute_rtp | ( | AudioStream * | stream, |
bool_t | val | ||
) |
enable/disable rtp stream
void audio_stream_set_sound_card_input_gain | ( | AudioStream * | stream, |
float | gain | ||
) |
Set microphone volume gain. If the sound backend supports it, the set volume gain will be synchronized with the host system mixer. If you intended to apply a static software gain, you should use audio_stream_set_mic_gain_db() or audio_stream_set_mic_gain().
stream | The audio stream. |
gain | Percentage of the max supported volume gain. Valid values are in [0.0 : 1.0]. |
float audio_stream_get_sound_card_input_gain | ( | const AudioStream * | stream | ) |
Get microphone volume gain.
stream | The audio stream. |
void audio_stream_set_sound_card_output_gain | ( | AudioStream * | stream, |
float | volume | ||
) |
Set speaker volume gain. If the sound backend supports it, the set volume gain will be synchronized with the host system mixer.
stream | The audio stream. |
gain | Percentage of the max supported volume gain. Valid values are in [0.0 : 1.0]. |
float audio_stream_get_sound_card_output_gain | ( | const AudioStream * | stream | ) |
Get speaker volume gain.
stream | The audio stream. |
void audio_stream_enable_noise_gate | ( | AudioStream * | stream, |
bool_t | val | ||
) |
enable noise gate, must be done before start()
void audio_stream_enable_equalizer | ( | AudioStream * | stream, |
bool_t | enabled | ||
) |
enable parametric equalizer in the stream that goes to the speaker
void audio_stream_stop | ( | AudioStream * | stream | ) |
stop the audio streaming thread and free everything
int audio_stream_send_dtmf | ( | AudioStream * | stream, |
char | dtmf | ||
) |
send a dtmf
MSFilter* audio_stream_open_remote_play | ( | AudioStream * | stream, |
const char * | filename | ||
) |
Open a player to play an audio/video file to remote end. The player is returned as a MSFilter so that application can make usual player controls on it using the MSPlayerInterface.
bool_t audio_stream_zrtp_enabled | ( | const AudioStream * | stream | ) |
return TRUE if zrtp is enabled, it does not mean that stream is encrypted, but only that zrtp is configured to know encryption status, uses #