]> git.sesse.net Git - kdenlive/commitdiff
Remember last seek position for clips in project tree
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 23 Oct 2012 23:13:23 +0000 (01:13 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 23 Oct 2012 23:13:23 +0000 (01:13 +0200)
src/clipitem.cpp
src/docclipbase.cpp
src/docclipbase.h
src/monitor.cpp

index 091eee6af772bf12f0420d4524dd465e24b6eb5e..6553c6bd80ccf33e26cf1dc84b424db4c2d2fc4e 100644 (file)
@@ -1145,7 +1145,7 @@ void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame, int startpixel, in
             int sample = (int)((frame - (int)(frame)) * 20);   // AUDIO_FRAME_SIZE
             if (frame < 0 || sample < 0 || sample > 19)
                 continue;
-            QMap<int, QByteArray> frame_channel_data = baseClip()->m_audioFrameCache[(int)frame];
+            QMap<int, QByteArray> frame_channel_data = baseClip()->audioFrameCache[(int)frame];
 
             for (int channel = 0; channel < channels && frame_channel_data[channel].size() > 0; channel++) {
 
index d278eeca429e9307f13c6da6feafbe9cd5ff052c..5dd95e56e7da1d3d5bafce4a0ae8c5a3e22b2175 100644 (file)
@@ -41,7 +41,8 @@
 
 DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) :
         QObject(),
-        m_audioFrameCache(),
+        lastSeekPosition(0),
+        audioFrameCache(),
         m_refcount(0),
         m_baseTrackProducers(),
         m_videoTrackProducers(),
@@ -137,7 +138,7 @@ bool DocClipBase::hasAudioThumb() const
 
 void DocClipBase::slotClearAudioCache()
 {
-    m_audioFrameCache.clear();
+    audioFrameCache.clear();
     m_audioThumbCreated = false;
 }
 
@@ -284,7 +285,7 @@ void DocClipBase::setAudioThumbCreated(bool isDone)
 void DocClipBase::updateAudioThumbnail(const audioByteArray& data)
 {
     //kDebug() << "CLIPBASE RECIEDVED AUDIO DATA*********************************************";
-    m_audioFrameCache = data;
+    audioFrameCache = data;
     m_audioThumbCreated = true;
     emit gotAudioData();
 }
index 724ca2180dbc4bfe096f44080bc348dfb90c406b..e6e722c25447d1a3b57d80b8d2c53423e908c281 100644 (file)
@@ -165,10 +165,6 @@ Q_OBJECT public:
     /** Returns the thumbnail producer used by this clip */
     KThumb *thumbProducer();
 
-    /** Cache for every audio Frame with 10 Bytes */
-    /** format is frame -> channel ->bytes */
-    QMap<int, QMap<int, QByteArray> > m_audioFrameCache;
-
     /** Free cache data */
     void slotClearAudioCache();
     QString getClipHash() const;
@@ -206,9 +202,12 @@ Q_OBJECT public:
     bool getAudioThumbs();
     void setAnalysisData(const QString &name, const QString &data);
     QMap <QString, QString> analysisData() const;
+    int lastSeekPosition;
+    /** Cache for every audio Frame with 10 Bytes */
+    /** format is frame -> channel ->bytes */
+    QMap<int, QMap<int, QByteArray> > audioFrameCache;
 
 private:   // Private attributes
-
     /** The number of times this clip is used in the project - the number of references to this clip
      * that exist. */
     uint m_refcount;
index d7491dea4852b5191bdfede8636120384af17cd1..67b35e92117784819422d209cf54a9864490a173 100644 (file)
@@ -830,6 +830,7 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda
 {
     if (render == NULL) return;
     if (clip == NULL && m_currentClip != NULL) {
+       m_currentClip->lastSeekPosition = render->seekFramePosition();
         kDebug()<<"// SETTING NULL CLIP MONITOR";
         m_currentClip = NULL;
         m_length = -1;
@@ -838,7 +839,9 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda
     }
 
     if (clip != m_currentClip || forceUpdate) {
+       if (m_currentClip) m_currentClip->lastSeekPosition = render->seekFramePosition();
         m_currentClip = clip;
+       if (position == -1) position = clip->lastSeekPosition;
         if (m_currentClip) slotActivateMonitor();
         updateMarkers(clip);
         Mlt::Producer *prod = NULL;