1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
|
/* GStreamer
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstfrei0r.h"
#include "gstfrei0rfilter.h"
#include "gstfrei0rsrc.h"
#include "gstfrei0rmixer.h"
#include <string.h>
GST_DEBUG_CATEGORY (frei0r_debug);
#define GST_CAT_DEFAULT frei0r_debug
static GstStaticCaps bgra8888_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA);
static GstStaticCaps rgba8888_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA);
static GstStaticCaps packed32_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA " ; "
GST_VIDEO_CAPS_RGBA " ; "
GST_VIDEO_CAPS_ABGR " ; "
GST_VIDEO_CAPS_ARGB " ; "
GST_VIDEO_CAPS_BGRx " ; "
GST_VIDEO_CAPS_RGBx " ; "
GST_VIDEO_CAPS_xBGR " ; "
GST_VIDEO_CAPS_xRGB " ; " GST_VIDEO_CAPS_YUV ("AYUV"));
GstCaps *
gst_frei0r_caps_from_color_model (gint color_model)
{
switch (color_model) {
case F0R_COLOR_MODEL_BGRA8888:
return gst_static_caps_get (&bgra8888_caps);
case F0R_COLOR_MODEL_RGBA8888:
return gst_static_caps_get (&rgba8888_caps);
case F0R_COLOR_MODEL_PACKED32:
return gst_static_caps_get (&packed32_caps);
default:
break;
}
return NULL;
}
void
gst_frei0r_klass_install_properties (GObjectClass * gobject_class,
GstFrei0rFuncTable * ftable, GstFrei0rProperty * properties,
gint n_properties)
{
gint i, count = 1;
f0r_instance_t *instance = ftable->construct (640, 480);
g_assert (instance);
for (i = 0; i < n_properties; i++) {
f0r_param_info_t *param_info = &properties[i].info;
gchar *prop_name;
ftable->get_param_info (param_info, i);
if (!param_info->name) {
GST_ERROR ("Property %d of %s without a valid name", i,
g_type_name (G_TYPE_FROM_CLASS (gobject_class)));
continue;
}
prop_name = g_ascii_strdown (param_info->name, -1);
g_strcanon (prop_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
/* satisfy glib2 (argname[0] must be [A-Za-z]) */
if (!((prop_name[0] >= 'a' && prop_name[0] <= 'z') ||
(prop_name[0] >= 'A' && prop_name[0] <= 'Z'))) {
gchar *tempstr = prop_name;
prop_name = g_strconcat ("param-", prop_name, NULL);
g_free (tempstr);
}
properties[i].prop_id = count;
properties[i].prop_idx = i;
ftable->get_param_value (instance, &properties[i].default_value, i);
if (param_info->type == F0R_PARAM_STRING)
properties[i].default_value.data.s =
g_strdup (properties[i].default_value.data.s);
switch (param_info->type) {
case F0R_PARAM_BOOL:
g_object_class_install_property (gobject_class, count++,
g_param_spec_boolean (prop_name, param_info->name,
param_info->explanation,
properties[i].default_value.data.b ? TRUE : FALSE,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
case F0R_PARAM_DOUBLE:{
gdouble def = properties[i].default_value.data.d;
/* If the default is NAN, +-INF we use 0.0 */
if (!(def <= G_MAXDOUBLE && def >= -G_MAXDOUBLE))
def = 0.0;
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name, param_info->name,
param_info->explanation, -G_MAXDOUBLE, G_MAXDOUBLE, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
}
case F0R_PARAM_STRING:
g_object_class_install_property (gobject_class, count++,
g_param_spec_string (prop_name, param_info->name,
param_info->explanation, properties[i].default_value.data.s,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
case F0R_PARAM_COLOR:{
gchar *prop_name_full;
gchar *prop_nick_full;
gdouble def;
def = properties[i].default_value.data.color.r;
/* If the default is out of range we use 0.0 */
if (!(def <= 1.0 && def >= 0.0))
def = 0.0;
prop_name_full = g_strconcat (prop_name, "-r", NULL);
prop_nick_full = g_strconcat (param_info->name, "-R", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, prop_nick_full,
param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
def = properties[i].default_value.data.color.g;
/* If the default is out of range we use 0.0 */
if (!(def <= 1.0 && def >= 0.0))
def = 0.0;
prop_name_full = g_strconcat (prop_name, "-g", NULL);
prop_nick_full = g_strconcat (param_info->name, "-G", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, param_info->name,
param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
def = properties[i].default_value.data.color.b;
/* If the default is out of range we use 0.0 */
if (!(def <= 1.0 && def >= 0.0))
def = 0.0;
prop_name_full = g_strconcat (prop_name, "-b", NULL);
prop_nick_full = g_strconcat (param_info->name, "-B", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, param_info->name,
param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
properties[i].n_prop_ids = 3;
break;
}
case F0R_PARAM_POSITION:{
gchar *prop_name_full;
gchar *prop_nick_full;
gdouble def;
def = properties[i].default_value.data.position.x;
/* If the default is out of range we use 0.0 */
if (!(def <= 1.0 && def >= 0.0))
def = 0.0;
prop_name_full = g_strconcat (prop_name, "-x", NULL);
prop_nick_full = g_strconcat (param_info->name, "-X", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name_full, param_info->name,
param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
def = properties[i].default_value.data.position.y;
/* If the default is out of range we use 0.0 */
if (!(def <= 1.0 && def >= 0.0))
def = 0.0;
prop_name_full = g_strconcat (prop_name, "-Y", NULL);
prop_nick_full = g_strconcat (param_info->name, "-X", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name_full, param_info->name,
param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
properties[i].n_prop_ids = 2;
break;
}
default:
g_assert_not_reached ();
break;
}
g_free (prop_name);
}
ftable->destruct (instance);
}
GstFrei0rPropertyValue *
gst_frei0r_property_cache_init (GstFrei0rProperty * properties,
gint n_properties)
{
gint i;
GstFrei0rPropertyValue *ret = g_new0 (GstFrei0rPropertyValue, n_properties);
for (i = 0; i < n_properties; i++) {
memcpy (&ret[i].data, &properties[i].default_value,
sizeof (GstFrei0rPropertyValue));
if (properties[i].info.type == F0R_PARAM_STRING)
ret[i].data.s = g_strdup (ret[i].data.s);
}
return ret;
}
void
gst_frei0r_property_cache_free (GstFrei0rProperty * properties,
GstFrei0rPropertyValue * property_cache, gint n_properties)
{
gint i;
for (i = 0; i < n_properties; i++) {
if (properties[i].info.type == F0R_PARAM_STRING)
g_free (property_cache[i].data.s);
}
g_free (property_cache);
}
f0r_instance_t *
gst_frei0r_instance_construct (GstFrei0rFuncTable * ftable,
GstFrei0rProperty * properties, gint n_properties,
GstFrei0rPropertyValue * property_cache, gint width, gint height)
{
f0r_instance_t *instance = ftable->construct (width, height);
gint i;
for (i = 0; i < n_properties; i++) {
if (properties[i].info.type == F0R_PARAM_STRING)
ftable->set_param_value (instance, property_cache[i].data.s, i);
else
ftable->set_param_value (instance, &property_cache[i].data, i);
}
return instance;
}
gboolean
gst_frei0r_get_property (f0r_instance_t * instance, GstFrei0rFuncTable * ftable,
GstFrei0rProperty * properties, gint n_properties,
GstFrei0rPropertyValue * property_cache, guint prop_id, GValue * value)
{
gint i;
GstFrei0rProperty *prop = NULL;
for (i = 0; i < n_properties; i++) {
if (properties[i].prop_id <= prop_id &&
properties[i].prop_id + properties[i].n_prop_ids > prop_id) {
prop = &properties[i];
break;
}
}
if (!prop)
return FALSE;
switch (prop->info.type) {
case F0R_PARAM_BOOL:{
gdouble d;
if (instance)
ftable->get_param_value (instance, &d, prop->prop_idx);
else
d = property_cache[prop->prop_idx].data.b;
g_value_set_boolean (value, (d < 0.5) ? FALSE : TRUE);
break;
}
case F0R_PARAM_DOUBLE:{
gdouble d;
if (instance)
ftable->get_param_value (instance, &d, prop->prop_idx);
else
d = property_cache[prop->prop_idx].data.d;
g_value_set_double (value, d);
break;
}
case F0R_PARAM_STRING:{
const gchar *s;
if (instance)
ftable->get_param_value (instance, &s, prop->prop_idx);
else
s = property_cache[prop->prop_idx].data.s;
g_value_set_string (value, s);
break;
}
case F0R_PARAM_COLOR:{
f0r_param_color_t color;
if (instance)
ftable->get_param_value (instance, &color, prop->prop_idx);
else
color = property_cache[prop->prop_idx].data.color;
switch (prop_id - prop->prop_id) {
case 0:
g_value_set_float (value, color.r);
break;
case 1:
g_value_set_float (value, color.g);
break;
case 2:
g_value_set_float (value, color.b);
break;
}
break;
}
case F0R_PARAM_POSITION:{
f0r_param_position_t position;
if (instance)
ftable->get_param_value (instance, &position, prop->prop_idx);
else
position = property_cache[prop->prop_idx].data.position;
switch (prop_id - prop->prop_id) {
case 0:
g_value_set_double (value, position.x);
break;
case 1:
g_value_set_double (value, position.y);
break;
}
break;
}
default:
g_assert_not_reached ();
break;
}
return TRUE;
}
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)
{
GstFrei0rProperty *prop = NULL;
gint i;
for (i = 0; i < n_properties; i++) {
if (properties[i].prop_id <= prop_id &&
properties[i].prop_id + properties[i].n_prop_ids > prop_id) {
prop = &properties[i];
break;
}
}
if (!prop)
return FALSE;
switch (prop->info.type) {
case F0R_PARAM_BOOL:{
gboolean b = g_value_get_boolean (value);
gdouble d = b ? 1.0 : 0.0;
if (instance)
ftable->set_param_value (instance, &d, prop->prop_idx);
property_cache[prop->prop_idx].data.b = d;
break;
}
case F0R_PARAM_DOUBLE:{
gdouble d = g_value_get_double (value);
if (instance)
ftable->set_param_value (instance, &d, prop->prop_idx);
property_cache[prop->prop_idx].data.d = d;
break;
}
case F0R_PARAM_STRING:{
gchar *s = g_value_dup_string (value);
/* Copies the string */
if (instance)
ftable->set_param_value (instance, s, prop->prop_idx);
property_cache[prop->prop_idx].data.s = s;
break;
}
case F0R_PARAM_COLOR:{
gfloat f = g_value_get_float (value);
f0r_param_color_t *color = &property_cache[prop->prop_idx].data.color;
switch (prop_id - prop->prop_id) {
case 0:
color->r = f;
break;
case 1:
color->g = f;
break;
case 2:
color->b = f;
break;
default:
g_assert_not_reached ();
}
if (instance)
ftable->set_param_value (instance, color, prop->prop_idx);
break;
}
case F0R_PARAM_POSITION:{
gdouble d = g_value_get_double (value);
f0r_param_position_t *position =
&property_cache[prop->prop_idx].data.position;
switch (prop_id - prop->prop_id) {
case 0:
position->x = d;
break;
case 1:
position->y = d;
break;
default:
g_assert_not_reached ();
}
if (instance)
ftable->set_param_value (instance, position, prop->prop_idx);
break;
}
default:
g_assert_not_reached ();
break;
}
return TRUE;
}
static gboolean
register_plugin (GstPlugin * plugin, const gchar * vendor,
const gchar * filename)
{
GModule *module;
GstFrei0rPluginRegisterReturn ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
GstFrei0rFuncTable ftable = { NULL, };
gint i;
f0r_plugin_info_t info = { NULL, };
f0r_instance_t *instance = NULL;
GST_DEBUG ("Registering plugin '%s'", filename);
module = g_module_open (filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
if (!module) {
GST_WARNING ("Failed to load plugin");
return FALSE;
}
if (!g_module_symbol (module, "f0r_init", (gpointer *) & ftable.init)) {
GST_INFO ("No frei0r plugin");
g_module_close (module);
return FALSE;
}
if (!g_module_symbol (module, "f0r_deinit", (gpointer *) & ftable.deinit) ||
!g_module_symbol (module, "f0r_construct",
(gpointer *) & ftable.construct)
|| !g_module_symbol (module, "f0r_destruct",
(gpointer *) & ftable.destruct)
|| !g_module_symbol (module, "f0r_get_plugin_info",
(gpointer *) & ftable.get_plugin_info)
|| !g_module_symbol (module, "f0r_get_param_info",
(gpointer *) & ftable.get_param_info)
|| !g_module_symbol (module, "f0r_set_param_value",
(gpointer *) & ftable.set_param_value)
|| !g_module_symbol (module, "f0r_get_param_value",
(gpointer *) & ftable.get_param_value))
goto invalid_frei0r_plugin;
/* One of these must exist */
g_module_symbol (module, "f0r_update", (gpointer *) & ftable.update);
g_module_symbol (module, "f0r_update2", (gpointer *) & ftable.update2);
if (!ftable.init ()) {
GST_WARNING ("Failed to initialize plugin");
g_module_close (module);
return FALSE;
}
if (!ftable.update && !ftable.update2)
goto invalid_frei0r_plugin;
ftable.get_plugin_info (&info);
if (info.frei0r_version > 1) {
GST_WARNING ("Unsupported frei0r version %d", info.frei0r_version);
ftable.deinit ();
g_module_close (module);
return FALSE;
}
if (info.color_model > F0R_COLOR_MODEL_PACKED32) {
GST_WARNING ("Unsupported color model %d", info.color_model);
ftable.deinit ();
g_module_close (module);
return FALSE;
}
for (i = 0; i < info.num_params; i++) {
f0r_param_info_t pinfo = { NULL, };
ftable.get_param_info (&pinfo, i);
if (pinfo.type > F0R_PARAM_STRING) {
GST_WARNING ("Unsupported parameter type %d", pinfo.type);
ftable.deinit ();
g_module_close (module);
return FALSE;
}
}
instance = ftable.construct (640, 480);
if (!instance) {
GST_WARNING ("Failed to instanciate plugin '%s'", info.name);
ftable.deinit ();
g_module_close (module);
return FALSE;
}
ftable.destruct (instance);
switch (info.plugin_type) {
case F0R_PLUGIN_TYPE_FILTER:
ret = gst_frei0r_filter_register (plugin, vendor, &info, &ftable);
break;
case F0R_PLUGIN_TYPE_SOURCE:
ret = gst_frei0r_src_register (plugin, vendor, &info, &ftable);
break;
case F0R_PLUGIN_TYPE_MIXER2:
case F0R_PLUGIN_TYPE_MIXER3:
ret = gst_frei0r_mixer_register (plugin, vendor, &info, &ftable);
break;
default:
break;
}
switch (ret) {
case GST_FREI0R_PLUGIN_REGISTER_RETURN_OK:
return TRUE;
case GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED:
GST_ERROR ("Failed to register frei0r plugin");
ftable.deinit ();
g_module_close (module);
return FALSE;
case GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED:
GST_DEBUG ("frei0r plugin already registered");
ftable.deinit ();
g_module_close (module);
return TRUE;
default:
g_return_val_if_reached (FALSE);
}
g_return_val_if_reached (FALSE);
invalid_frei0r_plugin:
GST_ERROR ("Invalid frei0r plugin");
ftable.deinit ();
g_module_close (module);
return FALSE;
}
static gboolean
register_plugins (GstPlugin * plugin, GHashTable * plugin_names,
const gchar * path, const gchar * base_path)
{
GDir *dir;
gchar *filename;
const gchar *entry_name;
gboolean ret = TRUE;
GST_DEBUG ("Scanning directory '%s' for frei0r plugins", path);
dir = g_dir_open (path, 0, NULL);
if (!dir)
return FALSE;
while ((entry_name = g_dir_read_name (dir))) {
gchar *tmp, *vendor = NULL;
gchar *hashtable_name;
tmp = g_strdup (path + strlen (base_path));
if (*tmp == G_DIR_SEPARATOR && *(tmp + 1))
vendor = tmp + 1;
else if (*tmp)
vendor = tmp;
if (vendor)
hashtable_name = g_strconcat (vendor, "-", entry_name, NULL);
else
hashtable_name = g_strdup (entry_name);
if (g_hash_table_lookup_extended (plugin_names, hashtable_name, NULL, NULL)) {
g_free (hashtable_name);
continue;
}
filename = g_build_filename (path, entry_name, NULL);
if ((g_str_has_suffix (filename, G_MODULE_SUFFIX)
#ifdef GST_EXTRA_MODULE_SUFFIX
|| g_str_has_suffix (filename, GST_EXTRA_MODULE_SUFFIX)
#endif
) && g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
gboolean this_ret;
this_ret = register_plugin (plugin, vendor, filename);
if (this_ret)
g_hash_table_insert (plugin_names, g_strdup (hashtable_name), NULL);
ret = ret && this_ret;
} else if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
ret = ret && register_plugins (plugin, plugin_names, filename, base_path);
}
g_free (filename);
g_free (hashtable_name);
g_free (tmp);
}
g_dir_close (dir);
return ret;
}
static gboolean
plugin_init (GstPlugin * plugin)
{
const gchar *homedir;
gchar *path;
GHashTable *plugin_names;
const gchar *frei0r_path;
GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");
gst_plugin_add_dependency_simple (plugin,
"FREI0R_PATH:HOME/.frei0r-1/lib",
"/usr/lib/frei0r-1:/usr/local/lib/frei0r-1:"
"/usr/lib32/frei0r-1:/usr/local/lib32/frei0r-1:"
"/usr/lib64/frei0r-1:/usr/local/lib64/frei0r-1",
NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
plugin_names =
g_hash_table_new_full ((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal,
(GDestroyNotify) g_free, NULL);
frei0r_path = g_getenv ("FREI0R_PATH");
if (frei0r_path && *frei0r_path) {
gchar **p, **paths = g_strsplit (frei0r_path, ":", -1);
for (p = paths; *p; p++) {
register_plugins (plugin, plugin_names, *p, *p);
}
g_strfreev (paths);
} else {
#define register_plugins2(plugin, pn, p) register_plugins(plugin, pn, p, p)
homedir = g_get_home_dir ();
path = g_build_filename (homedir, ".frei0r-1", "lib", NULL);
register_plugins2 (plugin, plugin_names, path);
g_free (path);
register_plugins2 (plugin, plugin_names, "/usr/local/lib/frei0r-1");
register_plugins2 (plugin, plugin_names, "/usr/lib/frei0r-1");
register_plugins2 (plugin, plugin_names, "/usr/local/lib32/frei0r-1");
register_plugins2 (plugin, plugin_names, "/usr/lib32/frei0r-1");
register_plugins2 (plugin, plugin_names, "/usr/local/lib64/frei0r-1");
register_plugins2 (plugin, plugin_names, "/usr/lib64/frei0r-1");
#undef register_plugins2
}
g_hash_table_unref (plugin_names);
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
frei0r,
"frei0r plugin library",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|