Decklink sdk starter code?

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

rakshithgb

  • Posts: 4
  • Joined: Wed Jun 27, 2018 4:53 am
  • Real Name: Rakshith Balaji

Decklink sdk starter code?

PostWed Jun 27, 2018 5:08 am

I've spent almost a week reading the sdk manual and trying out the given samples. I'm running a windows 10 machine with visual studio 2017. I was able to successfully build and run all samples. However I'm still struggling to write my own code.

1) After including and linking all the files in the "include" folder provided by the sdk to my project, the build fails. I get the errors
Code: Select all
MIDL202 syntax error: expecting a type specification near "HRESULT"
MIDL202 cannot recover from earlier syntax error; aborting compilation.

My code file is empty, I just wanted to see if the solution builds just by including the files provided.
It would be helpful if someone can provide a step by step guide on how to start the project since the sdk manual doesn't say much.

2) It would also be helpful if someone writes a simple code just to capture a frame from a video stream. A lot of people in this forum are currently struggling to start from scratch.
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 129
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Decklink sdk starter code?

PostThu Jun 28, 2018 5:26 am

Hi Rakshith,

You shouldn't need to link the Include directory.

To get the project to build, add Win/include/DeckLinkAPI.idl to your project (I normally add this to a filter named "DeckLink API" to keep seperate from my source).

When you build you should see MIDL invoked:
1>Processing ..\..\include\DeckLinkAPI.idl
1>DeckLinkAPI.idl

Are you able to share full build output?

Regards
Cameron
Offline

rakshithgb

  • Posts: 4
  • Joined: Wed Jun 27, 2018 4:53 am
  • Real Name: Rakshith Balaji

Re: Decklink sdk starter code?

PostThu Jun 28, 2018 5:39 am

Hi Cameron,

Yes sorry that was a silly mistake. I had to change a few property settings and I was able to successfully build. I'm now able to include the API header and use its objects.

However I'm still struggling to write simple code to capture frame. Currently I'm using this as a reference:
https://stackoverflow.com/questions/414 ... o-opencv-m

My setup involves only a single camera so I did the necessary changes. But I copied most of his code in runInput() function to my main function. But he has the callback defined like this:
Code: Select all
g_deckLinkInput->SetCallback(this);


How would I have to define it since all the code is in main?
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 129
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Decklink sdk starter code?

PostMon Jul 02, 2018 7:33 am

Hi Rakshith,

You cannot implement all the capture functionality in the main function. At minimum you need to create a class that subclasses IDeckLinkInputCallback base so that you have a callback function for the incoming frame.

Have a look at the Capture (Linux) or CapturePreview (Win/macOS) SDK samples to see example how to implement this class.

Regards
Cameron
Offline

rakshithgb

  • Posts: 4
  • Joined: Wed Jun 27, 2018 4:53 am
  • Real Name: Rakshith Balaji

Re: Decklink sdk starter code?

PostTue Jul 10, 2018 5:21 pm

Thank you Cameron I've implemented the subclass and used the callback properly.

If anyone is struggling to write a simple capture code I suggest what Cameron suggested, refer the capture code in linux samples and if you wish to do image processing using OpenCV the stack overflow link in my previous reply is a good start.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests