05 rc - xcode video grabber error

I am trying to run the project that comes with rc 005 for xcode computer vision and I seem to have a problem with the video grabber. here’s the error I get:

opencvExample

[Session started at 2008-03-08 13:08:23 -0500.]
terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_S_construct NULL not valid

openFrameworks has exited due to signal 6 (SIGABRT).

MovieGrabberExample

[Session started at 2008-03-08 13:06:53 -0500.]
terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_S_construct NULL not valid

openFrameworks has exited due to signal 6 (SIGABRT).

Hi,

Is this the open cv example?

I can’t reproduce this on my setup.
Could you post more details please?

1. When does this happen? Do you get a window? Or does it crash before?

2. What setup do you have? Machine type (PPC / INTEL), OS X version, Xcode version, Camera etc.

Can you try something.
1 - In main.cpp change OF_FULLSCREEN to OF_WINDOW.
2 - Compile and run the app in debug mode. When it crashes it should say loading into GDB dubgger - can you then open the debugger (apple - shift - y) and see if there is any indication of where it is crashing.

Thanks!
Theo

Hi, thanks for looking at this.

The main file is already using OF_WINDOW.

I’m using an intel mac, xcode 2.5. My video grabber is working in xcode using carbon instead of OF, so I know that my camera is working. It doesn’t crash. It just gives me a message inside openFrameworks - Run Log window.

I run it in debugger using OF_WINDOW and here’s what I get. There is a red arrow next to “0x9003d66c <+0012> jae 0x9003d67c <kill+28>” below

0x9003d660 <+0000> mov $0x25,%eax
0x9003d665 <+0005> nop
0x9003d666 <+0006> nop
0x9003d667 <+0007> call 0x901100f0 <_sysenter_trap>
0x9003d66c <+0012> jae 0x9003d67c <kill+28>
0x9003d66e <+0014> call 0x9003d673 <kill+19>
0x9003d673 <+0019> pop %edx
0x9003d674 <+0020> mov 0xffc97d5(%edx),%edx
0x9003d67a <+0026> jmp *%edx
0x9003d67c <+0028> ret
0x9003d67d <+0029> nop
0x9003d67e <+0030> nop
0x9003d67f <+0031> nop

Hmm- I don’t know enough about assembly to figure anything out from that - if you are lucky you can get the debugger to show you where in the code it crashed

eg: VG.grabFrame(); <-- crashed here

Sometimes you have to hit the ‘fix’ button and then relaunch it but if you play with the debugger you can usually get it to show you the human readable code of where it crashed.

A couple of other thingS:

I noticed the main.cpp is not setup correctly - some code left over from a previous release. I don’t think that is the issue but it may help.

Could you change the contents of main.cpp main(){ to :

  
	ofSetupOpenGL(1024,768, OF_WINDOW);			// <-------- setup the GL context  
  
	  
	// this kicks off the running of my app  
	// can be OF_WINDOW or OF_FULLSCREEN  
	// pass in width and height too:  
	  
	ofRunApp(new testApp());  

One other thing. Can you try trashing the preferences file:
com.yourcompany.openFrameworks.plist

It stores the camera settings if there are any.

Cheers,
theo

I replaced the main file as you told me. The file runs in full screen but the camera doesn’t turn on. Here’s the message I get:

openFrameworks has exited with status 0.
[Session started at 2008-03-08 13:56:21 -0500.]
2008-03-08 13:56:21.992 openFrameworks[9622] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x2d03, name = ‘com.yourcompany.openFrameworks.ServiceProvider’
See /usr/include/servers/bootstrap_defs.h for the error codes.
2008-03-08 13:56:21.993 openFrameworks[9622] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (com.yourcompany.openFrameworks.ServiceProvider)
error: creating a channel. Check if you have any qt capable cameras attached
openFrameworks(9622,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0x5492e4; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
openFrameworks(9622,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0x8fe10c05; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug
openFrameworks(9622,0xa000d000) malloc: *** Deallocation of a pointer not malloced: 0xbffff48c; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug

openFrameworks has exited with status 0.

com.yourcompany.openFrameworks.plist does not even exist in my preferences.

Hmm.

Those error messages suggest that there might be more than one program using the camera. If you still have a crashed openFrameworks app running or the camera was not closed properly that could be what is causing it. (or if your carbon capture app is running).

A restart should fix that and close all camera connections.

Then could you try running the same code again and still get that result?

If that doesn’t change anything I would be interested if commenting out:

loadSettings();

from the end of ofVideoGrabber::initGrabber

  
		bGrabberInited = true;  
		//loadSettings();  

does anything.

Thanks!!
Theo

Hey Theo,

I commented out Loadsettings as you told me and restarted the computer, but I still get the following error:

[Session started at 2008-03-08 17:11:56 -0500.]
terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_S_construct NULL not valid

openFrameworks has exited due to signal 6 (SIGABRT).

what version of quicktime do you have installed?

as a test, can you try running hacktv : http://developer.apple.com/samplecode/H-…-index.html
and see if it works for getting video?

thanks!
zach

Hey Sofia,

I want to send you a modified version ofVideoGrabber that will print out lots of extra info - so hopefully we can figure out where the crash is happening.

http://openframeworks.cc/files/005-rc/o-…–debug.zip

Throw it in libs/openFrameworks/video/ overwriting the old one.

Then after you run the computer vision or movie grabber app - could you copy the output from the xcode console and paste it to this thread.

The only extra thing you will need to do is in the testApp::setup() before

put

  
          
        vidGrabber.setVerbose(true); //add these two lines  
	vidGrabber.setDeviceID(0);   //add these two lines  
        vidGrabber.initGrabber();  
  

Thanks,
Hopefully we can fix this!
theo

Here is what I got after replacing the videograbber and adding the extra code above setup in the testapp as you told me. I don’t really know how to fix the problem, so I’m attaching an image of what my file looks like. Below is the code you asked for, I think.

[Session started at 2008-03-11 01:05:30 -0400.]
DEBUG: starting init
DEBUG: bSgInited != true
DEBUG: SGInitialize
DEBUG: SGSetDataRef
DEBUG: SGSetGWorld
DEBUG: SGNewChannel
DEBUG: MacSetRect
DEBUG: QTNewGWorldFromPtr - LockPixels - SetGWorld - SGSetGWorld
DEBUG: SGGetChannelDeviceList
DEBUG: str - crashing here?
terminate called after throwing an instance of ‘std::logic_error’
what(): basic_string::_S_construct NULL not valid

openFrameworks has exited due to signal 6 (SIGABRT).

Zach, my quicktime version is 7.4 (92). I too suspect it might have to do with quicktime. I had trouble with it in processing too before I fixed it.

Oh and Hack Tv captures video just fine.

I hope we can indeed solve this. Thanks to both!

S

Thats super helpful - I know exactly what the problem is - I’ll post a fix shortly.

Cheers,
Theo

Hi,

Okay fingers crossed :smiley:

Could you try this one and see if it works?
http://openframeworks.cc/files/005-rc/o-…-debug2.zip

Thanks!
Theo

Hi,

it doesn’t work. It seems that OF thinks my camera is in use somewhere else. Here’s what I get:

openFrameworks has exited with status -1.
[Session started at 2008-03-11 21:55:12 -0400.]
listing available capture devices
device[0] (null)
device[1] (null)
device[2] (null)
device[0] in use - using next default device
device[1] in use - using next default device
DEBUG: pstr (null)

A couple of months ago I had run a script to disable isight, but then I enabled it again. I don’t know if that messed up something.

yeah that is strange - It should be getting the names of the other video devices that are built in (DV and IIDC)

it seems like you might have messed something up with your script, that is disabling getting the names back but maybe not interfering with the way iMovie captures.

The other thing it could be is maybe a change in Quicktime 7.4 ? I am installing 7.4 to see if that is the cause - but maybe you could see if you can try undoing the script? Do you have a link to it - I could check it out as well.

Here is what my output looks like:

  
listing available capture devices  
device[0] DV Video   
device[1] IIDC FireWire Video   
device[2] USB Video Class Video   
device[3] USBVision   
device[1] in use - using next default device  
DEBUG: pstr USB Video Class Video   
DEBUG: crashing here strlen ?   
DEBUG: strlen is 21 ?   
DEBUG: str USB Video Class Video   
DEBUG: str len 21   
attempting to setup device[2] - USB Video Class Video   
using device[2] - USB Video Class Video  
end setup ofVideoGrabber  

Checked with the latest quicktime and I can still see all my devices - so I would bet it is something with that script you used.

Cheers,
Theo

Hi,

I don’t have the script I used to disable my isight, but I remember that I had to fix my camera and enable it again for processing to work. All other applications that use the camera work. OF is the only one it doesn’t work, so I’m wondering where exactly the problem is. I’ll ask around here at ITP to see if anyone has a clue.

Thanks

sofia

Yeah I am sure that Processing is using a different way to enumerate capture devices.
But our approach is the documented approach from the apple developer’s site so I would like to try and figure out why your video hardware is not being listed.

From the terminal could you run:

cd /
sudo find / -name “*IIDC*”

This should list all files that deal with the IIDC (what should be device 2 in your list).

Could you paste the results and then I can try and determine what differences you have in your file structure.

cheers!
Theo

Hi Zach and Theo,

sorry for my disappearance, I’m back on track now. i did what you told me and here’s what I got in terminal:

/Library/Audio/Plug-Ins/HAL/iSightAudio.plugin/Contents/Resources/IIDCAssistant.bundle
/Library/Audio/Plug-Ins/HAL/iSightAudio.plugin/Contents/Resources/IIDCAssistant.bundle/Contents/MacOS/IIDCAssistant
/private/etc/mach_init.d/IIDCAssistant.plist
/private/etc/mach_init.d/IIDCVideoAssistant.plist
/System/Library/PrivateFrameworks/CoreMediaIOServicesPrivate.framework/Versions/A/Resources/IIDC.plugin
/System/Library/PrivateFrameworks/CoreMediaIOServicesPrivate.framework/Versions/A/Resources/IIDC.plugin/Contents/MacOS/IIDC
/System/Library/PrivateFrameworks/CoreMediaIOServicesPrivate.framework/Versions/A/Resources/IIDC.plugin/Contents/Resources/IIDCVideoAssistant
/System/Library/PrivateFrameworks/CoreMediaIOServicesPrivate.framework/Versions/A/Resources/IIDCVideoAssistant
/System/Library/QuickTime/QuickTimeIIDCDigitizer.component
/System/Library/QuickTime/QuickTimeIIDCDigitizer.component/Contents/MacOS/QuickTimeIIDCDigitizer
/System/Library/QuickTime/QuickTimeIIDCDigitizer.component/Contents/Resources/QuickTimeIIDCDigitizer.rsrc
/System/Library/QuickTime copy/QuickTimeIIDCDigitizer.component
/System/Library/QuickTime copy/QuickTimeIIDCDigitizer.component/Contents/MacOS/QuickTimeIIDCDigitizer
/System/Library/QuickTime copy/QuickTimeIIDCDigitizer.component/Contents/Resources/QuickTimeIIDCDigitizer.rsrc

Cheers

Sofia

this looks to me like OSX has screwed something up internally (file permissions perhaps?). I’ve run into similar kinds of weird problems when applying update patches, including my audio device disappearing until i reverted the permissions on its driver to what they should be. (i’ve never been able to apply an update patch without getting the flashing-grey-folder-with-question-mark icon instead of an apple logo when i boot up, but that’s another story.)

basically buried somewhere in your config there’ll be a text file (or perhaps a binary file) that is supposed to list all the video devices you’ve ever had plugged in - for example, Theo’s gives

  
device[0] DV Video  
device[1] IIDC FireWire Video  
device[2] USB Video Class Video  
device[3] USBVision   

even though i’m sure he didn’t have all those devices plugged in when he ran it (right, Theo?). and somehow your file has become corrupted, which is where the (null)s are coming from.

anyway i’m sure this message is almost completely useless since the problem was so long ago but i thought i’d add my 2c anyway.

cheers
d