Commit a583bf72 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Remove metadata from Media class and expose it through the source.

parent 2a013d21
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "Clip.h" #include "Clip.h"
#include "ClipMetadataDisplayer.h" #include "ClipMetadataDisplayer.h"
#include "ClipRenderer.h" #include "ClipRenderer.h"
#include "ISource.h"
#include "Library.h" #include "Library.h"
#include "Media.h" #include "Media.h"
#include "MediaCellView.h" #include "MediaCellView.h"
...@@ -238,7 +239,7 @@ ImportController::accept() ...@@ -238,7 +239,7 @@ ImportController::accept()
collapseAllButCurrentPath(); collapseAllButCurrentPath();
foreach ( Clip* clip, m_temporaryMedias->clips().values() ) foreach ( Clip* clip, m_temporaryMedias->clips().values() )
{ {
if ( clip->getMedia()->lengthMS() == 0 && clip->getMedia()->inputType() == Media::File ) if ( clip->getMedia()->source()->length() == 0 && clip->getMedia()->inputType() == Media::File )
invalidMedias = true; invalidMedias = true;
Library::getInstance()->addClip( clip ); Library::getInstance()->addClip( clip );
} }
...@@ -260,7 +261,7 @@ ImportController::handleInvalidMedias() ...@@ -260,7 +261,7 @@ ImportController::handleInvalidMedias()
{ {
foreach ( Clip* clip, m_temporaryMedias->clips().values() ) foreach ( Clip* clip, m_temporaryMedias->clips().values() )
{ {
if ( clip->getMedia()->lengthMS() == 0 && clip->getMedia()->inputType() == Media::File ) if ( clip->getMedia()->source()->length() == 0 && clip->getMedia()->inputType() == Media::File )
{ {
Transcoder *transcoder = new Transcoder( clip->getMedia() ); Transcoder *transcoder = new Transcoder( clip->getMedia() );
connect( transcoder, SIGNAL( done() ), transcoder, SLOT( deleteLater() ) ); connect( transcoder, SIGNAL( done() ), transcoder, SLOT( deleteLater() ) );
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "Clip.h" #include "Clip.h"
#include "ClipProperty.h" #include "ClipProperty.h"
#include "ISource.h"
#include "Library.h" #include "Library.h"
#include "Media.h" #include "Media.h"
#include "MetaDataManager.h" #include "MetaDataManager.h"
...@@ -98,7 +99,7 @@ MediaCellView::metadataComputingStarted( const Media *media ) ...@@ -98,7 +99,7 @@ MediaCellView::metadataComputingStarted( const Media *media )
void void
MediaCellView::metadataUpdated( const Media *media ) MediaCellView::metadataUpdated( const Media *media )
{ {
setLength( media->lengthMS() ); setLength( media->source()->length() );
m_ui->thumbnail->setEnabled( true ); m_ui->thumbnail->setEnabled( true );
//If the media is a Video or an Image, we must wait for the snapshot to be computer //If the media is a Video or an Image, we must wait for the snapshot to be computer
//before allowing deletion. //before allowing deletion.
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "ClipMetadataDisplayer.h" #include "ClipMetadataDisplayer.h"
#include "Clip.h" #include "Clip.h"
#include "ISource.h"
#include "Media.h" #include "Media.h"
#include <QTime> #include <QTime>
...@@ -41,19 +42,20 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media ) ...@@ -41,19 +42,20 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media )
QTime duration; QTime duration;
duration = duration.addSecs( m_watchedClip->lengthSecond() ); duration = duration.addSecs( m_watchedClip->lengthSecond() );
const Backend::ISource* source = media->source();
updateInterface(); updateInterface();
//Duration //Duration
m_ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) ); m_ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
//Filename || title //Filename || title
m_ui->nameValueLabel->setText( media->fileInfo()->fileName() ); m_ui->nameValueLabel->setText( media->fileInfo()->fileName() );
//Resolution //Resolution
m_ui->resolutionValueLabel->setText( QString::number( media->width() ) m_ui->resolutionValueLabel->setText( QString::number( source->width() )
+ " x " + QString::number( media->height() ) ); + " x " + QString::number( source->height() ) );
//FPS //FPS
m_ui->fpsValueLabel->setText( QString::number( media->fps() ) ); m_ui->fpsValueLabel->setText( QString::number( source->fps() ) );
//nb tracks : //nb tracks :
m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) ); m_ui->nbVideoTracksValueLabel->setText( QString::number( source->nbVideoTracks() ) );
m_ui->nbAudioTracksValueLabel->setText( QString::number( media->nbAudioTracks() ) ); m_ui->nbAudioTracksValueLabel->setText( QString::number( source->nbAudioTracks() ) );
//Path: //Path:
m_ui->pathValueLabel->setText( media->fileInfo()->absoluteFilePath() ); m_ui->pathValueLabel->setText( media->fileInfo()->absoluteFilePath() );
//Workspace: //Workspace:
...@@ -118,8 +120,9 @@ ClipMetadataDisplayer::workspaceStateChanged( bool state ) ...@@ -118,8 +120,9 @@ ClipMetadataDisplayer::workspaceStateChanged( bool state )
void void
ClipMetadataDisplayer::updateInterface() ClipMetadataDisplayer::updateInterface()
{ {
m_ui->fpsLabel->setVisible( m_watchedMedia->hasVideoTrack() ); bool visible = m_watchedMedia->source()->hasVideo();
m_ui->fpsValueLabel->setVisible( m_watchedMedia->hasVideoTrack() ); m_ui->fpsLabel->setVisible( visible );
m_ui->resolutionLabel->setVisible( m_watchedMedia->hasVideoTrack() ); m_ui->fpsValueLabel->setVisible( visible );
m_ui->resolutionValueLabel->setVisible( m_watchedMedia->hasVideoTrack() ); m_ui->resolutionLabel->setVisible( visible );
m_ui->resolutionValueLabel->setVisible( visible );
} }
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "GraphicsAudioItem.h" #include "GraphicsAudioItem.h"
#include "ClipHelper.h" #include "ClipHelper.h"
#include "ISource.h"
#include "Media.h" #include "Media.h"
#include "TracksView.h" #include "TracksView.h"
#include "Timeline.h" #include "Timeline.h"
...@@ -37,7 +38,7 @@ ...@@ -37,7 +38,7 @@
GraphicsAudioItem::GraphicsAudioItem( Clip* clip ) : GraphicsAudioItem::GraphicsAudioItem( Clip* clip ) :
AbstractGraphicsMediaItem( clip ) AbstractGraphicsMediaItem( clip )
{ {
QTime length = QTime().addMSecs( clip->getMedia()->lengthMS() ); QTime length = QTime().addMSecs( clip->getMedia()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1" QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" ) "<br><b>Length:</b> %2" )
.arg( clip->getMedia()->fileName() ) .arg( clip->getMedia()->fileName() )
...@@ -50,7 +51,7 @@ GraphicsAudioItem::GraphicsAudioItem( ClipHelper* ch ) : ...@@ -50,7 +51,7 @@ GraphicsAudioItem::GraphicsAudioItem( ClipHelper* ch ) :
{ {
setFlags( QGraphicsItem::ItemIsSelectable ); setFlags( QGraphicsItem::ItemIsSelectable );
QTime length = QTime().addMSecs( ch->clip()->getMedia()->lengthMS() ); QTime length = QTime().addMSecs( ch->clip()->getMedia()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1" QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" ) "<br><b>Length:</b> %2" )
.arg( ch->clip()->getMedia()->fileName() ) .arg( ch->clip()->getMedia()->fileName() )
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "Clip.h" #include "Clip.h"
#include "ClipHelper.h" #include "ClipHelper.h"
#include "GraphicsMovieItem.h" #include "GraphicsMovieItem.h"
#include "ISource.h"
#include "Media.h" #include "Media.h"
#include "TracksView.h" #include "TracksView.h"
#include "Timeline.h" #include "Timeline.h"
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) :
AbstractGraphicsMediaItem( clip ) AbstractGraphicsMediaItem( clip )
{ {
QTime length = QTime().addMSecs( clip->getMedia()->lengthMS() ); QTime length = QTime().addMSecs( clip->getMedia()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1" QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" ) "<br><b>Length:</b> %2" )
.arg( clip->getMedia()->fileName() ) .arg( clip->getMedia()->fileName() )
...@@ -47,7 +48,7 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : ...@@ -47,7 +48,7 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) :
GraphicsMovieItem::GraphicsMovieItem( ClipHelper* ch ) : GraphicsMovieItem::GraphicsMovieItem( ClipHelper* ch ) :
AbstractGraphicsMediaItem( ch ) AbstractGraphicsMediaItem( ch )
{ {
QTime length = QTime().addMSecs( ch->clip()->getMedia()->lengthMS() ); QTime length = QTime().addMSecs( ch->clip()->getMedia()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1" QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" ) "<br><b>Length:</b> %2" )
.arg( ch->clip()->getMedia()->fileName() ) .arg( ch->clip()->getMedia()->fileName() )
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "GraphicsCursorItem.h" #include "GraphicsCursorItem.h"
#include "GraphicsTrack.h" #include "GraphicsTrack.h"
#include "Helper.h" #include "Helper.h"
#include "ISource.h"
#include "Library.h" #include "Library.h"
#include "Media.h" #include "Media.h"
//Ugly part { //Ugly part {
...@@ -374,14 +375,17 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event ) ...@@ -374,14 +375,17 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
{ {
const QString fullId = QString( event->mimeData()->data( "vlmc/uuid" ) ); const QString fullId = QString( event->mimeData()->data( "vlmc/uuid" ) );
Clip *clip = Library::getInstance()->clip( fullId ); Clip *clip = Library::getInstance()->clip( fullId );
if ( !clip ) return; if ( clip == NULL )
if ( clip->getMedia()->hasAudioTrack() == false && return;
clip->getMedia()->hasVideoTrack() == false ) bool hasVideo = clip->getMedia()->source()->hasVideo();
bool hasAudio = clip->getMedia()->source()->hasAudio();
if ( hasAudio == false && hasVideo == false )
return ; return ;
if ( clip->getMedia()->hasAudioTrack() == true ) if ( hasAudio == true )
{ {
if ( m_dragAudioItem ) delete m_dragAudioItem; if ( m_dragAudioItem )
delete m_dragAudioItem;
m_dragAudioItem = new GraphicsAudioItem( clip ); m_dragAudioItem = new GraphicsAudioItem( clip );
m_dragAudioItem->m_tracksView = this; m_dragAudioItem->m_tracksView = this;
m_dragAudioItem->setHeight( m_dragAudioItem->itemHeight() ); m_dragAudioItem->setHeight( m_dragAudioItem->itemHeight() );
...@@ -389,9 +393,10 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event ) ...@@ -389,9 +393,10 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
connect( m_dragAudioItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ), connect( m_dragAudioItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) ); this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
} }
if ( clip->getMedia()->hasVideoTrack() == true ) if ( hasVideo == true )
{ {
if ( m_dragVideoItem ) delete m_dragVideoItem; if ( m_dragVideoItem )
delete m_dragVideoItem;
m_dragVideoItem = new GraphicsMovieItem( clip ); m_dragVideoItem = new GraphicsMovieItem( clip );
m_dragVideoItem->m_tracksView = this; m_dragVideoItem->m_tracksView = this;
m_dragVideoItem->setHeight( m_dragVideoItem->itemHeight() ); m_dragVideoItem->setHeight( m_dragVideoItem->itemHeight() );
...@@ -400,10 +405,9 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event ) ...@@ -400,10 +405,9 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) ); this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
} }
// Group the items together // Group the items together
if ( clip->getMedia()->hasAudioTrack() == true && if ( hasVideo == true && hasAudio == true )
clip->getMedia()->hasVideoTrack() == true )
m_dragVideoItem->group( m_dragAudioItem ); m_dragVideoItem->group( m_dragAudioItem );
if ( clip->getMedia()->hasVideoTrack() == false ) if ( hasVideo == false )
moveItem( m_dragAudioItem, event->pos() ); moveItem( m_dragAudioItem, event->pos() );
else else
moveItem( m_dragVideoItem, event->pos() ); moveItem( m_dragVideoItem, event->pos() );
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
*/ */
#include "Clip.h" #include "Clip.h"
#include "ISource.h"
#include "Library.h" #include "Library.h"
#include "Media.h" #include "Media.h"
#include "Workspace.h" #include "Workspace.h"
...@@ -107,7 +108,7 @@ Clip::computeLength() ...@@ -107,7 +108,7 @@ Clip::computeLength()
{ {
if ( m_media->inputType() == Media::File ) if ( m_media->inputType() == Media::File )
{ {
float fps = m_media->fps(); float fps = m_media->source()->fps();
if ( fps < 0.1f ) if ( fps < 0.1f )
fps = Clip::DefaultFPS; fps = Clip::DefaultFPS;
m_length = m_end - m_begin; m_length = m_end - m_begin;
......
...@@ -54,14 +54,8 @@ const QString Media::streamPrefix = "stream://"; ...@@ -54,14 +54,8 @@ const QString Media::streamPrefix = "stream://";
Media::Media(const QString &path ) : Media::Media(const QString &path ) :
m_fileInfo( NULL ), m_fileInfo( NULL ),
m_lengthMS( 0 ),
m_nbFrames( 0 ), m_nbFrames( 0 ),
m_width( 0 ),
m_height( 0 ),
m_fps( .0f ),
m_baseClip( NULL ), m_baseClip( NULL ),
m_nbAudioTracks( 0 ),
m_nbVideoTracks( 0 ),
m_metadataComputed( false ), m_metadataComputed( false ),
m_inWorkspace( false ) m_inWorkspace( false )
{ {
...@@ -98,54 +92,6 @@ Media::fileInfo() const ...@@ -98,54 +92,6 @@ Media::fileInfo() const
return m_fileInfo; return m_fileInfo;
} }
void
Media::setLength( qint64 length )
{
m_lengthMS = length;
}
qint64
Media::lengthMS() const
{
return m_lengthMS;
}
int
Media::width() const
{
return m_width;
}
void
Media::setWidth( int width )
{
m_width = width;
}
int
Media::height() const
{
return m_height;
}
void
Media::setHeight( int height )
{
m_height = height;
}
float
Media::fps() const
{
return m_fps;
}
void
Media::setFps( float fps )
{
m_fps = fps;
}
Media::FileType Media::FileType
Media::fileType() const Media::fileType() const
{ {
...@@ -200,40 +146,10 @@ Media::source() ...@@ -200,40 +146,10 @@ Media::source()
return m_source; return m_source;
} }
bool const Backend::ISource*
Media::hasAudioTrack() const Media::source() const
{
return ( m_nbAudioTracks > 0 );
}
bool
Media::hasVideoTrack() const
{
return ( m_nbVideoTracks > 0 );
}
void
Media::setNbAudioTrack( int nbTrack )
{
m_nbAudioTracks = nbTrack;
}
void
Media::setNbVideoTrack( int nbTracks )
{
m_nbVideoTracks = nbTracks;
}
int
Media::nbAudioTracks() const
{
return m_nbAudioTracks;
}
int
Media::nbVideoTracks() const
{ {
return m_nbVideoTracks; return m_source;
} }
bool bool
......
...@@ -85,7 +85,8 @@ public: ...@@ -85,7 +85,8 @@ public:
const QFileInfo *fileInfo() const; const QFileInfo *fileInfo() const;
const QString &mrl() const; const QString &mrl() const;
const QString &fileName() const; const QString &fileName() const;
Backend::ISource* source(); Backend::ISource *source();
const Backend::ISource *source() const;
/** /**
* \brief Set this media's path. * \brief Set this media's path.
* *
...@@ -93,38 +94,10 @@ public: ...@@ -93,38 +94,10 @@ public:
*/ */
void setFilePath( const QString& path ); void setFilePath( const QString& path );
/**
\return Returns the length of this media (ie the
video duration) in milliseconds.
*/
qint64 lengthMS() const;
/**
\brief This methods is most of an entry point for the
MetadataManager than enything else.
If you use it to set a inconsistant media length
you'll just have to blame yourself !
*/
void setLength( qint64 length );
void setNbFrames( qint64 nbFrames ); void setNbFrames( qint64 nbFrames );
int width() const;
void setWidth( int width );
int height() const;
void setHeight( int height );
float fps() const;
void setFps( float fps );
qint64 nbFrames() const; qint64 nbFrames() const;
bool hasAudioTrack() const;
bool hasVideoTrack() const;
void setNbAudioTrack( int nbTrack );
void setNbVideoTrack( int nbTrack );
int nbAudioTracks() const;
int nbVideoTracks() const;
FileType fileType() const; FileType fileType() const;
void setFileType( FileType type ); void setFileType( FileType type );
...@@ -156,17 +129,11 @@ protected: ...@@ -156,17 +129,11 @@ protected:
Backend::ISource* m_source; Backend::ISource* m_source;
QString m_mrl; QString m_mrl;
QFileInfo* m_fileInfo; QFileInfo* m_fileInfo;
qint64 m_lengthMS;
qint64 m_nbFrames; qint64 m_nbFrames;
unsigned int m_width;
unsigned int m_height;
float m_fps;
FileType m_fileType; FileType m_fileType;
InputType m_inputType; InputType m_inputType;
QString m_fileName; QString m_fileName;
Clip* m_baseClip; Clip* m_baseClip;
int m_nbAudioTracks;
int m_nbVideoTracks;
bool m_metadataComputed; bool m_metadataComputed;
bool m_inWorkspace; bool m_inWorkspace;
QString m_workspacePath; QString m_workspacePath;
......
...@@ -177,7 +177,7 @@ ClipRenderer::previousFrame() ...@@ -177,7 +177,7 @@ ClipRenderer::previousFrame()
if ( m_paused == false ) if ( m_paused == false )
togglePlayPause( true ); togglePlayPause( true );
/* FIXME: Implement a better way to render previous frame */ /* FIXME: Implement a better way to render previous frame */
qint64 interval = static_cast<qint64>( qCeil(1000.0f * 2.0f / m_selectedClip->getMedia()->fps() ) ); qint64 interval = static_cast<qint64>( qCeil(1000.0f * 2.0f / m_selectedClip->getMedia()->source()->fps() ) );
m_sourceRenderer->setTime( m_sourceRenderer->time() - interval ); m_sourceRenderer->setTime( m_sourceRenderer->time() - interval );
m_sourceRenderer->nextFrame(); m_sourceRenderer->nextFrame();
} }
...@@ -193,7 +193,7 @@ qint64 ...@@ -193,7 +193,7 @@ qint64
ClipRenderer::getLengthMs() const ClipRenderer::getLengthMs() const
{ {
if ( m_selectedClip ) if ( m_selectedClip )
return ( qRound64( (qreal)( m_end - m_begin ) / m_selectedClip->getMedia()->fps() * 1000.0 ) ); return ( qRound64( (qreal)( m_end - m_begin ) / m_selectedClip->getMedia()->source()->fps() * 1000.0 ) );
return 0; return 0;
} }
...@@ -216,14 +216,14 @@ ClipRenderer::getCurrentFrame() const ...@@ -216,14 +216,14 @@ ClipRenderer::getCurrentFrame() const
if ( m_clipLoaded == false || m_isRendering == false || m_selectedClip == NULL ) if ( m_clipLoaded == false || m_isRendering == false || m_selectedClip == NULL )
return 0; return 0;
return qRound64( (qreal)m_sourceRenderer->time() / 1000 * return qRound64( (qreal)m_sourceRenderer->time() / 1000 *
(qreal)m_selectedClip->getMedia()->fps() ); (qreal)m_selectedClip->getMedia()->source()->fps() );
} }
float float
ClipRenderer::getFps() const ClipRenderer::getFps() const
{ {
if ( m_selectedClip != NULL ) if ( m_selectedClip != NULL )
return m_selectedClip->getMedia()->fps(); return m_selectedClip->getMedia()->source()->fps();
return 0.0f; return 0.0f;
} }
...@@ -239,7 +239,7 @@ ClipRenderer::previewWidgetCursorChanged( qint64 newFrame ) ...@@ -239,7 +239,7 @@ ClipRenderer::previewWidgetCursorChanged( qint64 newFrame )
if ( m_isRendering == true ) if ( m_isRendering == true )
{ {
newFrame += m_begin; newFrame += m_begin;
qint64 nbSeconds = qRound64( (qreal)newFrame / m_selectedClip->getMedia()->fps() ); qint64 nbSeconds = qRound64( (qreal)newFrame / m_selectedClip->getMedia()->source()->fps() );
m_sourceRenderer->setTime( nbSeconds * 1000 ); m_sourceRenderer->setTime( nbSeconds * 1000 );
} }
} }
...@@ -260,7 +260,7 @@ ClipRenderer::__videoStopped() ...@@ -260,7 +260,7 @@ ClipRenderer::__videoStopped()
void void
ClipRenderer::__timeChanged( qint64 time ) ClipRenderer::__timeChanged( qint64 time )
{ {
float fps = m_selectedClip->getMedia()->fps(); float fps = m_selectedClip->getMedia()->source()->fps();
qint64 f = qRound64( (qreal)time / 1000.0 * fps ); qint64 f = qRound64( (qreal)time / 1000.0 * fps );
if ( f >= m_end ) if ( f >= m_end )
return ; return ;
......
...@@ -103,7 +103,7 @@ ClipWorkflow::adjustBegin() ...@@ -103,7 +103,7 @@ ClipWorkflow::adjustBegin()
m_clipHelper->clip()->getMedia()->fileType() == Media::Audio ) m_clipHelper->clip()->getMedia()->fileType() == Media::Audio )
{ {
m_renderer->setTime( m_clipHelper->begin() / m_renderer->setTime( m_clipHelper->begin() /
m_clipHelper->clip()->getMedia()->fps() * 1000 ); m_clipHelper->clip()->getMedia()->source()->fps() * 1000 );
} }
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "ImageClipWorkflow.h" #include "ImageClipWorkflow.h"
#include "Clip.h" #include "Clip.h"
#include "ClipHelper.h" #include "ClipHelper.h"
#include "ISource.h"
#include "ISourceRenderer.h" #include "ISourceRenderer.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "Media.h" #include "Media.h"
...@@ -74,7 +75,7 @@ ImageClipWorkflow::getOutput( ClipWorkflow::GetMode, qint64 currentFrame ) ...@@ -74,7 +75,7 @@ ImageClipWorkflow::getOutput( ClipWorkflow::GetMode, qint64 currentFrame )
QMutexLocker lock( m_renderLock ); QMutexLocker lock( m_renderLock );
quint32 *buff = applyFilters( m_buffer, currentFrame, quint32 *buff = applyFilters( m_buffer, currentFrame,
currentFrame * 1000.0 / clip()->getMedia()->fps() ); currentFrame * 1000.0 / clip()->getMedia()->source()->fps() );
if ( buff != NULL ) if ( buff != NULL )
{ {
m_effectFrame->setBuffer( buff ); m_effectFrame->setBuffer( buff );
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "EffectInstance.h" #include "EffectInstance.h"
#include "EffectHelper.h" #include "EffectHelper.h"
#include "ImageClipWorkflow.h" #include "ImageClipWorkflow.h"
#include "ISource.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "Media.h" #include "Media.h"
#include "Types.h" #include "Types.h"
...@@ -507,8 +508,9 @@ TrackWorkflow::clear() ...@@ -507,8 +508,9 @@ TrackWorkflow::clear()
void void
TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw ) TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw )
{ {
qint64 nbMs = ( currentFrame - start ) / cw->clip()->getMedia()->fps() * 1000; float fps = cw->clip()->getMedia()->source()->fps();
qint64 beginInMs = cw->getClipHelper()->begin() / cw->clip()->getMedia()->fps() * 1000; qint64 nbMs = ( currentFrame - start ) / fps * 1000;
qint64 beginInMs = cw->getClipHelper()->begin() / fps * 1000;
qint64 startFrame = beginInMs + nbMs; qint64 startFrame = beginInMs + nbMs;
cw->setTime( startFrame ); cw->setTime( startFrame );
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "EffectInstance.h" #include "EffectInstance.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "Media.h" #include "Media.h"
#include "ISource.h"
#include "ISourceRenderer.h" #include "ISourceRenderer.h"
#include "SettingsManager.h" #include "SettingsManager.h"
#include "VideoClipWorkflow.h" #include "VideoClipWorkflow.h"
...@@ -119,7 +120,7 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode, qint64 currentFrame ) ...@@ -119,7 +120,7 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode, qint64 currentFrame )
buff = m_computedBuffers.head(); buff = m_computedBuffers.head();
quint32 *newFrame = applyFilters( buff, currentFrame, quint32 *newFrame = applyFilters( buff, currentFrame,
currentFrame * 1000.0 / clip()->getMedia()->fps() ); currentFrame * 1000.0 / clip()->getMedia()->source()->fps() );
if ( newFrame != NULL ) if ( newFrame != NULL )
buff->setBuffer( newFrame ); buff->setBuffer( newFrame );
......
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