1 /* GStreamer
2  * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __GST_FREI0R_H__
21 #define __GST_FREI0R_H__
22 
23 #include <gst/gst.h>
24 
25 #include "frei0r.h"
26 
27 G_BEGIN_DECLS
28 
29 typedef struct _GstFrei0rFuncTable GstFrei0rFuncTable;
30 typedef struct _GstFrei0rProperty GstFrei0rProperty;
31 typedef struct _GstFrei0rPropertyValue GstFrei0rPropertyValue;
32 
33 struct _GstFrei0rPropertyValue {
34   union {
35     f0r_param_bool b;
36     f0r_param_double d;
37     f0r_param_string *s;
38     f0r_param_position_t position;
39     f0r_param_color_t color;
40   } data;
41 };
42 
43 struct _GstFrei0rProperty {
44   guint prop_id;
45   guint n_prop_ids;
46 
47   gint prop_idx;
48   f0r_param_info_t info;
49 
50   GstFrei0rPropertyValue default_value;
51 };
52 
53 struct _GstFrei0rFuncTable {
54   int (*init) (void);
55   void (*deinit) (void);
56 
57   f0r_instance_t (*construct) (unsigned int width, unsigned int height);
58   void (*destruct) (f0r_instance_t instance);
59 
60   void (*get_plugin_info) (f0r_plugin_info_t* info);
61   void (*get_param_info) (f0r_param_info_t* info, int param_index);
62 
63   void (*set_param_value) (f0r_instance_t instance,
64 			   f0r_param_t param, int param_index);
65   void (*get_param_value) (f0r_instance_t instance,
66 			   f0r_param_t param, int param_index);
67 
68   void (*update) (f0r_instance_t instance,
69 		  double time, const guint32* inframe, guint32* outframe);
70   void (*update2) (f0r_instance_t instance,
71 		   double time,
72 		   const guint32* inframe1,
73 		   const guint32* inframe2,
74 		   const guint32* inframe3,
75 		   guint32* outframe);
76 };
77 
78 typedef enum {
79   GST_FREI0R_PLUGIN_REGISTER_RETURN_OK,
80   GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED,
81   GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED
82 } GstFrei0rPluginRegisterReturn;
83 
84 void gst_frei0r_klass_install_properties (GObjectClass *gobject_class, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties);
85 
86 f0r_instance_t * gst_frei0r_instance_construct (GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, gint width, gint height);
87 
88 GstFrei0rPropertyValue * gst_frei0r_property_cache_init (GstFrei0rProperty *properties, gint n_properties);
89 void gst_frei0r_property_cache_free (GstFrei0rProperty *properties, GstFrei0rPropertyValue *property_cache, gint n_properties);
90 
91 GstCaps * gst_frei0r_caps_from_color_model (gint color_model);
92 gboolean gst_frei0r_get_property (f0r_instance_t *instance, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, guint prop_id, GValue *value);
93 gboolean gst_frei0r_set_property (f0r_instance_t *instance, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, guint prop_id, const GValue *value);
94 
95 G_END_DECLS
96 
97 #endif /* __GST_FREI0R_H__ */
98