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
|
||||
redirects audio/video to the client where it is decoded
|
||||
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
|
||||
make
|
||||
|
||||
mint 13 packages
|
||||
libqt4-gui
|
||||
qt4-dev-tools
|
||||
To run vrplayer
|
||||
---------------
|
||||
include xrdpapi/.libs and xrdpvr/.libs in your LD_LIBRARY_PATH
|
||||
|
||||
To run vrplayer, include xrdpapi/.libs and xrdpvr/.libs in
|
||||
your LD_LIBRARY_PATH
|
||||
Example:
|
||||
--------
|
||||
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 */
|
||||
delete mediaPkt;
|
||||
playVideo->onMediaRestarted();
|
||||
usleep(1000 * 100);
|
||||
xrdpvr_seek_media(0, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ extern "C"
|
||||
class DemuxMedia : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DemuxMedia(QObject *parent = 0, QQueue<MediaPacket *> *audioQueue = 0,
|
||||
QQueue<MediaPacket *> *videoQueue = 0, void *channel = 0, int stream_id = 101);
|
||||
@ -60,6 +61,9 @@ private:
|
||||
QMutex sendMutex;
|
||||
|
||||
void startAudioVideoThreads();
|
||||
|
||||
signals:
|
||||
void onMediaRestarted();
|
||||
};
|
||||
|
||||
#endif // DEMUXMEDIA_H
|
||||
|
@ -275,7 +275,6 @@ void MainWindow::onBtnPlayClicked(bool)
|
||||
interface->setVcrOp(VCR_PLAY);
|
||||
vcrFlag = VCR_PLAY;
|
||||
}
|
||||
|
||||
else if (vcrFlag == VCR_STOP)
|
||||
{
|
||||
/* btn clicked while stopped - enter play mode */
|
||||
@ -312,15 +311,13 @@ void MainWindow::onMediaDurationInSeconds(int duration)
|
||||
int secs = 0;
|
||||
char buf[20];
|
||||
|
||||
//return;
|
||||
|
||||
/* setup progress bar */
|
||||
slider->setMinimum(0);
|
||||
slider->setMaximum(duration * 100); /* in hundredth of a sec */
|
||||
slider->setValue(0);
|
||||
slider->setSliderPosition(0);
|
||||
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 */
|
||||
hours = duration / 3600;
|
||||
@ -345,26 +342,24 @@ void MainWindow::onElapsedTime(int val)
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
int secs = 0;
|
||||
int duration = val / 100;
|
||||
int duration = 0;
|
||||
char buf[20];
|
||||
|
||||
if (vcrFlag == VCR_STOP)
|
||||
{
|
||||
qDebug() << "onElapsedTime: not updating slider coz of VCR_STOP";
|
||||
return;
|
||||
}
|
||||
|
||||
/* if slider bar is down, do not update */
|
||||
if (slider->isSliderDown())
|
||||
{
|
||||
qDebug() << "onElapsedTime: not updating slider coz slider is down";
|
||||
return;
|
||||
}
|
||||
|
||||
/* update progress bar */
|
||||
if (val >= slider->maximum())
|
||||
val = 0;
|
||||
|
||||
slider->setSliderPosition(val);
|
||||
|
||||
/* convert from seconds to hours:minutes:seconds */
|
||||
duration = val / 100;
|
||||
hours = duration / 3600;
|
||||
if (hours)
|
||||
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 closeEvent(QCloseEvent *e);
|
||||
void moveEvent(QMoveEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -53,7 +53,7 @@ void OurInterface::initRemoteClient()
|
||||
xrdpvr_play_media(channel, 101, filename.toAscii().data());
|
||||
|
||||
xrdpvr_get_media_duration(&start_time, &duration);
|
||||
qDebug() << "ourInterface:initRemoteClient: emit onMediaDurationInSecs: dur=" << duration;
|
||||
//qDebug() << "ourInterface:initRemoteClient: emit onMediaDurationInSecs: dur=" << duration;
|
||||
emit onMediaDurationInSeconds(duration);
|
||||
|
||||
/* 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.setHeight(height);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
qDebug() << "OurInterface:signal" <<
|
||||
"" << savedGeometry.x() <<
|
||||
"" << savedGeometry.y() <<
|
||||
@ -188,8 +188,6 @@ void OurInterface::onGeometryChanged(int x, int y, int width, int height)
|
||||
"" << savedGeometry.height();
|
||||
#endif
|
||||
|
||||
qDebug() << "setting geometry:channel=" << channel;
|
||||
|
||||
if (channel)
|
||||
{
|
||||
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)
|
||||
{
|
||||
posMutex.lock();
|
||||
@ -125,7 +130,7 @@ void PlayVideo::updateMediaPos()
|
||||
posMutex.lock();
|
||||
if (la_seekPos >= 0)
|
||||
{
|
||||
qDebug() << "seeking to" << la_seekPos;
|
||||
//qDebug() << "seeking to" << la_seekPos;
|
||||
xrdpvr_seek_media(la_seekPos, 0);
|
||||
elapsedTime = av_gettime() - la_seekPos * 1000000;
|
||||
la_seekPos = -1;
|
||||
@ -164,7 +169,7 @@ void DecoderThread::updateSlider()
|
||||
mutex.lock();
|
||||
if (la_seekPos >= 0)
|
||||
{
|
||||
qDebug() << "seeking to" << la_seekPos;
|
||||
//qDebug() << "seeking to" << la_seekPos;
|
||||
//audioTimer->stop();
|
||||
//videoTimer->stop();
|
||||
xrdpvr_seek_media(la_seekPos, 0);
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
void onMediaSeek(int value);
|
||||
void setVcrOp(int op);
|
||||
void onMediaRestarted();
|
||||
|
||||
public slots:
|
||||
void play();
|
||||
|
Loading…
Reference in New Issue
Block a user