Skip to content

Commit 382fbcc

Browse files
author
Mark Kendall
committed
MythFrontend: Add a UPnP Media Server scanner.
N.B. This is disabled for the time being while the UI side is added and an outstanding thread contention issue is resolved. This will currently successfully detect other UPnP media servers on the network (while ignoring the master backend), retrieve and parse their device descriptions and then subscribe to their event URLs for media update notifications. Subscriptions are renewed before they expire and there is initial support for browsing the media available from each device. Tested with PlayOn, gmediaserver, Windows Media Player 11 and mediatomb. The code is entirely event driven, sits its own low priority thread and should have extremely low resource demands in normal use. Given recent issues with 'background' events causing playback issues, however, I've added a minimum level of general logging that should flag up any scanning activity and thus correlate it with any pauses etc. If a media server becomes available during playback there may be a small spike in cpu utilisation while the device description xml file is parsed - though in testing this has not caused any issues at all. Additional code is still needed to iterate through and download all the media metadata available on each server and for UI integration.
1 parent 0b1a15b commit 382fbcc

File tree

4 files changed

+1069
-2
lines changed

4 files changed

+1069
-2
lines changed

mythtv/programs/mythfrontend/mediarenderer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "mediarenderer.h"
1313
#include "mythfexml.h"
1414
#include "compat.h"
15+
#include "upnpsubscription.h"
16+
#include "upnpscanner.h"
1517

1618
class MythFrontendStatus : public HttpServerExtension
1719
{
@@ -272,8 +274,16 @@ MediaRenderer::MediaRenderer()
272274
// VERBOSE(VB_UPNP, QString( "MediaRenderer::Registering RenderingControl Service." ));
273275
// m_pHttpServer->RegisterExtension( m_pUPnpRCTL= new UPnpRCTL( RootDevice() ));
274276

277+
//VERBOSE(VB_UPNP, QString("MediaRenderer: Registering subscription service."));
278+
//UPNPSubscription *subscription =
279+
// new UPNPSubscription(m_pHttpServer->m_sSharePath, nPort);
280+
//m_pHttpServer->RegisterExtension(subscription);
281+
275282
Start();
276283

284+
// Start scanning for UPnP media servers
285+
//UPNPScanner::Enable(true, subscription);
286+
277287
// ensure the frontend is aware of all backends (slave and master) and
278288
// other frontends
279289
SSDP::Instance()->PerformSearch("ssdp:all");

mythtv/programs/mythfrontend/mythfrontend.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ HEADERS += videofileassoc.h videometadatasettings.h
3838
HEADERS += videoplayercommand.h videopopups.h
3939
HEADERS += videofilter.h videolist.h
4040
HEADERS += videoplayersettings.h videodlg.h
41-
HEADERS += videoglobalsettings.h
41+
HEADERS += videoglobalsettings.h upnpscanner.h
4242

4343
SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp
4444
SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp
@@ -58,7 +58,7 @@ SOURCES += videofileassoc.cpp videometadatasettings.cpp
5858
SOURCES += videoplayercommand.cpp videopopups.cpp
5959
SOURCES += videofilter.cpp videolist.cpp
6060
SOURCES += videoplayersettings.cpp videodlg.cpp
61-
SOURCES += videoglobalsettings.cpp
61+
SOURCES += videoglobalsettings.cpp upnpscanner.cpp
6262

6363
macx {
6464
mac_bundle {

0 commit comments

Comments
 (0)