53 #include "../include/DecklinkInput.h" 58 : m_refCount(0), g_timecodeFormat(0), frameCount(0), final_frameCount(0)
67 pthread_mutex_init(&m_mutex, NULL);
72 pthread_mutex_destroy(&m_mutex);
77 pthread_mutex_lock(&m_mutex);
79 pthread_mutex_unlock(&m_mutex);
81 return (ULONG)m_refCount;
86 pthread_mutex_lock(&m_mutex);
88 pthread_mutex_unlock(&m_mutex);
96 return (ULONG)m_refCount;
109 std::shared_ptr<openshot::Frame> f;
117 #pragma omp critical (blackmagic_input_queue) 127 cout <<
"Can't find " << requested_frame <<
", GetCurrentFrameNumber(): " <<
GetCurrentFrameNumber() << endl;
141 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
143 fprintf(stderr,
"Frame received (#%lu) - No input signal detected\n",
frameCount);
147 const char *timecodeString = NULL;
150 IDeckLinkTimecode *timecode;
153 timecode->GetString(&timecodeString);
163 free((
void*)timecodeString);
166 IDeckLinkMutableVideoFrame *m_yuvFrame = NULL;
168 int width = videoFrame->GetWidth();
169 int height = videoFrame->GetHeight();
174 videoFrame->GetRowBytes(),
180 void *frameBytesSource;
181 void *frameBytesDest;
182 videoFrame->GetBytes(&frameBytesSource);
183 m_yuvFrame->GetBytes(&frameBytesDest);
184 memcpy(frameBytesDest, frameBytesSource, videoFrame->GetRowBytes() * height);
195 omp_set_nested(
true);
215 #pragma omp task firstprivate(copy_deckLinkOutput, copy_deckLinkConverter, frame, copy_frameCount) 219 void *audioFrameBytes;
222 IDeckLinkMutableVideoFrame *m_rgbFrame = NULL;
224 int width = videoFrame->GetWidth();
225 int height = videoFrame->GetHeight();
227 HRESULT res = copy_deckLinkOutput->CreateVideoFrame(
236 cout <<
"BMDOutputDelegate::StartRunning: Error creating RGB frame, res:" << res << endl;
239 copy_deckLinkConverter->ConvertFrame(frame, m_rgbFrame);
242 m_rgbFrame->GetBytes(&frameBytes);
245 std::shared_ptr<openshot::Frame> f(
new openshot::Frame(copy_frameCount, width, height,
"#000000", 2048, 2));
251 #pragma omp critical (blackmagic_input_queue) 259 m_rgbFrame->Release();
This class represents a single frame of video (i.e. image & audio data)
void Add(std::shared_ptr< Frame > frame)
Add a Frame to the cache.
#define OPEN_MP_NUM_PROCESSORS
std::shared_ptr< Frame > GetFrame(int64_t frame_number)
Get a frame from the cache.
void SetMaxBytes(int64_t number_of_bytes)
Set maximum bytes to a different amount.
void Remove(int64_t frame_number)
Remove a specific frame.