vrplayer: many fixes

This commit is contained in:
Jay Sorg
2013-12-18 23:33:28 -08:00
parent d60fd3f513
commit 75978a702b
8 changed files with 117 additions and 95 deletions
+12
View File
@@ -29,6 +29,18 @@ void DemuxMedia::setVcrOp(int op)
vcrMutex.lock();
vcrFlag = op;
vcrMutex.unlock();
if (op == VCR_STOP)
{
clear();
}
}
int DemuxMedia::clear()
{
sendMutex.lock();
videoQueue->clear();
sendMutex.unlock();
return 0;
}
void DemuxMedia::startDemuxing()
+1
View File
@@ -41,6 +41,7 @@ public:
void *channel = 0, int stream_id = 101);
void setVcrOp(int op);
int clear();
public slots:
void startDemuxing();
+16 -7
View File
@@ -295,11 +295,9 @@ void MainWindow::getVdoGeometry(QRect *rect)
void MainWindow::clearDisplay()
{
QPixmap pixmap(100,100);
pixmap.fill(QColor(0x00, 0x00, 0x00));
QPainter painter(&pixmap);
painter.setBrush(QBrush(Qt::black));
lblVideo->setPixmap(pixmap);
/* TODO: this needs to be set after video actually stops
* a few frames come after this */
lblVideo->update();
}
/*******************************************************************************
@@ -333,11 +331,21 @@ void MainWindow::on_actionOpen_Media_File_triggered()
{
remoteClientInited = false;
interface->deInitRemoteClient();
interface->initRemoteClient();
if (interface->initRemoteClient() != 0)
{
QMessageBox::question(this, "vrplayer", "Unsupported codec",
QMessageBox::Ok);
return;
}
}
else
{
interface->initRemoteClient();
if (interface->initRemoteClient() != 0)
{
QMessageBox::question(this, "vrplayer", "Unsupported codec",
QMessageBox::Ok);
return;
}
}
demuxMedia = interface->getDemuxMediaInstance();
@@ -413,6 +421,7 @@ void MainWindow::onBtnStopClicked(bool)
lblCurrentPos->setText("00:00:00");
/* clear screen by filling it with black */
usleep(500 * 1000);
clearDisplay();
btnPlay->setChecked(false);
+11 -6
View File
@@ -32,7 +32,8 @@ void OurInterface::oneTimeDeinit()
closeVirtualChannel();
}
void OurInterface::initRemoteClient()
/* returns error */
int OurInterface::initRemoteClient()
{
int64_t start_time;
int64_t duration;
@@ -40,18 +41,21 @@ void OurInterface::initRemoteClient()
//elapsedTime = 0;
if (sendMetadataFile())
return;
return 1;
if (sendVideoFormat())
return;
return 1;
if (sendAudioFormat())
return;
return 1;
if (sendGeometry(savedGeometry))
return;
return 1;
xrdpvr_play_media(channel, 101, filename.toAscii().data());
if (xrdpvr_play_media(channel, 101, filename.toAscii().data()) != 0)
{
return 1;
}
xrdpvr_get_media_duration(&start_time, &duration);
//qDebug() << "ourInterface:initRemoteClient: emit onMediaDurationInSecs: dur=" << duration;
@@ -66,6 +70,7 @@ void OurInterface::initRemoteClient()
demuxMedia->moveToThread(demuxMediaThread);
//playVideo = demuxMedia->getPlayVideoInstance();
}
return 0;
}
void OurInterface::deInitRemoteClient()
+2 -2
View File
@@ -31,11 +31,11 @@ class OurInterface : public QObject
public:
explicit OurInterface(QObject *parent = 0);
/* public methods */
int oneTimeInit();
void oneTimeDeinit();
void initRemoteClient();
int initRemoteClient();
void deInitRemoteClient();
int sendGeometry(QRect rect);
void setFilename(QString filename);