vrplayer: added feature to automatically restart media on end of stream
This commit is contained in:
parent
78498f6682
commit
374cb93ded
@ -1,17 +1,32 @@
|
|||||||
|
|
||||||
A QT based media player that runs on a RDP server and
|
A QT based media player that runs on a RDP server and
|
||||||
redirects audio/video to the client where it is decoded
|
redirects audio/video to the client where it is decoded
|
||||||
and rendered locally
|
and rendered locally
|
||||||
|
|
||||||
To build vrplayer, installl QT 4.x , then run
|
Required packages to build vrplayer:
|
||||||
|
------------------------------------
|
||||||
|
libqt4-gui
|
||||||
|
qt4-dev-tools
|
||||||
|
libavutil-dev
|
||||||
|
libavformat-dev
|
||||||
|
|
||||||
|
to build vrplayer
|
||||||
|
-----------------
|
||||||
|
cd ../xrdpvr
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
qmake
|
qmake
|
||||||
make
|
make
|
||||||
|
|
||||||
mint 13 packages
|
To run vrplayer
|
||||||
libqt4-gui
|
---------------
|
||||||
qt4-dev-tools
|
include xrdpapi/.libs and xrdpvr/.libs in your LD_LIBRARY_PATH
|
||||||
|
|
||||||
To run vrplayer, include xrdpapi/.libs and xrdpvr/.libs in
|
Example:
|
||||||
your LD_LIBRARY_PATH
|
--------
|
||||||
|
export LD_LIBRARY_PATH=../xrdpapi/.libs:../xrdpvr/.libs
|
||||||
|
run vrplayer inside the xfreerdp session
|
||||||
|
|
||||||
|
this is how we run xfreerdp:
|
||||||
|
----------------------------
|
||||||
|
./xfreerdp --sec rdp --plugin xrdpvr 192.168.2.149
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ void DemuxMedia::startDemuxing()
|
|||||||
{
|
{
|
||||||
/* looks like we reached end of file */
|
/* looks like we reached end of file */
|
||||||
delete mediaPkt;
|
delete mediaPkt;
|
||||||
|
playVideo->onMediaRestarted();
|
||||||
usleep(1000 * 100);
|
usleep(1000 * 100);
|
||||||
|
xrdpvr_seek_media(0, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ extern "C"
|
|||||||
class DemuxMedia : public QObject
|
class DemuxMedia : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DemuxMedia(QObject *parent = 0, QQueue<MediaPacket *> *audioQueue = 0,
|
explicit DemuxMedia(QObject *parent = 0, QQueue<MediaPacket *> *audioQueue = 0,
|
||||||
QQueue<MediaPacket *> *videoQueue = 0, void *channel = 0, int stream_id = 101);
|
QQueue<MediaPacket *> *videoQueue = 0, void *channel = 0, int stream_id = 101);
|
||||||
@ -60,6 +61,9 @@ private:
|
|||||||
QMutex sendMutex;
|
QMutex sendMutex;
|
||||||
|
|
||||||
void startAudioVideoThreads();
|
void startAudioVideoThreads();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void onMediaRestarted();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEMUXMEDIA_H
|
#endif // DEMUXMEDIA_H
|
||||||
|
@ -275,7 +275,6 @@ void MainWindow::onBtnPlayClicked(bool)
|
|||||||
interface->setVcrOp(VCR_PLAY);
|
interface->setVcrOp(VCR_PLAY);
|
||||||
vcrFlag = VCR_PLAY;
|
vcrFlag = VCR_PLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (vcrFlag == VCR_STOP)
|
else if (vcrFlag == VCR_STOP)
|
||||||
{
|
{
|
||||||
/* btn clicked while stopped - enter play mode */
|
/* btn clicked while stopped - enter play mode */
|
||||||
@ -312,15 +311,13 @@ void MainWindow::onMediaDurationInSeconds(int duration)
|
|||||||
int secs = 0;
|
int secs = 0;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
//return;
|
|
||||||
|
|
||||||
/* setup progress bar */
|
/* setup progress bar */
|
||||||
slider->setMinimum(0);
|
slider->setMinimum(0);
|
||||||
slider->setMaximum(duration * 100); /* in hundredth of a sec */
|
slider->setMaximum(duration * 100); /* in hundredth of a sec */
|
||||||
slider->setValue(0);
|
slider->setValue(0);
|
||||||
slider->setSliderPosition(0);
|
slider->setSliderPosition(0);
|
||||||
lblCurrentPos->setText("00:00:00");
|
lblCurrentPos->setText("00:00:00");
|
||||||
qDebug() << "media_duration=" << duration << " in hundredth of a sec:" << duration * 100;
|
//qDebug() << "media_duration=" << duration << " in hundredth of a sec:" << duration * 100;
|
||||||
|
|
||||||
/* convert from seconds to hours:minutes:seconds */
|
/* convert from seconds to hours:minutes:seconds */
|
||||||
hours = duration / 3600;
|
hours = duration / 3600;
|
||||||
@ -345,26 +342,24 @@ void MainWindow::onElapsedTime(int val)
|
|||||||
int hours = 0;
|
int hours = 0;
|
||||||
int minutes = 0;
|
int minutes = 0;
|
||||||
int secs = 0;
|
int secs = 0;
|
||||||
int duration = val / 100;
|
int duration = 0;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
if (vcrFlag == VCR_STOP)
|
if (vcrFlag == VCR_STOP)
|
||||||
{
|
|
||||||
qDebug() << "onElapsedTime: not updating slider coz of VCR_STOP";
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* if slider bar is down, do not update */
|
/* if slider bar is down, do not update */
|
||||||
if (slider->isSliderDown())
|
if (slider->isSliderDown())
|
||||||
{
|
|
||||||
qDebug() << "onElapsedTime: not updating slider coz slider is down";
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* update progress bar */
|
/* update progress bar */
|
||||||
|
if (val >= slider->maximum())
|
||||||
|
val = 0;
|
||||||
|
|
||||||
slider->setSliderPosition(val);
|
slider->setSliderPosition(val);
|
||||||
|
|
||||||
/* convert from seconds to hours:minutes:seconds */
|
/* convert from seconds to hours:minutes:seconds */
|
||||||
|
duration = val / 100;
|
||||||
hours = duration / 3600;
|
hours = duration / 3600;
|
||||||
if (hours)
|
if (hours)
|
||||||
duration -= (hours * 3600);
|
duration -= (hours * 3600);
|
||||||
@ -409,10 +404,3 @@ void MainWindow::onSliderActionTriggered(int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
// LK_TODO delete this
|
|
||||||
void MainWindow::mouseMoveEvent(QMouseEvent *)
|
|
||||||
{
|
|
||||||
//qDebug() << "mouseMoveEvent: x=" << e->globalX() << "y=" << e->globalY();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -80,7 +80,6 @@ protected:
|
|||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
void moveEvent(QMoveEvent *e);
|
void moveEvent(QMoveEvent *e);
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
@ -53,7 +53,7 @@ void OurInterface::initRemoteClient()
|
|||||||
xrdpvr_play_media(channel, 101, filename.toAscii().data());
|
xrdpvr_play_media(channel, 101, filename.toAscii().data());
|
||||||
|
|
||||||
xrdpvr_get_media_duration(&start_time, &duration);
|
xrdpvr_get_media_duration(&start_time, &duration);
|
||||||
qDebug() << "ourInterface:initRemoteClient: emit onMediaDurationInSecs: dur=" << duration;
|
//qDebug() << "ourInterface:initRemoteClient: emit onMediaDurationInSecs: dur=" << duration;
|
||||||
emit onMediaDurationInSeconds(duration);
|
emit onMediaDurationInSeconds(duration);
|
||||||
|
|
||||||
/* LK_TODO this needs to be undone in deinitRemoteClient() */
|
/* LK_TODO this needs to be undone in deinitRemoteClient() */
|
||||||
@ -180,7 +180,7 @@ void OurInterface::onGeometryChanged(int x, int y, int width, int height)
|
|||||||
savedGeometry.setWidth(width);
|
savedGeometry.setWidth(width);
|
||||||
savedGeometry.setHeight(height);
|
savedGeometry.setHeight(height);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
qDebug() << "OurInterface:signal" <<
|
qDebug() << "OurInterface:signal" <<
|
||||||
"" << savedGeometry.x() <<
|
"" << savedGeometry.x() <<
|
||||||
"" << savedGeometry.y() <<
|
"" << savedGeometry.y() <<
|
||||||
@ -188,8 +188,6 @@ void OurInterface::onGeometryChanged(int x, int y, int width, int height)
|
|||||||
"" << savedGeometry.height();
|
"" << savedGeometry.height();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qDebug() << "setting geometry:channel=" << channel;
|
|
||||||
|
|
||||||
if (channel)
|
if (channel)
|
||||||
{
|
{
|
||||||
xrdpvr_set_geometry(channel, 101, savedGeometry.x(), savedGeometry.y(),
|
xrdpvr_set_geometry(channel, 101, savedGeometry.x(), savedGeometry.y(),
|
||||||
|
@ -105,6 +105,11 @@ label1:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayVideo::onMediaRestarted()
|
||||||
|
{
|
||||||
|
elapsedTime = av_gettime();
|
||||||
|
}
|
||||||
|
|
||||||
void PlayVideo::onMediaSeek(int value)
|
void PlayVideo::onMediaSeek(int value)
|
||||||
{
|
{
|
||||||
posMutex.lock();
|
posMutex.lock();
|
||||||
@ -125,7 +130,7 @@ void PlayVideo::updateMediaPos()
|
|||||||
posMutex.lock();
|
posMutex.lock();
|
||||||
if (la_seekPos >= 0)
|
if (la_seekPos >= 0)
|
||||||
{
|
{
|
||||||
qDebug() << "seeking to" << la_seekPos;
|
//qDebug() << "seeking to" << la_seekPos;
|
||||||
xrdpvr_seek_media(la_seekPos, 0);
|
xrdpvr_seek_media(la_seekPos, 0);
|
||||||
elapsedTime = av_gettime() - la_seekPos * 1000000;
|
elapsedTime = av_gettime() - la_seekPos * 1000000;
|
||||||
la_seekPos = -1;
|
la_seekPos = -1;
|
||||||
@ -164,7 +169,7 @@ void DecoderThread::updateSlider()
|
|||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (la_seekPos >= 0)
|
if (la_seekPos >= 0)
|
||||||
{
|
{
|
||||||
qDebug() << "seeking to" << la_seekPos;
|
//qDebug() << "seeking to" << la_seekPos;
|
||||||
//audioTimer->stop();
|
//audioTimer->stop();
|
||||||
//videoTimer->stop();
|
//videoTimer->stop();
|
||||||
xrdpvr_seek_media(la_seekPos, 0);
|
xrdpvr_seek_media(la_seekPos, 0);
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
|
|
||||||
void onMediaSeek(int value);
|
void onMediaSeek(int value);
|
||||||
void setVcrOp(int op);
|
void setVcrOp(int op);
|
||||||
|
void onMediaRestarted();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void play();
|
void play();
|
||||||
|
Loading…
Reference in New Issue
Block a user