X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fabstractmonitor.h;h=1167e6c446f8bc09b677158f193ee1fc2df7e9d8;hb=dec4e4c60fabbd22d90ea55e34f59948e30a35a4;hp=2f56ac4d4629f9fc2477b40c0bd69f433499172c;hpb=ac5f5c9f6d4bdffeb76f3f2098b80f27bc532606;p=kdenlive diff --git a/src/abstractmonitor.h b/src/abstractmonitor.h index 2f56ac4d..1167e6c4 100644 --- a/src/abstractmonitor.h +++ b/src/abstractmonitor.h @@ -26,20 +26,42 @@ #include #include #include +#include + +#include class VideoPreviewContainer : public QFrame { Q_OBJECT public: VideoPreviewContainer(QWidget *parent = 0); - + ~VideoPreviewContainer(); + /** @brief Set the image to be displayed, will be put in the queue. */ void setImage(QImage img); + /** @brief Start the display refresh timer. */ + void start(); + /** @brief Stop the display refresh timer. */ + void stop(); + /** @brief Set the display ratio for this display. */ + void setRatio(double ratio); protected: virtual void paintEvent(QPaintEvent */*event*/); + virtual void resizeEvent(QResizeEvent * event); private: - QImage *m_image; + /** @brief The display aspect ratio for profile. */ + double m_dar; + /** @brief When true, the whole widget surface will be repainted, useful when resizing widget. */ + bool m_refresh; + /** @brief The rectangle defining the area for painting our image. */ + QRect m_displayRect; + /** @brief The queue of images to be displayed. */ + QList m_imageQueue; + /** @brief We refresh the image with a timer, since this widget is only for preview during capture. */ + QTimer m_refreshTimer; + /** @brief Re-calculate the display zone after a resize or aspect ratio change. */ + void updateDisplayZone(); }; @@ -49,20 +71,25 @@ class AbstractRender: public QObject Q_OBJECT public: /** @brief Build an abstract MLT Renderer - * @param rendererName A unique identifier for this renderer + * @param name A unique identifier for this renderer * @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering * @param profile The MLT profile used for the renderer (default one will be used if empty). */ - AbstractRender(QWidget *parent = 0):QObject(parent),sendFrameForAnalysis(false) {}; + AbstractRender(const QString &name, QWidget *parent = 0):QObject(parent), sendFrameForAnalysis(false), m_name(name) {}; /** @brief Destroy the MLT Renderer. */ virtual ~AbstractRender() {}; /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */ bool sendFrameForAnalysis; + + const QString &name() const {return m_name;}; /** @brief Someone needs us to send again a frame. */ virtual void sendFrameUpdate() = 0; +private: + QString m_name; + signals: /** @brief The renderer refreshed the current frame. */ void frameUpdated(QImage);