Commit 24d02d8c authored by Mirsal Ennaime's avatar Mirsal Ennaime

UPnP services discovery: Put the callback lock reference in the p_sys data structure.

parent 8ed92b22
...@@ -58,6 +58,7 @@ class MediaServer; ...@@ -58,6 +58,7 @@ class MediaServer;
class MediaServerList; class MediaServerList;
class Item; class Item;
class Container; class Container;
class Lockable;
// VLC handle // VLC handle
...@@ -65,6 +66,7 @@ struct services_discovery_sys_t ...@@ -65,6 +66,7 @@ struct services_discovery_sys_t
{ {
UpnpClient_Handle clientHandle; UpnpClient_Handle clientHandle;
MediaServerList* serverList; MediaServerList* serverList;
Lockable* callbackLock;
}; };
// Class definitions... // Class definitions...
...@@ -269,7 +271,6 @@ vlc_module_end(); ...@@ -269,7 +271,6 @@ vlc_module_end();
// More prototypes... // More prototypes...
static Lockable* CallbackLock;
static int Callback( Upnp_EventType eventType, void* event, void* user_data ); static int Callback( Upnp_EventType eventType, void* event, void* user_data );
const char* xml_getChildElementValue( IXML_Element* parent, const char* xml_getChildElementValue( IXML_Element* parent,
...@@ -299,7 +300,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -299,7 +300,7 @@ static int Open( vlc_object_t *p_this )
} }
p_sys->serverList = new MediaServerList( p_sd ); p_sys->serverList = new MediaServerList( p_sd );
CallbackLock = new Lockable(); p_sys->callbackLock = new Lockable();
res = UpnpRegisterClient( Callback, p_sys, &p_sys->clientHandle ); res = UpnpRegisterClient( Callback, p_sys, &p_sys->clientHandle );
if( res != UPNP_E_SUCCESS ) if( res != UPNP_E_SUCCESS )
...@@ -328,7 +329,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -328,7 +329,7 @@ static void Close( vlc_object_t *p_this )
UpnpFinish(); UpnpFinish();
delete p_sd->p_sys->serverList; delete p_sd->p_sys->serverList;
delete CallbackLock; delete p_sd->p_sys->callbackLock;
free( p_sd->p_sys ); free( p_sd->p_sys );
} }
...@@ -406,10 +407,9 @@ IXML_Document* parseBrowseResult( IXML_Document* doc ) ...@@ -406,10 +407,9 @@ IXML_Document* parseBrowseResult( IXML_Document* doc )
// Handles all UPnP events // Handles all UPnP events
static int Callback( Upnp_EventType eventType, void* event, void* user_data ) static int Callback( Upnp_EventType eventType, void* event, void* user_data )
{ {
Locker locker( CallbackLock );
services_discovery_t *p_sd = ( services_discovery_t* ) user_data; services_discovery_t *p_sd = ( services_discovery_t* ) user_data;
services_discovery_sys_t* p_sys = p_sd->p_sys; services_discovery_sys_t* p_sys = p_sd->p_sys;
Locker locker( p_sys->callbackLock );
switch( eventType ) { switch( eventType ) {
......
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