mediastreamer2 2.12.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Data Structures | Typedefs | Functions
Audio conferencing API - Easily create conferences.
Mediastreamer2's high level APIs

Audio conferencing API - Easily create conferences. More...

## Data Structures
struct | _MSAudioConferenceParams

## Typedefs
typedef struct _MSAudioConferenceParams | MSAudioConferenceParams
typedef struct _MSAudioConference | MSAudioConference
typedef struct _MSAudioEndpoint | MSAudioEndpoint

## Functions
MSAudioConference * | ms_audio_conference_new (const MSAudioConferenceParams *params)
const MSAudioConferenceParams * | ms_audio_conference_get_params (MSAudioConference *obj)
void | ms_audio_conference_add_member (MSAudioConference *obj, MSAudioEndpoint *ep)
void | ms_audio_conference_remove_member (MSAudioConference *obj, MSAudioEndpoint *ep)
void | ms_audio_conference_mute_member (MSAudioConference *obj, MSAudioEndpoint *ep, bool_t muted)
int | ms_audio_conference_get_size (MSAudioConference *obj)
void | ms_audio_conference_destroy (MSAudioConference *obj)
MSAudioEndpoint * | ms_audio_endpoint_get_from_stream (AudioStream *st, bool_t is_remote)
void | ms_audio_endpoint_release_from_stream (MSAudioEndpoint *obj)
MSAudioEndpoint * | ms_audio_endpoint_new_recorder (void)
int | ms_audio_recorder_endpoint_start (MSAudioEndpoint *ep, const char *path)
int | ms_audio_recorder_endpoint_stop (MSAudioEndpoint *ep)
void | ms_audio_endpoint_destroy (MSAudioEndpoint *ep)

## Detailed Description

Audio conferencing API - Easily create conferences.

## Typedef Documentation

typedef struct _MSAudioConferenceParams MSAudioConferenceParams

Typedef to structure that holds conference parameters

typedef struct _MSAudioConference MSAudioConference

The MSAudioConference is the object representing an audio conference.

First, the conference has to be created with ms_audio_conference_new(), with parameters supplied. Then, participants to the conference can be added with ms_audio_conference_add_member(). The MSAudioConference takes in charge the mixing and dispatching of the audio to the participants. If participants (MSAudioEndpoint) are using sampling rate different from the conference, then sample rate converters are automatically added and configured. Participants can be removed from the conference with ms_audio_conference_remove_member(). The conference processing is performed in a new thread run by a MSTicker object, which is owned by the conference. When all participants are removed, the MSAudioConference object can then be safely destroyed with ms_audio_conference_destroy().

typedef struct _MSAudioEndpoint MSAudioEndpoint

The MSAudioEndpoint represents a participant in the conference. It can be constructed from an existing AudioStream object with ms_audio_endpoint_get_from_stream().

## Function Documentation

MSAudioConference* ms_audio_conference_new | ( | const MSAudioConferenceParams * | params | ) |

Creates a conference.

Parameters

  params | a MSAudioConferenceParams structure, containing conference parameters.

Returns
  a MSAudioConference object.

const MSAudioConferenceParams* ms_audio_conference_get_params | ( | MSAudioConference * | obj | ) |

Gets conference's current parameters.

Parameters

  obj | the conference.

Returns
  a read-only pointer to the conference parameters.

void ms_audio_conference_add_member | ( | MSAudioConference * | obj,
|  | MSAudioEndpoint * | ep
| ) |  |

Adds a participant to the conference.

Parameters

  obj | the conference
  ep | the participant, represented as a MSAudioEndpoint object

void ms_audio_conference_remove_member | ( | MSAudioConference * | obj,
|  | MSAudioEndpoint * | ep
| ) |  |

Removes a participant from the conference.

Parameters

  obj | the conference
  ep | the participant, represented as a MSAudioEndpoint object

void ms_audio_conference_mute_member | ( | MSAudioConference * | obj,
|  | MSAudioEndpoint * | ep,
|  | bool_t | muted
| ) |  |

Mutes or unmutes a participant.

Parameters

  obj | the conference
  ep | the participant, represented as a MSAudioEndpoint object
  muted | true to mute the participant, false to unmute.

By default all participants are unmuted.

int ms_audio_conference_get_size | ( | MSAudioConference * | obj | ) |

Returns the size (ie the number of participants) of a conference.

Parameters

  obj | the conference

void ms_audio_conference_destroy | ( | MSAudioConference * | obj | ) |

Destroys a conference.

Parameters

  obj | the conference All participants must have been removed before destroying the conference.

MSAudioEndpoint* ms_audio_endpoint_get_from_stream | ( | AudioStream * | st,
|  | bool_t | is_remote
| ) |  |

Creates an MSAudioEndpoint from an existing AudioStream.

In order to create graphs for audio processing of each participant, the AudioStream object is used, because this object already handles all the processing for volume control, encoding, decoding, etc...

The construction of the participants depends whether it is a remote participant, that is somebody in the network sending and receiving audio through RTP, or a local participant, that is somebody using the local soundcard to capture and play audio.

To create a remote participant, first create and start an AudioStream for the participant with audio_stream_new() and audio_stream_start_with_files(), given NULL arguments as input and output files. This participant does not interact with soundcards, this is why we suggest to use audio_stream_start_full() to avoid holding any reference to the sound system. Then, create a MSAudioEndpoint representing this participant by calling ms_audio_endpoint_get_from_stream() with is_remote=TRUE.

To create a local participant, first create and start an AudioStream with audio_stream_new() and audio_stream_start_full(), with real soundcard arguments. Arguments controlling RTP should be filled with placeholders value and will not be used for conferencing. Then, create a MSAudioEndpoint representing this local participant by calling ms_audio_endpoint_get_from_stream() with the audiostream and is_remote=FALSE.
For example:

    AudioStream *st=audio_stream_new(65000,65001,FALSE);
    audio_stream_start_full(st, conf->local_dummy_profile,
                            "127.0.0.1",
                            65000,
                            "127.0.0.1",
                            65001,
                            0,
                            40,
                            NULL,
                            NULL,
                            playcard,
                            captcard,
                            needs_echocancellation,
                            );
    MSAudioEndpoint *local_endpoint=ms_audio_endpoint_get_from_stream(st,FALSE);

void ms_audio_endpoint_release_from_stream | ( | MSAudioEndpoint * | obj | ) |

Destroys a MSAudioEndpoint that was created from an AudioStream with ms_audio_endpoint_get_from_stream(). The AudioStream can then be destroyed if needed.

MSAudioEndpoint* ms_audio_endpoint_new_recorder | ( | void |  | ) |

Creates an audio endpoint (or virtual participant) to record the conference into a wav file.

int ms_audio_recorder_endpoint_start | ( | MSAudioEndpoint * | ep,
|  | const char * | path
| ) |  |

Start audio recording. The endpoint must have been created by ms_audio_endpoint_new_recorder().

Parameters

  ep | the endpoint
  path | path for the wav file where to record samples.

Returns
  0 if successful, -1 if the path is invalid.

int ms_audio_recorder_endpoint_stop | ( | MSAudioEndpoint * | ep | ) |

Stop audio recording. The endpoint must have been created by ms_audio_endpoint_new_recorder().

Parameters

  ep | the endpoint

Returns
  0 if successful, -1 if the record wasn't started.

void ms_audio_endpoint_destroy | ( | MSAudioEndpoint * | ep | ) |

Destroy an audio endpoint.

Note
  Endpoints created by ms_audio_endpoint_get_from_stream() must be released by ms_audio_endpoint_release_from_stream().