diff options
author | methodus <methodus@web.de> | 2012-10-22 14:31:47 +0200 |
---|---|---|
committer | methodus <methodus@web.de> | 2012-10-22 14:31:47 +0200 |
commit | b1c6f21ad8394d5a15ec4eb84e440f09c07f333e (patch) | |
tree | d7338317285697bce86e505a3d3ae1ca1547c9dc | |
parent | 2d47656d0dfddea80c04bcf48b3b9c36de784af1 (diff) | |
download | vdr-plugin-upnp-b1c6f21ad8394d5a15ec4eb84e440f09c07f333e.tar.gz vdr-plugin-upnp-b1c6f21ad8394d5a15ec4eb84e440f09c07f333e.tar.bz2 |
Fixed static initialization bug. Fixed linefeed bug
-rw-r--r-- | httptnt/cds_scpd.ecpp | 279 | ||||
-rw-r--r-- | httptnt/deviceDescription.ecpp | 23 | ||||
-rw-r--r-- | include/server.h | 4 | ||||
-rw-r--r-- | media/mediaManager.cpp | 18 | ||||
-rw-r--r-- | plugins/profiler/vdrDVBProfiler/Makefile | 2 | ||||
-rw-r--r-- | plugins/provider/recProvider/Makefile | 2 | ||||
-rw-r--r-- | plugins/provider/vdrProvider/Makefile | 2 | ||||
-rw-r--r-- | server/server.cpp | 19 |
8 files changed, 186 insertions, 163 deletions
diff --git a/httptnt/cds_scpd.ecpp b/httptnt/cds_scpd.ecpp index 7a2c72f..97b3b45 100644 --- a/httptnt/cds_scpd.ecpp +++ b/httptnt/cds_scpd.ecpp @@ -8,137 +8,12 @@ It contains the service description for the connection manager of the media serv #> <{ reply.setContentType("application/xml"); }> <scpd xmlns="urn:schemas-upnp-org:service-1-0"> - <serviceStateTable> - <stateVariable> <Optional/> - <name>TransferIDs</name> - <sendEventsAttribute>yes</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_ObjectID</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_Result</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_SearchCriteria</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_BrowseFlag</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - <allowedValueList> - <allowedValue>BrowseMetadata</allowedValue> - <allowedValue>BrowseDirectChildren</allowedValue> - </allowedValueList> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_Filter</name> - <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_SortCriteria</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_Index</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>ui4</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_Count</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>ui4</dataType> - </stateVariable> - <stateVariable> - <name>A_ARG_TYPE_UpdateID</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>ui4</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_TransferID</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>ui4</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_TransferStatus</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - <allowedValueList> - <allowedValue>COMPLETED</allowedValue> - <allowedValue>ERROR</allowedValue> - <allowedValue>IN_PROGRESS</allowedValue> - <allowedValue>STOPPED</allowedValue> - </allowedValueList> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_TransferLength</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_TransferTotal</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_TagValueList</name> <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>A_ARG_TYPE_URI</name> - <sendEventsAttribute>no</sendEventsAttribute> - <dataType>uri</dataType> - </stateVariable> - <stateVariable> - <name>SearchCapabilities</name> - <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>SortCapabilities</name> - <sendEventsAttribute>no</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - <stateVariable> - <name>SystemUpdateID</name> - <sendEventsAttribute>yes</sendEventsAttribute> - <dataType>ui4</dataType> - </stateVariable> - <stateVariable> <Optional/> - <name>ContainerUpdateIDs</name> -<sendEventsAttribute>yes</sendEventsAttribute> - <dataType>string</dataType> - </stateVariable> - </serviceStateTable> - <actionList> - <action> - <name>GetSearchCapabilities</name> - <argumentList> - <argument> - <name>SearchCaps</name> - <direction>out</direction> - <relatedStateVariable>SearchCapabilities </relatedStateVariable> - </argument> - </argumentList> - </action> - <action> - <name>GetSortCapabilities</name> - <argumentList> - <argument> - <name>SortCaps</name> - <direction>out</direction> - <relatedStateVariable>SortCapabilities</relatedStateVariable> - </argument> - </argumentList> - </action> - <action> - <name>GetSystemUpdateID</name> - <argumentList> - <argument> - <name>Id</name> - <direction>out</direction> - <relatedStateVariable>SystemUpdateID</relatedStateVariable> - </argument> - </argumentList> - </action> - <action> + <specVersion> + <major>1</major> + <minor>0</minor> + </specVersion> + <actionList> +<action> <name>Browse</name> <argumentList> <argument> @@ -193,6 +68,36 @@ It contains the service description for the connection manager of the media serv </argument> </argumentList> </action> + <action> + <name>GetSearchCapabilities</name> + <argumentList> + <argument> + <name>SearchCaps</name> + <direction>out</direction> + <relatedStateVariable>SearchCapabilities</relatedStateVariable> + </argument> + </argumentList> + </action> + <action> + <name>GetSortCapabilities</name> + <argumentList> + <argument> + <name>SortCaps</name> + <direction>out</direction> + <relatedStateVariable>SortCapabilities</relatedStateVariable> + </argument> + </argumentList> + </action> + <action> + <name>GetSystemUpdateID</name> + <argumentList> + <argument> + <name>Id</name> + <direction>out</direction> + <relatedStateVariable>SystemUpdateID</relatedStateVariable> + </argument> + </argumentList> + </action> <action> <name>Search</name> <argumentList> @@ -249,4 +154,116 @@ It contains the service description for the connection manager of the media serv </argumentList> </action> </actionList> + <serviceStateTable> + <stateVariable> + <name>TransferIDs</name> + <sendEventsAttribute>yes</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_ObjectID</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_Result</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_SearchCriteria</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_BrowseFlag</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + <allowedValueList> + <allowedValue>BrowseMetadata</allowedValue> + <allowedValue>BrowseDirectChildren</allowedValue> + </allowedValueList> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_Filter</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_SortCriteria</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_Index</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>ui4</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_Count</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>ui4</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_UpdateID</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>ui4</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_TransferID</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>ui4</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_TransferStatus</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + <allowedValueList> + <allowedValue>COMPLETED</allowedValue> + <allowedValue>ERROR</allowedValue> + <allowedValue>IN_PROGRESS</allowedValue> + <allowedValue>STOPPED</allowedValue> + </allowedValueList> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_TransferLength</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_TransferTotal</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_TagValueList</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>A_ARG_TYPE_URI</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>uri</dataType> + </stateVariable> + <stateVariable> + <name>SearchCapabilities</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>SortCapabilities</name> + <sendEventsAttribute>no</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + <stateVariable> + <name>SystemUpdateID</name> + <sendEventsAttribute>yes</sendEventsAttribute> + <dataType>ui4</dataType> + </stateVariable> + <stateVariable> + <name>ContainerUpdateIDs</name> + <sendEventsAttribute>yes</sendEventsAttribute> + <dataType>string</dataType> + </stateVariable> + </serviceStateTable> </scpd> diff --git a/httptnt/deviceDescription.ecpp b/httptnt/deviceDescription.ecpp index 9646d30..832df86 100644 --- a/httptnt/deviceDescription.ecpp +++ b/httptnt/deviceDescription.ecpp @@ -17,7 +17,7 @@ It contains the device and service descriptions of the media server. using namespace upnp; </%pre> -<{ +<%cpp> upnp::cMediaServer* server = cMediaServer::GetInstance(); const upnp::cWebserver& webserver = server->GetWebserver(); @@ -31,7 +31,7 @@ using namespace upnp; reply.setContentType("application/xml"); -}> +</%cpp> <root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:dlna="urn:schemas-dlna-org:device-1-0"> <specVersion> <major>1</major> @@ -51,13 +51,12 @@ using namespace upnp; <presentationURL><$ presentationUrl $></presentationURL> <dlna:X_DLNADOC>DMS-1.50</dlna:X_DLNADOC> <serviceList> -<{ +<%cpp> const cMediaServer::serviceMap& services = server->GetServices(); for(cMediaServer::serviceMap::const_iterator it = services.begin(); it != services.end(); ++it){ const cUPnPService::Description& serviceDescription = (*it).second->GetServiceDescription(); -}> - +</%cpp> <service> <serviceType><$ serviceDescription.serviceType $></serviceType> <serviceId><$ serviceDescription.serviceID $></serviceId> @@ -65,14 +64,16 @@ using namespace upnp; <controlURL><$ controlUrl $><$ serviceDescription.controlDescriptor $></controlURL> <eventSubURL><$ controlUrl $><$ serviceDescription.eventSubscriberDescriptor $></eventSubURL> </service> -% }; +<%cpp> + }; +</%cpp> </serviceList> <iconList> -<{ +<%cpp> const cMediaServer::iconList& icons = server->GetServerIcons(); for(cMediaServer::iconList::const_iterator it = icons.begin(); it != icons.end(); ++it){ -}> +</%cpp> <icon> <mimetype><$ (*it).profile.mime $></mimetype> <width><$ (*it).profile.width $></width> @@ -80,7 +81,9 @@ using namespace upnp; <depth><$ (int)(*it).profile.bitDepth $></depth> <url><$ staticContentUrl $><$ (*it).filename $></url> </icon> -% }; +<%cpp> + }; +</%cpp> </iconList> </device> -</root>
\ No newline at end of file +</root> diff --git a/include/server.h b/include/server.h index 7d9e479..ebdee03 100644 --- a/include/server.h +++ b/include/server.h @@ -71,7 +71,7 @@ public: const Description& GetServerDescription() const { return mServerDescription; } const iconList& GetServerIcons() const { return mServerIcons; } - const serviceMap& GetServices() const { return mServices; } + static serviceMap& GetServices(); static void RegisterService(cUPnPService* service); @@ -95,8 +95,6 @@ private: cWebserver* mWebserver; cMediaManager* mMediaManager; - static serviceMap mServices; - }; } diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp index a2eeb36..fdfaaed 100644 --- a/media/mediaManager.cpp +++ b/media/mediaManager.cpp @@ -5,8 +5,8 @@ * Author: savop */ -#include "../include/webserver.h" #include "../include/media/mediaManager.h" +#include "../include/webserver.h" #include "../include/pluginManager.h" #include "../include/server.h" #include "../include/parser.h" @@ -196,14 +196,14 @@ bool cMediaManager::UpdateContainerUpdateId(const string& objectID, long int upd StringList cMediaManager::GetSearchCapabilities() const { StringList list; - list.push_back(property::object::KEY_TITLE); - list.push_back(property::object::KEY_CREATOR); - list.push_back(property::object::KEY_DESCRIPTION); - list.push_back(property::object::KEY_LONG_DESCRIPTION); - list.push_back(property::object::KEY_CLASS); - list.push_back(property::object::KEY_DATE); - list.push_back(property::object::KEY_LANGUAGE); - list.push_back(property::resource::KEY_PROTOCOL_INFO); +// list.push_back(property::object::KEY_TITLE); +// list.push_back(property::object::KEY_CREATOR); +// list.push_back(property::object::KEY_DESCRIPTION); +// list.push_back(property::object::KEY_LONG_DESCRIPTION); +// list.push_back(property::object::KEY_CLASS); +// list.push_back(property::object::KEY_DATE); +// list.push_back(property::object::KEY_LANGUAGE); +// list.push_back(property::resource::KEY_PROTOCOL_INFO); return list; } diff --git a/plugins/profiler/vdrDVBProfiler/Makefile b/plugins/profiler/vdrDVBProfiler/Makefile index 28c8748..879edb2 100644 --- a/plugins/profiler/vdrDVBProfiler/Makefile +++ b/plugins/profiler/vdrDVBProfiler/Makefile @@ -27,7 +27,7 @@ APIVERSION = $(shell sed -ne '/define UPNPPLUGIN_VERSION/s/^.*"\(.*\)".*$$/\1/p' VDRDIR ?= $(UPNPDIR)/../../.. VDRAPIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) -INCLUDES += -I$(UPNPDIR)/include +INCLUDES += -I$(UPNPDIR)/include -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE diff --git a/plugins/provider/recProvider/Makefile b/plugins/provider/recProvider/Makefile index d23a6e7..95f8f41 100644 --- a/plugins/provider/recProvider/Makefile +++ b/plugins/provider/recProvider/Makefile @@ -27,7 +27,7 @@ APIVERSION = $(shell sed -ne '/define UPNPPLUGIN_VERSION/s/^.*"\(.*\)".*$$/\1/p' VDRDIR ?= $(UPNPDIR)/../../.. VDRAPIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) -INCLUDES += -I$(UPNPDIR)/include +INCLUDES += -I$(UPNPDIR)/include -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE diff --git a/plugins/provider/vdrProvider/Makefile b/plugins/provider/vdrProvider/Makefile index 9f8361e..de30380 100644 --- a/plugins/provider/vdrProvider/Makefile +++ b/plugins/provider/vdrProvider/Makefile @@ -27,7 +27,7 @@ APIVERSION = $(shell sed -ne '/define UPNPPLUGIN_VERSION/s/^.*"\(.*\)".*$$/\1/p' VDRDIR ?= $(UPNPDIR)/../../.. VDRAPIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) -INCLUDES += -I$(UPNPDIR)/include +INCLUDES += -I$(UPNPDIR)/include -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE diff --git a/server/server.cpp b/server/server.cpp index b44056f..c8c5619 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -23,8 +23,6 @@ cMediaServer* cMediaServer::GetInstance(){ return &server; } -cMediaServer::serviceMap cMediaServer::mServices; - cMediaServer::cMediaServer() : mServerDescription("VDR UPnP/DLNA MS", "Denis Loh", "http://upnp.vdr-developer.org", DESCRIPTION, "VDR UPnP-DLNA MS", VERSION, @@ -98,7 +96,8 @@ bool cMediaServer::Start(){ } isyslog("UPnP\tInitialising services..."); - for(serviceMap::iterator it = cMediaServer::mServices.begin(); it != cMediaServer::mServices.end(); ++it){ + serviceMap& services = cMediaServer::GetServices(); + for(serviceMap::iterator it = services.begin(); it != services.end(); ++it){ isyslog("UPnP\t...%s", (*it).second->GetServiceDescription().serviceType.c_str()); (*it).second->Init(this, mDeviceHandle); } @@ -119,7 +118,8 @@ bool cMediaServer::Stop(){ int ret = 0; isyslog("UPnP\tStopping services..."); - for(serviceMap::iterator it = cMediaServer::mServices.begin(); it != cMediaServer::mServices.end(); ++it){ + serviceMap& services = cMediaServer::GetServices(); + for(serviceMap::iterator it = services.begin(); it != services.end(); ++it){ isyslog("UPnP\t...%s", (*it).second->GetServiceDescription().serviceType.c_str()); (*it).second->Stop(); } @@ -263,10 +263,15 @@ string cMediaServer::GetDeviceDescriptionUrl() const { return mWebserver->GetServiceUrl() + mServerDescription.descriptionFile; } +cMediaServer::serviceMap& cMediaServer::GetServices(){ + static serviceMap services; + return services; +} + void cMediaServer::RegisterService(cUPnPService* service){ if(service != NULL){ cout << "Registered service: " << service->GetServiceDescription().serviceType << endl; - mServices[service->GetServiceDescription().serviceID] = service; + GetServices()[service->GetServiceDescription().serviceID] = service; } } @@ -295,7 +300,7 @@ int cMediaServer::ActionCallback(Upnp_EventType eventtype, void *event, void *co return UPNP_E_BAD_REQUEST; } - service = cMediaServer::mServices[actionRequest->ServiceID]; + service = cMediaServer::GetServices()[actionRequest->ServiceID]; if(service == NULL){ esyslog("UPnP\tCallback - unsupported service called for control"); @@ -314,7 +319,7 @@ int cMediaServer::ActionCallback(Upnp_EventType eventtype, void *event, void *co return UPNP_E_BAD_REQUEST; } - service = cMediaServer::mServices[eventRequest->ServiceId]; + service = cMediaServer::GetServices()[eventRequest->ServiceId]; if(service == NULL){ esyslog("UPnP\tCallback - unsupported service called for eventing"); |