gstreamer 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,25 +1,24 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
4
5
  *
5
- * This file is part of Ruby/GStreamer.
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
6
10
  *
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.
11
+ * This library 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 GNU
14
+ * Lesser General Public License for more details.
11
15
  *
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
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
20
  */
21
21
 
22
- #include "rbgst.h"
23
22
  #include "rbgst-private.h"
24
23
  #ifdef HAVE_GST_PBUTILS
25
24
  # include <gst/pbutils/missing-plugins.h>
@@ -621,7 +620,7 @@ type_name(VALUE self)
621
620
 
622
621
 
623
622
  void
624
- Init_gst_message(void)
623
+ Init_gst_message(VALUE mGst)
625
624
  {
626
625
  VALUE rb_cGstMessageType;
627
626
 
@@ -1,38 +1,38 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
4
5
  *
5
- * This file is part of Ruby/GStreamer.
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
6
10
  *
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.
11
+ * This library 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 GNU
14
+ * Lesser General Public License for more details.
11
15
  *
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
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
20
  */
21
21
 
22
- #include "rbgst.h"
23
22
  #include "rbgst-private.h"
24
23
 
25
24
  /* Class: Gst::MiniObject
26
25
  * Base class for refcounted lightweight objects.
27
26
  */
28
27
 
28
+ #define RG_TARGET_NAMESPACE rb_cGstMiniObject
29
29
  #define SELF(object) (RVAL2GST_MINI_OBJ(object))
30
30
  #define RVAL2GST_FLAGS(flags) \
31
31
  (RVAL2GFLAGS(flags, GST_TYPE_MINI_OBJECT_FLAGS))
32
32
  #define GST_FLAGS2RVAL(flags) \
33
33
  (GFLAGS2RVAL(flags, GST_TYPE_MINI_OBJECT_FLAGS))
34
34
 
35
- VALUE rb_cGstMiniObject;
35
+ VALUE RG_TARGET_NAMESPACE;
36
36
 
37
37
  static RGConvertTable table = {0};
38
38
 
@@ -94,7 +94,7 @@ rbgst_mini_object_robj2instance(VALUE object)
94
94
  {
95
95
  gpointer instance;
96
96
 
97
- if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGstMiniObject))) {
97
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(object, RG_TARGET_NAMESPACE))) {
98
98
  rb_raise(rb_eTypeError, "not a Gst::MiniObject");
99
99
  }
100
100
  Data_Get_Struct(object, GstMiniObject, instance);
@@ -133,47 +133,47 @@ s_allocate(VALUE klass)
133
133
  }
134
134
 
135
135
  static VALUE
136
- get_flags(VALUE self)
136
+ rg_flags(VALUE self)
137
137
  {
138
138
  return GST_FLAGS2RVAL(GST_MINI_OBJECT_FLAGS(SELF(self)));
139
139
  }
140
140
 
141
141
  static VALUE
142
- set_flags(VALUE self, VALUE flag)
142
+ rg_set_flags(VALUE self, VALUE flag)
143
143
  {
144
144
  GST_MINI_OBJECT_FLAGS(SELF(self)) = RVAL2GST_FLAGS(flag);
145
145
  return Qnil;
146
146
  }
147
147
 
148
148
  static VALUE
149
- raise_flag(VALUE self, VALUE flag)
149
+ rg_raise_flag(VALUE self, VALUE flag)
150
150
  {
151
151
  GST_MINI_OBJECT_FLAG_SET(SELF(self), RVAL2GST_FLAGS(flag));
152
152
  return Qnil;
153
153
  }
154
154
 
155
155
  static VALUE
156
- lower_flag(VALUE self, VALUE flag)
156
+ rg_lower_flag(VALUE self, VALUE flag)
157
157
  {
158
158
  GST_MINI_OBJECT_FLAG_UNSET(SELF(self), RVAL2GST_FLAGS(flag));
159
159
  return Qnil;
160
160
  }
161
161
 
162
162
  static VALUE
163
- flag_raised_p(VALUE self, VALUE flag)
163
+ rg_flag_raised_p(VALUE self, VALUE flag)
164
164
  {
165
165
  return CBOOL2RVAL(GST_MINI_OBJECT_FLAG_IS_SET(SELF(self),
166
166
  RVAL2GST_FLAGS(flag)));
167
167
  }
168
168
 
169
169
  static VALUE
170
- writable_p(VALUE self)
170
+ rg_writable_p(VALUE self)
171
171
  {
172
172
  return CBOOL2RVAL(gst_mini_object_is_writable(SELF(self)));
173
173
  }
174
174
 
175
175
  static VALUE
176
- writable_bang(VALUE self)
176
+ rg_writable_bang(VALUE self)
177
177
  {
178
178
  GstMiniObject *original, *writable;
179
179
 
@@ -186,7 +186,7 @@ writable_bang(VALUE self)
186
186
  }
187
187
 
188
188
  void
189
- Init_gst_mini_object(void)
189
+ Init_gst_mini_object(VALUE mGst)
190
190
  {
191
191
  table.type = GST_TYPE_MINI_OBJECT;
192
192
  table.get_superclass = rbgst_mini_object_get_superclass;
@@ -200,21 +200,21 @@ Init_gst_mini_object(void)
200
200
 
201
201
  RG_DEF_CONVERSION(&table);
202
202
 
203
- rb_cGstMiniObject = G_DEF_CLASS(GST_TYPE_MINI_OBJECT, "MiniObject", mGst);
203
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_MINI_OBJECT, "MiniObject", mGst);
204
204
 
205
- G_DEF_CLASS(GST_TYPE_MINI_OBJECT_FLAGS, "Flags", rb_cGstMiniObject);
206
- G_DEF_CONSTANTS(rb_cGstMiniObject, GST_TYPE_MINI_OBJECT_FLAGS,
205
+ G_DEF_CLASS(GST_TYPE_MINI_OBJECT_FLAGS, "Flags", RG_TARGET_NAMESPACE);
206
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_MINI_OBJECT_FLAGS,
207
207
  "GST_MINI_OBJECT_");
208
208
 
209
- rb_define_alloc_func(rb_cGstMiniObject, s_allocate);
209
+ rb_define_alloc_func(RG_TARGET_NAMESPACE, s_allocate);
210
210
 
211
- rb_define_method(rb_cGstMiniObject, "flags", get_flags, 0);
212
- rb_define_method(rb_cGstMiniObject, "set_flags", set_flags, 1);
213
- rb_define_method(rb_cGstMiniObject, "raise_flag", raise_flag, 1);
214
- rb_define_method(rb_cGstMiniObject, "lower_flag", lower_flag, 1);
215
- rb_define_method(rb_cGstMiniObject, "flag_raised?", flag_raised_p, 1);
216
- rb_define_method(rb_cGstMiniObject, "writable?", writable_p, 0);
217
- rb_define_method(rb_cGstMiniObject, "writable!", writable_bang, 0);
211
+ RG_DEF_METHOD(flags, 0);
212
+ RG_DEF_METHOD(set_flags, 1);
213
+ RG_DEF_METHOD(raise_flag, 1);
214
+ RG_DEF_METHOD(lower_flag, 1);
215
+ RG_DEF_METHOD_P(flag_raised, 1);
216
+ RG_DEF_METHOD_P(writable, 0);
217
+ RG_DEF_METHOD_BANG(writable, 0);
218
218
 
219
- G_DEF_SETTERS(rb_cGstMiniObject);
219
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
220
220
  }
@@ -1,30 +1,31 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
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) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
6
  *
6
- * 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.
7
11
  *
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.
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.
12
16
  *
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
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
21
21
  */
22
22
 
23
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
24
24
 
25
+ #define RG_TARGET_NAMESPACE cObject
25
26
  #define SELF(self) (RVAL2GST_OBJ(self))
26
27
 
27
- static RGConvertTable table = {0};
28
+ static RGConvertTable table;
28
29
 
29
30
  /* Class: Gst::Object
30
31
  * Basis for the GST object hierarchy.
@@ -41,7 +42,7 @@ rbgst_object_instance2robj(gpointer instance)
41
42
  return rbgobj_get_ruby_object_from_gobject(instance, TRUE);
42
43
  }
43
44
 
44
- void
45
+ static void
45
46
  rbgst_object_initialize(VALUE obj, gpointer cobj)
46
47
  {
47
48
  if (GST_OBJECT_IS_FLOATING(cobj)) {
@@ -53,28 +54,30 @@ rbgst_object_initialize(VALUE obj, gpointer cobj)
53
54
  }
54
55
 
55
56
  static VALUE
56
- object_set_name(VALUE self, VALUE name)
57
+ rg_set_name(VALUE self, VALUE name)
57
58
  {
58
59
  return CBOOL2RVAL(gst_object_set_name(SELF(self), RVAL2CSTR(name)));
59
60
  }
60
61
 
61
62
  void
62
- Init_gst_object(void)
63
+ Init_gst_object(VALUE mGst)
63
64
  {
64
- VALUE cGstObject;
65
+ VALUE RG_TARGET_NAMESPACE;
65
66
 
67
+ memset(&table, 0, sizeof(table));
66
68
  table.type = GST_TYPE_OBJECT;
69
+ table.klass = Qnil;
67
70
  table.instance2robj = rbgst_object_instance2robj;
68
71
  table.initialize = rbgst_object_initialize;
69
72
 
70
73
  RG_DEF_CONVERSION(&table);
71
74
 
72
- cGstObject = G_DEF_CLASS(GST_TYPE_OBJECT, "Object", mGst);
75
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_OBJECT, "Object", mGst);
73
76
 
74
- rb_define_method(cGstObject, "set_name", object_set_name, 1);
77
+ G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "name", rg_set_name, 1);
75
78
 
76
- G_DEF_SETTERS(cGstObject);
79
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
77
80
 
78
- G_DEF_CLASS(GST_TYPE_OBJECT_FLAGS, "Flags", cGstObject);
79
- G_DEF_CONSTANTS(cGstObject, GST_TYPE_OBJECT_FLAGS, "GST_");
81
+ G_DEF_CLASS(GST_TYPE_OBJECT_FLAGS, "Flags", RG_TARGET_NAMESPACE);
82
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_OBJECT_FLAGS, "GST_");
80
83
  }
@@ -1,27 +1,28 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
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) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
6
  *
6
- * 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.
7
11
  *
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.
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.
12
16
  *
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
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
21
21
  */
22
22
 
23
- #include "rbgst.h"
23
+ #include "rbgst-private.h"
24
24
 
25
+ #define RG_TARGET_NAMESPACE cPadTemplate
25
26
  #define SELF(self) RVAL2GST_PAD_TEMPLATE(self)
26
27
 
27
28
  /* Class: Gst::PadTemplate
@@ -37,7 +38,7 @@
37
38
  * Returns: the name of the pad template.
38
39
  */
39
40
  static VALUE
40
- get_name(VALUE self)
41
+ rg_name(VALUE self)
41
42
  {
42
43
  /*
43
44
  * We can't call Gst::Object#name since the real name
@@ -51,7 +52,7 @@ get_name(VALUE self)
51
52
  * Returns: the pad's presence (see Gst::Pad::Presence).
52
53
  */
53
54
  static VALUE
54
- get_presence(VALUE self)
55
+ rg_presence(VALUE self)
55
56
  {
56
57
  return GENUM2RVAL(GST_PAD_TEMPLATE_PRESENCE(SELF(self)),
57
58
  GST_TYPE_PAD_PRESENCE);
@@ -61,7 +62,7 @@ get_presence(VALUE self)
61
62
  * Returns: the pad's direction (see Gst::Pad::Direction).
62
63
  */
63
64
  static VALUE
64
- get_direction(VALUE self)
65
+ rg_direction(VALUE self)
65
66
  {
66
67
  return GENUM2RVAL(GST_PAD_TEMPLATE_DIRECTION(SELF(self)),
67
68
  GST_TYPE_PAD_DIRECTION);
@@ -75,7 +76,7 @@ get_direction(VALUE self)
75
76
  * Returns: a Gst::Caps object.
76
77
  */
77
78
  static VALUE
78
- get_caps(VALUE self)
79
+ rg_caps(VALUE self)
79
80
  {
80
81
  return GST_CAPS2RVAL(gst_pad_template_get_caps(RGST_PAD_TEMPLATE(self)));
81
82
  }
@@ -89,36 +90,36 @@ get_caps(VALUE self)
89
90
  * Returns: always nil.
90
91
  */
91
92
  static VALUE
92
- each_caps(VALUE self)
93
+ rg_each_caps(VALUE self)
93
94
  {
94
- return rb_ary_yield(get_caps(self));
95
+ return rb_ary_yield(rg_caps(self));
95
96
  }
96
97
 
97
98
  /* Method: has_caps?
98
99
  * Returns: true if the pad template has capabilities, false otherwise.
99
100
  */
100
101
  static VALUE
101
- has_caps_p(VALUE self)
102
+ rg_has_caps_p(VALUE self)
102
103
  {
103
104
  return CBOOL2RVAL(SELF(self)->caps != NULL);
104
105
  }
105
106
 
106
107
  void
107
- Init_gst_pad_template (void)
108
+ Init_gst_pad_template (VALUE mGst)
108
109
  {
109
- VALUE cGstPadTemplate;
110
+ VALUE RG_TARGET_NAMESPACE;
110
111
 
111
- cGstPadTemplate = G_DEF_CLASS(GST_TYPE_PAD_TEMPLATE, "PadTemplate", mGst);
112
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_PAD_TEMPLATE, "PadTemplate", mGst);
112
113
 
113
- rb_define_method(cGstPadTemplate, "name", get_name, 0);
114
- rb_define_method(cGstPadTemplate, "presence", get_presence, 0);
115
- rb_define_method(cGstPadTemplate, "direction", get_direction, 0);
116
- rb_define_method(cGstPadTemplate, "caps", get_caps, 0);
117
- rb_define_method(cGstPadTemplate, "each_caps", each_caps, 0);
118
- rb_define_method(cGstPadTemplate, "has_caps?", has_caps_p, 0);
119
- rb_define_alias(cGstPadTemplate, "have_caps?", "has_caps?");
114
+ RG_DEF_METHOD(name, 0);
115
+ RG_DEF_METHOD(presence, 0);
116
+ RG_DEF_METHOD(direction, 0);
117
+ RG_DEF_METHOD(caps, 0);
118
+ RG_DEF_METHOD(each_caps, 0);
119
+ RG_DEF_METHOD_P(has_caps, 0);
120
+ RG_DEF_ALIAS("have_caps?", "has_caps?");
120
121
 
121
- G_DEF_CLASS(GST_TYPE_PAD_TEMPLATE_FLAGS, "Flags", cGstPadTemplate);
122
- G_DEF_CONSTANTS(cGstPadTemplate, GST_TYPE_PAD_TEMPLATE_FLAGS,
122
+ G_DEF_CLASS(GST_TYPE_PAD_TEMPLATE_FLAGS, "Flags", RG_TARGET_NAMESPACE);
123
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_TEMPLATE_FLAGS,
123
124
  "GST_PAD_TEMPLATE_");
124
125
  }
@@ -1,30 +1,32 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- * Copyright (C) 2006, 2008 Sjoerd Simons <sjoerd@luon.net>
4
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2006, 2008 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
+ #include "rbgst-private.h"
24
25
 
26
+ #define RG_TARGET_NAMESPACE cPad
25
27
  #define SELF(self) RVAL2GST_PAD(self)
26
28
 
27
- static VALUE cGstPad;
29
+ static VALUE RG_TARGET_NAMESPACE;
28
30
 
29
31
  /* Class: Gst::Pad
30
32
  * The link between Gst::Element objects.
@@ -35,10 +37,10 @@ static VALUE cGstPad;
35
37
  */
36
38
 
37
39
  static VALUE
38
- rb_gst_pad_get_name (VALUE self)
40
+ rg_name (VALUE self)
39
41
  {
40
- GstPad *pad = RGST_PAD (self);
41
- return CSTR2RVAL (gst_pad_get_name (pad));
42
+ GstPad *pad = RGST_PAD (self);
43
+ return CSTR2RVAL (gst_pad_get_name (pad));
42
44
  }
43
45
 
44
46
  /* Method: direction
@@ -46,24 +48,24 @@ rb_gst_pad_get_name (VALUE self)
46
48
  */
47
49
 
48
50
  static VALUE
49
- rb_gst_pad_get_direction (VALUE self)
51
+ rg_direction (VALUE self)
50
52
  {
51
- GstPad *pad = RGST_PAD (self);
52
- return GENUM2RVAL (GST_PAD_DIRECTION(pad), GST_TYPE_PAD_DIRECTION);
53
+ GstPad *pad = RGST_PAD (self);
54
+ return GENUM2RVAL (GST_PAD_DIRECTION(pad), GST_TYPE_PAD_DIRECTION);
53
55
  }
54
56
 
55
57
  /* Method: pad_template
56
58
  * Returns: the Gst::PadTemplate object of this pad.
57
59
  */
58
60
  static VALUE
59
- rb_gst_pad_get_pad_template(VALUE self)
61
+ rg_pad_template(VALUE self)
60
62
  {
61
- GstPadTemplate *templ = gst_pad_get_pad_template (RGST_PAD (self));
62
- if (templ != NULL) {
63
- gst_object_ref (GST_OBJECT (templ));
64
- return RGST_PAD_TEMPLATE_NEW (templ);
65
- }
66
- return Qnil;
63
+ GstPadTemplate *templ = gst_pad_get_pad_template (RGST_PAD (self));
64
+ if (templ != NULL) {
65
+ gst_object_ref (GST_OBJECT (templ));
66
+ return RGST_PAD_TEMPLATE_NEW (templ);
67
+ }
68
+ return Qnil;
67
69
  }
68
70
 
69
71
  /*
@@ -75,10 +77,10 @@ rb_gst_pad_get_pad_template(VALUE self)
75
77
  * Returns: true if supported, false otherwise.
76
78
  */
77
79
  static VALUE
78
- rb_gst_pad_provides_query_types (VALUE self)
80
+ rg_provides_query_types_p (VALUE self)
79
81
  {
80
- GstPad *pad = RGST_PAD (self);
81
- return CBOOL2RVAL (GST_PAD_QUERYTYPEFUNC (pad) != gst_pad_get_query_types_default);
82
+ GstPad *pad = RGST_PAD (self);
83
+ return CBOOL2RVAL (GST_PAD_QUERYTYPEFUNC (pad) != gst_pad_get_query_types_default);
82
84
  }
83
85
 
84
86
  /*
@@ -89,19 +91,19 @@ rb_gst_pad_provides_query_types (VALUE self)
89
91
  * Returns: an array of Gst::QueryType objects.
90
92
  */
91
93
  static VALUE
92
- rb_gst_pad_get_query_types (VALUE self)
94
+ rg_query_types (VALUE self)
93
95
  {
94
- const GstQueryType *types;
95
- VALUE arr;
96
-
97
- arr = rb_ary_new ();
98
- types = gst_pad_get_query_types (RGST_PAD (self));
99
-
100
- while (types && *types) {
101
- rb_ary_push (arr, RGST_QUERY_TYPE_NEW ((GstQueryType *)types));
102
- types++;
103
- }
104
- return arr;
96
+ const GstQueryType *types;
97
+ VALUE arr;
98
+
99
+ arr = rb_ary_new ();
100
+ types = gst_pad_get_query_types (RGST_PAD (self));
101
+
102
+ while (types && *types) {
103
+ rb_ary_push (arr, RGST_QUERY_TYPE_NEW ((GstQueryType *)types));
104
+ types++;
105
+ }
106
+ return arr;
105
107
  }
106
108
 
107
109
  /*
@@ -113,13 +115,13 @@ rb_gst_pad_get_query_types (VALUE self)
113
115
  * Returns: always nil.
114
116
  */
115
117
  static VALUE
116
- rb_gst_pad_each_query_type (VALUE self)
118
+ rg_each_query_type (VALUE self)
117
119
  {
118
- return rb_ary_yield (rb_gst_pad_get_query_types (self));
120
+ return rb_ary_yield (rg_query_types (self));
119
121
  }
120
122
 
121
123
  static VALUE
122
- rb_gst_pad_is_linked(VALUE self)
124
+ rg_linked_p(VALUE self)
123
125
  {
124
126
  return CBOOL2RVAL(gst_pad_is_linked(SELF(self)));
125
127
  }
@@ -131,7 +133,7 @@ rb_gst_pad_link_raw(VALUE self, VALUE other_pad)
131
133
  GstPad *sink_pad;
132
134
 
133
135
  src_pad = SELF(self);
134
- if (!RVAL2CBOOL(rb_obj_is_kind_of(other_pad, cGstPad))) {
136
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(other_pad, RG_TARGET_NAMESPACE))) {
135
137
  rb_raise(rb_eTypeError, "Not a Gst::Pad");
136
138
  }
137
139
 
@@ -148,7 +150,7 @@ rb_gst_pad_link_raw(VALUE self, VALUE other_pad)
148
150
  * Returns: a Gst::Pad::LinkReturn
149
151
  */
150
152
  static VALUE
151
- rb_gst_pad_link(VALUE self, VALUE other_pad)
153
+ rg_link(VALUE self, VALUE other_pad)
152
154
  {
153
155
  return GENUM2RVAL(rb_gst_pad_link_raw(self, other_pad),
154
156
  GST_TYPE_PAD_LINK_RETURN);
@@ -171,7 +173,7 @@ rb_gst_pad_link(VALUE self, VALUE other_pad)
171
173
  * Return values aren't used in this case.)
172
174
  */
173
175
  static VALUE
174
- rb_gst_pad_link_shift(VALUE self, VALUE other_pad)
176
+ rg_operator_link_shift(VALUE self, VALUE other_pad)
175
177
  {
176
178
  if (rb_gst_pad_link_raw(self, other_pad) == GST_PAD_LINK_OK)
177
179
  return other_pad;
@@ -188,13 +190,13 @@ rb_gst_pad_link_shift(VALUE self, VALUE other_pad)
188
190
  * Returns: true if the pads were unlinked and false if the pads weren't linked.
189
191
  */
190
192
  static VALUE
191
- rb_gst_pad_unlink(VALUE self, VALUE other_pad)
193
+ rg_unlink(VALUE self, VALUE other_pad)
192
194
  {
193
195
  GstPad *src_pad;
194
196
  GstPad *sink_pad;
195
197
 
196
198
  src_pad = SELF(self);
197
- if (!CBOOL2RVAL(rb_obj_is_kind_of(other_pad, cGstPad))) {
199
+ if (!CBOOL2RVAL(rb_obj_is_kind_of(other_pad, RG_TARGET_NAMESPACE))) {
198
200
  rb_raise(rb_eTypeError, "Not a Gst::Pad");
199
201
  }
200
202
  sink_pad = RVAL2GST_PAD(other_pad);
@@ -214,7 +216,7 @@ rb_gst_pad_unlink(VALUE self, VALUE other_pad)
214
216
  * Method: query
215
217
  */
216
218
  static VALUE
217
- rb_gst_pad_query(VALUE self, VALUE query)
219
+ rg_query(VALUE self, VALUE query)
218
220
  {
219
221
  return CBOOL2RVAL(gst_pad_query(SELF(self), RVAL2GST_QUERY(query)));
220
222
  }
@@ -229,10 +231,10 @@ rb_gst_pad_query(VALUE self, VALUE query)
229
231
  * otherwise.
230
232
  */
231
233
  static VALUE
232
- rb_gst_pad_send_event (VALUE self, VALUE event)
234
+ rg_send_event (VALUE self, VALUE event)
233
235
  {
234
- return CBOOL2RVAL (gst_pad_send_event (RGST_PAD (self),
235
- RGST_EVENT (event)));
236
+ return CBOOL2RVAL (gst_pad_send_event (RGST_PAD (self),
237
+ RGST_EVENT (event)));
236
238
  }
237
239
 
238
240
  /*
@@ -243,7 +245,7 @@ rb_gst_pad_send_event (VALUE self, VALUE event)
243
245
  * Returns: a Gst::Caps object.
244
246
  */
245
247
  static VALUE
246
- rb_gst_pad_get_caps(VALUE self)
248
+ rg_caps(VALUE self)
247
249
  {
248
250
  return GST_CAPS2RVAL_UNREF(gst_pad_get_caps(SELF(self)));
249
251
  }
@@ -256,7 +258,7 @@ rb_gst_pad_get_caps(VALUE self)
256
258
  * Returns: a Gst::Caps object.
257
259
  */
258
260
  static VALUE
259
- rb_gst_pad_get_negotiated_caps(VALUE self)
261
+ rg_negotiated_caps(VALUE self)
260
262
  {
261
263
  return GST_CAPS2RVAL_UNREF(gst_pad_get_negotiated_caps(SELF(self)));
262
264
  }
@@ -269,7 +271,7 @@ rb_gst_pad_get_negotiated_caps(VALUE self)
269
271
  * Returns: true if the setting succeeded
270
272
  */
271
273
  static VALUE
272
- rb_gst_pad_set_caps(VALUE self, VALUE caps)
274
+ rg_set_caps(VALUE self, VALUE caps)
273
275
  {
274
276
  return CBOOL2RVAL(gst_pad_set_caps(SELF(self), RVAL2GST_CAPS(caps)));
275
277
  }
@@ -282,7 +284,7 @@ rb_gst_pad_set_caps(VALUE self, VALUE caps)
282
284
  * Returns: true if the setting succeeded
283
285
  */
284
286
  static VALUE
285
- rb_gst_pad_set_active(VALUE self, VALUE active)
287
+ rg_set_active(VALUE self, VALUE active)
286
288
  {
287
289
  return CBOOL2RVAL(gst_pad_set_active(SELF(self), RVAL2CBOOL(active)));
288
290
  }
@@ -295,44 +297,42 @@ rb_gst_pad_set_active(VALUE self, VALUE active)
295
297
  * Returns: Returns the peer pad or Qnil if there is none
296
298
  */
297
299
  static VALUE
298
- rb_gst_pad_get_peer(VALUE self)
300
+ rg_peer(VALUE self)
299
301
  {
300
302
  return GST_PAD2RVAL_UNREF(gst_pad_get_peer(SELF(self)));
301
303
  }
302
304
 
303
-
304
305
  void
305
- Init_gst_pad (void)
306
+ Init_gst_pad (VALUE mGst)
306
307
  {
307
- cGstPad = G_DEF_CLASS (GST_TYPE_PAD, "Pad", mGst);
308
-
309
- rb_define_method(cGstPad, "direction", rb_gst_pad_get_direction, 0);
310
- rb_define_method(cGstPad, "name", rb_gst_pad_get_name, 0);
311
- rb_define_method(cGstPad, "pad_template", rb_gst_pad_get_pad_template, 0);
312
- rb_define_method(cGstPad, "provides_query_types?", rb_gst_pad_provides_query_types, 0);
313
- rb_define_method(cGstPad, "query_types", rb_gst_pad_get_query_types, 0);
314
- rb_define_method(cGstPad, "each_query_type", rb_gst_pad_each_query_type, 0);
315
- rb_define_method(cGstPad, "linked?", rb_gst_pad_is_linked, 0);
316
- rb_define_method(cGstPad, "link", rb_gst_pad_link, 1);
317
- rb_define_method(cGstPad, ">>", rb_gst_pad_link_shift, 1);
318
- rb_define_method(cGstPad, "unlink", rb_gst_pad_unlink, 1);
319
- rb_define_method(cGstPad, "query", rb_gst_pad_query, 1);
320
- rb_define_method(cGstPad, "send_event", rb_gst_pad_send_event, 1);
321
- rb_define_method(cGstPad, "caps", rb_gst_pad_get_caps, 0);
322
- rb_define_method(cGstPad, "negotiated_caps", rb_gst_pad_get_negotiated_caps, 0);
323
- rb_define_method(cGstPad, "set_caps", rb_gst_pad_set_caps, 1);
324
- rb_define_method(cGstPad, "set_active", rb_gst_pad_set_active, 1);
325
- rb_define_method(cGstPad, "peer", rb_gst_pad_get_peer, 0);
326
-
327
- G_DEF_SETTERS(cGstPad);
328
-
329
-
330
- G_DEF_CLASS(GST_TYPE_PAD_LINK_RETURN, "LinkReturn", cGstPad);
331
- G_DEF_CONSTANTS(cGstPad, GST_TYPE_PAD_LINK_RETURN, "GST_PAD_");
332
- G_DEF_CLASS(GST_TYPE_PAD_DIRECTION, "Direction", cGstPad);
333
- G_DEF_CONSTANTS(cGstPad, GST_TYPE_PAD_DIRECTION, "GST_PAD_");
334
- G_DEF_CLASS(GST_TYPE_PAD_FLAGS, "Flags", cGstPad);
335
- G_DEF_CONSTANTS(cGstPad, GST_TYPE_PAD_FLAGS, "GST_PAD_");
336
- G_DEF_CLASS(GST_TYPE_PAD_PRESENCE, "Presence", cGstPad);
337
- G_DEF_CONSTANTS(cGstPad, GST_TYPE_PAD_PRESENCE, "GST_PAD_");
308
+ RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_PAD, "Pad", mGst);
309
+
310
+ RG_DEF_METHOD(direction, 0);
311
+ RG_DEF_METHOD(name, 0);
312
+ RG_DEF_METHOD(pad_template, 0);
313
+ RG_DEF_METHOD_P(provides_query_types, 0);
314
+ RG_DEF_METHOD(query_types, 0);
315
+ RG_DEF_METHOD(each_query_type, 0);
316
+ RG_DEF_METHOD_P(linked, 0);
317
+ RG_DEF_METHOD(link, 1);
318
+ RG_DEF_METHOD_OPERATOR(">>", link_shift, 1);
319
+ RG_DEF_METHOD(unlink, 1);
320
+ RG_DEF_METHOD(query, 1);
321
+ RG_DEF_METHOD(send_event, 1);
322
+ RG_DEF_METHOD(caps, 0);
323
+ RG_DEF_METHOD(negotiated_caps, 0);
324
+ RG_DEF_METHOD(set_caps, 1);
325
+ RG_DEF_METHOD(set_active, 1);
326
+ RG_DEF_METHOD(peer, 0);
327
+
328
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
329
+
330
+ G_DEF_CLASS(GST_TYPE_PAD_LINK_RETURN, "LinkReturn", RG_TARGET_NAMESPACE);
331
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_LINK_RETURN, "GST_PAD_");
332
+ G_DEF_CLASS(GST_TYPE_PAD_DIRECTION, "Direction", RG_TARGET_NAMESPACE);
333
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_DIRECTION, "GST_PAD_");
334
+ G_DEF_CLASS(GST_TYPE_PAD_FLAGS, "Flags", RG_TARGET_NAMESPACE);
335
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_FLAGS, "GST_PAD_");
336
+ G_DEF_CLASS(GST_TYPE_PAD_PRESENCE, "Presence", RG_TARGET_NAMESPACE);
337
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_PAD_PRESENCE, "GST_PAD_");
338
338
  }