• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2016 Thibault Saunier <thibault.saunier@collabora.com>
3  *               2016 Stefan Sauer <ensonic@users.sf.net>
4  *
5  * gstlv2utils.h: Header for LV2 plugin utils
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef __GST_LV2_UTILS_H__
24 #define __GST_LV2_UTILS_H__
25 
26 #include <gst/gst.h>
27 #include <gst/audio/audio.h>
28 #include <gst/audio/audio-channels.h>
29 
30 #include <lilv/lilv.h>
31 
32 G_BEGIN_DECLS
33 
34 typedef struct _GstLV2Group GstLV2Group;
35 typedef struct _GstLV2Port GstLV2Port;
36 
37 typedef struct _GstLV2 GstLV2;
38 typedef struct _GstLV2Class GstLV2Class;
39 
40 struct _GstLV2Group
41 {
42   gchar *uri; /**< RDF resource (URI or blank node) */
43   guint pad; /**< Gst pad index */
44   gchar *symbol; /**< Gst pad name / LV2 group symbol */
45   GArray *ports; /**< Array of GstLV2Port */
46   /* FIXME: not set as of now */
47   gboolean has_roles; /**< TRUE iff all ports have a known role */
48 };
49 
50 typedef enum {
51   GST_LV2_PORT_AUDIO = 0,
52   GST_LV2_PORT_CONTROL,
53   GST_LV2_PORT_CV
54 } GstLV2PortType;
55 
56 struct _GstLV2Port
57 {
58   gint index; /**< LV2 port index (on LV2 plugin) */
59   GstLV2PortType type; /**< Port type */
60   /**< Gst pad index (iff not part of a group), only for audio ports */
61   gint pad;
62   /* FIXME: not set as of now */
63   LilvNode *role; /**< Channel position / port role */
64   GstAudioChannelPosition position; /**< Channel position */
65 };
66 
67 struct _GstLV2
68 {
69   GstLV2Class *klass;
70 
71   LilvInstance *instance;
72   GHashTable *presets;
73 
74   gboolean activated;
75   unsigned long rate;
76 
77   struct
78   {
79     struct
80     {
81       gfloat *in;
82       gfloat *out;
83     } control;
84   } ports;
85 };
86 
87 struct _GstLV2Class
88 {
89   guint properties;
90 
91   const LilvPlugin *plugin;
92   GHashTable *sym_to_name;
93 
94   gint num_control_in, num_control_out;
95   gint num_cv_in, num_cv_out;
96 
97   GstLV2Group in_group; /**< Array of GstLV2Group */
98   GstLV2Group out_group; /**< Array of GstLV2Group */
99   GArray *control_in_ports; /**< Array of GstLV2Port */
100   GArray *control_out_ports; /**< Array of GstLV2Port */
101 };
102 
103 gboolean gst_lv2_check_required_features (const LilvPlugin * lv2plugin);
104 
105 void gst_lv2_host_init (void);
106 
107 gchar **gst_lv2_get_preset_names (GstLV2 * lv2, GstObject * obj);
108 gboolean gst_lv2_load_preset (GstLV2 * lv2, GstObject * obj, const gchar * name);
109 gboolean gst_lv2_save_preset (GstLV2 * lv2, GstObject * obj, const gchar * name);
110 gboolean gst_lv2_delete_preset (GstLV2 * lv2, GstObject * obj, const gchar * name);
111 
112 
113 void gst_lv2_init (GstLV2 * lv2, GstLV2Class * lv2_class);
114 void gst_lv2_finalize (GstLV2 * lv2);
115 
116 gboolean gst_lv2_setup (GstLV2 * lv2, unsigned long rate);
117 gboolean gst_lv2_cleanup (GstLV2 * lv2, GstObject *obj);
118 
119 void gst_lv2_object_set_property (GstLV2 * lv2, GObject * object,
120     guint prop_id, const GValue * value, GParamSpec * pspec);
121 void gst_lv2_object_get_property (GstLV2 * lv2, GObject * object,
122     guint prop_id, GValue * value, GParamSpec * pspec);
123 
124 void gst_lv2_class_install_properties (GstLV2Class * lv2_class,
125     GObjectClass * object_class, guint offset);
126 void gst_lv2_element_class_set_metadata (GstLV2Class * lv2_class,
127     GstElementClass * elem_class, const gchar * lv2_class_tags);
128 
129 void gst_lv2_class_init (GstLV2Class * lv2_class, GType type);
130 void gst_lv2_class_finalize (GstLV2Class * lv2_class);
131 
132 G_END_DECLS
133 
134 #endif /* __GST_LV2_UTILS_H__ */
135