mediastreamer2 5.2.0
Functions
Collaboration diagram for Sound Card Filter API:

Functions

struct _MSFilterms_snd_card_create_reader (MSSndCard *obj)
 
struct _MSFilterms_snd_card_create_writer (MSSndCard *obj)
 
MSSndCardms_snd_card_new (MSSndCardDesc *desc)
 
MSSndCardms_snd_card_new_with_name (MSSndCardDesc *desc, const char *name)
 
void ms_snd_card_destroy (MSSndCard *obj)
 
MSSndCardms_snd_card_dup (MSSndCard *card)
 
MSSndCardDeviceType ms_snd_card_get_device_type (const MSSndCard *obj)
 
const char * ms_snd_card_get_driver_type (const MSSndCard *obj)
 
const char * ms_snd_card_device_type_to_string (const MSSndCardDeviceType type)
 
const char * ms_snd_card_get_name (const MSSndCard *obj)
 
const char * ms_snd_card_get_string_id (const MSSndCard *obj)
 
int ms_snd_card_get_internal_id (MSSndCard *obj)
 
bool_t ms_snd_card_equals (const MSSndCard *c1, const MSSndCard *c2)
 
unsigned int ms_snd_card_get_capabilities (const MSSndCard *obj)
 
int ms_snd_card_get_minimal_latency (MSSndCard *obj)
 
void ms_snd_card_set_level (MSSndCard *obj, MSSndCardMixerElem e, int percent)
 
void ms_snd_card_set_internal_id (MSSndCard *obj, int id)
 
int ms_snd_card_get_level (MSSndCard *obj, MSSndCardMixerElem e)
 
void ms_snd_card_set_capture (MSSndCard *obj, MSSndCardCapture c)
 
int ms_snd_card_set_control (MSSndCard *obj, MSSndCardControlElem e, int val)
 
int ms_snd_card_get_control (MSSndCard *obj, MSSndCardControlElem e)
 
int ms_snd_card_get_preferred_sample_rate (const MSSndCard *obj)
 
int ms_snd_card_set_preferred_sample_rate (MSSndCard *obj, int rate)
 
void ms_snd_card_set_usage_hint (MSSndCard *obj, bool_t is_going_to_be_used)
 
void ms_snd_card_notify_audio_session_activated (MSSndCard *obj, bool_t activated)
 
void ms_snd_card_notify_audio_route_changed (MSSndCard *obj)
 
void ms_snd_card_app_notifies_activation (MSSndCard *obj, bool_t yesno)
 
void ms_snd_card_configure_audio_session (MSSndCard *obj)
 
void ms_snd_card_set_stream_type (MSSndCard *obj, MSSndCardStreamType type)
 
MSSndCardStreamType ms_snd_card_get_stream_type (MSSndCard *obj)
 
MSSndCardms_alsa_card_new_custom (const char *pcmdev, const char *mixdev)
 
void ms_alsa_card_set_forced_sample_rate (int samplerate)
 
MSSndCardms_snd_card_ref (MSSndCard *sndCard)
 
void ms_snd_card_unref (MSSndCard *sndCard)
 

Detailed Description

Function Documentation

◆ ms_alsa_card_new_custom()

MSSndCard * ms_alsa_card_new_custom ( const char *  pcmdev,
const char *  mixdev 
)

Create a alsa card with user supplied pcm name and mixer name.

Parameters
pcmdevThe pcm device name following alsa conventions (ex: plughw:0)
mixdevThe mixer device name following alsa conventions.

Returns: a MSSndCard object, NULL if alsa support is not available.

◆ ms_alsa_card_set_forced_sample_rate()

void ms_alsa_card_set_forced_sample_rate ( int  samplerate)

Use supplied sample rate to open alsa devices (forced rate). Has no interest except workarouding driver bugs. Use -1 to revert to normal behavior.

◆ ms_snd_card_app_notifies_activation()

void ms_snd_card_app_notifies_activation ( MSSndCard obj,
bool_t  yesno 
)

Used by application to tell the MSSndCard if rely on notifications of activation of audio session. When yesno is set to FALSE, the MSSndCard will not rely on notifications of activation of audio session, and will assume that audio is always usable. If set to TRUE, the mediastreamer2 will require explicit calls to ms_snd_card_notify_audio_session_activated().

Parameters
objA sound card object.
yesnoTRUE if app notifies is activated, FALSE otherwise. The default value is FALSE.

◆ ms_snd_card_configure_audio_session()

void ms_snd_card_configure_audio_session ( MSSndCard obj)

Used to configure audio session with default settings. Callkit usage.

Parameters
objA sound card object.

◆ ms_snd_card_create_reader()

struct _MSFilter * ms_snd_card_create_reader ( MSSndCard obj)

