]> git.sesse.net Git - kdenlive/blob - src/blackmagic/capture.h
- Fix build on FreeBSD.
[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
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
38 private slots:
39     void slotProcessFrame();
40
41 signals:
42     void gotTimeCode(ulong);
43     void gotMessage(const QString &);
44     void frameSaved(const QString);
45 };
46
47 class BmdCaptureHandler : public CaptureHandler
48 {
49     Q_OBJECT
50 public:
51     BmdCaptureHandler(QVBoxLayout *lay, QWidget *parent = 0);
52     ~BmdCaptureHandler();
53     CDeckLinkGLWidget *previewView;
54     void startPreview(int deviceId, int captureMode, bool audio = true);
55     void stopPreview();
56     void startCapture(const QString &path);
57     void stopCapture();
58     void captureFrame(const QString &fname);
59     void showOverlay(QImage img, bool transparent = true);
60     void hideOverlay();
61     void hidePreview(bool hide);
62     QStringList getDeviceName(QString);
63     void setDevice(const QString input, QString size = QString());
64
65 private:
66     IDeckLinkIterator       *deckLinkIterator;
67     DeckLinkCaptureDelegate     *delegate;
68     IDeckLinkDisplayMode        *displayMode;
69     IDeckLink           *deckLink;
70     IDeckLinkInput          *deckLinkInput;
71     IDeckLinkDisplayModeIterator    *displayModeIterator;
72 };
73
74
75 #endif