Visualisation plugin API for XBMC
#1
Thumbs Up 
hi,

i'm setting up an architecture which allows other devs to develop a visualisation plugin for xbmc

from the settings->music the end-user can select which visz. he/she wants and xbmc will use that one.
so how does it work?
first :
1. visz. plugins are normal .dlls but with the extension .vis
2. visz. plugins should b copied into the visualisations/ subdirectory on your xbox
3. visz. plugins must use a minimal set of dependencies. they should not depend on windows kernel/gdi or other things!


so how to program one?
here's a skeleton of a visz. plugin .dll:
Quote:// spectrum.cpp: implementation of the cspectrum class.
//
//////////////////////////////////////////////////////////////////////

#include <xtl.h>
#pragma comment (lib, "lib/xbox_dx8.lib" )

extern "c"
{
struct vis_info {
bool bwantsfreq;
int isyncdelay;
// int iaudiodatalength;
// int ifreqdatalength;
};
};

vis_info vinfo;
static lpdirect3ddevice8 m_pd3ddevice;
extern "c" void create(lpdirect3ddevice8 pd3ddevice, int iscreenwidth, int iscreenheight, const char* szvisname)
{
}

extern "c" void start(int ichannels, int isamplespersec, int ibitspersample, const char* szsongname)
{
}


extern "c" void audiodata(short* paudiodata, int iaudiodatalength, float *pfreqdata, int ifreqdatalength)
{
}

extern "c" void render()
{
}


extern "c" void stop()
{
}


extern "c" void getinfo(vis_info* pinfo)
{
memcpy(pinfo,&vinfo,sizeof(struct vis_info ) );
}
extern "c"
{
struct visualisation
{
public:
// gets called once during initialisation. allows vis. plugin to initialize itself
// pd3ddevice is a pointer to the dx8 device which you can use for dx8
// iscreenwidth/iscreenheight are the gui's screenwidth/screenheight in pixels
// szvisualisationname contains the name of the visualisation like goom or spectrum,...
void (--cdecl* create)(lpdirect3ddevice8 pd3ddevice, int iscreenwidth, int iscreenheight, const char* szvisualisationname);

// gets called at the start of a new song
// ichannels = number of audio channels
// ibitspersample = bits of each sample ( 8 or 16)
// isamplespersec = number of samples / sec.
// szsongname = name of the current song
void (--cdecl* start)(int ichannels, int isamplespersec, int ibitspersample, const char* szsongname);

// gets called if xbmc has new audio samples for the vis. plugin
// paudiodata is a short [channels][iaudiodatalength] array of raw audio samples
// pfreqdata is a array of float[channels][ifreqdatalength] of fft-ed audio samples
void (--cdecl* audiodata)(short* paudiodata, int iaudiodatalength, float *pfreqdata, int ifreqdatalength);

// gets called if vis. plugin should render itself
void (--cdecl* render) ();

// gets called if vis. should stop & cleanup
void (--cdecl* stop)();

// gets called if xbmc wants to know the visz. parameters specified by the vis_info struct
void (--cdecl* getinfo)(vis_info* pinfo);
};

void --declspec(dllexport) get_module(struct visualisation* pvisz)
{
pvisz->create = create;
pvisz->start = start;
pvisz->audiodata = audiodata;
pvisz->render = render;
pvisz->stop = stop;
pvisz->getinfo = getinfo;
}
};

please note that due to a bug in the forums i cant post any underscores. so i replaced the underscores with --
xbmc will first call get_module() to retrieve the visualisation struct. the plugin will give xbmc the visualisation struct filled with function pointers to all visz. routines needed by xbmc


well thats it for now. remember this is all premature.
no plugins are available yet, but hopefully we'll see one soon

frodo



XBMC Project Founder (Retired), now head programmer of MediaPortal
Reply


Messages In This Thread
Visualisation plugin API for XBMC - by Frodo - 2003-10-12, 19:07
[No subject] - by jmarshall - 2003-10-12, 22:45
[No subject] - by Frodo - 2003-10-13, 07:52
[No subject] - by jmarshall - 2003-10-13, 08:59
[No subject] - by Frodo - 2003-10-13, 10:03
[No subject] - by Gamester17 - 2003-10-13, 14:58
[No subject] - by Frodo - 2003-10-13, 14:59
[No subject] - by Gamester17 - 2003-10-13, 15:07
[No subject] - by jmarshall - 2003-10-13, 23:01
[No subject] - by Frodo - 2003-10-14, 07:32
[No subject] - by Frodo - 2003-10-14, 19:21
[No subject] - by jmarshall - 2003-10-14, 23:37
[No subject] - by Frodo - 2003-10-17, 10:38
[No subject] - by Gamester17 - 2003-10-17, 12:22
[No subject] - by Frodo - 2003-10-17, 13:13
[No subject] - by jmarshall - 2003-10-20, 23:55
[No subject] - by rjm2k - 2003-10-21, 21:24
[No subject] - by Frodo - 2003-10-22, 07:24
[No subject] - by rjm2k - 2003-10-22, 19:38
[No subject] - by Hullebulle - 2003-10-23, 02:20
[No subject] - by Gamester17 - 2003-10-23, 12:43
[No subject] - by rjm2k - 2003-10-23, 14:16
[No subject] - by jmarshall - 2003-10-23, 23:28
[No subject] - by jippie - 2003-11-03, 12:44
[No subject] - by DaveHShapiro - 2004-01-02, 23:20
[No subject] - by Hullebulle - 2004-01-16, 03:10
[No subject] - by jippie - 2004-01-20, 14:44
[No subject] - by Gamester17 - 2004-01-20, 14:50
[No subject] - by bradbradbrad - 2004-01-21, 11:46
[No subject] - by Gamester17 - 2004-01-22, 13:27
[No subject] - by jmarshall - 2004-01-23, 02:12
[No subject] - by Gamester17 - 2004-01-27, 15:42
[No subject] - by nmrs - 2004-02-14, 17:31
[No subject] - by nmrs - 2004-02-16, 15:48
[No subject] - by NEI - 2004-02-16, 16:05
[No subject] - by Gamester17 - 2004-02-16, 17:12
[No subject] - by Gamester17 - 2004-02-17, 18:41
[No subject] - by Frodo - 2004-02-18, 16:32
[No subject] - by Gamester17 - 2004-02-18, 16:49
[No subject] - by mynci - 2004-03-02, 00:33
[No subject] - by questor/fused - 2004-03-02, 01:11
[No subject] - by ---=Snyper=--- - 2004-03-03, 13:37
[No subject] - by nmrs - 2004-03-03, 13:41
[No subject] - by ---=Snyper=--- - 2004-03-03, 15:19
[No subject] - by Gamester17 - 2004-03-03, 18:06
[No subject] - by mynci - 2004-03-07, 23:37
[No subject] - by Gamester17 - 2004-04-07, 17:20
[No subject] - by mynci - 2004-04-07, 20:13
[No subject] - by nmrs - 2004-04-15, 15:22
[No subject] - by Butcher - 2004-04-15, 18:46
[No subject] - by pike - 2004-04-15, 19:04
[No subject] - by pike - 2004-04-15, 19:27
[No subject] - by nmrs - 2004-04-15, 19:30
[No subject] - by MrC - 2005-06-15, 00:35
[No subject] - by snq - 2005-10-14, 19:12
[No subject] - by snq - 2005-10-15, 02:34
[No subject] - by jiz_king - 2005-10-15, 11:47
[No subject] - by pike - 2005-10-15, 11:58
[No subject] - by snq - 2005-10-15, 12:52
[No subject] - by pike - 2005-10-15, 13:15
[No subject] - by Bobbin007 - 2005-10-15, 13:57
[No subject] - by pike - 2005-10-15, 14:55
[No subject] - by snq - 2005-10-15, 15:01
[No subject] - by snq - 2005-10-15, 15:08
[No subject] - by Bobbin007 - 2005-10-15, 15:12
[No subject] - by pike - 2005-10-15, 15:22
[No subject] - by snq - 2005-10-15, 16:20
[No subject] - by Gamester17 - 2005-10-15, 17:38
[No subject] - by snq - 2005-10-15, 19:29
[No subject] - by Gamester17 - 2005-10-16, 09:41
[No subject] - by MrC - 2005-10-16, 17:03
[No subject] - by MrC - 2005-10-16, 19:00
[No subject] - by snq - 2005-10-18, 04:07
[No subject] - by MrC - 2005-10-18, 22:11
[No subject] - by snq - 2005-10-19, 03:29
[No subject] - by snq - 2005-10-19, 13:24
[No subject] - by pike - 2005-10-19, 14:02
[No subject] - by C-Quel - 2005-10-19, 15:01
[No subject] - by snq - 2005-10-23, 14:40
[No subject] - by pike - 2005-10-23, 15:00
[No subject] - by snq - 2005-10-23, 15:09
[No subject] - by pike - 2005-10-23, 15:57
[No subject] - by snq - 2005-10-23, 16:07
[No subject] - by Nickman - 2005-10-23, 20:00
[No subject] - by Hullebulle - 2005-10-24, 12:32
[No subject] - by pike - 2006-02-05, 14:34
Logout Mark Read Team Forum Stats Members Help
Visualisation plugin API for XBMC0