1 /***************************************************************************
2 mltdevicecapture.h - description
4 begin : Sun May 21 2011
5 copyright : (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org)
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
19 * @class MltDeviceCapture
20 * @brief Interface for MLT capture.
23 #ifndef MLTDEVICECAPTURE_H
24 #define MLTDEVICECAPTURE_H
27 #include "definitions.h"
28 #include "abstractmonitor.h"
29 #include "mlt/framework/mlt_types.h"
45 class MltDeviceCapture: public AbstractRender
49 enum FailStates { OK = 0,
52 /** @brief Build a MLT Renderer
53 * @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
54 * @param profile The MLT profile used for the capture (default one will be used if empty). */
55 MltDeviceCapture(QString profile, VideoPreviewContainer *surface, QWidget *parent = 0);
57 /** @brief Destroy the MLT Renderer. */
62 /** @brief This property is used to decide if the renderer should convert it's frames to QImage for use in other Kdenlive widgets. */
63 bool sendFrameForAnalysis;
65 /** @brief Someone needs us to send again a frame. */
66 void sendFrameUpdate() {};
68 void emitFrameUpdated(Mlt::Frame&);
69 void emitFrameNumber(double position);
70 void emitConsumerStopped();
71 void showFrame(Mlt::Frame&);
72 void showAudio(Mlt::Frame&);
74 void saveFrame(Mlt::Frame& frame);
76 /** @brief Starts the MLT Video4Linux process.
77 * @param surface The widget onto which the frame should be painted
79 bool slotStartCapture(const QString ¶ms, const QString &path, const QString &playlist);
80 bool slotStartPreview(const QString &producer);
81 /** @brief A frame arrived from the MLT Video4Linux process. */
82 void gotCapturedFrame(Mlt::Frame& frame);
83 /** @brief Save current frame to file. */
84 void captureFrame(const QString &path);
88 Mlt::Consumer * m_mltConsumer;
89 Mlt::Producer * m_mltProducer;
90 Mlt::Profile *m_mltProfile;
91 QString m_activeProfile;
93 /** @brief The surface onto which the captured frames should be painted. */
94 VideoPreviewContainer *m_captureDisplayWidget;
96 /** @brief A human-readable description of this renderer. */
99 /** @brief This property is used to decide if the renderer should send audio data for monitoring. */
102 QString m_capturePath;
104 /** @brief Build the MLT Consumer object with initial settings.
105 * @param profileName The MLT profile to use for the consumer */
106 void buildConsumer(const QString &profileName = QString());
111 /** @brief A frame's image has to be shown.
113 * Used in Mac OS X. */
114 void showImageSignal(QImage);
116 /** @brief This signal contains the audio of the current frame. */
117 void audioSamplesSignal(const QVector<int16_t>&, int freq, int num_channels, int num_samples);
119 void frameSaved(const QString);
123 /** @brief Stops the consumer. */