- Posts: 4
- Joined: Mon Oct 30, 2017 12:33 pm
Hello,
I am just getting started in the magic [black] world of the blackmagic SDK.
I am trying to embed a live Video input using the native SDK (no directshow).
I am using a Decklink 4K SDI, driver 10.9.5, on Windows 7.
I started from the CapturePreviewCSharp sample project.
My plan was:
- get the Frame using the C# sample out of the box;
- convert from YUV -> RGB in the VideoInputFrameArrived callback
Unfortunately I am getting an access violation when I call the frameConverter.ConvertFrame(videoFrame, dst); I check the size of the 2 frames is the same and I couldn't find any info on the net.
- convert to Bitmap; I was thinking to use the following code, but I didn't get this far yet as I get the exception in the previous point:
If this is not the way to do it please let me know
- Raise an event with the Bitmap as argument that gets handled in another project (WPF) where the UI lives.
If anybody on the forum can please advise on both the exception and on the IFrameDeckLinkVideoFrame to Bitmap conversion it would be great!
Thanks in advance
PaCO
I am just getting started in the magic [black] world of the blackmagic SDK.
I am trying to embed a live Video input using the native SDK (no directshow).
I am using a Decklink 4K SDI, driver 10.9.5, on Windows 7.
I started from the CapturePreviewCSharp sample project.
My plan was:
- get the Frame using the C# sample out of the box;
- convert from YUV -> RGB in the VideoInputFrameArrived callback
- Code: Select all
void IDeckLinkInputCallback.VideoInputFrameArrived(IDeckLinkVideoInputFrame videoFrame, IDeckLinkAudioInputPacket audioPacket)
{
if (videoFrame != null)
{
bool inputSignal = videoFrame.GetFlags().HasFlag(_BMDFrameFlags.bmdFrameHasNoInputSource);
if (inputSignal != m_validInputSignal)
{
m_validInputSignal = inputSignal;
InputSignalChanged(m_validInputSignal);
}
IDeckLinkMutableVideoFrame dst;
m_deckLinkOutput.CreateVideoFrame(videoFrame.GetWidth(), videoFrame.GetHeight(),
videoFrame.GetRowBytes(), _BMDPixelFormat.bmdFormat8BitRGBA, _BMDFrameFlags.bmdFrameFlagDefault, out dst);
IDeckLinkVideoConversion frameConverter = new CDeckLinkVideoConversion();
frameConverter.ConvertFrame(videoFrame, dst);
Unfortunately I am getting an access violation when I call the frameConverter.ConvertFrame(videoFrame, dst); I check the size of the 2 frames is the same and I couldn't find any info on the net.
- convert to Bitmap; I was thinking to use the following code, but I didn't get this far yet as I get the exception in the previous point:
- Code: Select all
IntPtr pointer;
dst.GetBytes(out pointer);
Bitmap bmp = new Bitmap(dst.GetWidth(), dst.GetHeight(), 0, System.Drawing.Imaging.PixelFormat.Format32bppRgb, pointer);
If this is not the way to do it please let me know
- Raise an event with the Bitmap as argument that gets handled in another project (WPF) where the UI lives.
If anybody on the forum can please advise on both the exception and on the IFrameDeckLinkVideoFrame to Bitmap conversion it would be great!
Thanks in advance
PaCO