lu-zero / bmdtools

Basic capture and play programs for Blackmagic Design Decklink
Boost Software License 1.0
198 stars 74 forks source link

Change behavior on input change #38

Open triwav opened 10 years ago

triwav commented 10 years ago

So right now when the input gets dropped, it immediately switches to color bars. I know in the Mac and Windows software there is any option to change this to either black or the last frame of video. I'm not sure if the Linux SDK has something similar that could be tapped into to bring this about.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/5403699-change-behavior-on-input-change?utm_campaign=plugin&utm_content=tracker%2F256764&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F256764&utm_medium=issues&utm_source=github).
haakonnessjoen commented 10 years ago

You can probably do this via the SDK regardless of OS. Using BMDIdleVideoOutputOperation (bmdDeckLinkConfigVideoOutputIdleOperation).

triwav commented 10 years ago

Thanks for the suggestion. I was thinking this was something in the SDK as well. I think that's actually referring to something else though. I haven't had a chance to test it but I believe bmdcapture is actually making its own bars. If you look here: https://github.com/lu-zero/bmdtools/blob/master/bmdcapture.cpp#L384-L395 you'll notice it makes a bars array and then iterates over the video frame size. The one thing I can't figure out is it iterates over every height by one but it seems like it skips every other width. I'm not a C++ programmer so I'm not sure why that is. It looks the variable p is a reference to frameBytes which perhaps is an array or some other structure I'm not familiar with. I'll do some experimenting though and see what I can figure out.

lu-zero commented 10 years ago

I can update it to do that, thanks for the idea =)

triwav commented 10 years ago

I appreciate it. I was able to figure out the black video pretty easily by just doing

for (int y = 0; y < height; y++) { for (int x = 0; x < width; x += 2) *p++ = 0x10801080; }

(although if you just don't do anything it also appears to be black. What I couldn't figure out is how to show the last valid frame which is the ideal one for me. I tried assigning a reference to frameBytes and iterating forward and backward on the memory pointer to try and repeat but it always ended up being black. Thanks for your help on this.