aboutsummaryrefslogtreecommitdiff
path: root/lib/service/servicemp3.cpp
diff options
context:
space:
mode:
authorFraxinas <andreas.frisch@multimedia-labs.de>2010-07-20 10:06:11 +0200
committerghost <andreas.monzner@multimedia-labs.de>2010-10-06 12:23:23 +0200
commit81ffdf5509cc46accb9d607ac5e51ae07d38c041 (patch)
treefe3bcc4c1de5fd55e35ea23e8d2e66f3ccb2b683 /lib/service/servicemp3.cpp
parentaba0cdf8718a41a4ac3397131b45d272d119d60b (diff)
downloadenigma2-81ffdf5509cc46accb9d607ac5e51ae07d38c041.tar.gz
enigma2-81ffdf5509cc46accb9d607ac5e51ae07d38c041.zip
implement configurable http user-agent (fixes #224)
Diffstat (limited to 'lib/service/servicemp3.cpp')
-rw-r--r--lib/service/servicemp3.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index 154f4868..3ab4924a 100644
--- a/lib/service/servicemp3.cpp
+++ b/lib/service/servicemp3.cpp
@@ -287,6 +287,15 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
if ( sourceinfo.is_streaming )
{
uri = g_strdup_printf ("%s", filename);
+
+ std::string config_str;
+ if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 )
+ {
+ if ( config_str == "True" )
+ ePythonConfigQuery::getConfigValue("config.mediaplayer.alternateUserAgent", m_useragent);
+ }
+ if ( m_useragent.length() == 0 )
+ m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer";
}
else if ( sourceinfo.containertype == ctCDA )
{
@@ -347,6 +356,10 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
subs.language_code = std::string("und");
m_subtitleStreams.push_back(subs);
}
+ if ( sourceinfo.is_streaming )
+ {
+ g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this);
+ }
} else
{
m_event((iPlayableService*)this, evUser+12);
@@ -1364,6 +1377,15 @@ GstBusSyncReply eServiceMP3::gstBusSyncHandler(GstBus *bus, GstMessage *message,
return GST_BUS_PASS;
}
+void eServiceMP3::gstHTTPSourceSetAgent(GObject *object, GParamSpec *unused, gpointer user_data)
+{
+ eServiceMP3 *_this = (eServiceMP3*)user_data;
+ GstElement *source;
+ g_object_get(_this->m_gst_playbin, "source", &source, NULL);
+ g_object_set (G_OBJECT (source), "user-agent", _this->m_useragent.c_str(), NULL);
+ gst_object_unref(source);
+}
+
audiotype_t eServiceMP3::gstCheckAudioPad(GstStructure* structure)
{
if (!structure)