add unload method when complete audio filter is disabled/unregistred.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@589 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
aymeric 2009-08-20 14:30:54 +00:00
parent c6964906ab
commit bc8e37b39b
4 changed files with 26 additions and 18 deletions

View file

@ -96,6 +96,7 @@ typedef int (*MSSndCardGetControlFunc)(struct _MSSndCard *obj, MSSndCardControlE
typedef struct _MSFilter * (*MSSndCardCreateReaderFunc)(struct _MSSndCard *obj);
typedef struct _MSFilter * (*MSSndCardCreateWriterFunc)(struct _MSSndCard *obj);
typedef struct _MSSndCard * (*MSSndCardDuplicateFunc)(struct _MSSndCard *obj);
typedef void (*MSSndCardUnloadFunc)(MSSndCardManager *obj);
struct _MSSndCardDesc{
const char *driver_type;
@ -110,6 +111,7 @@ struct _MSSndCardDesc{
MSSndCardCreateWriterFunc create_writer;
MSSndCardUninitFunc uninit;
MSSndCardDuplicateFunc duplicate;
MSSndCardUnloadFunc unload;
};

View file

@ -33,6 +33,12 @@ static MSSndCardManager * create_manager(){
void ms_snd_card_manager_destroy(void){
if (scm!=NULL){
MSList *elem;
for(elem=scm->descs;elem!=NULL;elem=elem->next){
MSSndCardDesc *desc = (MSSndCardDesc*)elem->data;
if (desc->unload!=NULL)
desc->unload(scm);
}
ms_list_for_each(scm->cards,(void (*)(void*))ms_snd_card_destroy);
ms_list_free(scm->cards);
ms_list_free(scm->descs);

View file

@ -669,6 +669,7 @@ static void winsndcard_uninit(MSSndCard *card){
static void winsndcard_detect(MSSndCardManager *m);
static MSSndCard *winsndcard_dup(MSSndCard *obj);
static void winsndcard_unload(MSSndCardManager *m);
MSSndCardDesc winsnd_card_desc={
"MME",
@ -682,7 +683,8 @@ MSSndCardDesc winsnd_card_desc={
ms_winsnd_read_new,
ms_winsnd_write_new,
winsndcard_uninit,
winsndcard_dup
winsndcard_dup,
winsndcard_unload
};
static MSSndCard *winsndcard_dup(MSSndCard *obj){
@ -796,7 +798,7 @@ static void mark_as_removed(MSSndCardManager *m){
}
}
static ms_thread_t poller_thread;
static ms_thread_t poller_thread=NULL;
static bool_t poller_running=TRUE;
static void * new_device_polling_thread(void *ignore){
@ -821,15 +823,13 @@ static void stop_poller(){
poller_thread=NULL;
}
static void winsndcard_unload(MSSndCardManager *m){
stop_poller();
}
static void winsndcard_detect(MSSndCardManager *m){
static int doitonce = 0;
_winsndcard_detect(m);
if (doitonce==0)
{
doitonce++;
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
atexit(&stop_poller);
}
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
}
typedef struct WinSnd{

View file

@ -766,6 +766,7 @@ static void winsnddscard_uninit(MSSndCard *card){
static void winsnddscard_detect(MSSndCardManager *m);
static MSSndCard *winsnddscard_dup(MSSndCard *obj);
static void winsnddscard_unload(MSSndCardManager *m);
MSSndCardDesc winsndds_card_desc={
"DirectSound",
@ -779,7 +780,8 @@ MSSndCardDesc winsndds_card_desc={
ms_winsndds_read_new,
ms_winsndds_write_new,
winsnddscard_uninit,
winsnddscard_dup
winsnddscard_dup,
winsnddscard_unload
};
static MSSndCard *winsnddscard_dup(MSSndCard *obj){
@ -991,7 +993,7 @@ static void mark_as_removed(MSSndCardManager *m){
}
}
static ms_thread_t poller_thread;
static ms_thread_t poller_thread=NULL;
static bool_t poller_running=TRUE;
static void * new_device_polling_thread(void *ignore){
@ -1016,15 +1018,13 @@ static void stop_poller(){
poller_thread=NULL;
}
static void winsnddscard_unload(MSSndCardManager *m){
stop_poller();
}
static void winsnddscard_detect(MSSndCardManager *m){
static int doitonce = 0;
_winsnddscard_detect(m);
if (doitonce==0)
{
doitonce++;
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
atexit(&stop_poller);
}
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
}
typedef struct WinSndDs{