[SCM] kodi-pvr-hts/master: add support for retrieving the list of available stremaing profiles from the server
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Wed Mar 2 23:01:48 UTC 2016
The following commit has been merged in the master branch:
commit 313b95ae781b9d3aeeaeb136ebfb7a5d6dd2e156
Author: Sam Stenvall <sam.stenvall at nordsoftware.com>
Date: Sun Oct 18 13:30:54 2015 +0300
add support for retrieving the list of available stremaing profiles
from the server
diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index 0b5321b..6dadf14 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -106,6 +106,53 @@ std::string CTvheadend::GetImageURL ( const char *str )
}
}
+void CTvheadend::QueryAvailableProfiles()
+{
+ /* Build message */
+ htsmsg_t *m = htsmsg_create_map();
+
+ /* Send */
+ {
+ CLockObject lock(m_conn.Mutex());
+ m = m_conn.SendAndWait("getProfiles", m);
+ }
+
+ /* Validate */
+ if (m == nullptr)
+ return;
+
+ htsmsg_t *l;
+ htsmsg_field_t *f;
+
+ if ((l = htsmsg_get_list(m, "profiles")) == NULL)
+ {
+ tvherror("malformed getProfiles: 'profiles' missing");
+ htsmsg_destroy(m);
+ return;
+ }
+
+ /* Process */
+ HTSMSG_FOREACH(f, l)
+ {
+ const char *str;
+ Profile profile;
+
+ if ((str = htsmsg_get_str(&f->hmf_msg, "uuid")) != NULL)
+ profile.SetUuid(str);
+ if ((str = htsmsg_get_str(&f->hmf_msg, "name")) != NULL)
+ profile.SetName(str);
+ if ((str = htsmsg_get_str(&f->hmf_msg, "comment")) != NULL)
+ profile.SetComment(str);
+
+ tvhdebug("profile name: %s, comment: %s added",
+ profile.GetName().c_str(), profile.GetComment().c_str());
+
+ m_profiles.push_back(profile);
+ }
+
+ htsmsg_destroy(m);
+}
+
/* **************************************************************************
* Tags
* *************************************************************************/
diff --git a/src/Tvheadend.h b/src/Tvheadend.h
index a4b254d..39d5226 100644
--- a/src/Tvheadend.h
+++ b/src/Tvheadend.h
@@ -33,6 +33,7 @@
#include "HTSPTypes.h"
#include "AsyncState.h"
#include "tvheadend/ChannelTuningPredictor.h"
+#include "tvheadend/Profile.h"
#include "tvheadend/entity/Tag.h"
#include "tvheadend/entity/Channel.h"
#include "tvheadend/entity/Recording.h"
@@ -401,6 +402,12 @@ public:
PVR_ERROR GetEpg ( ADDON_HANDLE handle, const PVR_CHANNEL &chn,
time_t start, time_t end );
+
+ /**
+ * Queries the server for available streaming profiles and populates
+ * m_profiles
+ */
+ void QueryAvailableProfiles();
private:
bool CreateTimer ( const tvheadend::entity::Recording &tvhTmr, PVR_TIMER &tmr );
@@ -408,6 +415,11 @@ private:
uint32_t GetNextUnnumberedChannelNumber ();
std::string GetImageURL ( const char *str );
+ /**
+ * The streaming profiles available on the server
+ */
+ tvheadend::Profiles m_profiles;
+
PLATFORM::CMutex m_mutex;
CHTSPConnection m_conn;
diff --git a/src/tvheadend/status/SourceInfo.h b/src/tvheadend/Profile.h
similarity index 54%
copy from src/tvheadend/status/SourceInfo.h
copy to src/tvheadend/Profile.h
index 611e757..0ef2ac4 100644
--- a/src/tvheadend/status/SourceInfo.h
+++ b/src/tvheadend/Profile.h
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2005-2015 Team Kodi
- * http://kodi.tv
+ * http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,52 +22,45 @@
*/
#include <string>
+#include <vector>
namespace tvheadend
{
- namespace status
+
+ class Profile;
+ typedef std::vector<Profile> Profiles;
+
+ /**
+ * Represents a single streaming profile
+ */
+ class Profile
{
- /**
- * Represents information about the current service
- */
- struct SourceInfo
- {
- /**
- * The current adapter used
- */
- std::string si_adapter;
+ public:
+
+ std::string GetUuid() const { return m_uuid; }
+ void SetUuid(const std::string &uuid) { m_uuid = uuid; }
- /**
- * The network
- */
- std::string si_network;
+ std::string GetName() const { return m_name; }
+ void SetName(const std::string &name) { m_name = name; }
- /**
- * The mux
- */
- std::string si_mux;
+ std::string GetComment() const { return m_comment; }
+ void SetComment(const std::string &comment) { m_comment = comment; }
- /**
- * The service provider
- */
- std::string si_provider;
+ private:
+ /*
+ * The profile UUID
+ */
+ std::string m_uuid;
- /**
- * The service name
- */
- std::string si_service;
+ /**
+ * The profile name
+ */
+ std::string m_name;
+
+ /**
+ * The profile comment
+ */
+ std::string m_comment;
+ };
- /**
- * Clears the current status
- */
- void Clear()
- {
- si_adapter.clear();
- si_network.clear();
- si_mux.clear();
- si_provider.clear();
- si_service.clear();
- }
- };
- }
}
--
kodi-pvr-hts packaging
More information about the pkg-multimedia-commits
mailing list