Internal keyer and VB.Net

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Maurizio Bianchella

  • Posts: 17
  • Joined: Wed Dec 10, 2014 2:15 pm

Internal keyer and VB.Net

PostMon Aug 10, 2015 4:09 pm

Hi,
I'm trying to use the internal key of a Decklink Studio 4k card, by API and VB.Net 2013 (FrameWork 3.5)
I'm able to obtain a reference to the IDecklink interface, to the IDecklinkOutput and IDecklinkKeyer ones.
The problem seems to be to create a good IDeckLinkMutableVideoFrame.
To do that, first of all I create it by CreateVideoFrame method of a IDecklinkOutput interface, by the following params:
CreateVideoFrame(720, 576, (720 * 4), DeckLinkAPI._BMDPixelFormat.bmdFormat8BitARGB, DeckLinkAPI._BMDFrameFlags.bmdFrameFlagFlipVertical, IVF)

where, of course, the IFV is a reference to a IDecklinkMutableVideoFrame. Just for a test, I'm using only a PAL resolution

Then I need to copy the data from an image file to the IDeckLinkMutableVideoFrame object, an I'm trying by:

Dim pBuffer As System.IntPtr
IVF.GetBytes(pBuffer)
Dim Stride As Integer = IVF.GetRowBytes
Dim V As New System.Drawing.Bitmap(IVF.GetWidth, IVF.GetHeight, Stride, Imaging.PixelFormat.Format32bppRgb, pBuffer)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(V)
g.DrawImage(btm, 0, 0, btm.Width, btm.Height)

and then I dispose all the thing.
The btm variable is a bitmap obtained by the an image file.
the problem is that the image is shown, but the colors are not right. I've tried all the params for the System.Drawing.imaging.PixelFormat argument when I create a new bitmap, but without any good result.
Can you help me, please?
Maurizio Bianchella
Italy
Offline

Nicholas Gill

Blackmagic Design

  • Posts: 169
  • Joined: Mon May 04, 2015 10:28 pm

Re: Internal keyer and VB.Net

PostWed Aug 12, 2015 12:30 am

Hi Maurizio,

The code shown is creating a video frame expecting the bmdFormat8BitARGB pixel format.

Referencing SDK Manual section 2.7.4 Pixel Formats - bmdFormat8BitARGB:

ARGB (or ARGB32) 4:4:4:4 raw
Four 8-bit unsigned components are packed into one 32-bit little-endian word. Alpha channel is valid.


Whereas the pixel format provided is Imaging.PixelFormat.Format32bppRgb [1]:

Specifies that the format is 32 bits per pixel; 8 bits each are used for the red, green, and blue components. The remaining 8 bits are not used.


i.e.
Expected: ARGB
Actual: RGB-

The application will need to provide the frame data in the expected pixel format. Reference table in [1] to find a PixelFormat enumeration which matches what the Desktop Video API expects (check in 2.7.4) for the frame pixel format.

Cheers,

-nick

[1] https://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat(v=vs.110).aspx
Offline

thomasgodon

  • Posts: 14
  • Joined: Tue Mar 19, 2013 3:22 pm

Re: Internal keyer and VB.Net

PostFri Jan 08, 2016 12:32 pm

Hi,

Can you point me in the right direction the get a reference to de idecklinkiterator within vb.net?

thx
Thomas

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 14 guests