]> git.sesse.net Git - kdenlive/blob - src/blackmagic/capture.h
Preliminary support for blackmagic capture (only .raw format for now, cannot be read...
[kdenlive] / src / blackmagic / capture.h
1 #ifndef __CAPTURE_H__
2 #define __CAPTURE_H__
3
4 #include "include/DeckLinkAPI.h"
5
6 #include <QWidget>
7 #include <QObject>
8 #include <QLayout>
9
10 class CDeckLinkGLWidget;
11 class PlaybackDelegate;
12
13 class DeckLinkCaptureDelegate : public QObject, public IDeckLinkInputCallback
14 {
15 Q_OBJECT
16 public:
17         DeckLinkCaptureDelegate();
18         virtual ~DeckLinkCaptureDelegate();
19
20         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID /*iid*/, LPVOID */*ppv*/) { return E_NOINTERFACE; }
21         virtual ULONG STDMETHODCALLTYPE AddRef(void);
22         virtual ULONG STDMETHODCALLTYPE  Release(void);
23         virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
24         virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
25
26 private:
27         ULONG                           m_refCount;
28         pthread_mutex_t         m_mutex;
29 signals:
30         void gotTimeCode(ulong);
31         void gotMessage(const QString &);
32 };
33
34 class CaptureHandler : public QObject
35 {
36   Q_OBJECT
37 public:
38         CaptureHandler(QVBoxLayout *lay, QWidget *parent = 0);
39         ~CaptureHandler();
40         CDeckLinkGLWidget *previewView;
41         void startPreview(int deviceId, int captureMode);
42         void stopPreview();
43         void startCapture(const QString &path);
44         void stopCapture();
45         void captureFrame(const QString &fname);
46         void showOverlay(QImage img, bool transparent = true);
47         void hideOverlay();
48         void hidePreview(bool hide);
49         
50 private:
51         IDeckLinkIterator               *deckLinkIterator;
52         DeckLinkCaptureDelegate         *delegate;
53         IDeckLinkDisplayMode            *displayMode;
54         IDeckLink                       *deckLink;
55         IDeckLinkInput                  *deckLinkInput;
56         IDeckLinkDisplayModeIterator    *displayModeIterator;
57         QVBoxLayout *m_layout;
58         QWidget *m_parent;
59
60 signals:
61         void gotTimeCode(ulong);
62         void gotMessage(const QString &);
63 };
64
65
66 #endif