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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon Apr 11 10:37:29 CEST 2016


On 04/11/2016 10:33 AM, Hugo Beauzée-Luyssen wrote:
> On 04/10/2016 05:47 PM, Yikai Lu wrote:
>> ---
>>   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
>>
> Applied, thanks!
> _______________________________________________
> Vlmc-devel mailing list
> Vlmc-devel at videolan.org
> https://mailman.videolan.org/listinfo/vlmc-devel

Oops, I missed the newer version, I suppose I should mostly review/apply 
the other patch, right?



More information about the Vlmc-devel mailing list