- Posts: 1
- Joined: Tue Mar 15, 2016 12:23 pm
Hello,
I'm new to the BM SDK and trying to convert incoming frames into an easier to work with RGB array. I've been using the Capture sample code as a basis.
I've reached the point of converting from the incoming YUV format to RGB but i'm experiencing issues with Segmentation Faults on the conversion line.
"frameConverter->ConvertFrame(srcVideoFrame, outFrame);"
Can anyone provide any suggestions as to where I am going wrong with this? Or, point me towards best / easier practises for converting the incoming frame into a data structure more resembling a 2D array of RGB pixel objects. e.g.
Grateful for any help / suggestions anyone can provide.
Many thanks,
James
I'm new to the BM SDK and trying to convert incoming frames into an easier to work with RGB array. I've been using the Capture sample code as a basis.
I've reached the point of converting from the incoming YUV format to RGB but i'm experiencing issues with Segmentation Faults on the conversion line.
"frameConverter->ConvertFrame(srcVideoFrame, outFrame);"
- Code: Select all
static void toRGB(IDeckLinkVideoFrame* srcVideoFrame) {
int width = srcVideoFrame->GetWidth();
int height = srcVideoFrame->GetHeight();
int rowBytes = srcVideoFrame->GetRowBytes();
int noBytes = rowBytes * height;
// Get output interface for conversion.
IDeckLinkOutput* m_deckLinkOutput = NULL;
if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&m_deckLinkOutput) != S_OK)
{
fprintf(stderr, "Could not obtain the IDeckLinkOutput interface\n");
}
// Convert video frame to RGB format.
IDeckLinkMutableVideoFrame* outFrame = NULL;
// Create new frame.
m_deckLinkOutput->CreateVideoFrame(width, height, rowBytes, bmdFormat8BitARGB, bmdFrameFlagDefault, &outFrame);
IDeckLinkVideoConversion* frameConverter = NULL;
frameConverter = CreateVideoConversionInstance();
frameConverter->ConvertFrame(srcVideoFrame, outFrame); // Segmentation fault here.
}
Can anyone provide any suggestions as to where I am going wrong with this? Or, point me towards best / easier practises for converting the incoming frame into a data structure more resembling a 2D array of RGB pixel objects. e.g.
- Code: Select all
struct RGBPixel{
int r;
int g;
int b;
}
Grateful for any help / suggestions anyone can provide.
Many thanks,
James