I am a Electrical Engineering student and for first code in my internship I have to write something that captures and saves image and video from a DeckLink Duo 2 card using exclusively the SDK for it, that being my first "real code", unlike the mostly basic stuff we write in the university.
I've been trying to understand how to use that SDK for over a week at this point and haven't had a lot of success. More specifically I've been trying to follow pages 19 and 20 of the documentation, trying to write one method at a time but still stuck in the first one.
My idea, which seems to be the case in the examples the SDK gives, is to be implementing the classes as pointers and then executing the suggested methods using them, such as in the code that follows. I'm just trying to call the EnableVideoInput method so by being sure I implemented one of them, I know the path to implement the other ones:
#include "DeckLinkAPI.h"
#include <stdio.h>
#include <list>
#include <map>
#include <conio.h>
#include "platform.h"
int main(int argc, char** argv)
{
IDeckLink* deckLink;
IDeckLinkIterator* deckLinkIterator;
IDeckLinkInput* deckLinkInput;
IDeckLinkDisplayMode* displayMode;
HRESULT result;
// Initialize COM on this thread
result = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (FAILED(result))
{
fprintf(stderr, "Initialization of COM failed - result = %08x.\n", result);
return 1;
}
// Comando CoCreateInstance orientado pela documentacao para criar o objeto iDeckLink.
result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator);
if (result != S_OK)
{
fprintf(stderr, "The selected device does not have an input interface\n");
}
// Applying the step suggested in the documentation
result = deckLinkInput->EnableVideoInput(bmdModeHD1080p6000, bmdFormat8BitYUV, bmdVideoInputFlagDefault);
CoUninitialize();
getch();
}
It builds, but when I try to either open or debug it, it says "The variable 'deckLinkInput' is being used without being initialized". What am I getting wrong and how could I implement these methods?
The compiler is correct,
deckLinkInput
is uninitialised, you've forgotten to callIDeckLinkIterator::Next
to get the card:Then you need to get the input from the card: