Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MythFrontend: Add playback support to the http interface.

- convert the network control code to use a MythEvent message with the
new ACTION_HANDLEMEDIA action and a QStringList for the arguments.

- support ACTION_HANDLEMEDIA in MythFEXML.

The following commands are now functionally equivalent for the network
control and http interfaces (though the http version will currently only
work when the UI is on the main screen):-

play file myth://Videos@backend-ip:6543/test.mpg
http://backend-
ip:6543/test.mpg
  • Loading branch information...
commit 30bdb491626e6bf4fcf2135a236574c3882e72e5 1 parent 9357aaf
Mark Kendall authored
View
12 mythtv/libs/libmythui/mythmainwindow.cpp
@@ -1025,6 +1025,8 @@ void MythMainWindow::InitKeys()
"Edit"), "E");
RegisterKey("Global", ACTION_SCREENSHOT, QT_TRANSLATE_NOOP("MythControls",
"Save screenshot"), "");
+ RegisterKey("Global", ACTION_HANDLEMEDIA, QT_TRANSLATE_NOOP("MythControls",
+ "Play a media resource"), "");
RegisterKey("Global", "PAGEUP", QT_TRANSLATE_NOOP("MythControls",
"Page Up"), "PgUp");
@@ -2189,12 +2191,12 @@ void MythMainWindow::customEvent(QEvent *ce)
MythEvent *me = (MythEvent *)ce;
QString message = me->Message();
- if (message.left(12) == "HANDLE_MEDIA")
+ if (message.startsWith(ACTION_HANDLEMEDIA))
{
- QStringList tokens = message.split(' ', QString::SkipEmptyParts);
- HandleMedia(tokens[1],
- message.mid(tokens[0].length() +
- tokens[1].length() + 2));
+ if (me->ExtraDataCount() == 1)
+ HandleMedia("Internal", me->ExtraData(0));
+ else
+ VERBOSE(VB_IMPORTANT, "Failed to handle media");
}
else if (message.startsWith(ACTION_SCREENSHOT))
{
View
3  mythtv/libs/libmythui/mythuiactions.h
@@ -18,6 +18,7 @@
#define ACTION_LEFT "LEFT"
#define ACTION_RIGHT "RIGHT"
-#define ACTION_SCREENSHOT "SCREENSHOT"
+#define ACTION_HANDLEMEDIA "HANDLEMEDIA"
+#define ACTION_SCREENSHOT "SCREENSHOT"
#endif // MYTHUI_ACTIONS_H
View
5 mythtv/programs/mythfrontend/mythfexml.cpp
@@ -187,6 +187,11 @@ void MythFEXML::SendAction(HTTPRequest *pRequest)
args << map->value("height");
valid = true;
}
+ else if (ACTION_HANDLEMEDIA == sText && 2 == pcount)
+ {
+ args << map->value("file");
+ valid = true;
+ }
if (valid)
{
View
7 mythtv/programs/mythfrontend/networkcontrol.cpp
@@ -588,9 +588,10 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID)
if (GetMythUI()->GetCurrentLocation().toLower() == "mainmenu")
{
- QString msg = QString("HANDLE_MEDIA Internal %1").arg(nc->getFrom(2));
- MythEvent me(msg);
- QCoreApplication::postEvent(GetMythMainWindow(), me.clone());
+ QStringList args;
+ args << nc->getFrom(2);
+ MythEvent *me = new MythEvent(ACTION_HANDLEMEDIA, args);
+ qApp->postEvent(GetMythMainWindow(), me);
}
else
return QString("Unable to change to main menu to start playback!");
Please sign in to comment.
Something went wrong with that request. Please try again.