Angelo video capture card

I am using this Adlink-Angelo-RTV video capture card as it allows x4 simultaneous video inputs.

The problem is that the ofw videoInput doesn’t recognise this as a device, so I have to use the c++ library provided with the card to access the inputs, initialise them and capture the stream etc.

The sample files are windows based applications and are quite bloated with code, there isn’t a sample ‘bare bones’ example file.

In writting a wrapper for this, I have included what I believe to be the right libraries and .h files in my project paths (c++ and linker). When trying to compile I get the following error

Linking…
angeloWrapper.obj : error LNK2001: unresolved external symbol _AngeloRTV_Initial@4
Release\openFrameworksApp.exe : fatal error LNK1120: 1 unresolved externals

I found some information here that might help.

Do you have any ideas how to solve this?

Thanks

it looks like you are missing a library to link against from the angelo capture code. hard to say without poking around the api, but I imagine you can solve this by:

a) looking at the bloated code and compiling it. they prob. ship with a vs example that can work, even if the code is convoluted, if it works itś a good start.
b) then, looking at the libraries it links against, comparing it to your wrapper, and see if you are missing something.

the vcproj is just a text file and itś pretty wasy to see and compare libraries…

I actually have worked with angelo at one point or another and will see if I have wrapper code somewhere. in the meantime, I bet its one or a few libs that need to be linked properly.

good luck
zach

After many hours messing around, I got this working. You are right, it was a missing library. Thanks.

I manage to get the video device to capture, and copy the pixel data to an ofImage, however it crashes after a few mins. I believe I need to use an event on the channel rather than every frame.

So now my next problem…

Based on the sample code, I create this callback event:
AngeloRTV_Set_Callback(1, MediaStreamProc);

I have my angeloWrapper class. Creating function angeloWrapper::MediaStreamProc doesn’t work.

The callback function only works if you use
void __stdcall MediaStreamProc(){

However, this function can’t access any data/functions from my wrapper, as this is part of stdcall and not angeloWrapper.

Looking at angelo.h (the library include) it shows the method call as:
I16 PASCAL AngeloRTV_Set_Callback (U16 PortNo, void ( __stdcall *CallBackProc)(U32 VideoBufferaddress ,U16 PortNo));

So, how can I call a function from my wrapper from within the stdcall event function? I’ve tried calling…
test(); // identifier not found
angeloWrapper::test(); // illegal call of non-static member function

Many thanks!

(offline) zach fixed one of my colour flickring problems -> see-here

Following from my last post, calling a class function from a callback is tricky to do. Instead, the video buffer is copied to a global variable.

Now I have a threading problem, where two threads are trying to access the pixels array at the same time, causing it to crash.

I am trying to solve this with a mutex, so only one process can use it at a time. I have a callback function that copies the video buffer to a global pixel array, and I also have my main app which makes a copy of this pixel array.

The code sort of looks like this

  
  
  
// this is my angelo wrapper  
HANDLE hMutex[4];  
  
videoGrabber Init (){  
 hMutex[0] = CreateMutex(NULL, false, NULL); // repeat 4 times  
}  
  
videoGrabber Callback(){  
  
 // lock the mutex so that the main app cant access pixels whilst writing  
 WaitForSingleObject( hMutex[ portNumber ], INFINITE);  
   
  -- copy video buffer  
  
 // unlock the mutex again  
 ReleaseMutex( hMutex[ portNumber ] );  
  
}  
  
videoGrabber usingPixels( portNumber ){  
  WaitForSingleObject( hMutex[ portNumber ], INFINITE);  
}  
  
videoGrabber NotUsingPixels( portNumber ){  
  ReleaseMutex( hMutex[ portNumber ] );  
}  
  
// ---- main app -------  
  
 main app () {  
  
  // lock the mutex so video grabber cant write to them  
  videoGrabber.usingPixels( 0);  
  // copy the pixels from video grabber  
  .....  
  // unlock the mutex so grabber can write to pixels    
  videoGrabber.NotUsingPixels( 0 );  
  
}  
  

Anyone here good with threads and mutex ?

Thanks

hi chris

looks ok - you can also use enterCriticalSection…

I’d do printfs to see where the crash occurs
small printf per function call

printf (“startCallback”)
printf (“endCallback”)

etc,

you may discover an error in your logic or a strrange situation that way.

also, you can stress test threaded stuff by trying to call functions you think will breaks way more often then normal.

hope that helps
zach