From b1c6f21ad8394d5a15ec4eb84e440f09c07f333e Mon Sep 17 00:00:00 2001 From: methodus Date: Mon, 22 Oct 2012 14:31:47 +0200 Subject: Fixed static initialization bug. Fixed linefeed bug --- httptnt/cds_scpd.ecpp | 279 ++++++++++++++++--------------- httptnt/deviceDescription.ecpp | 23 +-- include/server.h | 4 +- media/mediaManager.cpp | 18 +- plugins/profiler/vdrDVBProfiler/Makefile | 2 +- plugins/provider/recProvider/Makefile | 2 +- plugins/provider/vdrProvider/Makefile | 2 +- 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"); }> - - - TransferIDs - yes - string - - - A_ARG_TYPE_ObjectID no - string - - - A_ARG_TYPE_Result no - string - - - A_ARG_TYPE_SearchCriteria no - string - - - A_ARG_TYPE_BrowseFlag no - string - - BrowseMetadata - BrowseDirectChildren - - - - A_ARG_TYPE_Filter - no - string - - - A_ARG_TYPE_SortCriteria no - string - - - A_ARG_TYPE_Index no - ui4 - - - A_ARG_TYPE_Count no - ui4 - - - A_ARG_TYPE_UpdateID no - ui4 - - - A_ARG_TYPE_TransferID no - ui4 - - - A_ARG_TYPE_TransferStatus no - string - - COMPLETED - ERROR - IN_PROGRESS - STOPPED - - - - A_ARG_TYPE_TransferLength no - string - - - A_ARG_TYPE_TransferTotal no - string - - - A_ARG_TYPE_TagValueList no - string - - - A_ARG_TYPE_URI - no - uri - - - SearchCapabilities - no - string - - - SortCapabilities - no - string - - - SystemUpdateID - yes - ui4 - - - ContainerUpdateIDs -yes - string - - - - - GetSearchCapabilities - - - SearchCaps - out - SearchCapabilities - - - - - GetSortCapabilities - - - SortCaps - out - SortCapabilities - - - - - GetSystemUpdateID - - - Id - out - SystemUpdateID - - - - + + 1 + 0 + + + Browse @@ -192,6 +67,36 @@ It contains the service description for the connection manager of the media serv A_ARG_TYPE_UpdateID + + + GetSearchCapabilities + + + SearchCaps + out + SearchCapabilities + + + + + GetSortCapabilities + + + SortCaps + out + SortCapabilities + + + + + GetSystemUpdateID + + + Id + out + SystemUpdateID + + Search @@ -249,4 +154,116 @@ It contains the service description for the connection manager of the media serv + + + TransferIDs + yes + string + + + A_ARG_TYPE_ObjectID + no + string + + + A_ARG_TYPE_Result + no + string + + + A_ARG_TYPE_SearchCriteria + no + string + + + A_ARG_TYPE_BrowseFlag + no + string + + BrowseMetadata + BrowseDirectChildren + + + + A_ARG_TYPE_Filter + no + string + + + A_ARG_TYPE_SortCriteria + no + string + + + A_ARG_TYPE_Index + no + ui4 + + + A_ARG_TYPE_Count + no + ui4 + + + A_ARG_TYPE_UpdateID + no + ui4 + + + A_ARG_TYPE_TransferID + no + ui4 + + + A_ARG_TYPE_TransferStatus + no + string + + COMPLETED + ERROR + IN_PROGRESS + STOPPED + + + + A_ARG_TYPE_TransferLength + no + string + + + A_ARG_TYPE_TransferTotal + no + string + + + A_ARG_TYPE_TagValueList + no + string + + + A_ARG_TYPE_URI + no + uri + + + SearchCapabilities + no + string + + + SortCapabilities + no + string + + + SystemUpdateID + yes + ui4 + + + ContainerUpdateIDs + yes + string + + 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; -<{ +<%cpp> upnp::cMediaServer* server = cMediaServer::GetInstance(); const upnp::cWebserver& webserver = server->GetWebserver(); @@ -31,7 +31,7 @@ using namespace upnp; reply.setContentType("application/xml"); -}> + 1 @@ -51,13 +51,12 @@ using namespace upnp; <$ presentationUrl $> DMS-1.50 -<{ +<%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(); -}> - + <$ serviceDescription.serviceType $> <$ serviceDescription.serviceID $> @@ -65,14 +64,16 @@ using namespace upnp; <$ controlUrl $><$ serviceDescription.controlDescriptor $> <$ controlUrl $><$ serviceDescription.eventSubscriberDescriptor $> -% }; +<%cpp> + }; + -<{ +<%cpp> const cMediaServer::iconList& icons = server->GetServerIcons(); for(cMediaServer::iconList::const_iterator it = icons.begin(); it != icons.end(); ++it){ -}> + <$ (*it).profile.mime $> <$ (*it).profile.width $> @@ -80,7 +81,9 @@ using namespace upnp; <$ (int)(*it).profile.bitDepth $> <$ staticContentUrl $><$ (*it).filename $> -% }; +<%cpp> + }; + - \ No newline at end of file + 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"); -- cgit v1.2.3