From 216e4086520765fface77acd86a718dfb6e627e2 Mon Sep 17 00:00:00 2001 From: methodus Date: Sat, 15 Sep 2012 23:37:25 +0200 Subject: Anpassung der Plugin-Schnittstelle --- httptnt/cds_scpd.ecpp | 382 ++++++++++++++++++++++++++--------------- httptnt/cds_scpd.o | Bin 206016 -> 210528 bytes httptnt/deviceDescription.ecpp | 7 +- httptnt/deviceDescription.o | Bin 295912 -> 295880 bytes include/plugin.h | 21 ++- include/service.h | 1 + libvdr-upnp.so | Bin 1772649 -> 1810533 bytes libvdr-upnp.so.1.7.27 | Bin 1772649 -> 1810533 bytes media/mediaManager.cpp | 32 +++- media/mediaManager.o | Bin 387416 -> 464328 bytes media/pluginManager.cpp | 6 +- media/pluginManager.o | Bin 269696 -> 270936 bytes metadata.db | Bin 7168 -> 7168 bytes po/upnp.pot | 2 +- server/connectionManager.cpp | 1 - server/connectionManager.o | Bin 313200 -> 313200 bytes server/contentDirectory.o | Bin 232952 -> 232960 bytes server/server.cpp | 4 +- server/server.o | Bin 327792 -> 327800 bytes server/service.o | Bin 84424 -> 84424 bytes server/webserver.cpp | 7 +- server/webserver.o | Bin 549288 -> 549144 bytes 22 files changed, 306 insertions(+), 157 deletions(-) diff --git a/httptnt/cds_scpd.ecpp b/httptnt/cds_scpd.ecpp index 73f0baf..7a2c72f 100644 --- a/httptnt/cds_scpd.ecpp +++ b/httptnt/cds_scpd.ecpp @@ -8,145 +8,245 @@ It contains the service description for the connection manager of the media serv #> <{ reply.setContentType("application/xml"); }> - - 1 - 0 - - - - GetSearchCapabilities - - - SearchCaps - out - SearchCapabilities - - - - - GetSortCapabilities - - - SortCaps - out - SortCapabilities - - - - - GetSystemUpdateID - - - Id - out - SystemUpdateID - - - - - Browse - - - ObjectID - in - A_ARG_TYPE_ObjectID - - - BrowseFlag - in - A_ARG_TYPE_BrowseFlag - - - Filter - in - A_ARG_TYPE_Filter - - - StartingIndex - in - A_ARG_TYPE_Index - - - RequestedCount - in - A_ARG_TYPE_Count - - - SortCriteria - in - A_ARG_TYPE_SortCriteria - - - Result - out - A_ARG_TYPE_Result - - - NumberReturned - out - A_ARG_TYPE_Count - - - TotalMatches - out - A_ARG_TYPE_Count - - - UpdateID - out - A_ARG_TYPE_UpdateID - - - - - - - A_ARG_TYPE_ObjectID - string - - - A_ARG_TYPE_Result - string - - - A_ARG_TYPE_BrowseFlag - string - - BrowseMetadata - BrowseDirectChildren - - - - A_ARG_TYPE_Filter - string - - - A_ARG_TYPE_SortCriteria - string - - - A_ARG_TYPE_Index - ui4 - - - A_ARG_TYPE_Count - ui4 - - - A_ARG_TYPE_UpdateID - ui4 - - - SearchCapabilities - string - - - SortCapabilities - string - - - SystemUpdateID - ui4 - - + + + 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 + + + + + Browse + + + ObjectID + in + A_ARG_TYPE_ObjectID + + + BrowseFlag + in + A_ARG_TYPE_BrowseFlag + + + Filter + in + A_ARG_TYPE_Filter + + + StartingIndex + in + A_ARG_TYPE_Index + + + RequestedCount + in + A_ARG_TYPE_Count + + + SortCriteria + in + A_ARG_TYPE_SortCriteria + + + Result + out + A_ARG_TYPE_Result + + + NumberReturned + out + A_ARG_TYPE_Count + + + TotalMatches + out + A_ARG_TYPE_Count + + + UpdateID + out + A_ARG_TYPE_UpdateID + + + + + Search + + + ContainerID + in + A_ARG_TYPE_ObjectID + + + SearchCriteria + in + A_ARG_TYPE_SearchCriteria + + + Filter + in + A_ARG_TYPE_Filter + + + StartingIndex + in + A_ARG_TYPE_Index + + + RequestedCount + in + A_ARG_TYPE_Count + + + SortCriteria + in + A_ARG_TYPE_SortCriteria + + + Result + out + A_ARG_TYPE_Result + + + NumberReturned + out + A_ARG_TYPE_Count + + + TotalMatches + out + A_ARG_TYPE_Count + + + UpdateID + out + A_ARG_TYPE_UpdateID + + + + diff --git a/httptnt/cds_scpd.o b/httptnt/cds_scpd.o index 40f462c..aa5d2d9 100644 Binary files a/httptnt/cds_scpd.o and b/httptnt/cds_scpd.o differ diff --git a/httptnt/deviceDescription.ecpp b/httptnt/deviceDescription.ecpp index f43ff8c..dfbe853 100644 --- a/httptnt/deviceDescription.ecpp +++ b/httptnt/deviceDescription.ecpp @@ -38,7 +38,6 @@ using namespace upnp; 1 0 - <$ urlBase $> urn:schemas-upnp-org:device:MediaServer:1 <$ serverDescription.friendlyName $> @@ -50,7 +49,7 @@ using namespace upnp; <$ serverDescription.modelURL $> <$ serverDescription.serialNumber $> <$ deviceUUID $> - <$ presentationUrl $> + <$ urlBase $><$ presentationUrl $> DMS-1.50 <{ @@ -63,7 +62,7 @@ using namespace upnp; <$ serviceDescription.serviceType $> <$ serviceDescription.serviceID $> - <$ serviceUrl $><$ serviceDescription.SCPDXML $> + <$ urlBase $><$ serviceUrl $><$ serviceDescription.SCPDXML $> <$ controlUrl $><$ serviceDescription.controlDescriptor $> <$ controlUrl $><$ serviceDescription.eventSubscriberDescriptor $> @@ -80,7 +79,7 @@ using namespace upnp; <$ (*it).profile.width $> <$ (*it).profile.height $> <$ (int)(*it).profile.bitDepth $> - <$ staticContentUrl $><$ (*it).filename $> + <$ urlBase $><$ staticContentUrl $><$ (*it).filename $> % }; diff --git a/httptnt/deviceDescription.o b/httptnt/deviceDescription.o index b14f268..52c8b9f 100644 Binary files a/httptnt/deviceDescription.o and b/httptnt/deviceDescription.o differ diff --git a/include/plugin.h b/include/plugin.h index 94a60da..29803f5 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -144,6 +144,8 @@ public: string GetParentID() const { return parentID; } bool SetTitle(string title); string GetTitle() const { return title; } + bool SetCreator(string creator); + string GetCreator() const { return creator; } bool SetUpnpClass(string upnpClass); string GetUpnpClass() const { return upnpClass; } bool SetRestricted(bool restricted); @@ -173,6 +175,7 @@ private: string objectID; string parentID; string title; + string creator; string upnpClass; bool restricted; string description; @@ -367,6 +370,22 @@ public: */ virtual size_t Read(char* buf, size_t bufLen); + /** + * Seeks in the stream + * + * This function sets the file curser to the specific byte position. + * + * The offset is added to the position relatively to "origin". + * This can be (from ): + * + * - SEEK_SET + * - SEEK_CUR + * - SEEK_END + * + * Returns true, if seeking was successful, false otherwise. + */ + virtual bool Seek(size_t offset, int origin); + /** * Closes the file * @@ -415,7 +434,7 @@ protected: * - change of the parent container, where the file or container * was moved to */ - void OnContainerUpdate(string uri, long containerUpdateId); + void OnContainerUpdate(string uri, long containerUpdateId, string changesUri = string()); }; diff --git a/include/service.h b/include/service.h index ddcf614..07d3551 100644 --- a/include/service.h +++ b/include/service.h @@ -9,6 +9,7 @@ #define SERVICE_H_ #include +#include #include namespace upnp { diff --git a/libvdr-upnp.so b/libvdr-upnp.so index da4f86a..131fa37 100755 Binary files a/libvdr-upnp.so and b/libvdr-upnp.so differ diff --git a/libvdr-upnp.so.1.7.27 b/libvdr-upnp.so.1.7.27 index da4f86a..131fa37 100755 Binary files a/libvdr-upnp.so.1.7.27 and b/libvdr-upnp.so.1.7.27 differ diff --git a/media/mediaManager.cpp b/media/mediaManager.cpp index 9740a0b..ed07da7 100644 --- a/media/mediaManager.cpp +++ b/media/mediaManager.cpp @@ -10,6 +10,7 @@ #include "../include/server.h" #include #include +#include #include namespace upnp { @@ -43,23 +44,48 @@ void cMediaManager::OnContainerUpdate(string containerID, long updateID){ } StringList cMediaManager::GetSearchCapabilities() const { - // TODO: SearchCapabilities ermitteln und zurückgeben. StringList list; + list.push_back("dc:title"); + list.push_back("dc:creator"); + list.push_back("dc:description"); + list.push_back("upnp:longDescription"); + list.push_back("res@protocolInfo"); + list.push_back("upnp:class"); + list.push_back("dc:date"); + list.push_back("dc:language"); + return list; } StringList cMediaManager::GetSortCapabilities() const { - // TODO: SortCapabilities ermitteln und zurückgeben. StringList list; + list.push_back("dc:title"); + list.push_back("dc:creator"); + list.push_back("dc:description"); + list.push_back("upnp:longDescription"); + list.push_back("res@protocolInfo"); + list.push_back("upnp:class"); + list.push_back("dc:date"); + list.push_back("dc:language"); + return list; } StringList cMediaManager::GetSupportedProtocolInfos() const { - // TODO: ProtocolInfos ermitteln und zurückgeben. + tntdb::Connection conn = mConnection; + tntdb::Statement stmt = conn.prepare( + "SELECT DISTINCT protocolInfo FROM resources;" + ); + StringList list; + for(tntdb::Statement::const_iterator it = stmt.begin(); it != stmt.end(); ++it){ + tntdb::Row row = (*it); + list.push_back(row.getString("protocolInfo")); + } + return list; } diff --git a/media/mediaManager.o b/media/mediaManager.o index aae1479..171e839 100644 Binary files a/media/mediaManager.o and b/media/mediaManager.o differ diff --git a/media/pluginManager.cpp b/media/pluginManager.cpp index 232a9fe..e677d6a 100644 --- a/media/pluginManager.cpp +++ b/media/pluginManager.cpp @@ -182,8 +182,6 @@ bool cMetadata::Resource::SetResourceUri(string resourceUri){ } bool cMetadata::Resource::SetProtocolInfo(string protocolInfo){ - //TODO validiere protocolInfo. - this->protocolInfo = protocolInfo; return true; } @@ -254,6 +252,10 @@ size_t cUPnPResourceProvider::Read(char* buf, size_t bufLen){ return -1; } +bool cUPnPResourceProvider::Seek(size_t offset, int origin){ + return false; +} + void cUPnPResourceProvider::Close(){ } diff --git a/media/pluginManager.o b/media/pluginManager.o index ecfa185..3fb2f31 100644 Binary files a/media/pluginManager.o and b/media/pluginManager.o differ diff --git a/metadata.db b/metadata.db index 308999f..a215e1c 100644 Binary files a/metadata.db and b/metadata.db differ diff --git a/po/upnp.pot b/po/upnp.pot index 12fddb8..c84cb55 100644 --- a/po/upnp.pot +++ b/po/upnp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-upnp 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-09-13 19:11+0200\n" +"POT-Creation-Date: 2012-09-15 23:24+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/server/connectionManager.cpp b/server/connectionManager.cpp index fd16d97..cea68bc 100644 --- a/server/connectionManager.cpp +++ b/server/connectionManager.cpp @@ -7,7 +7,6 @@ #include "../include/connectionManager.h" #include "../include/tools.h" -#include "../include/server.h" #include "../include/media/mediaManager.h" #include #include diff --git a/server/connectionManager.o b/server/connectionManager.o index e3b3e75..1ec3f19 100644 Binary files a/server/connectionManager.o and b/server/connectionManager.o differ diff --git a/server/contentDirectory.o b/server/contentDirectory.o index 488881a..50d633d 100644 Binary files a/server/contentDirectory.o and b/server/contentDirectory.o differ diff --git a/server/server.cpp b/server/server.cpp index a211c1c..69c0a2c 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -114,6 +114,8 @@ bool cMediaServer::Start(){ return false; } + + mIsRunning = true; return IsRunning(); @@ -284,7 +286,7 @@ int cMediaServer::ActionCallback(Upnp_EventType eventtype, void *event, void *co case UPNP_EVENT_SUBSCRIPTION_REQUEST: eventRequest = (Upnp_Subscription_Request*) event; - dsyslog("UPnP\tSubscription request: %s", eventRequest->ServiceId); + dsyslog("UPnP\tSubscription request from: %s", eventRequest->ServiceId); if(!mediaServer->CheckDeviceUUID(eventRequest->UDN)){ esyslog("UPnP\tUPnP Callback - event request not for this device"); diff --git a/server/server.o b/server/server.o index f603bbb..bec8a88 100644 Binary files a/server/server.o and b/server/server.o differ diff --git a/server/service.o b/server/service.o index a130cda..fbfdbe6 100644 Binary files a/server/service.o and b/server/service.o differ diff --git a/server/webserver.cpp b/server/webserver.cpp index ce8acda..b67076b 100644 --- a/server/webserver.cpp +++ b/server/webserver.cpp @@ -17,7 +17,7 @@ cWebserver::cWebserver(std::string address) , mWebserverThread(*this) { SetWebserverRootDir(string(), string(), string()); - SetServiceUrl("services/", string()); + SetServiceUrl(string(), string()); } cWebserver::~cWebserver(){ @@ -109,14 +109,15 @@ void cWebserver::SetWebserverRootDir(std::string rootDirectory, std::string stat void cWebserver::SetServiceUrl(std::string descriptionUrl, std::string controlUrl){ if(mWebserverThread.Active()) return; - if(descriptionUrl.empty()) + if(descriptionUrl.empty()){ mServiceUrl = "services/"; + } else mServiceUrl = descriptionUrl; if(controlUrl.empty()){ stringstream s; - s << "http://" << UpnpGetServerIpAddress() << ":" << UpnpGetServerPort() << "/" << mServiceUrl; + s << "http://" << UpnpGetServerIpAddress() << ":" << UpnpGetServerPort() << "/" << "services/"; mControlUrl = s.str(); } else { diff --git a/server/webserver.o b/server/webserver.o index c6789ea..dc6db8b 100644 Binary files a/server/webserver.o and b/server/webserver.o differ -- cgit v1.2.3