1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2020 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __AGS_PLUGIN_H__
21 #define __AGS_PLUGIN_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <libxml/tree.h>
27 
28 #include <unistd.h>
29 
30 G_BEGIN_DECLS
31 
32 #define AGS_TYPE_PLUGIN                    (ags_plugin_get_type())
33 #define AGS_PLUGIN(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PLUGIN, AgsPlugin))
34 #define AGS_PLUGIN_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_PLUGIN, AgsPluginInterface))
35 #define AGS_IS_PLUGIN(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PLUGIN))
36 #define AGS_IS_PLUGIN_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_PLUGIN))
37 #define AGS_PLUGIN_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_PLUGIN, AgsPluginInterface))
38 
39 typedef struct _AgsPlugin AgsPlugin;
40 typedef struct _AgsPluginInterface AgsPluginInterface;
41 
42 struct _AgsPluginInterface
43 {
44   GTypeInterface ginterface;
45 
46   gchar* (*get_name)(AgsPlugin *plugin);
47   void (*set_name)(AgsPlugin *plugin, gchar *name);
48 
49   gchar* (*get_version)(AgsPlugin *plugin);
50   void (*set_version)(AgsPlugin *plugin, gchar *version);
51 
52   gchar* (*get_build_id)(AgsPlugin *plugin);
53   void (*set_build_id)(AgsPlugin *plugin, gchar *build_id);
54 
55   gchar* (*get_xml_type)(AgsPlugin *plugin);
56   void (*set_xml_type)(AgsPlugin *plugin, gchar *xml_type);
57 
58   GList* (*get_ports)(AgsPlugin *plugin);
59   void (*set_ports)(AgsPlugin *plugin, GList *ports);
60 
61   void (*read)(GObject *file,
62 	       xmlNode *node,
63 	       AgsPlugin *plugin);
64   xmlNode* (*write)(GObject *file,
65 		    xmlNode *parent,
66 		    AgsPlugin *plugin);
67 };
68 
69 GType ags_plugin_get_type();
70 
71 gchar* ags_plugin_get_name(AgsPlugin *plugin);
72 void ags_plugin_set_name(AgsPlugin *plugin, gchar *name);
73 
74 gchar* ags_plugin_get_version(AgsPlugin *plugin);
75 void ags_plugin_set_version(AgsPlugin *plugin, gchar *version);
76 
77 gchar* ags_plugin_get_build_id(AgsPlugin *plugin);
78 void ags_plugin_set_build_id(AgsPlugin *plugin, gchar *build_id);
79 
80 gchar* ags_plugin_get_xml_type(AgsPlugin *plugin);
81 void ags_plugin_set_xml_type(AgsPlugin *plugin, gchar *xml_type);
82 
83 GList* ags_plugin_get_ports(AgsPlugin *plugin);
84 void ags_plugin_set_ports(AgsPlugin *plugin, GList *ports);
85 
86 void ags_plugin_read(GObject *file,
87 		     xmlNode *node,
88 		     AgsPlugin *plugin);
89 xmlNode* ags_plugin_write(GObject *file,
90 			  xmlNode *parent,
91 			  AgsPlugin *plugin);
92 
93 G_END_DECLS
94 
95 #endif /*__AGS_PLUGIN_H__*/
96