[GEM-dev] pix_freeframe.cpp

IOhannes m zmoelnig zmoelnig at iem.at
Fri Apr 29 19:03:51 CEST 2005


hi

james tittle wrote:
> ...ok, I've got this compiling on OSX now, and loading the plugin, but
good!

> but it very quickly unloads because "no 24-bit support"...the relevent
> code here:
bad!


> 
> 
> if ((plugmain(FF_INITIALISE, NULL, 0)).ivalue == FF_FAIL){
> error("plugin %s: init failed", name);
> return NULL;
> }
> 
> // plugmain(FF_DEINITIALISE,NULL,0);
> if ((plugmain(FF_GETPLUGINCAPS, (LPVOID)FF_CAP_32BITVIDEO, 0)).ivalue ==
> FF_TRUE){
> 
> if(can_rgba)*can_rgba=1;
> } else {
> 
> if(can_rgba)*can_rgba=0;
> if ((plugmain(FF_GETPLUGINCAPS, (LPVOID)FF_CAP_24BITVIDEO, 0)).ivalue !=
> FF_TRUE){
> error("plugin %s: no %dbit support", name, 24);

i first try to detect whether there is 32bit (RGBA) support, and if that
fails i look for 24bit.

i ignore any other format that is supported by the plugin (as Gem
doesn't support much else and FreeFrame does not use YUV)

i don't feel much like implementing fromRGB565() right now (although i
might do it sometimes in the future...)


> 
> plugmain(FF_DEINITIALISE, NULL, 0);
> return NULL;
> }
> }
> 
> ...is different than what I was using in a standalone OSX FF-host loader:
> 
> if (pFreeFrameMain!=NULL) {
> 
> 
> pFreeFrameMain(FF_DEINITIALISE,NULL,0);
?
why deinitialising, when we still want to do something with it ?
(i see that it the deinitialiser is in my code too (although commented
out), but i don't know why anymore...)

> 
> if ((DWORD)pFreeFrameMain(FF_GETPLUGINCAPS,(void*)2,0)==FF_TRUE) {
> 
> pVideoInfo->bitDepth=2;
> } else if ((DWORD)pFreeFrameMain(FF_GETPLUGINCAPS,(void*)1,0)==FF_TRUE) {
> 
> pVideoInfo->bitDepth=1;
> } else if ((DWORD)pFreeFrameMain(FF_GETPLUGINCAPS,(void*)0,0)==FF_TRUE) {
> 
> pVideoInfo->bitDepth=0;
> } else {
> 
> assert(FALSE);
> 
> pVideoInfo->bitDepth=2;

so you think we should enforce some format even if the plugin tells us,
that it doesn't support it ?

> }
> 
> 
> pFreeFrameMain(FF_INITIALISE,pVideoInfo,0);
> 
> 
> }
> 
> ...so, having not really peered into the logic too much, are you trying
> have it only load if it does RGBA?

as said above, i load it if it can do either RGBA (preferred) or RGB.

are you sure the plugin is loaded correctly by Gem ?
does it report any capabilities ??

i had serious problems making it run, until i had a look at the
FreeFrame documentation, telling me, that on linux (gcc) i had to use
the "-freg-struct-return" when compiling the host. (since the plugins
are compiled with that option too; and gcc (on linux) defaults to
returning structures as pointers to the structure instead of storing it
in registers)
the solution was to either compile the plugins without the
"-freg-struct-return" flag (which will only work for plugins where you
have the source code (so this idea is both good and bad)) or compile Gem
with the said flag.
of course the readme was for linux, but since you are using gcc too, you
might have the same problems.

i am not sure, whether reg-struct-return might do anything harmful (man
gcc says something about binary incompatibility, that's why you cannot
load plugins that are compiled with that flag without doing so yourself)
and the freeframe people decided to use it, in order to be able to write
hosts or(?) plugins in both C and delphi...


apart from that, of course my implementation might not be a reference
implementation...






mfg.ca.sd
IOhannes




More information about the GEM-dev mailing list