Fri Jul 24 15:55:59 CEST 2009

global Codec Engine structures

I found a code sequence in the VLC code that seems a bit odd: there is
a combination of local (object-specific) and global initializations.
I tried to move the global init


to the start of the program but then I get:

Program received signal SIG32, Real-time event 32.
0x40028e10 in ?? ()

Looks like i've messed up my system..

Hmm..  Hard reboot seemed to have fixed it.  Looks like there is some
kind of locking mechanism.  Let's try to nail this down.

First: does tinyscheme actually destruct all data on _deinit() ?  It
looks like it does:

# ./test
> (make-blob)
#<FOREIGN DATA 0xa0590>
> (quit)
free(): blob
scheme_deinit() DONE

The code sets all root pointers to nill and then calls gc, cleaning up
everything.  So what's wrong?

Everything works fine from the scheme command line, but when I attempt
to start something from the debugger it borks, and the scheme side
won't startup again.  The problem might be that Engine_close doesn't
get called?

It's not possible to open the engine from two different programs.  It
throws error 3.  Let's make these readable first.  The vlc code uses 
`ppsz_engine_error'.  Where is that defined?  Not in the TI .a files.
It's in vlc/modules/codec/davinci/davinci.c

Ok, now I try again I can open it multiple times.. Hmm..

Let's try to go on, sense will come later.  It looks like the engine
is better managed as a singleton though.

The VLC code contains a PrintAvailableAlgorithms function that doesn't
seem to use the codec engine instance.

This[1] brings clarity[1].  The Engine_open just returns a handle to a
global engine object.

So what does CERuntime_init() do?

Let's change the c code to reflect this.

[1] http://wiki.davincidsp.com/index.php/Multiple_Threads_using_Codec_Engine_Handle