Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.cpp #2

Open
github-jeff opened this issue Nov 16, 2020 · 7 comments
Open

main.cpp #2

github-jeff opened this issue Nov 16, 2020 · 7 comments

Comments

@github-jeff
Copy link

github-jeff commented Nov 16, 2020

OS: Ubuntu 20.04

I have adjusted the make file to reference both the opencv4/opencv2 directory as well as the black magic SDK directory.

Makefile:

xx = g++
OPEN_CV = 3rd_party/opencv4
BMD_SDK = 3rd_party/blackmagic_decklink_sdk/Linux/include
INC = $(OPEN_CV) $(BMD_SDK)
INC_PARAMS = $(foreach d, $(INC), -I $d)
source = *.cpp $(BMD_SDK)/DeckLinkAPIDispatch.cpp
prom = decklink_opencv
libs = -lopencv_core -lopencv_highgui -lopencv_imgproc -lpthread -lstdc++ -ldl -lDeckLinkAPI
decklink_opencv: $(source)
	$(xx) -o $(prom) -Wall -std=c++11 $(source) $(INC_PARAMS) -L /usr/local/lib $(libs) -O3

The only modification that I have made to your code, beyond the Makefile is in DeckLinkUtil.hpp in line 8 was

#include <opencv2/highgui.hpp>
#include <opencv2/highgui.h>

$make yields the following error.

DeckLinkUtil.cpp: In member function ‘int DeckLinkUtil::startCaptureWithDisplayMode(int)’:
DeckLinkUtil.cpp:91:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<IDeckLinkDisplayMode*>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   91 |     if (mode < 0 || mode >= displayModeList.size()) {
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main(int, const char**)’:
main.cpp:17:43: error: no matching function for call to ‘DeckLinkUtil::DeckLinkUtil()’
   17 |     DeckLinkUtil *util = new DeckLinkUtil();
      |                                           ^
In file included from main.cpp:12:
DeckLinkUtil.hpp:28:5: note: candidate: ‘DeckLinkUtil::DeckLinkUtil(int)’
   28 |     DeckLinkUtil(int id);
      |     ^~~~~~~~~~~~
DeckLinkUtil.hpp:28:5: note:   candidate expects 1 argument, 0 provided
make: *** [Makefile:10: decklink_opencv] Error 1

When I picked a value: (0) was used for the initial commit, so I put it back in.

DeckLinkUtil *util = new DeckLinkUtil();
DeckLinkUtil *util = new DeckLinkUtil(0);

The code compiles but alas there is no display. Just a black screen. All modes were tried 0 - 20 including x. OBS works so there is certainly data to be displayed.

@js-john
Copy link
Owner

js-john commented Nov 16, 2020

Is your input signal HDMI or SDI? The default signal input of the BMD capture card is SDI. If you use HDMI, try to select "HDMI" as the input signal source in Blackmagic Desktop Video Setup app.

@github-jeff
Copy link
Author

github-jeff commented Nov 16, 2020 via email

@js-john
Copy link
Owner

js-john commented Nov 16, 2020

It seems that your capture card supports 1080@60 (1080P or 1080i ?). I have Ultrastudio Mini Recorder and DeckLink Mini Recorder and the bandwidth can only support to 1080P@30 or 1080i@60. May be I have to make some changes to make it compatible to your device.

@github-jeff
Copy link
Author

Thanks for taking a look. I will gladly test the new revision when it becomes available. The card I am using is Intensity Pro 4K.

These are the current input settings and card type which currently work.
image

The mode list when running your code reports special characters instead of listing the modes. Yes, you can look them up but since you are into the code, you might as well know.
image

Since you are looking at the code, and not sure it really matters, or if it was intentional, but the DectlinkOpencv folder is miss-spelled. I made the mistake a few times when trying to call it.

@js-john
Copy link
Owner

js-john commented Nov 17, 2020

@github-jeff by the way.. I use std::cout instead of printf but i don't have linux machine right now to check if the display mode list bug is fixed.

@github-jeff
Copy link
Author

github-jeff commented Nov 17, 2020

I swapped out the Makefile with the one listed above. Brought in the 3rd party files opencv4, and blackmagic sdk. The code compiled with only one warning:

DeckLinkUtil.cpp: In member function ‘int DeckLinkUtil::startCaptureWithDisplayMode(int)’:
DeckLinkUtil.cpp:91:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<IDeckLinkDisplayMode*>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   91 |     if (mode < 0 || mode >= displayModeList.size()) {
      |                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

The mode display did change, but it's not readable.
image

Here is a pretty good explanation of what is happening in Linux consoles and what can be done code wise. There are a few options for your consideration.

https://stackoverflow.com/questions/13809611/cout-and-cin-in-linux-cant-see-the-console

When the code is run, the monitor window does open but it unfortunately does not display the video source. I will see if the BMD demo sheds any light as to what is happening here. In the meantime, if you want to work on this, please let me know and i will happily test as many revisions as you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants