[vlmc-devel] [PATCH] Fix guessing as a wrong type of media when its onMetaDataComputed is not yet called
yikei lu
luyikei.qmltu at gmail.com
Tue Apr 12 15:02:12 CEST 2016
I won't
2016-04-12 22:00 GMT+09:00 Hugo Beauzée-Luyssen <hugo at beauzee.fr>:
> On 04/11/2016 05:17 AM, Yikai Lu wrote:
>>
>> 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 | 4 +++-
>> src/Media/Clip.cpp | 2 +-
>> src/Media/Media.cpp | 5 ++++-
>> 3 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/Library/MediaContainer.cpp
>> b/src/Library/MediaContainer.cpp
>> index a0b3364..ec6b5a5 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;
>> }
>>
>> diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
>> index 4f29f8e..b0ad42e 100644
>> --- a/src/Media/Clip.cpp
>> +++ b/src/Media/Clip.cpp
>> @@ -241,7 +241,7 @@ Clip::toVariant() const
>> { "notes", m_notes }
>> };
>> if ( isRootClip() )
>> - h.insert( "media", m_media->toVariant() );
>> + h.insert( "media", m_media->fileInfo()->absoluteFilePath() );
>> else
>> {
>> h.insert( "parent", m_parent->uuid().toString() );
>> 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
>>
> If the correct type is guaranteed to be known (which is the case with the
> new media library), do you need this extra complexity?
>
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel
More information about the Vlmc-devel
mailing list