[vlmc-devel] [PATCH] Fix guessing as a wrong type of media when itsonMetaDataComputed is not yet called

yikei lu luyikei.qmltu at gmail.com
Sun Apr 10 19:13:29 CEST 2016


Also sorry. I should’ve saved only media’s path in clip. Please ignore this patch !


 
Sent from my Windows 10 phone

From: yikei lu
Sent: 2016年4月11日 1:37
To: Mailing list for vlmc developers
Subject: Re: [PATCH] Fix guessing as a wrong type of media when itsonMetaDataComputed is not yet called

Sorry I meant TrackWorkflow

2016-04-11 0:52 GMT+09:00 Yikai Lu <luyikei.qmltu at gmail.com>:
> If loading in MainWorkflow is too fast to compute media's metadata, it's highly likely that the workflow will misjudge the type of ClipWorkflow.
> ---
>  src/Library/MediaContainer.cpp | 6 ++++--
>  src/Media/Media.cpp            | 5 ++++-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
> index a0b3364..574cb95 100644
> --- a/src/Library/MediaContainer.cpp
> +++ b/src/Library/MediaContainer.cpp
> @@ -195,7 +195,9 @@ MediaContainer::count() const
>  Media*
>  MediaContainer::createMediaFromVariant( const QVariant& var )
>  {
> -    Media* m = addMedia( QFileInfo( var.toString() ) );
> +    auto map = var.toMap();
> +    Media* m = addMedia( QFileInfo( map["path"].toString() ) );
> +    m->setFileType( (Media::FileType) map["type"].toInt() );
>      return m;
>  }
>
> @@ -209,7 +211,7 @@ MediaContainer::createClipFromVariant( const QVariant &var, Clip* parent )
>          c = new Clip( parent, h["begin"].toULongLong(),
>                  h["end"].toULongLong(), h["uuid"].toString() );
>      else {
> -        c = new Clip( m_medias[ h["media"].toString() ], 0, -1, h["uuid"].toString() );
> +        c = new Clip( m_medias[ h["media"].toMap()["path"].toString() ], 0, -1, h["uuid"].toString() );
>          addClip( c );
>      }
>      if ( h.contains( "subClips" ) )
> diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
> index 9f708f1..cdbbd31 100644
> --- a/src/Media/Media.cpp
> +++ b/src/Media/Media.cpp
> @@ -151,7 +151,10 @@ Media::onMetaDataComputed()
>  QVariant
>  Media::toVariant() const
>  {
> -    return QVariant( m_fileInfo->absoluteFilePath() );
> +    return QVariant( QVariantHash {
> +                         { "path", m_fileInfo->absoluteFilePath() },
> +                         { "type", (int) m_fileType }
> +                     } );
>  }
>
>  void
> --
> 1.9.1
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlmc-devel/attachments/20160411/d06bf532/attachment.html>


More information about the Vlmc-devel mailing list