Author Topic: QueryInterface problem in visualization  (Read 729 times)

ahrbahr

  • Posts: 2
QueryInterface problem in visualization
« on: 10 Mar '18 - 00:31 »
Hi!
I'm writing my own visualization plugin and I'm having some trouble getting the QueryInterface to work. It's not very well documented but I've looked at some other plugins code and I think I'm using it correctly. I'm using mingw and have a feeling that there may be some difference in the way g++ and visual c++ implements virtual function tables. If that's the case, I guess that's the problem, and I wonder how I would work around this issue. If not, well what else am I missing?

Ian @ un4seen

  • Administrator
  • Posts: 21211
Re: QueryInterface problem in visualization
« Reply #1 on: 12 Mar '18 - 14:20 »
Please give a bit more info on the problem that you're having. I guess you are implementing a ReceiveQueryInterface function in your plugin, to receive an instance of the VisQueryInterface class? If so, is that getting called when your vis is activated? If so, are you having problems with the class's QueryInt/String functions, and if so, what parameters are you using in those calls? The strings currently supported by XMPlay are: currentsongfilename, currengsongdisplaystring, currentsongtitle, currentsongauthor.

ahrbahr

  • Posts: 2
Re: QueryInterface problem in visualization
« Reply #2 on: 16 Mar '18 - 21:45 »
Oh, I see. I assumed all of the QueryInterface was supported and of course I only tried the unsupported strings. ^^
(which was really stupid since the one I actually needed was currentsongfilename)
Anyway, this turned out to be easier than I first thought. Thanks!

While I'm here I might as well ask if there is a way to use xmplays png loader (maybe there is a jpeg one as well?) in my visualization rather than bloating it by including my own one.

Ian @ un4seen

  • Administrator
  • Posts: 21211
Re: QueryInterface problem in visualization
« Reply #3 on: 20 Mar '18 - 18:27 »
It is possible to use XMPlay's PNG decoder (which is actually in XMP-ZIP.DLL), but it currently only supports 24-bit and 32-bit PNG files. If that's fine for your requirements, you could use it something like this:

Code: [Select]
BITMAPINFO *WINAPI (*DecodePNG)(const void *src, DWORD srclen) = NULL;
HMODULE xmpzip = GetModuleHandle("xmp-zip");
if (xmpzip) *(void**)&DecodePNG = GetProcAddress(xmpzip, "PNG");

...

BITMAPINFO *bmp = DecodePNG(pngdata, pngsize); // decode PNG data
if (bmp) {
// do something with the bitmap here
xmpfmisc->Free(bmp); // free the bitmap
}

XMPlay doesn't have a JPEG decoder.