Commit 81645063 authored by Sandrine Avakian's avatar Sandrine Avakian
Browse files

Adding MSFactory to MSSndCardManager.

Fixing bug in ms_factory_init_voip.
parent a93ad507
......@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define sndcard_h
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfactory.h>
/**
* @file mssndcard.h
* @brief mediastreamer2 mssndcard.h include file
......@@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
struct _MSSndCardManager{
MSFactory* factory;
MSList *cards;
MSList *descs;
};
......
......@@ -791,7 +791,7 @@ static void set_audio_device_id(AuCard *wc,AUCommon* d, bool_t is_read) {
CFRelease(devUid);
}
MSFilter *ms_au_read_new(MSSndCard *card){
MSFilter *f = ms_filter_new_from_desc(&ms_au_read_desc);
MSFilter *f = ms_factory_create_filter_from_desc((ms_snd_card_manager_get()->factory), &ms_au_read_desc);
AuCard *wc = (AuCard *) card->data;
AURead *d = (AURead *) f->data;
/*d->common.dev = wc->dev;*/
......@@ -802,7 +802,8 @@ MSFilter *ms_au_read_new(MSSndCard *card){
MSFilter *ms_au_write_new(MSSndCard *card){
MSFilter *f=ms_filter_new_from_desc(&ms_au_write_desc);
MSFactory* factory=(ms_snd_card_manager_get())->factory;
MSFilter *f=ms_factory_create_filter_from_desc(factory, &ms_au_write_desc);
AuCard *wc = (AuCard *) card->data;
AUWrite *d = (AUWrite *) f->data;
/*d->common.dev = wc->dev;*/
......
......@@ -27,6 +27,7 @@ static MSSndCardManager *scm=NULL;
static MSSndCardManager * create_manager(void){
MSSndCardManager *obj=(MSSndCardManager *)ms_new0(MSSndCardManager,1);
obj->factory = NULL;
obj->cards=NULL;
obj->descs=NULL;
return obj;
......
......@@ -271,11 +271,11 @@ void ms_factory_init_voip(MSFactory *obj){
ms_factory_register_filter(obj,ms_voip_filter_descs[i]);
}
if (managers_ref==0){
managers_ref++;
if (managers_ref == 0){
cm=ms_snd_card_manager_get();
if (cm->descs==NULL){
ms_message("Registering all soundcard handlers");
cm->factory=obj;
for (i=0;ms_snd_card_descs[i]!=NULL;i++){
ms_snd_card_manager_register_desc(cm,ms_snd_card_descs[i]);
}
......@@ -294,7 +294,7 @@ void ms_factory_init_voip(MSFactory *obj){
}
#endif
}
managers_ref++;
#ifdef VIDEO_ENABLED
{
MSVideoPresetsManager *vpm = ms_video_presets_manager_new(obj);
......@@ -322,6 +322,7 @@ void ms_factory_init_voip(MSFactory *obj){
}
void ms_factory_uninit_voip(MSFactory *obj){
ms_srtp_shutdown();
if (obj->voip_initd){
#ifdef VIDEO_ENABLED
ms_video_presets_manager_destroy(obj->video_presets_manager);
......@@ -334,6 +335,7 @@ void ms_factory_uninit_voip(MSFactory *obj){
#endif
}
}
obj->voip_initd = FALSE;
}
void ms_voip_exit(){
......
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