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

MetaData: Handle audio only files with a video extension

parent 8ff89d34
...@@ -183,6 +183,11 @@ Media::fileType() const ...@@ -183,6 +183,11 @@ Media::fileType() const
return m_fileType; return m_fileType;
} }
void Media::setFileType(Media::FileType type)
{
m_fileType = type;
}
void void
Media::emitMetaDataComputed() Media::emitMetaDataComputed()
{ {
......
...@@ -137,6 +137,7 @@ public: ...@@ -137,6 +137,7 @@ public:
int nbVideoTracks() const; int nbVideoTracks() const;
FileType fileType() const; FileType fileType() const;
void setFileType( FileType type );
InputType inputType() const; InputType inputType() const;
......
...@@ -91,9 +91,6 @@ MetaDataWorker::compute() ...@@ -91,9 +91,6 @@ MetaDataWorker::compute()
void void
MetaDataWorker::computeDynamicFileMetaData() MetaDataWorker::computeDynamicFileMetaData()
{ {
//Disabling audio for this specific use of the media
if ( m_media->fileType() == Media::Video )
m_media->addVolatileParam( ":no-audio", ":audio" );
connect( m_mediaPlayer, SIGNAL( lengthChanged( qint64 ) ), connect( m_mediaPlayer, SIGNAL( lengthChanged( qint64 ) ),
this, SLOT( entrypointLengthChanged( qint64 ) ), Qt::QueuedConnection ); this, SLOT( entrypointLengthChanged( qint64 ) ), Qt::QueuedConnection );
} }
...@@ -113,6 +110,19 @@ MetaDataWorker::metaDataAvailable() ...@@ -113,6 +110,19 @@ MetaDataWorker::metaDataAvailable()
m_mediaIsPlaying = false; m_mediaIsPlaying = false;
m_lengthHasChanged = false; m_lengthHasChanged = false;
m_media->setNbAudioTrack( m_mediaPlayer->getNbAudioTrack() );
m_media->setNbVideoTrack( m_mediaPlayer->getNbVideoTrack() );
if ( m_media->hasAudioTrack() == false && m_media->hasVideoTrack() == false )
{
emit failed( m_media );
return ;
}
//Don't be fooled by the extension, and probe the file for it's actual type:
if ( m_media->fileType() == Media::Video )
{
if ( m_media->hasVideoTrack() == false )
m_media->setFileType( Media::Audio );
}
if ( m_media->fileType() != Media::Audio ) if ( m_media->fileType() != Media::Audio )
{ {
//In order to wait for the VOUT to be ready: //In order to wait for the VOUT to be ready:
...@@ -149,8 +159,6 @@ MetaDataWorker::metaDataAvailable() ...@@ -149,8 +159,6 @@ MetaDataWorker::metaDataAvailable()
else else
m_media->setLength( m_mediaPlayer->getLength() ); m_media->setLength( m_mediaPlayer->getLength() );
m_media->setNbAudioTrack( m_mediaPlayer->getNbAudioTrack() );
m_media->setNbVideoTrack( m_mediaPlayer->getNbVideoTrack() );
m_media->setNbFrames( (m_media->lengthMS() / 1000) * m_media->fps() ); m_media->setNbFrames( (m_media->lengthMS() / 1000) * m_media->fps() );
m_media->emitMetaDataComputed(); m_media->emitMetaDataComputed();
......
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