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

Completely refactored metadata computing.

parent f12f24b9
......@@ -52,9 +52,8 @@ void MediaListViewController::newMediaLoaded( const QUuid& uuid )
connect( cell, SIGNAL( arrowClicked( const QUuid& ) ),
this, SLOT( showClipList( const QUuid& ) ) );
if ( media->getMetadata() != Media::ParsedWithSnapshot )
connect( media, SIGNAL( snapshotComputed( Media* ) ),
this, SLOT( updateCell( Media* ) ) );
connect( media, SIGNAL( snapshotComputed( Media* ) ),
this, SLOT( updateCell( Media* ) ) );
cell->setNbClips( media->clips()->size() );
cell->setThumbnail( media->getSnapshot() );
cell->setTitle( media->getFileName() );
......
......@@ -73,6 +73,7 @@ MediaPlayer::~MediaPlayer()
libvlc_event_detach( p_em, libvlc_MediaPlayerStopped, callbacks, this, m_ex );
libvlc_event_detach( p_em, libvlc_MediaPlayerEndReached, callbacks, this, m_ex );
libvlc_event_detach( p_em, libvlc_MediaPlayerPositionChanged, callbacks, this, m_ex );
stop();
libvlc_media_player_release( m_internalPtr );
}
......
......@@ -104,8 +104,7 @@ Library::removingMediaAsked( const QUuid& uuid )
void
Library::deleteMedia( const QUuid& uuid )
{
if ( m_medias.contains( uuid ) &&
m_medias.value( uuid )->getMetadata() == Media::ParsedWithAudioSpectrum )
if ( m_medias.contains( uuid ) )
{
disconnect( m_medias.value( uuid ),
SIGNAL( audioSpectrumComputed( const QUuid& ) ),
......@@ -113,9 +112,7 @@ Library::deleteMedia( const QUuid& uuid )
SLOT( deleteMedia( const QUuid& ) ) );
delete m_medias.take( uuid );
}
else if ( m_temporaryMedias.contains( uuid ) &&
m_temporaryMedias.value( uuid )->getMetadata() ==
Media::ParsedWithAudioSpectrum )
else if ( m_temporaryMedias.contains( uuid ) )
{
disconnect( m_medias.value( uuid ),
SIGNAL( audioSpectrumComputed( const QUuid& ) ),
......
......@@ -45,7 +45,7 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_nbFrames( 0 ),
m_width( 0 ),
m_height( 0 ),
m_metadataState( None )
m_baseClip( NULL )
{
if ( uuid.length() == 0 )
m_uuid = QUuid::createUuid();
......@@ -72,7 +72,6 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_fileName = m_mrl;
qDebug() << "Loading a stream";
}
m_audioValueList = new QList<int>();
m_vlcMedia = new LibVLCpp::Media( m_mrl );
}
......@@ -192,26 +191,20 @@ Media::FileType Media::getFileType() const
return m_fileType;
}
void Media::emitMetaDataComputed( bool hasMetadata )
void Media::emitMetaDataComputed()
{
if ( hasMetadata == true )
{
m_baseClip = new Clip( this );
m_metadataState = ParsedWithoutSnapshot;
}
Q_ASSERT( m_baseClip == NULL );
m_baseClip = new Clip( this );
emit metaDataComputed( this );
}
void Media::emitSnapshotComputed()
{
if ( m_metadataState == ParsedWithoutSnapshot )
m_metadataState = ParsedWithSnapshot;
emit snapshotComputed( this );
}
void Media::emitAudioSpectrumComuted()
{
m_metadataState = ParsedWithAudioSpectrum;
emit audioSpectrumComputed( this->getUuid() );
}
......@@ -277,8 +270,3 @@ void Media::removeClip( const QUuid& uuid )
{
m_clips.remove( uuid );
}
Media::MetadataState Media::getMetadata() const
{
return m_metadataState;
}
......@@ -65,13 +65,6 @@ public:
File,
Stream
};
enum MetadataState
{
None,
ParsedWithoutSnapshot,
ParsedWithSnapshot,
ParsedWithAudioSpectrum
};
Media( const QString& filePath, const QString& uuid = QString() );
virtual ~Media();
......@@ -132,12 +125,11 @@ public:
void setMetaTags( const QStringList& tags );
bool matchMetaTag( const QString& tag ) const;
void emitMetaDataComputed( bool hasMetadata );
void emitMetaDataComputed();
void emitSnapshotComputed();
void emitAudioSpectrumComuted();
// bool hasMetadata() const;
MetadataState getMetadata() const;
void addClip( Clip* clip );
void removeClip( const QUuid& uuid );
......@@ -166,7 +158,6 @@ protected:
float m_fps;
FileType m_fileType;
InputType m_inputType;
MetadataState m_metadataState;
QString m_fileName;
QStringList m_metaTags;
Clip* m_baseClip;
......
......@@ -23,168 +23,56 @@
#include "MetaDataManager.h"
#include "MetaDataWorker.h"
#include "vlmc.h"
#include <QtDebug>
#include <QQueue>
#include <QMap>
#include <QDebug>
MetaDataManager::MetaDataManager() : m_mediaPlayersMaxCount( DEFAULT_MAX_MEDIA_PLAYER ), m_mediaPlayersToRemove( 0 )
MetaDataManager::MetaDataManager() :
m_computeInProgress( false ),
m_mediaPlayer( NULL )
{
for ( int i = 0; i < m_mediaPlayersMaxCount; ++i )
addMediaPlayer();
m_computingMutex = new QMutex;
}
MetaDataManager::~MetaDataManager()
{
while ( m_mediaPlayers.count(Running) )
SleepMS(1);
while ( LibVLCpp::MediaPlayer* mediaPlayer = m_mediaPlayers.take( Idle ) )
delete mediaPlayer;
}
void MetaDataManager::addMediaPlayer()
{
if ( m_mediaPlayers.count() <= m_mediaPlayersMaxCount )
m_mediaPlayers.insert( Idle, new LibVLCpp::MediaPlayer() );
}
void MetaDataManager::removeMediaPlayer()
{
if ( m_mediaPlayers.count() > 0 )
{
QMap<MediaPlayerState, LibVLCpp::MediaPlayer*>::iterator it = m_mediaPlayers.find( Idle );
if ( it != m_mediaPlayers.end() )
{
delete it.value();
m_mediaPlayers.erase( it );
}
else
++m_mediaPlayersToRemove;
}
delete m_computingMutex;
if ( m_mediaPlayer )
delete m_mediaPlayer;
}
void MetaDataManager::setMediaPlayersNumberMaxCount( int number )
void MetaDataManager::launchComputing( Media *media )
{
if ( number <= 0 )
return;
if ( number <= m_mediaPlayers.count() )
{
for ( int i = m_mediaPlayers.count() - number; i > 0; --i )
removeMediaPlayer();
}
m_mediaPlayersMaxCount = number;
m_computeInProgress = true;
m_mediaPlayer = new LibVLCpp::MediaPlayer;
MetaDataWorker* worker = new MetaDataWorker( m_mediaPlayer, media );
connect( worker, SIGNAL( computed() ),
this, SLOT( computingCompleted() ),
Qt::DirectConnection );
worker->compute();
}
void MetaDataManager::populateEmptyMediaPlayerSlots()
void MetaDataManager::computingCompleted()
{
if ( m_mediaPlayers.count() < m_mediaPlayersMaxCount )
{
for ( int i = m_mediaPlayersMaxCount - m_mediaPlayers.count(); i > 0; --i )
addMediaPlayer();
}
}
QMutexLocker lock( m_computingMutex );
int MetaDataManager::mediaPlayersMaxCount() const
{
return m_mediaPlayers.count();
m_mediaPlayer->stop();
delete m_mediaPlayer;
m_mediaPlayer = NULL;
m_computeInProgress = false;
if ( m_mediaToCompute.size() != 0 )
launchComputing( m_mediaToCompute.dequeue() );
}
void MetaDataManager::computeMediaMetadata( Media *media )
{
{
QMutexLocker lock(&m_mediasToComputeMetaDataMutex);
m_mediasToComputeMetaData.enqueue( media );
}
checkMediasToCompute();
}
QMutexLocker lock( m_computingMutex );
void MetaDataManager::checkMediasToCompute()
{
//qDebug() << "checking media to compute" << m_mediasToComputeMetaData << m_mediasToComputeSnapshot << m_mediasToComputeAudioSpectrum;
m_mediasToComputeMetaDataMutex.lock();
m_mediasToComputeSnapshotMutex.lock();
m_mediasToComputeAudioSpectrumMutex.lock();
m_mediaPlayersMutex.lock();
QMap<MediaPlayerState, LibVLCpp::MediaPlayer*>::iterator it;
if ( m_mediasToComputeMetaData.count() > 0 &&
( it = m_mediaPlayers.find( Idle ) ) != m_mediaPlayers.end() )
{
m_mediasToComputeAudioSpectrumMutex.unlock();
Media* media;
media = m_mediasToComputeMetaData.dequeue();
m_mediasToComputeSnapshot.enqueue( media );
m_mediasToComputeMetaDataMutex.unlock();
m_mediasToComputeSnapshotMutex.unlock();
LibVLCpp::MediaPlayer* mediaPlayer = it.value();
m_mediaPlayers.erase( it );
m_mediaPlayers.insert( Running, mediaPlayer );
m_mediaPlayersMutex.unlock();
MetaDataWorker* worker = new MetaDataWorker( mediaPlayer, media, MetaDataWorker::MetaData );
connect( worker, SIGNAL( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), this, SLOT( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), Qt::DirectConnection );
//connect( media, SIGNAL( metaDataComputed( Media* ) ), this, SLOT( checkMediasToCompute() ) );
worker->compute();
}
else if ( m_mediasToComputeSnapshot.count() > 0 &&
( it = m_mediaPlayers.find( Idle ) ) != m_mediaPlayers.end() )
if ( m_computeInProgress == true )
{
m_mediasToComputeMetaDataMutex.unlock();
Media* media;
media = m_mediasToComputeSnapshot.dequeue();
m_mediasToComputeAudioSpectrum.enqueue( media );
m_mediasToComputeSnapshotMutex.unlock();
m_mediasToComputeAudioSpectrumMutex.unlock();
LibVLCpp::MediaPlayer* mediaPlayer = it.value();
m_mediaPlayers.erase( it );
m_mediaPlayers.insert( Running, mediaPlayer );
m_mediaPlayersMutex.unlock();
MetaDataWorker* worker = new MetaDataWorker( mediaPlayer, media, MetaDataWorker::Snapshot );
//disconnect( media, SIGNAL( metaDataComputed( Media* ) ), this, SLOT( checkMediasToCompute() ) );
connect( worker, SIGNAL( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), this, SLOT( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), Qt::DirectConnection );
//connect( media, SIGNAL( snapshotComputed( Media* ) ), this, SLOT( checkMediasToCompute() ) );
worker->compute();
}
else if (m_mediasToComputeAudioSpectrum.count() > 0 &&
(it = m_mediaPlayers.find( Idle ) ) != m_mediaPlayers.end() )
{
m_mediasToComputeMetaDataMutex.unlock();
m_mediasToComputeSnapshotMutex.unlock();
Media* media;
media = m_mediasToComputeAudioSpectrum.dequeue();
m_mediasToComputeAudioSpectrumMutex.unlock();
LibVLCpp::MediaPlayer* mediaPlayer = it.value();
m_mediaPlayers.erase( it );
m_mediaPlayers.insert( Running, mediaPlayer );
m_mediaPlayersMutex.unlock();
/******************************************************************************************/
// FIXME: In MetaDataWorker the m_media->getVLCMedia()->setAudioDataCtx( this ); method
// doesn't change anything so the lock continue to use the old instance even if this method
// is set with a new instance. It seems that the mediaPlayer instance keept the first value
// and don't care of the new value.
mediaPlayer->stop();
delete mediaPlayer;
mediaPlayer = new LibVLCpp::MediaPlayer();
/******************************************************************************************/
MetaDataWorker* worker = new MetaDataWorker( mediaPlayer, media, MetaDataWorker::Audio );
connect( worker, SIGNAL( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), this, SLOT( mediaPlayerIdle( LibVLCpp::MediaPlayer* ) ), Qt::DirectConnection );
worker->compute();
m_mediaToCompute.enqueue( media );
}
else
{
m_mediasToComputeSnapshotMutex.unlock();
m_mediasToComputeMetaDataMutex.unlock();
m_mediasToComputeAudioSpectrumMutex.unlock();
m_mediaPlayersMutex.unlock();
}
return;
}
void MetaDataManager::mediaPlayerIdle( LibVLCpp::MediaPlayer* mediaPlayer )
{
//qDebug() << "new media player idle";
{
QMutexLocker lock(&m_mediaPlayersMutex);
m_mediaPlayers.remove( Running, mediaPlayer );
m_mediaPlayers.insert( Idle, mediaPlayer );
launchComputing( media );
}
checkMediasToCompute();
}
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@gmail.com>
* 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
......@@ -23,54 +23,36 @@
#ifndef METADATAMANAGER_H
#define METADATAMANAGER_H
#include <QObject>
#include <QMutex>
#include <QMutexLocker>
#include <QQueue>
#include <QMultiMap>
#include <QThreadPool>
#include "VLCMediaPlayer.h"
#include "Media.h"
#include "Singleton.hpp"
#define DEFAULT_MAX_MEDIA_PLAYER 1
#include <QObject>
#include <QQueue>
class QMutex;
class Media;
class MetaDataManager : public QObject, public Singleton<MetaDataManager>
{
Q_OBJECT
Q_DISABLE_COPY( MetaDataManager )
enum MediaPlayerState
{
Idle,
Running
};
Q_DISABLE_COPY( MetaDataManager );
public:
~MetaDataManager();
void computeMediaMetadata( Media* media );
void setMediaPlayersNumberMaxCount( int number );
void addMediaPlayer();
void removeMediaPlayer();
void populateEmptyMediaPlayerSlots();
int mediaPlayersMaxCount() const;
void checkMediasToCompute();
private slots:
void mediaPlayerIdle( LibVLCpp::MediaPlayer* mediaPlayer );
private:
MetaDataManager();
~MetaDataManager();
void launchComputing( Media *media );
private:
QQueue<Media*> m_mediasToComputeMetaData;
QQueue<Media*> m_mediasToComputeSnapshot;
QQueue<Media*> m_mediasToComputeAudioSpectrum;
QMultiMap<MediaPlayerState, LibVLCpp::MediaPlayer*> m_mediaPlayers;
QMutex m_mediasToComputeMetaDataMutex;
QMutex m_mediasToComputeSnapshotMutex;
QMutex m_mediasToComputeAudioSpectrumMutex;
QMutex m_mediaPlayersMutex;
int m_mediaPlayersMaxCount;
int m_mediaPlayersToRemove;
friend class Singleton<MetaDataManager>;
QMutex *m_computingMutex;
QQueue<Media*> m_mediaToCompute;
bool m_computeInProgress;
LibVLCpp::MediaPlayer *m_mediaPlayer;
friend class Singleton<MetaDataManager>;
private slots:
void computingCompleted();
};
#endif //METADATAMANAGER_H
......@@ -31,9 +31,8 @@
#include <QThreadPool>
#include <QRunnable>
MetaDataWorker::MetaDataWorker( LibVLCpp::MediaPlayer* mediaPlayer, Media* media, MetaDataWorker::MetaDataType type ) :
MetaDataWorker::MetaDataWorker( LibVLCpp::MediaPlayer* mediaPlayer, Media* media ) :
m_mediaPlayer( mediaPlayer ),
m_type( type ),
m_media( media ),
m_mediaIsPlaying( false),
m_lengthHasChanged( false ),
......@@ -43,36 +42,37 @@ MetaDataWorker::MetaDataWorker( LibVLCpp::MediaPlayer* mediaPlayer, Media* media
MetaDataWorker::~MetaDataWorker()
{
delete m_audioBuffer;
if ( m_audioBuffer )
delete m_audioBuffer;
}
void MetaDataWorker::compute()
{
if ( m_media->getFileType() == Media::Video )
if ( m_media->getFileType() == Media::Video ||
m_media->getFileType() == Media::Audio )
{
if ( m_type == Audio )
computeAudioMetaData();
else
computeVideoMetaData();
computeDynamicFileMetaData();
}
else if ( m_media->getFileType() == Media::Image )
{
computeImageMetaData();
}
m_media->addConstantParam( ":vout=dummy" );
m_mediaPlayer->setMedia( m_media->getVLCMedia() );
if ( m_type != Audio )
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( entrypointPlaying() ), Qt::QueuedConnection );
connect( m_mediaPlayer, SIGNAL( playing() ),
this, SLOT( entrypointPlaying() ), Qt::QueuedConnection );
m_mediaPlayer->play();
m_media->flushVolatileParameters();
}
void MetaDataWorker::computeVideoMetaData()
void MetaDataWorker::computeDynamicFileMetaData()
{
//Disabling audio for this specific use of the media
if ( m_media->getFileType() == Media::Video )
m_media->addConstantParam( ":vout=dummy" );
m_media->addVolatileParam( ":no-audio", ":audio" );
connect( m_mediaPlayer, SIGNAL( lengthChanged() ), this, SLOT( entrypointLengthChanged() ), Qt::QueuedConnection );
connect( m_mediaPlayer, SIGNAL( lengthChanged() ),
this, SLOT( entrypointLengthChanged() ), Qt::QueuedConnection );
}
void MetaDataWorker::computeImageMetaData()
......@@ -83,7 +83,7 @@ void MetaDataWorker::computeImageMetaData()
m_lengthHasChanged = true;
}
void MetaDataWorker::computeAudioMetaData()
void MetaDataWorker::prepareAudioSpectrumComputing()
{
m_media->getVLCMedia()->addOption( ":no-sout-video" );
m_media->getVLCMedia()->addOption( ":sout=#transcode{}:smem" );
......@@ -96,7 +96,7 @@ void MetaDataWorker::computeAudioMetaData()
connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( generateAudioSpectrum() ), Qt::QueuedConnection );
}
void MetaDataWorker::getMetaData()
void MetaDataWorker::metaDataAvailable()
{
m_mediaIsPlaying = false;
m_lengthHasChanged = false;
......@@ -104,51 +104,44 @@ void MetaDataWorker::getMetaData()
//In order to wait for the VOUT to be ready:
//Until we have a way of knowing when it is, both getWidth and getHeight method
//will trigger exception... so we shut it up.
LibVLCpp::Exception::setErrorCallback( LibVLCpp::Exception::silentExceptionHandler );
while ( m_mediaPlayer->hasVout() == false )
if ( m_media->getFileType() != Media::Audio )
{
SleepMS( 1 ); //Ugly isn't it :)
}
LibVLCpp::Exception::setErrorCallback( NULL );
LibVLCpp::Exception::setErrorCallback( LibVLCpp::Exception::silentExceptionHandler );
while ( m_mediaPlayer->hasVout() == false )
{
SleepMS( 1 ); //Ugly isn't it :)
}
LibVLCpp::Exception::setErrorCallback( NULL );
if ( m_type == MetaData )
{
m_media->setLength( m_mediaPlayer->getLength() );
m_media->setWidth( m_mediaPlayer->getWidth() );
m_media->setHeight( m_mediaPlayer->getHeight() );
m_media->setFps( m_mediaPlayer->getFps() );
if ( m_media->getFps() == .0f )
{
qWarning() << "Invalid FPS for media:" << m_media->getFileInfo()->absoluteFilePath();
m_media->setFps( Clip::DefaultFPS );
}
m_media->setNbFrames( (m_media->getLengthMS() / 1000) * m_media->getFps() );
if ( m_mediaPlayer->isPlaying() )
m_mediaPlayer->stop();
emit mediaPlayerIdle( m_mediaPlayer );
m_media->emitMetaDataComputed( true );
delete this;
return;
}
else if ( m_type == Snapshot )
m_media->setLength( m_mediaPlayer->getLength() );
m_media->setFps( m_mediaPlayer->getFps() );
if ( m_media->getFps() == .0f )
{
//Setting time for snapshot :
if ( m_media->getFileType() == Media::Video )
{
connect( m_mediaPlayer, SIGNAL( positionChanged( float ) ), this, SLOT( renderSnapshot() ) );
m_mediaPlayer->setTime( m_mediaPlayer->getLength() / 3 );
}
else
connect( this, SIGNAL( snapshotRequested() ), this, SLOT( renderSnapshot() ) );
qWarning() << "Invalid FPS for media:" << m_media->getFileInfo()->absoluteFilePath();
m_media->setFps( Clip::DefaultFPS );
}
m_media->setNbFrames( (m_media->getLengthMS() / 1000) * m_media->getFps() );
m_media->emitMetaDataComputed();
//Setting time for snapshot :
if ( m_media->getFileType() == Media::Video ||
m_media->getFileType() == Media::Image )
{
connect( m_mediaPlayer, SIGNAL( positionChanged( float ) ), this, SLOT( renderSnapshot() ) );
m_mediaPlayer->setTime( m_mediaPlayer->getLength() / 3 );
}
else
finalize();
}
void MetaDataWorker::renderSnapshot()
{
if ( m_media->getFileType() == Media::Video )
if ( m_media->getFileType() == Media::Video ||
m_media->getFileType() == Media::Audio )
disconnect( m_mediaPlayer, SIGNAL( positionChanged( float ) ), this, SLOT( renderSnapshot() ) );
else
disconnect( this, SIGNAL( snapshotRequested() ), this, SLOT( renderSnapshot() ) );
QTemporaryFile tmp;
tmp.setAutoRemove( false );
tmp.open();
......@@ -177,15 +170,15 @@ void MetaDataWorker::setSnapshot()
//CHECKME:
//This is synchrone, but it may become asynchrone in the future...
// connect( m_mediaPlayer, SIGNAL( stopped () ), this, SLOT( mediaPlayerStopped() ), Qt::QueuedConnection );
if ( m_mediaIsPlaying )
m_mediaPlayer->stop();
emit mediaPlayerIdle( m_mediaPlayer );
if ( m_type == Snapshot )
m_media->emitSnapshotComputed();
else
m_media->emitMetaDataComputed( true );
m_media->emitSnapshotComputed();
finalize();
}
void MetaDataWorker::finalize()
{
m_media->disconnect( this );
emit computed();
delete this;
}
......@@ -194,7 +187,7 @@ void MetaDataWorker::entrypointLengthChanged()
disconnect( m_mediaPlayer, SIGNAL( lengthChanged() ), this, SLOT( entrypointLengthChanged() ) );
m_lengthHasChanged = true;
if ( m_mediaIsPlaying == true )
getMetaData();
metaDataAvailable();
}
void MetaDataWorker::entrypointPlaying()
......@@ -202,7 +195,7 @@ void MetaDataWorker::entrypointPlaying()
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( entrypointPlaying() ) );
m_mediaIsPlaying = true;
if ( m_lengthHasChanged == true )
getMetaData();
metaDataAvailable();
}
void MetaDataWorker::lock( MetaDataWorker* metaDataWorker, uint8_t** pcm_buffer , unsigned int size )
......@@ -252,7 +245,6 @@ void MetaDataWorker::generateAudioSpectrum()
{
disconnect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( generateAudioSpectrum() ) );
m_mediaPlayer->stop();
emit mediaPlayerIdle( m_mediaPlayer );
// AudioSpectrumHelper* audioSpectrum = new AudioSpectrumHelper( m_media->getAudioValues() );
// audioSpectrum->setAutoDelete( true );
// QThreadPool::globalInstance()->start( audioSpectrum );
......
......@@ -44,19 +44,19 @@ class MetaDataWorker : public QObject
};
public:
MetaDataWorker( LibVLCpp::MediaPlayer* mediaPlayer, Media* media, MetaDataType type );
MetaDataWorker( LibVLCpp::MediaPlayer* mediaPlayer, Media* media );
~MetaDataWorker();
void compute();
private:
void computeVideoMetaData();
void computeDynamicFileMetaData();
void computeImageMetaData();
void computeAudioMetaData();
void prepareAudioSpectrumComputing();
void addAudioValue( int value );
void finalize();
private:
void getMetaData();
void initVlcOutput();
void metaDataAvailable();
static void lock( MetaDataWorker* metaDataWorker, uint8_t** pcm_buffer , unsigned int size );
static void unlock( MetaDataWorker* metaDataWorker, uint8_t* pcm_buffer,
unsigned int channels, unsigned int rate,
......@@ -65,8 +65,6 @@ class MetaDataWorker : public QObject
private:
LibVLCpp::MediaPlayer* m_mediaPlayer;
MetaDataType m_type;
Media* m_media;
QString m_tmpSnapshotFilename;
......@@ -75,16 +73,15 @@ class MetaDataWorker : public QObject
unsigned char* m_audioBuffer;
signals:
void snapshotRequested();
void mediaPlayerIdle( LibVLCpp::MediaPlayer* mediaPlayer );
private slots:
void renderSnapshot();
void setSnapshot();
void entrypointPlaying();
void entrypointLengthChanged();
void generateAudioSpectrum();
signals:
void computed();
};
#endif // METADATAWORKER_H
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