OpenShot Library | libopenshot  0.2.7
DecklinkInput.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for DecklinkInput class
4  * @author Jonathan Thomas <jonathan@openshot.org>, Blackmagic Design
5  *
6  * @ref License
7  */
8 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 // Copyright (c) 2009 Blackmagic Design
11 //
12 // SPDX-License-Identifier: LGPL-3.0-or-later
13 // SPDX-License-Identifier: MIT
14 
15 #ifndef OPENSHOT_DECKLINK_INPUT_H
16 #define OPENSHOT_DECKLINK_INPUT_H
17 
18 #include <iostream>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <pthread.h>
23 #include <unistd.h>
24 #include <fcntl.h>
25 
26 #include "DeckLinkAPI.h"
27 #include "Frame.h"
28 #include "CacheMemory.h"
29 #include "OpenMPUtilities.h"
30 
31 /// Implementation of the Blackmagic Decklink API (used by the DecklinkReader)
32 class DeckLinkInputDelegate : public IDeckLinkInputCallback
33 {
34 public:
35  pthread_cond_t* sleepCond;
36  BMDTimecodeFormat g_timecodeFormat;
37  unsigned long frameCount;
38  unsigned long final_frameCount;
39 
40  // Queue of raw video frames
41  std::deque<IDeckLinkMutableVideoFrame*> raw_video_frames;
43 
44  // Convert between YUV and RGB
45  IDeckLinkOutput *deckLinkOutput;
46  IDeckLinkVideoConversion *deckLinkConverter;
47 
48  DeckLinkInputDelegate(pthread_cond_t* m_sleepCond, IDeckLinkOutput* deckLinkOutput, IDeckLinkVideoConversion* deckLinkConverter);
50 
51  virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
52  virtual ULONG STDMETHODCALLTYPE AddRef(void);
53  virtual ULONG STDMETHODCALLTYPE Release(void);
54  virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
55  virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
56 
57  // Extra methods
58  std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
59  unsigned long GetCurrentFrameNumber();
60 
61 private:
62  ULONG m_refCount;
63  pthread_mutex_t m_mutex;
64 };
65 
66 #endif
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame)
virtual ULONG STDMETHODCALLTYPE AddRef(void)
Header file for OpenMPUtilities (set some common macros)
std::deque< IDeckLinkMutableVideoFrame * > raw_video_frames
Definition: DecklinkInput.h:41
virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode *, BMDDetectedVideoInputFormatFlags)
Header file for CacheMemory class.
Header file for Frame class.
Implementation of the Blackmagic Decklink API (used by the DecklinkReader)
Definition: DecklinkInput.h:32
DeckLinkInputDelegate(pthread_cond_t *m_sleepCond, IDeckLinkOutput *deckLinkOutput, IDeckLinkVideoConversion *deckLinkConverter)
unsigned long frameCount
Definition: DecklinkInput.h:37
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame *, IDeckLinkAudioInputPacket *)
unsigned long GetCurrentFrameNumber()
openshot::CacheMemory final_frames
Definition: DecklinkInput.h:42
virtual ULONG STDMETHODCALLTYPE Release(void)
unsigned long final_frameCount
Definition: DecklinkInput.h:38
BMDTimecodeFormat g_timecodeFormat
Definition: DecklinkInput.h:36
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv)
Definition: DecklinkInput.h:51
pthread_cond_t * sleepCond
Definition: DecklinkInput.h:35
IDeckLinkOutput * deckLinkOutput
Definition: DecklinkInput.h:45
IDeckLinkVideoConversion * deckLinkConverter
Definition: DecklinkInput.h:46
This class is a memory-based cache manager for Frame objects.
Definition: CacheMemory.h:32