]> git.sesse.net Git - kdenlive/blob - src/blackmagic/capture.h
* Add preliminary support for Blackmagic HDMI capture card
[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 IDeckLinkInputCallback
14 {
15 public:
16         DeckLinkCaptureDelegate();
17         ~DeckLinkCaptureDelegate();
18
19         virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
20         virtual ULONG STDMETHODCALLTYPE AddRef(void);
21         virtual ULONG STDMETHODCALLTYPE  Release(void);
22         virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
23         virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
24
25 private:
26         ULONG                           m_refCount;
27         pthread_mutex_t         m_mutex;
28 };
29
30 class CaptureHandler
31 {
32 public:
33         CaptureHandler(QLayout *lay, QWidget *parent = 0);
34         ~CaptureHandler();
35         CDeckLinkGLWidget *previewView;
36         void startPreview(int deviceId, int captureMode);
37         void stopPreview();
38         void startCapture();
39         void stopCapture();
40         void captureFrame(const QString &fname);
41         void showOverlay(QImage img, bool transparent = true);
42         void hideOverlay();
43         
44 private:
45         IDeckLinkIterator               *deckLinkIterator;
46         DeckLinkCaptureDelegate         *delegate;
47         IDeckLinkDisplayMode            *displayMode;
48         IDeckLink                       *deckLink;
49         IDeckLinkInput                  *deckLinkInput;
50         IDeckLinkDisplayModeIterator    *displayModeIterator;
51         QLayout *m_layout;
52         QWidget *m_parent;
53 };
54
55
56 #endif