]> git.sesse.net Git - nageru/blobdiff - nageru/decklink_capture.cpp
Allow dynamic frame sizes for FFmpeg inputs.
[nageru] / nageru / decklink_capture.cpp
index e239ec964f6f70d17fc13c24494ead77e7d726b4..90d86b15dd580f0fe73d96148fa4f728ff280c9f 100644 (file)
@@ -256,7 +256,14 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
                        assert(stride == width * 2);
                }
 
-               current_video_frame = video_frame_allocator->create_frame(width, height, stride);
+               if (width * stride > FRAME_SIZE) {
+                       // TODO: If we had an OpenGL context here, calling create_frame()
+                       // would be completely fine.
+                       fprintf(stderr, "Card %u: Captured frame %d x %d (stride %d) would be larger than supported frame size (%d > %d), skipping.\n",
+                               card_index, width, height, stride, width * stride, FRAME_SIZE);
+               } else {
+                       current_video_frame = video_frame_allocator->create_frame(width, height, stride);
+               }
                if (current_video_frame.data != nullptr) {
                        const uint8_t *src;
                        video_frame->GetBytes((void **)&src);