Commit fa8cbea1 authored by Simon Morlat's avatar Simon Morlat

merge patch from Aurelien (ms2 little improvements)

parent a4f5a5bc
......@@ -59,6 +59,10 @@ extern void libmsandroiddisplay_init(void);
#include <android/log.h>
#endif
#if defined(WIN32) && !defined(_WIN32_WCE)
static MSList *ms_plugins_loaded_list;
#endif
MSList *ms_list_new(void *data){
MSList *new_elem=(MSList *)ms_new(MSList,1);
new_elem->prev=new_elem->next=NULL;
......@@ -317,6 +321,8 @@ int ms_load_plugins(const char *dir){
if (initroutine!=NULL){
initroutine();
ms_message("Plugin loaded (%s)", szPluginFile);
// Add this new loaded plugin to the list (useful for FreeLibrary at the end)
ms_plugins_loaded_list=ms_list_append(ms_plugins_loaded_list,os_handle);
num++;
}else{
ms_warning("Could not locate init routine of plugin %s. Should be %s",
......@@ -400,6 +406,19 @@ int ms_load_plugins(const char *dir){
return num;
}
void ms_unload_plugins(){
#if defined(WIN32) && !defined(_WIN32_WCE)
MSList *elem;
for(elem=ms_plugins_loaded_list;elem!=NULL;elem=elem->next)
{
HINSTANCE handle=(HINSTANCE )elem->data;
FreeLibrary(handle) ;
}
ms_list_free(ms_plugins_loaded_list);
#endif
}
#ifdef __ALSA_ENABLED__
extern MSSndCardDesc alsa_card_desc;
......@@ -617,6 +636,7 @@ void ms_exit(){
#ifdef VIDEO_ENABLED
ms_web_cam_manager_destroy();
#endif
ms_unload_plugins();
}
void ms_sleep(int seconds){
......
......@@ -59,7 +59,8 @@ void ms_ticker_stop(MSTicker *s){
ms_mutex_lock(&s->lock);
s->run=FALSE;
ms_mutex_unlock(&s->lock);
ms_thread_join(s->thread,NULL);
if(s->thread)
ms_thread_join(s->thread,NULL);
}
void ms_ticker_set_name(MSTicker *s, const char *name){
......
......@@ -490,10 +490,14 @@ static void msv4l2_postprocess(MSFilter *f){
V4l2State *s=(V4l2State*)f->data;
s->thread_run = FALSE;
if(ms_thread_join(s->thread,NULL))
ms_warning("msv4l2 thread was already stopped");
else
if(s->thread) {
ms_thread_join(s->thread,NULL);
ms_message("msv4l2 thread has joined.");
}
else {
ms_warning("msv4l2 thread was already stopped");
}
flushq(&s->rq,0);
}
......
......@@ -143,7 +143,7 @@ static void speex_ec_process(MSFilter *f){
while((refm=ms_queue_get(f->inputs[1]))!=NULL){
ms_queue_put(f->outputs[1],refm);
}
return;
return;
}
if (f->inputs[1]!=NULL){
......
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