X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmltdevicecapture.h;h=ea7291c9acc358faa069c0edcdf5ebdf4f76b75a;hb=d679fbf19a2511b181570418dc7fa7c815728bcb;hp=2a332bf96a37a4f2288cd8eabfce0b585c006930;hpb=eaf30e1dab73f87d24a3b589e074b8c1cfa6f058;p=kdenlive diff --git a/src/mltdevicecapture.h b/src/mltdevicecapture.h index 2a332bf9..ea7291c9 100644 --- a/src/mltdevicecapture.h +++ b/src/mltdevicecapture.h @@ -1,4 +1,4 @@ -/*************************************************************************** + /*************************************************************************** mltdevicecapture.h - description ------------------- begin : Sun May 21 2011 @@ -26,21 +26,20 @@ #include "gentime.h" #include "definitions.h" #include "abstractmonitor.h" -#include "mlt/framework/mlt_types.h" +#include + +#include +#include + namespace Mlt { class Consumer; -class Playlist; -class Tractor; -class Transition; class Frame; -class Field; +class Event; class Producer; -class Filter; class Profile; -class Service; -}; +} class MltDeviceCapture: public AbstractRender { @@ -52,7 +51,7 @@ Q_OBJECT public: /** @brief Build a MLT 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 capture (default one will be used if empty). */ - MltDeviceCapture(QString profile, VideoPreviewContainer *surface, QWidget *parent = 0); + explicit MltDeviceCapture(QString profile, VideoSurface *surface, QWidget *parent = 0); /** @brief Destroy the MLT Renderer. */ ~MltDeviceCapture(); @@ -63,7 +62,7 @@ Q_OBJECT public: bool sendFrameForAnalysis; /** @brief Someone needs us to send again a frame. */ - void sendFrameUpdate() {}; + void sendFrameUpdate() {} void emitFrameUpdated(Mlt::Frame&); void emitFrameNumber(double position); @@ -82,58 +81,77 @@ Q_OBJECT public: void gotCapturedFrame(Mlt::Frame& frame); /** @brief Save current frame to file. */ void captureFrame(const QString &path); - void doRefresh(); + /** @brief This will add the video clip from path and add it in the overlay track. */ void setOverlay(const QString &path); /** @brief This will add an MLT video effect to the overlay track. */ - void setOverlayEffect(const QString tag, QStringList parameters); + void setOverlayEffect(const QString &tag, const QStringList ¶meters); /** @brief This will add a horizontal flip effect, easier to work when filming yourself. */ void mirror(bool activate); + + /** @brief True if we are processing an image (yuv > rgb) when recording. */ + bool processingImage; + + void pause(); private: Mlt::Consumer * m_mltConsumer; Mlt::Producer * m_mltProducer; Mlt::Profile *m_mltProfile; + Mlt::Event *m_showFrameEvent; QString m_activeProfile; int m_droppedFrames; + /** @brief When true, images will be displayed on monitor while capturing. */ bool m_livePreview; + /** @brief Count captured frames, used to display only one in ten images while capturing. */ + int m_frameCount; /** @brief The surface onto which the captured frames should be painted. */ - VideoPreviewContainer *m_captureDisplayWidget; + VideoSurface *m_captureDisplayWidget; /** @brief A human-readable description of this renderer. */ int m_winid; - /** @brief This property is used to decide if the renderer should send audio data for monitoring. */ - bool m_analyseAudio; + void uyvy2rgb(unsigned char *yuv_buffer, int width, int height); QString m_capturePath; + + QTimer m_droppedFramesTimer; + + QMutex m_mutex; /** @brief Build the MLT Consumer object with initial settings. * @param profileName The MLT profile to use for the consumer */ void buildConsumer(const QString &profileName = QString()); -private slots: +private slots: + void slotPreparePreview(); + void slotAllowPreview(); + /** @brief When capturing, check every second for dropped frames. */ + void slotCheckDroppedFrames(); + signals: /** @brief A frame's image has to be shown. * * Used in Mac OS X. */ - void showImageSignal(QImage); - - /** @brief This signal contains the audio of the current frame. */ - void audioSamplesSignal(const QVector&, int freq, int num_channels, int num_samples); + void showImageSignal(const QImage&); - void frameSaved(const QString); + void frameSaved(const QString &); void droppedFrames(int); + + void unblockPreview(); + void imageReady(const QImage &); + public slots: /** @brief Stops the consumer. */ void stop(); + void slotDoRefresh(); }; #endif