56 #include "../include/DecklinkInput.h"
61 : m_refCount(0), g_timecodeFormat(0), frameCount(0), final_frameCount(0)
70 pthread_mutex_init(&m_mutex, NULL);
75 pthread_mutex_destroy(&m_mutex);
80 pthread_mutex_lock(&m_mutex);
82 pthread_mutex_unlock(&m_mutex);
84 return (ULONG)m_refCount;
89 pthread_mutex_lock(&m_mutex);
91 pthread_mutex_unlock(&m_mutex);
99 return (ULONG)m_refCount;
112 std::shared_ptr<openshot::Frame> f;
120 #pragma omp critical (blackmagic_input_queue)
130 cout <<
"Can't find " << requested_frame <<
", GetCurrentFrameNumber(): " <<
GetCurrentFrameNumber() << endl;
144 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
146 fprintf(stderr,
"Frame received (#%lu) - No input signal detected\n",
frameCount);
150 const char *timecodeString = NULL;
153 IDeckLinkTimecode *timecode;
156 timecode->GetString(&timecodeString);
166 free((
void*)timecodeString);
169 IDeckLinkMutableVideoFrame *m_yuvFrame = NULL;
171 int width = videoFrame->GetWidth();
172 int height = videoFrame->GetHeight();
177 videoFrame->GetRowBytes(),
183 void *frameBytesSource;
184 void *frameBytesDest;
185 videoFrame->GetBytes(&frameBytesSource);
186 m_yuvFrame->GetBytes(&frameBytesDest);
187 memcpy(frameBytesDest, frameBytesSource, videoFrame->GetRowBytes() * height);
198 omp_set_nested(
true);
218 #pragma omp task firstprivate(copy_deckLinkOutput, copy_deckLinkConverter, frame, copy_frameCount)
222 void *audioFrameBytes;
225 IDeckLinkMutableVideoFrame *m_rgbFrame = NULL;
227 int width = videoFrame->GetWidth();
228 int height = videoFrame->GetHeight();
230 HRESULT res = copy_deckLinkOutput->CreateVideoFrame(
239 cout <<
"BMDOutputDelegate::StartRunning: Error creating RGB frame, res:" << res << endl;
242 copy_deckLinkConverter->ConvertFrame(frame, m_rgbFrame);
245 m_rgbFrame->GetBytes(&frameBytes);
248 std::shared_ptr<openshot::Frame> f(
new openshot::Frame(copy_frameCount, width, height,
"#000000", 2048, 2));
254 #pragma omp critical (blackmagic_input_queue)
262 m_rgbFrame->Release();