20 : m_refCount(0), g_timecodeFormat(0), frameCount(0), final_frameCount(0)
29 pthread_mutex_init(&m_mutex, NULL);
34 pthread_mutex_destroy(&m_mutex);
39 pthread_mutex_lock(&m_mutex);
41 pthread_mutex_unlock(&m_mutex);
43 return (ULONG)m_refCount;
48 pthread_mutex_lock(&m_mutex);
50 pthread_mutex_unlock(&m_mutex);
58 return (ULONG)m_refCount;
71 std::shared_ptr<openshot::Frame> f;
79 #pragma omp critical (blackmagic_input_queue) 89 cout <<
"Can't find " << requested_frame <<
", GetCurrentFrameNumber(): " <<
GetCurrentFrameNumber() << endl;
103 if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
105 fprintf(stderr,
"Frame received (#%lu) - No input signal detected\n",
frameCount);
109 const char *timecodeString = NULL;
112 IDeckLinkTimecode *timecode;
115 timecode->GetString(&timecodeString);
125 free((
void*)timecodeString);
128 IDeckLinkMutableVideoFrame *m_yuvFrame = NULL;
130 int width = videoFrame->GetWidth();
131 int height = videoFrame->GetHeight();
136 videoFrame->GetRowBytes(),
142 void *frameBytesSource;
143 void *frameBytesDest;
144 videoFrame->GetBytes(&frameBytesSource);
145 m_yuvFrame->GetBytes(&frameBytesDest);
146 memcpy(frameBytesDest, frameBytesSource, videoFrame->GetRowBytes() * height);
157 omp_set_nested(
true);
177 #pragma omp task firstprivate(copy_deckLinkOutput, copy_deckLinkConverter, frame, copy_frameCount) 181 void *audioFrameBytes;
184 IDeckLinkMutableVideoFrame *m_rgbFrame = NULL;
186 int width = videoFrame->GetWidth();
187 int height = videoFrame->GetHeight();
189 HRESULT res = copy_deckLinkOutput->CreateVideoFrame(
198 cout <<
"BMDOutputDelegate::StartRunning: Error creating RGB frame, res:" << res << endl;
201 copy_deckLinkConverter->ConvertFrame(frame, m_rgbFrame);
204 m_rgbFrame->GetBytes(&frameBytes);
207 auto f = std::make_shared<openshot::Frame>(
208 copy_frameCount, width, height,
"#000000", 2048, 2);
214 #pragma omp critical (blackmagic_input_queue) 222 m_rgbFrame->Release();
#define OPEN_MP_NUM_PROCESSORS
std::shared_ptr< openshot::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 Add(std::shared_ptr< openshot::Frame > frame)
Add a Frame to the cache.
void Remove(int64_t frame_number)
Remove a specific frame.