moviePlayerExample.exe crashes

When I run the moviePlayer Example included 0.04 for Dev CPP, I get the following error message when I load the movie which I’ve posted at http://itp.nyu.edu/~mjc497/testvid/index.html

moviePlayerExample.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

I don’t see any other error messages.

I’ve successfully opened other movie files using the example. I also tried converting the movie to use photo-JPEG but it still crashed. I tried to trace through the code a bit – I get a segmentation fault error in

ofVideoPlayer::loadMovie(string name)

when the function tries to call closeMovie()

Michael

hmm - what platform? have you tried renaming?

it works for me on windows –

zach

[quote author=“zach”]hmm - what platform? have you tried renaming?

it works for me on windows –

zach[/quote]

My apologies – my bug reporting skills seem to have gone out the window.

Windows XP SP2 tablet edition

I’ll try renaming the file – do you think that spaces in the file name should be a problem?

thanks!!

I think actually the problem you have is that the movie player expects the movie to be 320x240 – I think it’s crashing when it accesses pixels

comment out this code:

  
  
ofSetColor(0x000000);  
	unsigned char * pixels = fingerMovie.getPixels();  
	// let's move through the "RGB" char array  
	// using the red pixel to control the size of a circle.  
	for (int i = 4; i < 320; i+=8){  
		for (int j = 4; j < 240; j+=8){  
			unsigned char r = pixels[(j * 320 + i)*3];  
			float val = 1 - ((float)r / 255.0f);  
			ofCircle(400 + i,20+j,10*val);  
		}  
	}  
  

to :

  
  
/*  
ofSetColor(0x000000);  
	unsigned char * pixels = fingerMovie.getPixels();  
	// let's move through the "RGB" char array  
	// using the red pixel to control the size of a circle.  
	for (int i = 4; i < 320; i+=8){  
		for (int j = 4; j < 240; j+=8){  
			unsigned char r = pixels[(j * 320 + i)*3];  
			float val = 1 - ((float)r / 255.0f);  
			ofCircle(400 + i,20+j,10*val);  
		}  
	}  
*/  
  

and recompile – then does it crash?

take care,
zach

Thank you Zach - the movie plays fine now. I would never have found that. I’m using Dev-C++ and when I run the movie player example in debug mode, DEV-C++ indicates segmentation faults when I step into code well before I reach testApp::draw.

Are you using Dev-C++ or Visual Studio?

Thanks again,

Michael

I’m trying to use all the compilers now :slight_smile: these days I’m using codeblocks to get a hang of it.

one tip for debugging is this:

comment out backwards until you don’t crash. ie, comment out the inside of the draw and mouse/key routines, then if you crash comment out the inside of the update routine, etc. Once you find the function that is crashing, start commenting out parts of it from the bottom moving up to the top, and you can often find the lines that are causing the problem. I actually commented it out when I went to test the movie since I intuitively knew the code was written for 320x240 (since I wrote it) but if you use the technique I describe, you can pin-point the part of the code that is crashing. in this case, those for loops have 320 and 240 hard coded in them and that should pop out…

take care
zach

Zach,

That’s the crazy bit. The code works without a problem when I comment out the section that you’ve indicated provided I compile it and run it. However, before posting here, I tried to use the debug features of Dev-C++ to figure out the problem.

The first time I told Dev-C++ to debug, it told me that debugging info. wasn’t available and asked if I wanted to enable it, which I did and then it recompiled all of the files. I set breakpoints in TestApp::setup(), but Dev-C++ would complain of an “Access Violation (segmentation fault)” (which I assume to mean that the code accessed a null pointer) before reaching my breakpoint.

When I looked in the console window associated with moviePlayerExample.exe, I saw the message “OpenMovieFile failed -50”. Since this was the case, I tried stepping into fingerMovie.loadMovie() and narrowed things down to line 41 in ofQtUtils.cpp

  
result = OpenMovieFile (&theFSSpec, &movieResFile, fsRdPerm);  

this is returning -50 when I’m debugging. I was unable to tell what the contents of theFSSpec.name were – I couldn’t get the watch window in Dev-C++ to display anything except the pointer, despite my attempts to dereference the pointer.

So it looks like my problem (again, only when debugging) is that the movie file is not loaded.

Is there some sort of compiler directive I should set in Dev-C++ when I do debugging? Is there some documentation I can read to learn more about the differences between the release executable and debug executable?

thank you again for your patience,

Michael

I just discovered the dev-c++ forum on this site. When you mentioned codeBlocks, I downloaded it, but couldn’t get the movieplayer example to run. I’m going to follow the instructions in the dev-c++ forum before trying to mess around more with dev-c++ because the forum posts I’ve browsed seem to indicate that it is quirky.

Michael

yeah I didn’t know, but that it’s the debugger not running the directory of the exe :frowning:

adding this code to the top of setup in the app:

  
  
     char *path= new char [1024];  
     size_t size;  
     path=_getcwd(path,1024);  
     cout << path << endl;  
   

shows the differences:

non debug:

  
  
C:\Documents and Settings\Administrator\My Documents\projects\openFrameworks\ver  
sions\devcpp\0.05\0.05_devcpp_RC\apps\moviePlayerExample\bin  
  

debug:

  
  
C:\Documents and Settings\Administrator\My Documents\projects\openFrameworks\ver  
sions\devcpp\0.05\0.05_devcpp_RC\apps\moviePlayerExample  
OpenMovieFile failed -50  
  

for example, the app is looking for a folder called “data” but if you run the exe from another location, the current working directory is not the same and it can find the relatively named data directory.

so a super ghetto solution is copy the data directory to be at the same level as where the debugger is running (where the “.dev” file is). then the debugger should work.

usually this is setting somewhere that’s adjustable, but looking around devcpp for a few minutes, I couldn’t see where to set that. you might want to take at the thread I made about running using codeblocks w/ devcpp projects – they are the same tools (gnu gcc, gdb, etc) but codeblocks gives you more options (and can probably adjust where the debugger is running from).

hope that helps!
zach
\

I just discovered the dev-c++ forum on this site. When you mentioned codeBlocks, I downloaded it, but couldn’t get the movieplayer example to run. I’m going to follow the instructions in the dev-c++ forum before trying to mess around more with dev-c++ because the forum posts I’ve browsed seem to indicate that it is quirky.

see the part of the thread (third post) where I mention missing a step about setting the “executing directory” to bin. Same problem as your debugger problem actually :slight_smile:

IMHO devcpp is the quirky one compared to codeblocks…

take care,
zach