Change converter´s code that it exits when finished

3 views
Skip to first unread message

Zampano

unread,
Jul 20, 2008, 8:21:43 AM7/20/08
to one-stone-soup
Hi,

if you have time, it would be nice if you could give me a little
hint.
I have the converters code in Eclipse and are able to compile it.
I want to change the code that the converter ends it self after
converting the file. At the moment I have to press "ctrl+c" to
close
it. Since I use it often I wanted to make me a script which
converts
every file in a specified folder automatically. So I only have to
put
the files in that folder and have to run the shell-script only
once in
the end.

This is what I tried:

I searched for the place in code which gives "Done reading all
images." out, and added the line "System.exit(0);" .
The compiled app seems to work normally, and gives even "Done
reading
all images." back before it ends it self. Unfortunately the mov-
video-
file which were created is 0 bytes big, so it does´t work.
Can you give me a tip how to end the app? Even if you don´t have
time-
thanks!


// Check if we've finished all the frames.
if (recordingStream.isFinished()) {
// We are done. Set EndOfMedia.
System.out.println("Done reading
all images.");
buffer.setEOM(true);
buffer.setOffset(0);
buffer.setLength(0);
ended = true;
// added the next line
System.exit(0);
return;

Zampano

unread,
Jul 22, 2008, 8:43:49 AM7/22/08
to one-stone-soup
Thanks for version 1.1!
It works like a charm, the problem is solved.

nicholas....@googlemail.com

unread,
Jul 22, 2008, 5:39:05 PM7/22/08
to one-stone-soup
I've found the solution. There was a line missing on line 289 (ish)

DataSink dataSink = Manager.createDataSink(dataSource, mediaLocator);
/*this line*/ dataSink.addDataSinkListener(this);
dataSink.open();

That allows the application to listen for the end of the file. I've
added it and checked it in to the project and released it as recording-
converter-r1.1.jar

The application now stops when the file has been converted.
Thanks for posting this bug
Reply all
Reply to author
Forward
0 new messages