[vlmc-devel] commit: Fixing length problems ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Sep 15 23:26:27 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Sep 15 23:14:49 2010 +0200| [1ee4f1b7001bfd8b99036b71c0d1366d9fc5cdb9] | committer: Hugo Beauzée-Luyssen 

Fixing length problems

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=1ee4f1b7001bfd8b99036b71c0d1366d9fc5cdb9
---

 src/Commands/Commands.cpp          |    5 ++++-
 src/EffectsEngine/Effect.h         |    1 +
 src/EffectsEngine/EffectHelper.cpp |    4 ++--
 src/Gui/timeline/TracksView.cpp    |    2 --
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/Commands/Commands.cpp b/src/Commands/Commands.cpp
index f5706c1..2d4b7f9 100644
--- a/src/Commands/Commands.cpp
+++ b/src/Commands/Commands.cpp
@@ -230,7 +230,10 @@ Commands::Effect::Move::redo()
         m_old->removeEffect( m_helper );
         m_new->addEffect( m_helper );
         qint64  offset = m_helper->begin() - m_newPos;
-        m_helper->setBoundaries( m_newPos, m_helper->end() - offset );
+        if ( m_helper->end() <= 0 )
+            m_helper->setBoundaries( m_newPos, ::Effect::TrackEffectDefaultLength );
+        else
+            m_helper->setBoundaries( m_newPos, m_helper->end() - offset );
     }
     else
         m_new->moveEffect( m_helper, m_newPos );
diff --git a/src/EffectsEngine/Effect.h b/src/EffectsEngine/Effect.h
index e250036..82b1e93 100644
--- a/src/EffectsEngine/Effect.h
+++ b/src/EffectsEngine/Effect.h
@@ -32,6 +32,7 @@ class   EffectInstance;
 class Effect : public QLibrary
 {
     public:
+        static const quint32        TrackEffectDefaultLength = 25 * 60 * 10; //10 minutes at 25fps
         enum    Type
         {
             Unknown = -1,
diff --git a/src/EffectsEngine/EffectHelper.cpp b/src/EffectsEngine/EffectHelper.cpp
index 04179a0..2a1baf7 100644
--- a/src/EffectsEngine/EffectHelper.cpp
+++ b/src/EffectsEngine/EffectHelper.cpp
@@ -56,6 +56,6 @@ EffectHelper::setTarget( EffectUser *target )
     m_begin = 0;
     if ( target != NULL )
         m_end = target->length();
-    else
-        m_end = -1;
+    if ( m_end <= 0 ) //Clip can't be 0lengthed, so this case would be a track.
+        m_end = Effect::TrackEffectDefaultLength; //Have a reasonable default length.
 }
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 493c770..00a5a27 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -286,8 +286,6 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
         EffectHelper    *effectHelper = qobject_cast<EffectHelper*>( helper );
         Q_ASSERT( effectHelper != NULL );
         item = new GraphicsEffectItem( effectHelper );
-        if ( helper->length() <= 0 )
-            item->setWidth( maximumWidth() );
     }
     m_itemsLoaded.insert( helper->uuid() );
     item->m_tracksView = this;



More information about the Vlmc-devel mailing list