summaryrefslogtreecommitdiffstats
path: root/vrplayer/decoder.cpp
diff options
context:
space:
mode:
authorLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-12-08 16:36:41 -0800
committerLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2012-12-08 16:36:41 -0800
commit4c67aad4c46be80466017b082eae8d9ffad2768d (patch)
treea970451c336fa2078d4511ffa9660826f1517ac4 /vrplayer/decoder.cpp
parent309f2225b1f6c56d954c4eaf512474a7d1303a95 (diff)
downloadxrdp-proprietary-4c67aad4c46be80466017b082eae8d9ffad2768d.tar.gz
xrdp-proprietary-4c67aad4c46be80466017b082eae8d9ffad2768d.zip
o development checkin
o added vrplayer
Diffstat (limited to 'vrplayer/decoder.cpp')
-rw-r--r--vrplayer/decoder.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/vrplayer/decoder.cpp b/vrplayer/decoder.cpp
new file mode 100644
index 00000000..b1741997
--- /dev/null
+++ b/vrplayer/decoder.cpp
@@ -0,0 +1,72 @@
+#include "decoder.h"
+
+Decoder::Decoder(QObject *parent) :
+ QObject(parent)
+{
+ channel = NULL;
+}
+
+/*
+ * inititialize the decoder
+ *
+ * @return 0 on success, -1 on failure
+ *****************************************************************************/
+int Decoder::init(QString filename)
+{
+ if (channel)
+ return -1;
+
+ /* open a virtual channel and connect to remote client */
+ channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "xrdpvr", 0);
+ if (channel == NULL)
+ {
+ qDebug() << "WTSVirtualChannelOpenEx() failed\n";
+ return -1;
+ }
+
+ /* initialize the player */
+ if (xrdpvr_init_player(channel, 101, filename.toAscii().data()))
+ {
+ fprintf(stderr, "failed to initialize the player\n");
+ return -1;
+ }
+
+#if 1
+ sleep(1);
+ qDebug() << "sleeping 1";
+ xrdpvr_set_geometry(channel, 101, mainWindowGeometry.x(),
+ mainWindowGeometry.y(), mainWindowGeometry.width(),
+ mainWindowGeometry.height());
+ qDebug() << "set geometry to:" << mainWindowGeometry.x() <<
+ "" << mainWindowGeometry.y() <<
+ "" << mainWindowGeometry.width() <<
+ "" << mainWindowGeometry.height();
+#endif
+
+ /* send compressed media data to client; client will decompress */
+ /* the media and play it locally */
+ xrdpvr_play_media(channel, 101, filename.toAscii().data());
+
+ /* perform clean up */
+ xrdpvr_deinit_player(channel, 101);
+
+ WTSVirtualChannelClose(channel);
+
+ return 0;
+}
+
+void Decoder::onGeometryChanged(QRect *g)
+{
+#if 1
+ mainWindowGeometry.setX(g->x());
+ mainWindowGeometry.setY(g->y());
+ mainWindowGeometry.setWidth(g->width());
+ mainWindowGeometry.setHeight(g->height());
+#else
+ if (!channel)
+ return;
+
+ xrdpvr_set_geometry(channel, 101, g->x(), g->y(), g->width(), g->height());
+ qDebug() << "sent geometry";
+#endif
+}