[vlmc-devel] SequenceWorkflow: Duplicate a clip in addClip
Yikai Lu
git at videolan.org
Tue Aug 23 18:09:32 CEST 2016
vlmc | branch: medialibrary | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Aug 21 18:12:39 2016 -0500| [87bcc3927ac09087c1ad15f056d489a32a59e98b] | committer: Hugo Beauzée-Luyssen
SequenceWorkflow: Duplicate a clip in addClip
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> https://code.videolan.org/videolan/vlmc/commit/87bcc3927ac09087c1ad15f056d489a32a59e98b
---
src/Workflow/SequenceWorkflow.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/Workflow/SequenceWorkflow.cpp b/src/Workflow/SequenceWorkflow.cpp
index 3f2b9f6..8d1654a 100644
--- a/src/Workflow/SequenceWorkflow.cpp
+++ b/src/Workflow/SequenceWorkflow.cpp
@@ -33,6 +33,7 @@
#include "Main/Core.h"
#include "Library/Library.h"
#include "Tools/VlmcDebug.h"
+#include "Media/Media.h"
SequenceWorkflow::SequenceWorkflow( size_t trackCount )
: m_multitrack( new Backend::MLT::MLTMultiTrack )
@@ -76,12 +77,18 @@ SequenceWorkflow::addClip( QSharedPointer<Clip> const& clip, quint32 trackId, qi
QString
SequenceWorkflow::addClip( const QUuid& uuid, quint32 trackId, qint32 pos, bool isAudioClip )
{
- auto newClip = Core::instance()->library()->clip( uuid );
- if ( newClip == nullptr )
+ auto parentClip = Core::instance()->library()->clip( uuid );
+ if ( parentClip == nullptr )
{
vlmcCritical() << "Couldn't find an acceptable parent to be added.";
return QUuid().toString();
}
+ auto newClip = parentClip->media()->cut( parentClip->begin(), parentClip->end() );
+ if ( newClip == nullptr )
+ {
+ vlmcCritical() << "Couldn't duplicate the parent clip.";
+ return QUuid().toString();
+ }
if ( isAudioClip == true )
newClip->setFormats( Clip::Audio );
More information about the Vlmc-devel
mailing list