]> git.sesse.net Git - kdenlive/blobdiff - src/clipmanager.h
* Fix crash when deleting clip and audio thumb was being created
[kdenlive] / src / clipmanager.h
index ad01a17c41c6b474a047e6a5eef9b01fdf2a89fb..169341a065e0d3e31c8ce728dcc026bbb6b9dfde 100644 (file)
@@ -30,6 +30,8 @@
 #include <QPixmap>
 #include <QObject>
 #include <QTimer>
+#include <QMutex>
+#include <QFuture>
 
 #include <KUrl>
 #include <KUndoStack>
@@ -96,8 +98,6 @@ Q_OBJECT public:
     int getFreeClipId();
     int getFreeFolderId();
     int lastClipId() const;
-    void startAudioThumbsGeneration();
-    void endAudioThumbsGeneration(const QString &requestedId);
     void askForAudioThumb(const QString &id);
     QString projectFolder() const;
     void clearUnusedProducers();
@@ -110,6 +110,10 @@ Q_OBJECT public:
     void removeGroup(AbstractGroupItem *group);
     QDomElement groupsXml() const;
     int clipsCount() const;
+    /** @brief Request creation of a clip thumbnail for specified frames. */
+    void requestThumbs(const QString id, QList <int> frames);
+    /** @brief remove a clip id from the queue list. */
+    void stopThumbs(const QString &id);
 
 #if KDE_IS_VERSION(4,5,0)
     KImageCache* pixmapCache;
@@ -122,6 +126,8 @@ private slots:
     void slotClipAvailable(const QString &path);
     /** Check the list of externally modified clips, and process them if they were not modified in the last 1500 milliseconds */
     void slotProcessModifiedClips();
+    void slotGetThumbs();
+    void slotGetAudioThumbs();
 
 private:   // Private attributes
     /** the list of clips in the document */
@@ -134,19 +140,32 @@ private:   // Private attributes
     KdenliveDoc *m_doc;
     int m_clipIdCounter;
     int m_folderIdCounter;
-    QString m_generatingAudioId;
     KDirWatch m_fileWatcher;
     /** Timer used to reload clips when they have been externally modified */
     QTimer m_modifiedTimer;
     /** List of the clip IDs that need to be reloaded after being externally modified */
     QMap <QString, QTime> m_modifiedClips;
+    /** Struct containing the list of clip thumbnails to request (clip id and frames) */
+    QMap <QString, int> m_requestedThumbs;
+    QMutex m_thumbsMutex;
+    QFuture<void> m_thumbsThread;
+    /** @brief If true, abort processing of clip thumbs before removing a clip. */
+    bool m_abortThumb;
+    /** @brief We are about to delete the clip producer, stop processing thumbs. */
+    bool m_closing;
+    QFuture<void> m_audioThumbsThread;
+    /** @brief If true, abort processing of audio thumbs. */
+    bool m_abortAudioThumb;
+    /** @brief The id of currently processed clip for audio thumbs creation. */
+    QString m_processingAudioThumbId;
 
 signals:
     void reloadClip(const QString &);
     void modifiedClip(const QString &);
     void missingClip(const QString &);
     void availableClip(const QString &);
-    void checkAllClips(bool displayRatioChanged, bool fpsChanged);
+    void checkAllClips(bool displayRatioChanged, bool fpsChanged, QStringList brokenClips);
+    void displayMessage(const QString &, int);
 };
 
 #endif