[vlmc-devel] Clip: Set default formats

Yikai Lu git at videolan.org
Sun Jul 10 18:03:31 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul  9 00:24:31 2016 +0900| [c6eaf750216b85beeaf82e52a9a72efdd442b52b] | committer: Yikai Lu

Clip: Set default formats

> https://code.videolan.org/videolan/vlmc/commit/c6eaf750216b85beeaf82e52a9a72efdd442b52b
---

 src/Media/Clip.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index ee62b99..9986ce6 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -43,6 +43,12 @@ Clip::Clip( Media *media, qint64 begin /*= 0*/, qint64 end /*= Backend::IInput::
 {
     m_childs = new MediaContainer( this );
     m_rootClip = media->baseClip();
+    Formats f;
+    if ( media->input()->hasAudio() == true )
+        f |= Clip::Audio;
+    if ( media->input()->hasVideo() == true )
+        f |= Clip::Video;
+    setFormats( f );
 }
 
 Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -2*/,
@@ -63,6 +69,7 @@ Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -2*/,
     else
         end = parent->begin() + end;
     m_input = parent->input()->cut( begin, end );
+    setFormats( parent->formats() );
 }
 
 Clip::~Clip()
@@ -250,7 +257,8 @@ Clip::toVariant() const
     QVariantHash h = {
         { "uuid", m_uuid.toString() },
         { "metatags", m_metaTags },
-        { "notes", m_notes }
+        { "notes", m_notes },
+        { "formats", (int)formats() }
     };
     if ( isRootClip() )
         h.insert( "media", m_media->toVariant() );



More information about the Vlmc-devel mailing list