]> git.sesse.net Git - kdenlive/blob - src/blackmagic/capture.h
Fix compile warning
[kdenlive] / src / blackmagic / capture.h
1 #ifndef __BMDCAPTURE_H__
2 #define __BMDCAPTURE_H__
3
4 #include "include/DeckLinkAPI.h"
5 #include "../stopmotion/capturehandler.h"
6
7 #include <QWidget>
8 #include <QObject>
9 #include <QLayout>
10 #if defined(Q_WS_MAC) || defined(Q_OS_FREEBSD)
11 #include <pthread.h>
12 #endif
13
14 class CDeckLinkGLWidget;
15 class PlaybackDelegate;
16
17 class DeckLinkCaptureDelegate : public QObject, public IDeckLinkInputCallback
18 {
19     Q_OBJECT
20 public:
21     DeckLinkCaptureDelegate();
22     virtual ~DeckLinkCaptureDelegate();
23     void setAnalyse(bool isOn);
24     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID /*iid*/, LPVOID */*ppv*/) {
25         return E_NOINTERFACE;
26     }
27     virtual ULONG STDMETHODCALLTYPE AddRef(void);
28     virtual ULONG STDMETHODCALLTYPE  Release(void);
29     virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
30     virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
31
32 private:
33     ULONG               m_refCount;
34     pthread_mutex_t     m_mutex;
35     QList <IDeckLinkVideoInputFrame*> m_framesList;
36     QStringList m_framePath;
37     bool m_analyseFrame;
38
39 private slots:
40     void slotProcessFrame();
41
42 signals:
43     void gotTimeCode(ulong);
44     void gotMessage(const QString &);
45     void frameSaved(const QString);
46     void gotFrame(QImage);
47 };
48
49 class BmdCaptureHandler : public CaptureHandler
50 {
51     Q_OBJECT
52 public:
53     BmdCaptureHandler(QVBoxLayout *lay, QWidget *parent = 0);
54     ~BmdCaptureHandler();
55     CDeckLinkGLWidget *previewView;
56     void startPreview(int deviceId, int captureMode, bool audio = true);
57     void stopPreview();
58     void startCapture(const QString &path);
59     void stopCapture();
60     void captureFrame(const QString &fname);
61     void showOverlay(QImage img, bool transparent = true);
62     void hideOverlay();
63     void hidePreview(bool hide);
64     QStringList getDeviceName(QString);
65     void setDevice(const QString input, QString size = QString());
66
67 private:
68     IDeckLinkIterator       *deckLinkIterator;
69     DeckLinkCaptureDelegate     *delegate;
70     IDeckLinkDisplayMode        *displayMode;
71     IDeckLink           *deckLink;
72     IDeckLinkInput          *deckLinkInput;
73     IDeckLinkDisplayModeIterator    *displayModeIterator;
74 };
75
76
77 #endif