]> git.sesse.net Git - kdenlive/blob - src/blackmagic/capture.h
webcam capture: Try to get webcam name instead of displaying /dev/video0
[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 #ifdef Q_WS_MAC
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 signals:
36     void gotTimeCode(ulong);
37     void gotMessage(const QString &);
38     void frameSaved(const QString);
39 };
40
41 class BmdCaptureHandler : public CaptureHandler
42 {
43     Q_OBJECT
44 public:
45     BmdCaptureHandler(QVBoxLayout *lay, QWidget *parent = 0);
46     ~BmdCaptureHandler();
47     CDeckLinkGLWidget *previewView;
48     void startPreview(int deviceId, int captureMode);
49     void stopPreview();
50     void startCapture(const QString &path);
51     void stopCapture();
52     void captureFrame(const QString &fname);
53     void showOverlay(QImage img, bool transparent = true);
54     void hideOverlay();
55     void hidePreview(bool hide);
56     QString getDeviceName(QString);
57
58 private:
59     IDeckLinkIterator       *deckLinkIterator;
60     DeckLinkCaptureDelegate     *delegate;
61     IDeckLinkDisplayMode        *displayMode;
62     IDeckLink           *deckLink;
63     IDeckLinkInput          *deckLinkInput;
64     IDeckLinkDisplayModeIterator    *displayModeIterator;
65 };
66
67
68 #endif