Commit 333f5256 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Merge commit 'origin/debug'

parents 0ae169d6 f1f8749a
......@@ -62,7 +62,7 @@ Clip::Clip( Clip* clip ) :
Clip::Clip( const QUuid& uuid, float begin, float end ) :
m_begin( begin),
m_end( 1.0f )
m_end( end )
{
Q_UNUSED( end );
Media* media = Library::getInstance()->getMedia( uuid );
......@@ -111,6 +111,7 @@ void Clip::computeLength()
qint64 nbMs = (qint64)( ( m_end - m_begin ) * (float)m_parent->getLength() );
m_lengthSeconds = nbMs / 1000;
m_length = (nbMs / 1000) * fps;
emit lengthUpdated();
}
else
{
......@@ -183,7 +184,6 @@ Clip* Clip::split( float newEnd )
Clip* newClip = new Clip( this, newEnd, m_end );
m_end = newEnd;
computeLength();
emit lengthUpdated();
return newClip;
}
......@@ -191,6 +191,6 @@ Clip* Clip::split( qint64 endFrame )
{
//FIXME the conversion *breaks* clip spliting
//But we don't have any other choice for now, VLC only support float positions!
float newEnd = (float) endFrame / m_length;
float newEnd = (float) endFrame / m_parent->getnbFrames();
return split( newEnd );
}
......@@ -40,6 +40,7 @@ Media::Media( const QString& filePath, const QString& uuid )
m_snapshot( NULL ),
m_fileInfo( NULL ),
m_length( 0 ),
m_nbFrames( 0 ),
m_width( 0 ),
m_height( 0 )
{
......@@ -229,3 +230,13 @@ void Media::setUuid( const QUuid& uuid )
{
m_uuid = uuid;
}
void Media::setNbFrames( qint64 nbFrames )
{
m_nbFrames = nbFrames;
}
qint64 Media::getnbFrames() const
{
return m_nbFrames;
}
......@@ -105,6 +105,7 @@ public:
you'll just have to blame yourself !
*/
void setLength( qint64 length );
void setNbFrames( qint64 nbFrames );
int getWidth() const;
void setWidth( int width );
......@@ -115,6 +116,8 @@ public:
float getFps() const;
void setFps( float fps );
qint64 getnbFrames() const;
const QUuid& getUuid() const;
void setUuid( const QUuid& uuid );
......@@ -147,6 +150,7 @@ protected:
QUuid m_uuid;
QFileInfo* m_fileInfo;
qint64 m_length;
qint64 m_nbFrames;
unsigned int m_width;
unsigned int m_height;
float m_fps;
......
......@@ -89,6 +89,7 @@ void MetaDataWorker::getMetaData()
m_currentMedia->setWidth( m_mediaPlayer->getWidth() );
m_currentMedia->setHeight( m_mediaPlayer->getHeight() );
m_currentMedia->setFps( m_mediaPlayer->getFps() );
m_currentMedia->setNbFrames( m_currentMedia->getLength() / 1000 * m_currentMedia->getFps() );
//Setting time for snapshot :
if ( m_currentMedia->getFileType() == Media::Video )
......
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