General Plugin Help
Marcoski <[email protected]> Wed, 27 Apr 2005 15:37:08 +0200
| Newsgroups | gmane.comp.multimedia.xmms.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I'm tring to write my first xmms plugin.
I followed this tutorial http://www.xmms.org/docs/vis-plugin.html to
create a Visualization plugin and all is ok.
Now I need to make a General Plugin hence i've need to use the
GeneralPlugin struct write inside plugin.h.
Follow my code:
/* xmms plugin 1 */
#include <stdio.h>
#include <string.h>
#include <xmms/plugin.h>
#include <sys/wait.h>
#include <sys/types.h>
#define VERSION 0.1
//forward declarations
static void init(void);
static void configure(void);
static void cleanup(void);
static gint timeout_func(gpointer);
static gint previous_song = -1;
static gint timeout_tag = 0;
//callback functions see xmms/plugin.h for more information about
VisPlugin struct
GeneralPlugin gtable={
NULL, /* Filled in by xmms */
NULL, /* Filled in by xmms */
-1, /* The session ID for attaching to the control socket */
NULL, /* The description that is shown in the preferences box */
init, /* Called when the plugin is enabled */
NULL, /* Show the about box */
configure,
cleanup /* Called when the plugin is disabled or when xmms
exits */
};
//XMMS entry point
GeneralPlugin *get_gplugin_info(){
gtable.description = g_strdup_printf(("Track Song %s"), VERSION);
return >able;
}
static void init(){
previous_song = -1;
timeout_tag = gtk_timeout_add(100, timeout_func, NULL);
}
static void configure(){
printf("configuration to do\n");
}
static gint timeout_func(gpointer data){
previous_song++;
printf("song: %d\n", previous_song);
return TRUE;
}
static void cleanup(){
printf("cleanup to do\n");
}
All seems to be right but when i try to exec xmms with that plugin
installed i've got only a segmentation fault.
Anyone knows why?
Thanks all
--
Marcoski -alias- Marco Trognoni
Undergraduate Student in Computer Science @ University of Bologna
ICQ#: 31020595
MSN: [email protected]
Linux Registred User: #345012