Commit 5212f16f authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added some "compactibility sleep" for windows. Basically, a #ifdef...

Removed some debug texts
parent 2c2c3c81
......@@ -83,7 +83,6 @@ void Media::flushVolatileParameters()
QString defaultValue;
foreach ( defaultValue, m_volatileParameters )
{
qDebug() << "Restoring volatile parameter" << defaultValue;
m_vlcMedia->addOption( defaultValue.toStdString().c_str() );
}
m_volatileParameters.clear();
......@@ -91,14 +90,12 @@ void Media::flushVolatileParameters()
void Media::addVolatileParam( const QString& param, const QString& defaultValue )
{
qDebug() << "Adding volatile parameter:" << param << ". Will be restored to:" << defaultValue;
m_vlcMedia->addOption( param.toStdString().c_str() );
m_volatileParameters.append( defaultValue );
}
void Media::addConstantParam( const QString& param )
{
qDebug() << "Adding constant parameter:" << param;
m_vlcMedia->addOption( param.toStdString().c_str() );
}
......
......@@ -26,6 +26,8 @@
*/
#include <QtDebug>
#include "vlmc.h"
#include "MetaDataManager.h"
#include "Library.h"
......@@ -80,7 +82,7 @@ void MetaDataManager::run()
m_mediaPlayer->play();
m_currentClip->flushVolatileParameters();
}
usleep( 10000 );
SleepMS( 1 );
}
return;
}
......@@ -112,7 +114,7 @@ void MetaDataManager::getMetaData()
m_currentClip->setWidth( m_mediaPlayer->getWidth() );
m_currentClip->setHeight( m_mediaPlayer->getHeight() );
qDebug() << "length =" << m_currentClip->getLength();
// qDebug() << "length =" << m_currentClip->getLength();
//Setting time for snapshot :
if ( m_currentClip->getFileType() == Media::Video )
{
......
......@@ -22,11 +22,7 @@
#include <QtDebug>
#ifdef Q_WS_WIN
// Used for Sleep()
#include <Windows.h>
#endif
#include "vlmc.h"
#include "ClipWorkflow.h"
int g_debugId = 0;
......@@ -197,11 +193,7 @@ ClipWorkflow::State ClipWorkflow::getState() const
void ClipWorkflow::startRender()
{
while ( isReady() == false )
#ifdef Q_WS_WIN
Sleep( 1 );
#else
usleep( 50 );
#endif
SleepMS( 1 );
m_mediaPlayer->play();
setState( Rendering );
}
......
......@@ -22,11 +22,7 @@
#include <QtDebug>
#ifdef Q_WS_WIN
// Used for Sleep()
#include <Windows.h>
#endif
#include "vlmc.h"
#include "TrackWorkflow.h"
TrackWorkflow::TrackWorkflow( unsigned int trackId ) :
......@@ -84,11 +80,7 @@ unsigned char* TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentF
cw->getStateLock()->unlock();
while ( cw->isRendering() == true )
{
#ifdef Q_WS_WIN
Sleep( 1 );
#else
usleep( 100 );
#endif
SleepMS( 100 );
}
//This way we can trigger the appropriate if just below.
//by restoring the initial state of the function, and just pretend that
......@@ -177,11 +169,7 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
{
cw->getStateLock()->unlock();
while ( cw->isRendering() == true )
#ifdef Q_WS_WIN
Sleep( 1 );
#else
usleep( 100 );
#endif
SleepMS( 1 );
cw->queryStateChange( ClipWorkflow::Stopping );
cw->wake();
cw->stop();
......@@ -190,11 +178,7 @@ void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
{
cw->getStateLock()->unlock();
while ( cw->isReady() == false )
#ifdef Q_WS_WIN
Sleep( 1 );
#else
usleep( 20 );
#endif
SleepMS( 1 );
cw->stop();
}
else
......
......@@ -23,11 +23,7 @@
#include <QtDebug>
#include <QThread>
#ifdef Q_WS_WIN
// Used for Sleep()
#include <Windows.h>
#endif
#include "vlmc.h"
#include "RenderPreviewWidget.h"
#include "Timeline.h"
......@@ -136,11 +132,7 @@ void RenderPreviewWidget::nextFrame()
bool framePlayed = false;
while ( framePlayed == false )
{
#ifdef Q_WS_WIN
Sleep( 1 );
#else
usleep( 50 );
#endif
SleepMS( 50 );
QReadLocker lock( m_framePlayedLock );
framePlayed = m_framePlayed;
}
......
/*****************************************************************************
* vlmc.h : contains the definition for every macro and prototypes used
* used program wide.
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLMC_H
#define VLMC_H
#include <QtGlobal>
#ifdef Q_OS_UNIX
#define SleepMS( x ) usleep( (x) * 1000 )
#else
#define SleepMS( x ) Sleep( x )
#endif
#endif // VLMC_H
......@@ -86,7 +86,8 @@ HEADERS += src/gui/MainWindow.h \
src/API/Module.h \
src/API/ModuleManager.h \
src/API/vlmc_module_internal.h \
src/WorkflowFileRenderer.h
src/WorkflowFileRenderer.h \
src/vlmc.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/Preferences.ui \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment