gstreamer 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Rakefile +201 -3
  2. data/ext/gstreamer/extconf.rb +10 -10
  3. data/ext/gstreamer/misc.c +16 -15
  4. data/ext/gstreamer/rbgst-bin.c +75 -83
  5. data/ext/gstreamer/rbgst-buffer.c +91 -91
  6. data/ext/gstreamer/rbgst-bus.c +21 -21
  7. data/ext/gstreamer/rbgst-caps.c +98 -91
  8. data/ext/gstreamer/rbgst-child-proxy.c +19 -18
  9. data/ext/gstreamer/rbgst-clock.c +34 -32
  10. data/ext/gstreamer/rbgst-element-factory.c +79 -85
  11. data/ext/gstreamer/rbgst-element.c +245 -210
  12. data/ext/gstreamer/rbgst-event.c +18 -18
  13. data/ext/gstreamer/rbgst-ghost-pad.c +24 -21
  14. data/ext/gstreamer/rbgst-index-factory.c +31 -29
  15. data/ext/gstreamer/rbgst-install-plugins-context.c +86 -0
  16. data/ext/gstreamer/rbgst-install-plugins-return.c +45 -0
  17. data/ext/gstreamer/rbgst-install-plugins.c +45 -111
  18. data/ext/gstreamer/rbgst-message.c +15 -16
  19. data/ext/gstreamer/rbgst-mini-object.c +37 -37
  20. data/ext/gstreamer/rbgst-object.c +29 -26
  21. data/ext/gstreamer/rbgst-pad-template.c +36 -35
  22. data/ext/gstreamer/rbgst-pad.c +96 -96
  23. data/ext/gstreamer/rbgst-pipeline.c +32 -31
  24. data/ext/gstreamer/rbgst-plugin-feature.c +47 -48
  25. data/ext/gstreamer/rbgst-plugin.c +62 -64
  26. data/ext/gstreamer/rbgst-private.c +14 -15
  27. data/ext/gstreamer/rbgst-private.h +76 -16
  28. data/ext/gstreamer/rbgst-query.c +22 -20
  29. data/ext/gstreamer/rbgst-seek.c +22 -19
  30. data/ext/gstreamer/rbgst-static-caps.c +26 -24
  31. data/ext/gstreamer/rbgst-static-pad-template.c +27 -26
  32. data/ext/gstreamer/rbgst-structure.c +61 -59
  33. data/ext/gstreamer/rbgst-system-clock.c +23 -20
  34. data/ext/gstreamer/rbgst-type-find-factory.c +44 -43
  35. data/ext/gstreamer/rbgst-value.c +40 -28
  36. data/ext/gstreamer/rbgst-x-overlay.c +32 -31
  37. data/ext/gstreamer/rbgst.c +78 -128
  38. data/ext/gstreamer/rbgst.h +16 -16
  39. data/ext/gstreamer/rbgstclockentry.c +46 -43
  40. data/ext/gstreamer/rbgstformat.c +64 -61
  41. data/ext/gstreamer/rbgstindex.c +67 -64
  42. data/ext/gstreamer/rbgstindexentry.c +31 -28
  43. data/ext/gstreamer/rbgstparse.c +32 -29
  44. data/ext/gstreamer/rbgstquerytype.c +64 -61
  45. data/ext/gstreamer/rbgstregistry.c +79 -76
  46. data/ext/gstreamer/rbgsttag.c +34 -32
  47. data/ext/gstreamer/rbgsttagsetter.c +22 -19
  48. data/ext/gstreamer/rbgstxml.c +78 -75
  49. data/lib/gst.rb +15 -1
  50. data/test/test_buffer.rb +5 -2
  51. data/test/test_element.rb +7 -9
  52. data/test/test_value.rb +2 -2
  53. metadata +11 -11
  54. data/ChangeLog +0 -1202
  55. data/test/test_clock.rb +0 -7
@@ -1,26 +1,26 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
3
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
4
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
6
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
7
  *
6
- * This file is part of Ruby/GStreamer.
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
7
12
  *
8
- * Ruby/GStreamer is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Lesser General Public License for more details.
12
17
  *
13
- * Ruby/GStreamer is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with Ruby/GStreamer; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
+ * MA 02110-1301 USA
21
22
  */
22
23
 
23
- #include "rbgst.h"
24
24
  #include "rbgst-private.h"
25
25
 
26
26
  /* Document-class: Gst::Event
@@ -312,7 +312,7 @@ rbgst_event_get_type(VALUE self)
312
312
  }
313
313
 
314
314
  void
315
- Init_gst_event (void)
315
+ Init_gst_event (VALUE mGst)
316
316
  {
317
317
  table.type = GST_TYPE_EVENT;
318
318
  table.get_superclass = get_superclass;
@@ -1,31 +1,34 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2006,2008 Sjoerd Simons <sjoerd@luon.net>
3
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006,2008 Sjoerd Simons <sjoerd@luon.net>
5
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
4
6
  *
5
- * This file is part of Ruby/GStreamer.
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
6
11
  *
7
- * Ruby/GStreamer is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
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
+ * Lesser General Public License for more details.
11
16
  *
12
- * Ruby/GStreamer 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
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with Ruby/GStreamer; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
20
21
  */
21
22
 
22
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
24
+
25
+ #define RG_TARGET_NAMESPACE cGhostPad
23
26
 
24
27
  static VALUE
25
- rb_gst_ghost_pad_new(VALUE self, VALUE name, VALUE pad)
28
+ rg_initialize(VALUE self, VALUE name, VALUE pad)
26
29
  {
27
30
  GstPad *gpad;
28
-
31
+
29
32
  gpad = gst_ghost_pad_new(RVAL2CSTR(name), RVAL2GST_PAD(pad));
30
33
 
31
34
  G_INITIALIZE(self, gpad);
@@ -34,9 +37,9 @@ rb_gst_ghost_pad_new(VALUE self, VALUE name, VALUE pad)
34
37
  }
35
38
 
36
39
  void
37
- Init_gst_ghost_pad(void)
40
+ Init_gst_ghost_pad(VALUE mGst)
38
41
  {
39
- VALUE c = G_DEF_CLASS(GST_TYPE_GHOST_PAD, "GhostPad", mGst);
42
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_GHOST_PAD, "GhostPad", mGst);
40
43
 
41
- rb_define_method(c, "initialize", rb_gst_ghost_pad_new, 2);
44
+ RG_DEF_METHOD(initialize, 2);
42
45
  }
@@ -1,26 +1,28 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
4
6
  *
5
- * This file is part of Ruby/GStreamer.
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
6
11
  *
7
- * Ruby/GStreamer is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
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
+ * Lesser General Public License for more details.
11
16
  *
12
- * Ruby/GStreamer 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
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with Ruby/GStreamer; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
20
21
  */
21
22
 
22
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
23
24
 
25
+ #define RG_TARGET_NAMESPACE cIndexFactory
24
26
  #define SELF(self) RVAL2GST_INDEX_FACTORY(self)
25
27
 
26
28
  /* Class: Gst::IndexFactory
@@ -28,7 +30,7 @@
28
30
  */
29
31
 
30
32
  static VALUE
31
- s_find(VALUE self, VALUE name)
33
+ rg_s_find(VALUE self, VALUE name)
32
34
  {
33
35
  return GOBJ2RVAL(gst_index_factory_find(RVAL2CSTR(name)));
34
36
  }
@@ -37,31 +39,31 @@ s_find(VALUE self, VALUE name)
37
39
  * Returns: a String representing the factory.
38
40
  */
39
41
  static VALUE
40
- rb_gst_indexfactory_to_s (VALUE self)
42
+ rg_to_s (VALUE self)
41
43
  {
42
- GstIndexFactory *factory = RGST_INDEX_FACTORY (self);
43
- return rb_str_new_with_format ("Index: %s (%s)",
44
- GST_PLUGIN_FEATURE_NAME (factory),
45
- factory->longdesc);
44
+ GstIndexFactory *factory = RGST_INDEX_FACTORY (self);
45
+ return rb_str_new_with_format ("Index: %s (%s)",
46
+ GST_PLUGIN_FEATURE_NAME (factory),
47
+ factory->longdesc);
46
48
  }
47
49
 
48
50
  static VALUE
49
- get_description(VALUE self)
51
+ rg_description(VALUE self)
50
52
  {
51
53
  return CSTR2RVAL(SELF(self)->longdesc);
52
54
  }
53
55
 
54
56
  void
55
- Init_gst_indexfactory (void)
57
+ Init_gst_indexfactory (VALUE mGst)
56
58
  {
57
- VALUE rb_cGstIndexFactory;
59
+ VALUE RG_TARGET_NAMESPACE;
58
60
 
59
- rb_cGstIndexFactory = G_DEF_CLASS(GST_TYPE_INDEX_FACTORY,
61
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_INDEX_FACTORY,
60
62
  "IndexFactory", mGst);
61
63
 
62
- rb_define_singleton_method(rb_cGstIndexFactory, "find", s_find, 1);
64
+ RG_DEF_SMETHOD(find, 1);
63
65
 
64
- rb_define_method(rb_cGstIndexFactory, "to_s", rb_gst_indexfactory_to_s, 0);
66
+ RG_DEF_METHOD(to_s, 0);
65
67
 
66
- rb_define_method(rb_cGstIndexFactory, "description", get_description, 0);
68
+ RG_DEF_METHOD(description, 0);
67
69
  }
@@ -0,0 +1,86 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #ifdef HAVE_GST_PBUTILS
22
+ #include "rbgst-private.h"
23
+ #include <gst/pbutils/pbutils-enumtypes.h>
24
+ #include <gst/pbutils/install-plugins.h>
25
+
26
+ #define RG_TARGET_NAMESPACE cInstallPluginsContext
27
+
28
+ static RGConvertTable context_table = {0};
29
+ static VALUE RG_TARGET_NAMESPACE;
30
+
31
+ static VALUE
32
+ context2robj(gpointer context)
33
+ {
34
+ return Data_Wrap_Struct(RG_TARGET_NAMESPACE, NULL,
35
+ gst_install_plugins_context_free,
36
+ (GstInstallPluginsContext *)context);
37
+ }
38
+
39
+ static gpointer
40
+ robj2context(VALUE object)
41
+ {
42
+ gpointer instance;
43
+
44
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(object, RG_TARGET_NAMESPACE))) {
45
+ rb_raise(rb_eTypeError, "not a Gst::InstallPluginsContext");
46
+ }
47
+ Data_Get_Struct(object, GstInstallPluginsContext, instance);
48
+ return instance;
49
+ }
50
+
51
+ static VALUE
52
+ rg_initialize(VALUE self)
53
+ {
54
+ GstInstallPluginsContext *context;
55
+
56
+ context = gst_install_plugins_context_new();
57
+ G_INITIALIZE(self, context);
58
+ return Qnil;
59
+ }
60
+
61
+ static VALUE
62
+ rg_set_xid(VALUE self, VALUE xid)
63
+ {
64
+ GstInstallPluginsContext *context;
65
+
66
+ context = (GstInstallPluginsContext *)RVAL2GOBJ(self);
67
+ gst_install_plugins_context_set_xid(context, NUM2INT(xid));/*FIXME: segfault on ruby exit*/
68
+ return self;
69
+ }
70
+
71
+ void
72
+ Init_gst_install_plugins_context(VALUE mGst)
73
+ {
74
+ context_table.type = GST_TYPE_INSTALL_PLUGINS_CONTEXT;
75
+ context_table.instance2robj = context2robj;
76
+ context_table.robj2instance = robj2context;
77
+ RG_DEF_CONVERSION(&context_table);
78
+
79
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_INSTALL_PLUGINS_CONTEXT,
80
+ "InstallPluginsContext", mGst);
81
+
82
+ RG_DEF_METHOD(initialize, 0);
83
+ RG_DEF_METHOD(set_xid, 1);
84
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
85
+ }
86
+ #endif /* HAVE_GST_PBUTILS */
@@ -0,0 +1,45 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #ifdef HAVE_GST_PBUTILS
22
+ #include "rbgst-private.h"
23
+ #include <gst/pbutils/pbutils-enumtypes.h>
24
+ #include <gst/pbutils/install-plugins.h>
25
+
26
+ #define RG_TARGET_NAMESPACE cInstallPluginsReturn
27
+
28
+ static VALUE RG_TARGET_NAMESPACE;
29
+
30
+ static VALUE
31
+ rg_name(VALUE self)
32
+ {
33
+ return CSTR2RVAL(gst_install_plugins_return_get_name(
34
+ (GstInstallPluginsReturn)
35
+ RVAL2GENUM(self, GST_TYPE_INSTALL_PLUGINS_RETURN)));
36
+ }
37
+
38
+ void
39
+ Init_gst_install_plugins_return(VALUE mGst)
40
+ {
41
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_INSTALL_PLUGINS_RETURN,
42
+ "InstallPluginsReturn", mGst);
43
+ RG_DEF_METHOD(name, 0);
44
+ }
45
+ #endif /* HAVE_GST_PBUTILS */
@@ -1,65 +1,55 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
4
  *
5
- * This file is part of Ruby/GStreamer.
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
6
9
  *
7
- * Ruby/GStreamer is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
11
14
  *
12
- * Ruby/GStreamer 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
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with Ruby/GStreamer; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
20
19
  */
21
20
 
22
21
  #ifdef HAVE_GST_PBUTILS
23
- #include "rbgst.h"
24
22
  #include "rbgst-private.h"
25
23
  #include <gst/pbutils/pbutils-enumtypes.h>
26
24
  #include <gst/pbutils/install-plugins.h>
27
25
 
28
- static RGConvertTable context_table = {0};
29
- static VALUE mGstInstallPlugins;
30
- static VALUE rb_cGstInstallPluginsReturn;
31
- static VALUE rb_cGstInstallPluginsContext;
26
+ #define RG_TARGET_NAMESPACE mInstallPlugins
32
27
 
33
- static VALUE
34
- return_get_name(VALUE self)
35
- {
36
- return CSTR2RVAL(gst_install_plugins_return_get_name(
37
- (GstInstallPluginsReturn)
38
- RVAL2GENUM(self, GST_TYPE_INSTALL_PLUGINS_RETURN)));
39
- }
28
+ static VALUE RG_TARGET_NAMESPACE;
29
+ static VALUE cInstallPluginsContext;
40
30
 
41
31
  static void
42
32
  gst_install_plugins_result_func(GstInstallPluginsReturn result, VALUE data)
43
33
  {
44
34
  rb_funcall(data, rb_intern("call"), 1,
45
35
  GENUM2RVAL(result, GST_TYPE_INSTALL_PLUGINS_RETURN));
46
- G_CHILD_REMOVE(mGstInstallPlugins, data);
36
+ G_CHILD_REMOVE(RG_TARGET_NAMESPACE, data);
47
37
  }
48
38
 
49
39
  static VALUE
50
- supported(VALUE self)
40
+ rg_s_supported_p(VALUE self)
51
41
  {
52
42
  return CBOOL2RVAL(gst_install_plugins_supported());
53
43
  }
54
44
 
55
45
  static VALUE
56
- progress(VALUE self)
46
+ rg_s_progress_p(VALUE self)
57
47
  {
58
48
  return CBOOL2RVAL(gst_install_plugins_installation_in_progress());
59
49
  }
60
50
 
61
51
  static VALUE
62
- async(int argc, VALUE *argv, VALUE self)
52
+ rg_s_async(int argc, VALUE *argv, VALUE self)
63
53
  {
64
54
  VALUE details, rcontext, block;
65
55
  int length, i;
@@ -75,19 +65,19 @@ async(int argc, VALUE *argv, VALUE self)
75
65
  str = RARRAY_PTR(details);
76
66
  carray= ALLOCA_N (char *, length+1);
77
67
  for (i = 0; i<length; i++) {
78
- carray[i] = RVAL2CSTR(str[i]);
79
- }
80
- carray[length] = NULL;
68
+ carray[i] = RVAL2CSTR(str[i]);
69
+ }
70
+ carray[length] = NULL;
81
71
 
82
72
  if (!NIL_P(rcontext)) {
83
- if (!RVAL2CBOOL(rb_obj_is_kind_of(rcontext, rb_cGstInstallPluginsContext)))
84
- rb_raise(rb_eTypeError,
85
- "2nd parameter is not Gst::InstallPluginsContext");
86
- context = (GstInstallPluginsContext *)RVAL2GOBJ(rcontext);
87
- }
88
- else {
89
- context = NULL;
90
- }
73
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(rcontext, cInstallPluginsContext)))
74
+ rb_raise(rb_eTypeError,
75
+ "2nd parameter is not Gst::InstallPluginsContext");
76
+ context = (GstInstallPluginsContext *)RVAL2GOBJ(rcontext);
77
+ }
78
+ else {
79
+ context = NULL;
80
+ }
91
81
 
92
82
  block = rb_block_proc();
93
83
  G_CHILD_ADD(self, block);
@@ -95,11 +85,11 @@ async(int argc, VALUE *argv, VALUE self)
95
85
  result = gst_install_plugins_async(carray, context,
96
86
  (GstInstallPluginsResultFunc)gst_install_plugins_result_func,
97
87
  (gpointer)block);
98
- return GENUM2RVAL(result, GST_TYPE_INSTALL_PLUGINS_RETURN);
88
+ return GENUM2RVAL(result, GST_TYPE_INSTALL_PLUGINS_RETURN);
99
89
  }
100
90
 
101
91
  static VALUE
102
- sync(int argc, VALUE *argv, VALUE self)
92
+ rg_s_sync(int argc, VALUE *argv, VALUE self)
103
93
  {
104
94
  VALUE details, context;
105
95
  int length, i;
@@ -113,79 +103,23 @@ sync(int argc, VALUE *argv, VALUE self)
113
103
  str = RARRAY_PTR(details);
114
104
  carray= ALLOCA_N (char *, length+1);
115
105
  for (i = 0; i<length; i++) {
116
- carray[i] = RVAL2CSTR(str[i]);
117
- }
118
- carray[length] = NULL;
119
-
120
- result = gst_install_plugins_sync(carray, NULL);
121
- return GENUM2RVAL(result, GST_TYPE_INSTALL_PLUGINS_RETURN);
122
- }
123
-
124
- static VALUE
125
- context2robj(gpointer context)
126
- {
127
- return Data_Wrap_Struct(rb_cGstInstallPluginsContext, NULL,
128
- gst_install_plugins_context_free,
129
- (GstInstallPluginsContext *)context);
130
- }
131
-
132
- static gpointer
133
- robj2context(VALUE object)
134
- {
135
- gpointer instance;
136
-
137
- if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGstInstallPluginsContext))) {
138
- rb_raise(rb_eTypeError, "not a Gst::InstallPluginsContext");
106
+ carray[i] = RVAL2CSTR(str[i]);
139
107
  }
140
- Data_Get_Struct(object, GstInstallPluginsContext, instance);
141
- return instance;
142
- }
143
-
144
- static VALUE
145
- context_initialize(VALUE self)
146
- {
147
- GstInstallPluginsContext *context;
108
+ carray[length] = NULL;
148
109
 
149
- context = gst_install_plugins_context_new();
150
- G_INITIALIZE(self, context);
151
- return Qnil;
152
- }
153
-
154
- static VALUE
155
- context_set_xid(VALUE self, VALUE xid)
156
- {
157
- GstInstallPluginsContext *context;
158
-
159
- context = (GstInstallPluginsContext *)RVAL2GOBJ(self);
160
- gst_install_plugins_context_set_xid(context, NUM2INT(xid));/*FIXME: segfault on ruby exit*/
161
- return self;
110
+ result = gst_install_plugins_sync(carray, NULL);
111
+ return GENUM2RVAL(result, GST_TYPE_INSTALL_PLUGINS_RETURN);
162
112
  }
163
113
 
164
114
  void
165
- Init_gst_install_plugins(void)
115
+ Init_gst_install_plugins(VALUE mGst)
166
116
  {
167
- mGstInstallPlugins = rb_define_module_under(mGst, "InstallPlugins");
168
-
169
- rb_cGstInstallPluginsReturn = G_DEF_CLASS(GST_TYPE_INSTALL_PLUGINS_RETURN,
170
- "InstallPluginsReturn", mGst);
171
- rb_define_method(rb_cGstInstallPluginsReturn, "name", return_get_name,
172
- 0);
173
-
174
- rb_define_singleton_method(mGstInstallPlugins, "supported?", supported, 0);
175
- rb_define_singleton_method(mGstInstallPlugins, "progress?", progress, 0);
176
- rb_define_singleton_method(mGstInstallPlugins, "async", async, -1);
177
- rb_define_singleton_method(mGstInstallPlugins, "sync", sync, -1);
178
-
179
- context_table.type = GST_TYPE_INSTALL_PLUGINS_CONTEXT;
180
- context_table.instance2robj = context2robj;
181
- context_table.robj2instance = robj2context;
182
- RG_DEF_CONVERSION(&context_table);
183
- rb_cGstInstallPluginsContext = G_DEF_CLASS(GST_TYPE_INSTALL_PLUGINS_CONTEXT,
184
- "InstallPluginsContext", mGst);
185
- rb_define_method(rb_cGstInstallPluginsContext, "initialize",
186
- context_initialize, 0);
187
- rb_define_method(rb_cGstInstallPluginsContext, "set_xid",
188
- context_set_xid, 1);
189
- G_DEF_SETTERS(rb_cGstInstallPluginsContext);
117
+ RG_TARGET_NAMESPACE = rb_define_module_under(mGst, "InstallPlugins");
118
+ cInstallPluginsContext = rb_const_get(mGst, rb_intern("InstallPluginsContext"));
119
+
120
+ RG_DEF_SMETHOD_P(supported, 0);
121
+ RG_DEF_SMETHOD_P(progress, 0);
122
+ RG_DEF_SMETHOD(async, -1);
123
+ RG_DEF_SMETHOD(sync, -1);
190
124
  }
191
125
  #endif /* HAVE_GST_PBUTILS */