Commit 182ac7e0 authored by aymeric's avatar aymeric

Add mute/unmute support in mediastreamer2 and winsnd2 filter

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@445 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 9913e3fd
......@@ -40,6 +40,8 @@ EXPORTS
ms_snd_card_set_level
ms_snd_card_get_level
ms_snd_card_set_capture
ms_snd_card_set_control
ms_snd_card_get_control
ms_ticker_new
ms_ticker_set_name
......
......@@ -40,6 +40,8 @@ EXPORTS
ms_snd_card_set_level
ms_snd_card_get_level
ms_snd_card_set_capture
ms_snd_card_set_control
ms_snd_card_get_control
ms_ticker_new
ms_ticker_set_name
......
......@@ -65,6 +65,18 @@ enum _MSSndCardCapture {
MS_SND_CARD_LINE
};
/**
* Structure for sound card mixer values.
* @var MSSndCardMixerElem
*/
typedef enum _MSSndCardControlElem MSSndCardControlElem;
enum _MSSndCardControlElem {
MS_SND_CARD_MASTER_MUTE,
MS_SND_CARD_PLAYBACK_MUTE,
MS_SND_CARD_CAPTURE_MUTE
};
/**
* Structure for sound card capture source values.
* @var MSSndCardCapture
......@@ -79,6 +91,8 @@ typedef void (*MSSndCardUninitFunc)(struct _MSSndCard *obj);
typedef void (*MSSndCardSetLevelFunc)(struct _MSSndCard *obj, MSSndCardMixerElem e, int percent);
typedef void (*MSSndCardSetCaptureFunc)(struct _MSSndCard *obj, MSSndCardCapture e);
typedef int (*MSSndCardGetLevelFunc)(struct _MSSndCard *obj, MSSndCardMixerElem e);
typedef void (*MSSndCardSetControlFunc)(struct _MSSndCard *obj, MSSndCardControlElem e, int val);
typedef int (*MSSndCardGetControlFunc)(struct _MSSndCard *obj, MSSndCardControlElem e);
typedef struct _MSFilter * (*MSSndCardCreateReaderFunc)(struct _MSSndCard *obj);
typedef struct _MSFilter * (*MSSndCardCreateWriterFunc)(struct _MSSndCard *obj);
typedef struct _MSSndCard * (*MSSndCardDuplicateFunc)(struct _MSSndCard *obj);
......@@ -90,6 +104,8 @@ struct _MSSndCardDesc{
MSSndCardSetLevelFunc set_level;
MSSndCardGetLevelFunc get_level;
MSSndCardSetCaptureFunc set_capture;
MSSndCardSetControlFunc set_control;
MSSndCardGetControlFunc get_control;
MSSndCardCreateReaderFunc create_reader;
MSSndCardCreateWriterFunc create_writer;
MSSndCardUninitFunc uninit;
......@@ -342,7 +358,7 @@ void ms_snd_card_set_level(MSSndCard *obj, MSSndCardMixerElem e, int percent);
* @param obj A sound card object.
* @param e A sound card mixer object.
*
* Returns: A int if successfull, 0 otherwise.
* Returns: A int if successfull, <0 otherwise.
*/
int ms_snd_card_get_level(MSSndCard *obj, MSSndCardMixerElem e);
......@@ -362,6 +378,40 @@ int ms_snd_card_get_level(MSSndCard *obj, MSSndCardMixerElem e);
*/
void ms_snd_card_set_capture(MSSndCard *obj, MSSndCardCapture c);
/**
* Set some mixer control.
*
* <PRE>
* 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
* </PRE>
* Note: not implemented on all sound card filters.
*
* @param obj A sound card object.
* @param e A sound card control object.
* @param percent A value for control.
*
*/
void ms_snd_card_set_control(MSSndCard *obj, MSSndCardControlElem e, int val);
/**
* Get some mixer control.
*
* <PRE>
* 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
* </PRE>
* Note: not implemented on all sound card filters.
*
* @param obj A sound card object.
* @param e A sound card mixer object.
*
* Returns: A int if successfull, <0 otherwise.
*/
int ms_snd_card_get_control(MSSndCard *obj, MSSndCardControlElem e);
/**
* Create a alsa card with user supplied pcm name and mixer name.
* @param pcmdev The pcm device name following alsa conventions (ex: plughw:0)
......
......@@ -156,14 +156,14 @@ const char *ms_snd_card_get_string_id(MSSndCard *obj){
void ms_snd_card_set_level(MSSndCard *obj, MSSndCardMixerElem e, int percent){
if (obj->desc->set_level!=NULL)
obj->desc->set_level(obj,e,percent);
else ms_warning("ms_snd_card_set_capture: unimplemented by %s wrapper",obj->desc->driver_type);
else ms_warning("ms_snd_card_set_level: unimplemented by %s wrapper",obj->desc->driver_type);
}
int ms_snd_card_get_level(MSSndCard *obj, MSSndCardMixerElem e){
if (obj->desc->get_level!=NULL)
return obj->desc->get_level(obj,e);
else {
ms_warning("ms_snd_card_set_capture: unimplemented by %s wrapper",obj->desc->driver_type);
ms_warning("ms_snd_card_get_level: unimplemented by %s wrapper",obj->desc->driver_type);
return -1;
}
}
......@@ -174,6 +174,23 @@ void ms_snd_card_set_capture(MSSndCard *obj, MSSndCardCapture c){
else ms_warning("ms_snd_card_set_capture: unimplemented by %s wrapper",obj->desc->driver_type);
}
void ms_snd_card_set_control(MSSndCard *obj, MSSndCardControlElem e, int val)
{
if (obj->desc->set_control!=NULL)
obj->desc->set_control(obj,e,val);
else ms_warning("ms_snd_card_set_control: unimplemented by %s wrapper",obj->desc->driver_type);
}
int ms_snd_card_get_control(MSSndCard *obj, MSSndCardControlElem e)
{
if (obj->desc->get_control!=NULL)
return obj->desc->get_control(obj,e);
else {
ms_warning("ms_snd_card_get_control: unimplemented by %s wrapper",obj->desc->driver_type);
return -1;
}
}
struct _MSFilter * ms_snd_card_create_reader(MSSndCard *obj){
if (obj->desc->create_reader!=NULL)
return obj->desc->create_reader(obj);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment