summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormethodus <methodus@web.de>2012-10-12 13:38:12 +0200
committermethodus <methodus@web.de>2012-10-12 13:38:12 +0200
commit9b199c2d95141de43fac33412ec3e9fc1f543e71 (patch)
treecd62f387aad28bc8216774e52eda0582ebbcc526
parente3ce4d1e7e47af0efe5bc1015ba38598e68a149d (diff)
downloadvdr-plugin-upnp-9b199c2d95141de43fac33412ec3e9fc1f543e71.tar.gz
vdr-plugin-upnp-9b199c2d95141de43fac33412ec3e9fc1f543e71.tar.bz2
Continued DVBProfiler for recordings and Live-TV channels
-rw-r--r--include/media/profile.h43
-rw-r--r--include/plugin.h2
-rw-r--r--media/pluginManager.cpp14
-rw-r--r--media/profile.cpp36
-rw-r--r--plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp62
5 files changed, 154 insertions, 3 deletions
diff --git a/include/media/profile.h b/include/media/profile.h
index 867de66..e8b2bda 100644
--- a/include/media/profile.h
+++ b/include/media/profile.h
@@ -13,8 +13,51 @@
using namespace std;
+#define DLNA_OPERATION_NONE 00 ///< No seek operations supported
+#define DLNA_OPERATION_TIME_SEEK_RANGE 10 ///< is the server supporting time based seeks?
+#define DLNA_OPERATION_RANGE 01 ///< or byte based seeks?
+
+#define DLNA_CONVERSION_TRANSCODED 1 ///< the content was converted from one media format to another
+#define DLNA_CONVERSION_NONE 0 ///< the content is available without conversion
+
+#define DLNA_PLAYSPEEDS_NONE ""
+
+#define DLNA_FLAG_NONE 0
+#define DLNA_FLAG_SENDER_PACED 1 << 31 ///< is the server setting the pace (i.e. RTP)?
+#define DLNA_FLAG_TIME_BASED_SEEK 1 << 30 ///< is the server supporting time based seeks?
+#define DLNA_FLAG_BYTE_BASED_SEEK 1 << 29 ///< or byte based seeking?
+#define DLNA_FLAG_PLAY_CONTAINER 1 << 28 ///< is it possible to play all contents of a container?
+#define DLNA_FLAG_S0_INCREASE 1 << 27 ///< is the beginning changing (time shift)?
+#define DLNA_FLAG_SN_INCREASE 1 << 26 ///< is the end changing (live-TV)?
+#define DLNA_FLAG_RTSP_PAUSE 1 << 25 ///< is pausing rtp streams permitted?
+#define DLNA_FLAG_STREAMING_TRANSFER 1 << 24 ///< is the transfer a stream (Audio/AV)?
+#define DLNA_FLAG_INTERACTIVE_TRANSFER 1 << 23 ///< is the transfer interactiv (printings)?
+#define DLNA_FLAG_BACKGROUND_TRANSFER 1 << 22 ///< is the tranfer done in background (downloaded)?
+#define DLNA_FLAG_CONNECTION_STALLING 1 << 21 ///< can the connection be paused on HTTP streams?
+#define DLNA_FLAG_VERSION_1_5 1 << 20 ///< does the server complies with DLNA V1.5
+#define DLNA_FLAG_CLEARTEXT_CONTENT 1 << 16 ///< (Link Protection) currently not used
+#define DLNA_FLAG_CLEARTEXT_BYTE_FULL_SEEK 1 << 15 ///< (Link Protection) currently not used
+#define DLNA_FLAG_CLEARTEXT_LIMITED_SEEK 1 << 14 ///< (Link Protection) currently not used
+
namespace upnp {
+struct DLNA4thField {
+ DLNA4thField();
+ DLNA4thField(string pn,
+ uint8_t op = DLNA_OPERATION_NONE,
+ string ps = DLNA_PLAYSPEEDS_NONE,
+ bool ci = DLNA_CONVERSION_NONE,
+ uint32_t flags = DLNA_FLAG_NONE);
+
+ string profile;
+ uint8_t operations;
+ string playSpeeds;
+ bool conversionIndicator;
+ uint32_t primaryFlags;
+
+ string ToString();
+};
+
namespace video {
}
diff --git a/include/plugin.h b/include/plugin.h
index 5607a7e..6749336 100644
--- a/include/plugin.h
+++ b/include/plugin.h
@@ -142,6 +142,8 @@ public:
class Resource {
public:
+ Resource();
+
bool SetResourceUri(string resourceUri);
bool SetProtocolInfo(string protocolInfo);
bool SetDuration(string duration);
diff --git a/media/pluginManager.cpp b/media/pluginManager.cpp
index baacbc2..ea7f82a 100644
--- a/media/pluginManager.cpp
+++ b/media/pluginManager.cpp
@@ -180,6 +180,20 @@ string cMetadata::Property::GetKey() const {
return key;
}
+cMetadata::Resource::Resource()
+: resourceUri(string())
+, protocolInfo(string())
+, duration(string())
+, resolution(string())
+, bitrate(0)
+, size(0)
+, sampleFrequency(0)
+, bitsPerSample(0)
+, nrAudioChannels(0)
+, colorDepth(0)
+{
+}
+
bool cMetadata::Resource::SetResourceUri(string resourceUri){
this->resourceUri = resourceUri;
return true;
diff --git a/media/profile.cpp b/media/profile.cpp
index 1b7b81c..0cff566 100644
--- a/media/profile.cpp
+++ b/media/profile.cpp
@@ -6,9 +6,45 @@
*/
#include "../include/media/profile.h"
+#include <sstream>
+#include <bitset>
using namespace upnp;
+DLNA4thField::DLNA4thField()
+: profile(string())
+, operations(DLNA_OPERATION_NONE)
+, playSpeeds(DLNA_PLAYSPEEDS_NONE)
+, conversionIndicator(DLNA_CONVERSION_NONE)
+, primaryFlags(DLNA_FLAG_NONE)
+{
+}
+
+DLNA4thField::DLNA4thField(string pn, uint8_t op, string ps, bool ci, uint32_t flags)
+: profile(pn)
+, operations(op)
+, playSpeeds(ps)
+, conversionIndicator(ci)
+, primaryFlags(flags)
+{
+}
+
+string DLNA4thField::ToString(){
+ stringstream ss;
+
+ if(profile.empty()) return "*";
+
+ ss << "DLNA.ORG_PN=" << profile << ";";
+
+ ss << "DLNA.ORG_OP=" << bitset<2>(operations) << ";";
+
+ ss << "DLNA.ORG_CI=" << bitset<1>(conversionIndicator) << ";";
+
+ ss << "DLNA.ORG_FLAGS=" << hex << primaryFlags << "000000000000000000000000" << ";";
+
+ return ss.str();
+}
+
image::cIcon image::DLNA_ICON_PNG_SM_24A = { "image/png", 48, 48, 24 };
image::cIcon image::DLNA_ICON_PNG_LRG_24A = { "image/png", 120, 120, 24 };
diff --git a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp
index eb578a0..4bb14c6 100644
--- a/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp
+++ b/plugins/profiler/vdrDVBProfiler/dvbProfiler.cpp
@@ -12,6 +12,7 @@
#include <tools.h>
#include <string>
#include <sstream>
+#include <media/profile.h>
using namespace std;
@@ -40,13 +41,68 @@ public:
private:
virtual bool GetRecordingMetadata(const string& uri, cMetadata& metadata){
- dsyslog("DvbProfiler\tGetting recording metadata for '%s'", uri.c_str());
+ //TODO
return false;
}
virtual bool GetChannelMetadata(const string& uri, cMetadata& metadata){
- dsyslog("DvbProfiler\tGetting channel metadata for '%s'", uri.c_str());
- return false;
+
+ tChannelID channelID = tChannelID::FromString(uri.substr(6).c_str());
+ if(!channelID.Valid()) return false;
+
+ cChannel* channel = Channels.GetByChannelID(channelID);
+ if(channel == NULL) return false;
+
+ // First of all we can set the default information.
+
+ string parentUri = uri.substr(0, uri.find_last_of('/')+1);
+
+ metadata.SetObjectIDByUri(uri);
+ metadata.SetParentIDByUri(parentUri);
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_CLASS, string("object.item.videoItem.videoBroadcast")));
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_RESTRICTED, true));
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_CHANNEL_NAME, string(channel->Name())));
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_CHANNEL_NR, (long int)channel->Number()));
+
+ // Now, we try to get the present event of the schedule
+ metadata.SetProperty(cMetadata::Property(property::object::KEY_TITLE, string(channel->Name())));
+
+ cMetadata::Resource resource;
+
+ stringstream protocolInfo;
+
+ protocolInfo << "http-get:*:video/mpeg:";
+
+ DLNA4thField fourthfield;
+
+ switch (channel->Vtype()) {
+ case 0x02:
+ fourthfield = DLNA4thField("MPEG_TS_SD_EU_ISO", DLNA_OPERATION_NONE,
+ DLNA_PLAYSPEEDS_NONE, DLNA_CONVERSION_NONE,
+ DLNA_FLAG_STREAMING_TRANSFER |
+ DLNA_FLAG_SN_INCREASE |
+ DLNA_FLAG_VERSION_1_5 );
+ break;
+ case 0x1B:
+ fourthfield = DLNA4thField("AVC_TS_HD_EU_ISO", DLNA_OPERATION_NONE,
+ DLNA_PLAYSPEEDS_NONE, DLNA_CONVERSION_NONE,
+ DLNA_FLAG_STREAMING_TRANSFER |
+ DLNA_FLAG_SN_INCREASE |
+ DLNA_FLAG_VERSION_1_5 );
+ break;
+ default:
+ return false;
+ break;
+ }
+
+ protocolInfo << fourthfield.ToString();
+
+ resource.SetResourceUri(uri);
+ resource.SetProtocolInfo(protocolInfo.str());
+
+ metadata.AddResource(resource);
+
+ return true;
}
};