Commit f8194924 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added (really) drafted Tracks Workflow

Corrected Clip workflow, seems kinda functionnal, but will need more
testing...
parent 26795455
......@@ -130,7 +130,7 @@ void MetaDataManager::setSnapshot()
//This is synchrone, but it may become asynchrone in the future...
m_mediaPlayer->stop();
startAudioDataParsing();
//startAudioDataParsing();
}
void MetaDataManager::startAudioDataParsing()
......
......@@ -20,22 +20,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include "ClipWorkflow.h"
ClipWorkflow::ClipWorkflow( Clip::Clip* clip, QMutex* condMutex, QWaitCondition* waitCond ) :
m_clip( clip ),
m_renderComplete( true ),
m_renderComplete( false ),
m_buffer( NULL ),
m_condMutex( condMutex ),
m_waitCond( waitCond ),
m_mediaPlayer(NULL)
{
m_mutex = new QReadWriteLock();
m_buffer = new unsigned char[VIDEOHEIGHT * VIDEOWIDTH * 4];
}
ClipWorkflow::~ClipWorkflow()
{
delete[] m_buffer;
delete m_mutex;
}
......@@ -65,6 +68,7 @@ void ClipWorkflow::unlock( ClipWorkflow* clipWorkflow )
QWriteLocker lock2( clipWorkflow->m_mutex );
clipWorkflow->m_renderComplete = true;
}
//qDebug() << "Frame rendered, sleeping mode";
clipWorkflow->m_waitCond->wait( clipWorkflow->m_condMutex );
}
......
/*****************************************************************************
* TrackWorkflow.cpp : Will query the Clip workflow for each successive clip in the track
*****************************************************************************
* 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.
*****************************************************************************/
#include <QtDebug>
#include "TrackWorkflow.h"
TrackWorkflow::TrackWorkflow()
{
m_condMutex = new QMutex;
m_waitCondition = new QWaitCondition;
m_mediaPlayer = new LibVLCpp::MediaPlayer();
}
void TrackWorkflow::addClip( Clip* clip )
{
m_currentClipWorkflow = new ClipWorkflow( clip, m_condMutex, m_waitCondition );
m_currentClipWorkflow->startRender( m_mediaPlayer );
}
const unsigned char* TrackWorkflow::getOutput() const
{
// qDebug() << "Awaking all renderers";
m_waitCondition->wakeAll();
while ( m_currentClipWorkflow->renderComplete() == false )
{
//qDebug() << "Frame is not ready yet... waiting";
// usleep( 1000 );
}
// qDebug() << "Frame rendered";
return m_currentClipWorkflow->getOutput();
}
/*****************************************************************************
* TrackWorkflow.h : Will query the Clip workflow for each successive clip in the track
*****************************************************************************
* 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 TRACKWORKFLOW_H
#define TRACKWORKFLOW_H
#include <QObject>
#include <QMutex>
#include <QWaitCondition>
#include "ClipWorkflow.h"
#include "VLCMediaPlayer.h"
//THIS IS A JUNK FOR TESTING CLIP WORKFLOW
class TrackWorkflow : public QObject
{
Q_OBJECT
public:
TrackWorkflow();
const unsigned char* getOutput() const;
private:
ClipWorkflow* m_currentClipWorkflow;
QMutex* m_condMutex;
QWaitCondition* m_waitCondition;
LibVLCpp::MediaPlayer* m_mediaPlayer;
public slots:
void addClip( Clip* );
};
#endif // TRACKWORKFLOW_H
......@@ -46,6 +46,7 @@ public:
void setCursorPos( int pos );
int cursorPos();
GraphicsCursorItem* tracksCursor() const { return m_cursorLine; }
//FIXME: this should probably take a Clip* as a parameter doesn't it ?
void addClip( Media* clip, const QPoint& point );
void setScale( double scaleFactor );
......
......@@ -40,7 +40,8 @@ SOURCES += src/main.cpp \
src/gui/GraphicsCursorItem.cpp \
src/TimelineBackend.cpp \
src/Track.cpp \
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp \
src/Workflow/TrackWorkflow.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -73,7 +74,8 @@ HEADERS += src/gui/MainWindow.h \
src/gui/GraphicsCursorItem.h \
src/TimelineBackend.h \
src/Track.h \
src/Workflow/ClipWorkflow.h
src/Workflow/ClipWorkflow.h \
src/Workflow/TrackWorkflow.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