Create an INPUT filter based on the selected sound card.

Parameters
objA sound card object.

Returns: A MSFilter if successfull, NULL otherwise.

◆ ms_snd_card_create_writer()

struct _MSFilter * ms_snd_card_create_writer ( MSSndCard obj)

Create an OUPUT filter based on the selected sound card.

Parameters
objA sound card object.

Returns: A MSFilter if successfull, NULL otherwise.

◆ ms_snd_card_destroy()

void ms_snd_card_destroy ( MSSndCard obj)

Destroy sound card object.

Parameters
objA MSSndCard object.
Deprecated:
, use ms_snd_card_unref instead

◆ ms_snd_card_device_type_to_string()

const char * ms_snd_card_device_type_to_string ( const MSSndCardDeviceType  type)

Retreive a sound card's device type string.

Parameters
typeA sound card type.

Returns: a string if successfull, "bad type" otherwise.

Returns a string value of the given MSSndCardDeviceType enum

◆ ms_snd_card_dup()

MSSndCard * ms_snd_card_dup ( MSSndCard card)

Duplicate a sound card object.

This helps to open several time a sound card.

Parameters
cardA sound card object.

Returns: MSSndCard if successfull, NULL otherwise.

◆ ms_snd_card_equals()

bool_t ms_snd_card_equals ( const MSSndCard c1,
const MSSndCard c2 
)

Returns TRUE if both MSSndCard are equal, which means that they refer to the same audio device with same capabilities.

◆ ms_snd_card_get_capabilities()

unsigned int ms_snd_card_get_capabilities ( const MSSndCard obj)

Retreive sound card's capabilities.

  MS_SND_CARD_CAP_CAPTURE
  MS_SND_CARD_CAP_PLAYBACK
  MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK
  MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER
Parameters
objA sound card object.

Returns: A unsigned int if successfull, 0 otherwise.

◆ ms_snd_card_get_control()

int ms_snd_card_get_control ( MSSndCard obj,
MSSndCardControlElem  e 
)

Get some mixer control.

  MS_SND_CARD_MASTER_MUTE, -> return 0: unmute, 1: mute
  MS_SND_CARD_PLAYBACK_MUTE, -> return 0: unmute, 1: mute
  MS_SND_CARD_CAPTURE_MUTE -> return 0: unmute, 1: mute

Note: not implemented on all sound card filters.

Parameters
objA sound card object.
eA sound card mixer object.

Returns: A int if successfull, <0 otherwise.

◆ ms_snd_card_get_device_type()

MSSndCardDeviceType ms_snd_card_get_device_type ( const MSSndCard obj)

Retreive a sound card's device type.

Parameters
objA sound card object.

Returns: an MSSndCardDeviceType enum type. Default value is MSSndCardDeviceType::MS_SND_CARD_DEVICE_TYPE_UNKNOWN.

◆ ms_snd_card_get_driver_type()

const char * ms_snd_card_get_driver_type ( const MSSndCard obj)

Retreive a sound card's driver type string.

Internal driver types are either: "OSS, ALSA, WINSND, PASND, CA"

Parameters
objA sound card object.

Returns: a string if successfull, NULL otherwise.

◆ ms_snd_card_get_internal_id()

int ms_snd_card_get_internal_id ( MSSndCard obj)

Retrieve sound card's internal ID.

Parameters
objA sound card object.

Returns: An integer storing the internal ID value.

◆ ms_snd_card_get_level()

int ms_snd_card_get_level ( MSSndCard obj,
MSSndCardMixerElem  e 
)

Get some mixer level value.

  MS_SND_CARD_MASTER,
  MS_SND_CARD_PLAYBACK,
  MS_SND_CARD_CAPTURE

Note: not implemented on all sound card filters.

Parameters
objA sound card object.
eA sound card mixer object.

Returns: A int if successfull, <0 otherwise.

◆ ms_snd_card_get_minimal_latency()

int ms_snd_card_get_minimal_latency ( MSSndCard obj)

Returns the sound card minimal latency (playback+record), in milliseconds. This value is to be used by the software echo cancellers to know where to search for the echo (optimization). Typically, an echo shall not be found before the value returned by this function. If this value is not known, then it should return 0.

Parameters
objA sound card object.

◆ ms_snd_card_get_name()

const char * ms_snd_card_get_name ( const MSSndCard obj)

Retreive a sound card's name.

Parameters
objA sound card object.

Returns: a string if successfull, NULL otherwise.

◆ ms_snd_card_get_preferred_sample_rate()

int ms_snd_card_get_preferred_sample_rate ( const MSSndCard obj)

Get preferred sample rate

Parameters
objA sound card object.

Returns: return sample rate in khz

◆ ms_snd_card_get_stream_type()

MSSndCardStreamType ms_snd_card_get_stream_type ( MSSndCard obj)

Gets the stream type for this soundcard, default is VOICE

◆ ms_snd_card_get_string_id()

const char * ms_snd_card_get_string_id ( const MSSndCard obj)

Retreive sound card's name ($driver_type: $name).

Parameters
objA sound card object.

Returns: A string if successfull, NULL otherwise.

◆ ms_snd_card_new()

MSSndCard * ms_snd_card_new ( MSSndCardDesc desc)

Create a new sound card object.

Parameters
descA sound card description object.

Returns: MSSndCard if successfull, NULL otherwise.

◆ ms_snd_card_new_with_name()

MSSndCard * ms_snd_card_new_with_name ( MSSndCardDesc desc,
const char *  name 
)

Create a new sound card object.

Parameters
descA sound card description object.
nameThe card name

Returns: MSSndCard if successfull, NULL otherwise.

◆ ms_snd_card_notify_audio_route_changed()

void ms_snd_card_notify_audio_route_changed ( MSSndCard obj)

Used by application to notify whether audio route is changed. On most platform this function is useless. But an iOS application needs to explicitely notify mediastreamer2 with ms_snd_card_notify_audio_route_changed() about the changment of audio route to ajust the sample rate for playback/record.

Parameters
objA sound card object.

◆ ms_snd_card_notify_audio_session_activated()

void ms_snd_card_notify_audio_session_activated ( MSSndCard obj,
bool_t  activated 
)

Used by application to notify whether audio access is allowed for the process. On most platform this function is useless, but in an iOS application using Callkit, the system decides when audio (through the AVAudioSession singleton) is open or closed. Such application needs to explicitely notify mediastreamer2 with ms_snd_card_notify_audio_session_activated() about the state of the audio session.

Parameters
objA sound card object.
activedTRUE if audio session is activated, FALSE otherwise.

◆ ms_snd_card_ref()

MSSndCard * ms_snd_card_ref ( MSSndCard sndCard)

Takes a ref on a MSSndCard

◆ ms_snd_card_set_capture()

void ms_snd_card_set_capture ( MSSndCard obj,
MSSndCardCapture  c 
)

Set some source for capture.

  MS_SND_CARD_MIC,
  MS_SND_CARD_LINE

Note: not implemented on all sound card filters.

Parameters
objA sound card object.
cA sound card capture value.

Returns: A int if successfull, 0 otherwise.

◆ ms_snd_card_set_control()

int ms_snd_card_set_control ( MSSndCard obj,
MSSndCardControlElem  e,
int  val 
)

Set some mixer control.

  MS_SND_CARD_MASTER_MUTE, -> 0: unmute, 1: mute
  MS_SND_CARD_PLAYBACK_MUTE, -> 0: unmute, 1: mute
  MS_SND_CARD_CAPTURE_MUTE -> 0: unmute, 1: mute

Note: not implemented on all sound card filters.

Parameters
objA sound card object.
eA sound card control object.
valA value for control.

Returns: 0 if successfull, <0 otherwise.

◆ ms_snd_card_set_internal_id()

void ms_snd_card_set_internal_id ( MSSndCard obj,
int  id 
)

Set internal ID of the sound card.

Parameters
objA sound card object.
idA sound card internal ID.

◆ ms_snd_card_set_level()

void ms_snd_card_set_level ( MSSndCard obj,
MSSndCardMixerElem  e,
int  percent 
)

Set some mixer level value.

  MS_SND_CARD_MASTER,
  MS_SND_CARD_PLAYBACK,
  MS_SND_CARD_CAPTURE

Note: not implemented on all sound card filters.

Parameters
objA sound card object.
eA sound card mixer object.
percentA volume level.

◆ ms_snd_card_set_preferred_sample_rate()

int ms_snd_card_set_preferred_sample_rate ( MSSndCard obj,
int  rate 
)

set preferred sample rate. The underlying card will try to avoid any resampling for this samplerate.

Parameters
objA sound card object.
ratesampling rate.

Returns: 0 if successfull, <0 otherwise.

◆ ms_snd_card_set_stream_type()

void ms_snd_card_set_stream_type ( MSSndCard obj,
MSSndCardStreamType  type 
)

Sets the stream type for this soundcard, default is VOICE

◆ ms_snd_card_set_usage_hint()

void ms_snd_card_set_usage_hint ( MSSndCard obj,
bool_t  is_going_to_be_used 
)

Enable application to tell that the soundcard is going to be used or will cease to be used. This is recommended for cards which are known to be slow (see flag MS_SND_CARD_CAP_IS_SLOW ).

◆ ms_snd_card_unref()

void ms_snd_card_unref ( MSSndCard sndCard)

Removes a ref from a MSSndCard