[vlmc-devel] MetaData: Handle audio only files with a video extension
Hugo Beauzée-Luyssen
git at videolan.org
Mon Sep 3 23:51:00 CEST 2012
vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Sep 3 23:48:19 2012 +0300| [bbecd5f08d20176316168fc4641308c148271233] | committer: Hugo Beauzée-Luyssen
MetaData: Handle audio only files with a video extension
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=bbecd5f08d20176316168fc4641308c148271233
---
src/Media/Media.cpp | 5 +++++
src/Media/Media.h | 1 +
src/Metadata/MetaDataWorker.cpp | 18 +++++++++++++-----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index b3724ef..ef31fd0 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -183,6 +183,11 @@ Media::fileType() const
return m_fileType;
}
+void Media::setFileType(Media::FileType type)
+{
+ m_fileType = type;
+}
+
void
Media::emitMetaDataComputed()
{
diff --git a/src/Media/Media.h b/src/Media/Media.h
index 210872c..03fee55 100644
--- a/src/Media/Media.h
+++ b/src/Media/Media.h
@@ -137,6 +137,7 @@ public:
int nbVideoTracks() const;
FileType fileType() const;
+ void setFileType( FileType type );
InputType inputType() const;
diff --git a/src/Metadata/MetaDataWorker.cpp b/src/Metadata/MetaDataWorker.cpp
index 643f7fd..866dee9 100644
--- a/src/Metadata/MetaDataWorker.cpp
+++ b/src/Metadata/MetaDataWorker.cpp
@@ -91,9 +91,6 @@ MetaDataWorker::compute()
void
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 ) ),
this, SLOT( entrypointLengthChanged( qint64 ) ), Qt::QueuedConnection );
}
@@ -113,6 +110,19 @@ MetaDataWorker::metaDataAvailable()
m_mediaIsPlaying = 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 )
{
//In order to wait for the VOUT to be ready:
@@ -149,8 +159,6 @@ MetaDataWorker::metaDataAvailable()
else
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->emitMetaDataComputed();
More information about the Vlmc-devel
mailing list