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) 2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 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
  char *
@@ -1,28 +1,32 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project
2
5
  *
3
- * Copyright (C) 2008 Ruby-GNOME2 Project
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.
4
10
  *
5
- * This file is part of Ruby/GStreamer.
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.
6
15
  *
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
- *
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
22
  #ifndef __RBGST_PRIVATE_H_
23
23
  #define __RBGST_PRIVATE_H_
24
24
 
25
- #include <ruby.h>
25
+ #include "rbgst.h"
26
+
27
+ #ifndef G_VALUE_INIT
28
+ # define G_VALUE_INIT { 0, { { 0 } } }
29
+ #endif
26
30
 
27
31
  char *_rbgst_inspect(VALUE object);
28
32
  void _rbgst_define_class_if_need(VALUE klass, GType type, const gchar *prefix);
@@ -34,4 +38,60 @@ void _rbgst_mini_object_free(void *ptr);
34
38
  VALUE rbgst_object_instance2robj(gpointer instance);
35
39
 
36
40
 
41
+ G_GNUC_INTERNAL void Init_gst_bin (VALUE mGst);
42
+ G_GNUC_INTERNAL void Init_gst_buffer(VALUE mGst);
43
+ G_GNUC_INTERNAL void Init_gst_bus(VALUE mGst);
44
+ G_GNUC_INTERNAL void Init_gst_caps (VALUE mGst);
45
+ G_GNUC_INTERNAL void Init_gst_child_proxy(VALUE mGst);
46
+ G_GNUC_INTERNAL void Init_gst_clock (VALUE mGst);
47
+ G_GNUC_INTERNAL void Init_gst_clock_entry (VALUE mGst);
48
+ G_GNUC_INTERNAL void Init_gst_element (VALUE mGst);
49
+ G_GNUC_INTERNAL void Init_gst_elementfactory (VALUE mGst);
50
+ G_GNUC_INTERNAL void Init_gst_event(VALUE mGst);
51
+ G_GNUC_INTERNAL void Init_gst_format (VALUE mGst);
52
+ G_GNUC_INTERNAL void Init_gst_seek(VALUE mGst);
53
+ G_GNUC_INTERNAL void Init_gst_structure(VALUE mGst);
54
+ G_GNUC_INTERNAL void Init_gst_index (VALUE mGst);
55
+ G_GNUC_INTERNAL void Init_gst_indexentry (VALUE mGst);
56
+ G_GNUC_INTERNAL void Init_gst_indexfactory (VALUE mGst);
57
+ G_GNUC_INTERNAL void Init_gst_message(VALUE mGst);
58
+ G_GNUC_INTERNAL void Init_gst_mini_object(VALUE mGst);
59
+ G_GNUC_INTERNAL void Init_gst_object (VALUE mGst);
60
+ G_GNUC_INTERNAL void Init_gst_pad (VALUE mGst);
61
+ G_GNUC_INTERNAL void Init_gst_pad_template(VALUE mGst);
62
+ G_GNUC_INTERNAL void Init_gst_ghost_pad(VALUE mGst);
63
+ G_GNUC_INTERNAL void Init_gst_parse (VALUE mGst);
64
+ G_GNUC_INTERNAL void Init_gst_pipeline (VALUE mGst);
65
+ G_GNUC_INTERNAL void Init_gst_plugin (VALUE mGst);
66
+ G_GNUC_INTERNAL void Init_gst_plugin_feature (VALUE mGst);
67
+ G_GNUC_INTERNAL void Init_gst_query(VALUE mGst);
68
+ G_GNUC_INTERNAL void Init_gst_querytype (VALUE mGst);
69
+ G_GNUC_INTERNAL void Init_gst_registry (VALUE mGst);
70
+ G_GNUC_INTERNAL void Init_gst_registry_pool (VALUE mGst);
71
+ G_GNUC_INTERNAL void Init_gst_scheduler (VALUE mGst);
72
+ G_GNUC_INTERNAL void Init_gst_schedulerfactory (VALUE mGst);
73
+ G_GNUC_INTERNAL void Init_gst_static_caps(VALUE mGst);
74
+ G_GNUC_INTERNAL void Init_gst_static_pad_template(VALUE mGst);
75
+ G_GNUC_INTERNAL void Init_gst_systemclock (VALUE mGst);
76
+ G_GNUC_INTERNAL void Init_gst_tag (VALUE mGst);
77
+ G_GNUC_INTERNAL void Init_gst_tag_setter (VALUE mGst);
78
+ G_GNUC_INTERNAL void Init_gst_thread (VALUE mGst);
79
+ G_GNUC_INTERNAL void Init_gst_typefindfactory (VALUE mGst);
80
+ G_GNUC_INTERNAL void Init_gst_value(VALUE mGst);
81
+ G_GNUC_INTERNAL void Init_gst_xml (VALUE mGst);
82
+
83
+ #if defined(HAVE_GST_OVERLAY)
84
+ G_GNUC_INTERNAL void Init_gst_x_overlay (VALUE mGst);
85
+ #endif
86
+
87
+ #if defined(HAVE_MEDIA_INFO)
88
+ G_GNUC_INTERNAL void Init_gst_mediatype (VALUE mGst);
89
+ #endif
90
+
91
+ #ifdef HAVE_GST_PBUTILS
92
+ G_GNUC_INTERNAL void Init_gst_install_plugins_context (VALUE mGst);
93
+ G_GNUC_INTERNAL void Init_gst_install_plugins (VALUE mGst);
94
+ G_GNUC_INTERNAL void Init_gst_install_plugins_return (VALUE mGst);
95
+ #endif
96
+
37
97
  #endif /* __RBGST_PRIVATE_H_ */
@@ -1,34 +1,34 @@
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) 2006 Zaheer Abbas Merali <zaheerabbas at merali dot org>
5
- * Copyright (C) 2007 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2007 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
6
+ * Copyright (C) 2006 Zaheer Abbas Merali <zaheerabbas at merali dot org>
7
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
6
8
  *
7
- * This file is part of Ruby/GStreamer.
9
+ * This library is free software; you can redistribute it and/or
10
+ * modify it under the terms of the GNU Lesser General Public
11
+ * License as published by the Free Software Foundation; either
12
+ * version 2.1 of the License, or (at your option) any later version.
8
13
  *
9
- * Ruby/GStreamer is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU Lesser General Public
11
- * License as published by the Free Software Foundation; either
12
- * version 2.1 of the License, or (at your option) any later version.
14
+ * This library is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ * Lesser General Public License for more details.
13
18
  *
14
- * Ruby/GStreamer is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- * Lesser General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU Lesser General Public
20
- * License along with Ruby/GStreamer; if not, write to the Free Software
21
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ * You should have received a copy of the GNU Lesser General Public
20
+ * License along with this library; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
+ * MA 02110-1301 USA
22
23
  */
23
24
 
24
- #include "rbgst.h"
25
25
  #include "rbgst-private.h"
26
26
 
27
27
  /* Document-class: Gst::Query
28
28
  * Queries.
29
29
  */
30
30
 
31
- static RGConvertTable table = {0};
31
+ static RGConvertTable table;
32
32
 
33
33
  static VALUE rb_cGstQueryPosition;
34
34
  static VALUE rb_cGstQueryDuration;
@@ -261,9 +261,11 @@ formats_parse(VALUE self)
261
261
  }
262
262
 
263
263
  void
264
- Init_gst_query (void)
264
+ Init_gst_query (VALUE mGst)
265
265
  {
266
+ memset(&table, 0, sizeof(table));
266
267
  table.type = GST_TYPE_QUERY;
268
+ table.klass = Qnil;
267
269
  table.get_superclass = get_superclass;
268
270
  table.instance2robj = instance2robj;
269
271
  RG_DEF_CONVERSION(&table);
@@ -1,36 +1,39 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
5
  *
4
- * 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.
5
10
  *
6
- * Ruby/GStreamer 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.
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.
10
15
  *
11
- * Ruby/GStreamer 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.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with Ruby/GStreamer; if not, write to the Free Software
18
- * 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
19
20
  */
20
21
 
21
- #include "rbgst.h"
22
+ #include "rbgst-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE mSeek
22
25
 
23
26
  /* Class: Gst::Seek
24
27
  */
25
28
 
26
29
  void
27
- Init_gst_seek (void)
30
+ Init_gst_seek (VALUE mGst)
28
31
  {
29
- VALUE c = rb_define_module_under(mGst, "Seek");
32
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGst, "Seek");
30
33
 
31
34
  G_DEF_CLASS(GST_TYPE_SEEK_TYPE, "SeekType", mGst);
32
- G_DEF_CONSTANTS(c, GST_TYPE_SEEK_TYPE, "GST_SEEK_");
35
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_SEEK_TYPE, "GST_SEEK_");
33
36
 
34
37
  G_DEF_CLASS(GST_TYPE_SEEK_FLAGS, "SeekFlags", mGst);
35
- G_DEF_CONSTANTS(c, GST_TYPE_SEEK_FLAGS, "GST_SEEK_");
38
+ G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GST_TYPE_SEEK_FLAGS, "GST_SEEK_");
36
39
  }
@@ -1,49 +1,51 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
5
  *
4
- * 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.
5
10
  *
6
- * Ruby/GStreamer 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.
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.
10
15
  *
11
- * Ruby/GStreamer 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.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with Ruby/GStreamer; if not, write to the Free Software
18
- * 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
19
20
  */
20
21
 
21
- #include "rbgst.h"
22
+ #include "rbgst-private.h"
22
23
 
24
+ #define RG_TARGET_NAMESPACE cStaticCaps
23
25
  #define SELF(obj) (RVAL2GST_STATIC_CAPS(obj))
24
26
 
25
27
  static VALUE
26
- get_description(VALUE self)
28
+ rg_description(VALUE self)
27
29
  {
28
30
  return CSTR2RVAL(SELF(self)->string);
29
31
  }
30
32
 
31
33
  static VALUE
32
- get(VALUE self)
34
+ rg_get(VALUE self)
33
35
  {
34
36
  return GST_CAPS2RVAL(gst_static_caps_get(SELF(self)));
35
37
  }
36
38
 
37
39
  void
38
- Init_gst_static_caps(void)
40
+ Init_gst_static_caps(VALUE mGst)
39
41
  {
40
- VALUE rb_cGstStaticCaps;
42
+ VALUE RG_TARGET_NAMESPACE;
41
43
 
42
- rb_cGstStaticCaps = G_DEF_CLASS(GST_TYPE_STATIC_CAPS, "StaticCaps", mGst);
44
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_STATIC_CAPS, "StaticCaps", mGst);
43
45
 
44
- rb_define_method(rb_cGstStaticCaps, "description", get_description, 0);
45
- rb_define_method(rb_cGstStaticCaps, "get", get, 0);
46
- rb_define_alias(rb_cGstStaticCaps, "to_caps", "get");
46
+ RG_DEF_METHOD(description, 0);
47
+ RG_DEF_METHOD(get, 0);
48
+ RG_DEF_ALIAS("to_caps", "get");
47
49
 
48
- G_DEF_SETTERS(rb_cGstStaticCaps);
50
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
49
51
  }
@@ -1,64 +1,65 @@
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"
22
+ #include "rbgst-private.h"
23
23
 
24
24
  /* Class: Gst::StaticPadTemplate
25
25
  */
26
26
 
27
+ #define RG_TARGET_NAMESPACE cStaticPadTemplate
27
28
  #define SELF(self) RVAL2GST_STATIC_PAD_TEMPLATE(self)
28
29
 
29
30
  static VALUE
30
- get_name(VALUE self)
31
+ rg_name(VALUE self)
31
32
  {
32
33
  return CSTR2RVAL(SELF(self)->name_template);
33
34
  }
34
35
 
35
36
  static VALUE
36
- get_presence(VALUE self)
37
+ rg_presence(VALUE self)
37
38
  {
38
39
  return GENUM2RVAL(SELF(self)->presence, GST_TYPE_PAD_PRESENCE);
39
40
  }
40
41
 
41
42
  static VALUE
42
- get_direction(VALUE self)
43
+ rg_direction(VALUE self)
43
44
  {
44
45
  return GENUM2RVAL(SELF(self)->direction, GST_TYPE_PAD_DIRECTION);
45
46
  }
46
47
 
47
48
  static VALUE
48
- get_caps(VALUE self)
49
+ rg_caps(VALUE self)
49
50
  {
50
51
  return GST_STATIC_CAPS2RVAL(gst_static_pad_template_get_caps(SELF(self)));
51
52
  }
52
53
 
53
54
  void
54
- Init_gst_static_pad_template (void)
55
+ Init_gst_static_pad_template (VALUE mGst)
55
56
  {
56
- VALUE cGstStaticPadTemplate;
57
+ VALUE RG_TARGET_NAMESPACE;
57
58
 
58
- cGstStaticPadTemplate = G_DEF_CLASS(GST_TYPE_STATIC_PAD_TEMPLATE,
59
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_STATIC_PAD_TEMPLATE,
59
60
  "StaticPadTemplate", mGst);
60
- rb_define_method(cGstStaticPadTemplate, "name", get_name, 0);
61
- rb_define_method(cGstStaticPadTemplate, "presence", get_presence, 0);
62
- rb_define_method(cGstStaticPadTemplate, "direction", get_direction, 0);
63
- rb_define_method(cGstStaticPadTemplate, "caps", get_caps, 0);
61
+ RG_DEF_METHOD(name, 0);
62
+ RG_DEF_METHOD(presence, 0);
63
+ RG_DEF_METHOD(direction, 0);
64
+ RG_DEF_METHOD(caps, 0);
64
65
  }
@@ -1,29 +1,31 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
3
5
  *
4
- * 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.
5
10
  *
6
- * Ruby/GStreamer 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.
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.
10
15
  *
11
- * Ruby/GStreamer 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.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with Ruby/GStreamer; if not, write to the Free Software
18
- * 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
19
20
  */
20
21
 
21
- #include "rbgst.h"
22
+ #include "rbgst-private.h"
22
23
 
24
+ #define RG_TARGET_NAMESPACE cStructure
23
25
  #define SELF(obj) (RVAL2GST_STRUCT(obj))
24
26
 
25
27
  static VALUE
26
- s_parse(VALUE self, VALUE string)
28
+ rg_s_parse(VALUE self, VALUE string)
27
29
  {
28
30
  GstStructure *structure;
29
31
  gchar *end;
@@ -34,7 +36,7 @@ s_parse(VALUE self, VALUE string)
34
36
  }
35
37
 
36
38
  static VALUE
37
- initialize(int argc, VALUE *argv, VALUE self)
39
+ rg_initialize(int argc, VALUE *argv, VALUE self)
38
40
  {
39
41
  VALUE name, fields;
40
42
  GstStructure *structure;
@@ -52,34 +54,34 @@ initialize(int argc, VALUE *argv, VALUE self)
52
54
  }
53
55
 
54
56
  static VALUE
55
- get_name(VALUE self)
57
+ rg_name(VALUE self)
56
58
  {
57
59
  return CSTR2RVAL(gst_structure_get_name(SELF(self)));
58
60
  }
59
61
 
60
62
  static VALUE
61
- set_name(VALUE self, VALUE name)
63
+ rg_set_name(VALUE self, VALUE name)
62
64
  {
63
65
  gst_structure_set_name(SELF(self), RVAL2CSTR(name));
64
66
  return Qnil;
65
67
  }
66
68
 
67
69
  static VALUE
68
- has_name_p(VALUE self, VALUE name)
70
+ rg_has_name_p(VALUE self, VALUE name)
69
71
  {
70
72
  return CBOOL2RVAL(gst_structure_has_name(SELF(self), RVAL2CSTR(name)));
71
73
  }
72
74
 
73
75
  static VALUE
74
- get_value(VALUE self, VALUE name)
76
+ rg_operator_get_value(VALUE self, VALUE name)
75
77
  {
76
78
  return GVAL2RVAL(gst_structure_get_value(SELF(self), RVAL2CSTR(name)));
77
79
  }
78
80
 
79
81
  static VALUE
80
- set_value(VALUE self, VALUE name, VALUE rb_value)
82
+ rg_operator_set_value(VALUE self, VALUE name, VALUE rb_value)
81
83
  {
82
- GValue value = {0};
84
+ GValue value = G_VALUE_INIT;
83
85
 
84
86
  rbgobj_initialize_gvalue(&value, rb_value);
85
87
  gst_structure_set_value(SELF(self), RVAL2CSTR(name), &value);
@@ -89,7 +91,7 @@ set_value(VALUE self, VALUE name, VALUE rb_value)
89
91
  }
90
92
 
91
93
  static VALUE
92
- remove_fields(int argc, VALUE *argv, VALUE self)
94
+ rg_remove(int argc, VALUE *argv, VALUE self)
93
95
  {
94
96
  int i;
95
97
  VALUE name, rest;
@@ -108,7 +110,7 @@ remove_fields(int argc, VALUE *argv, VALUE self)
108
110
  }
109
111
 
110
112
  static VALUE
111
- remove_all_fields(VALUE self)
113
+ rg_remove_all(VALUE self)
112
114
  {
113
115
  gst_structure_remove_all_fields(SELF(self));
114
116
  return Qnil;
@@ -168,7 +170,7 @@ foreach_cb(GQuark field_id, const GValue *value, gpointer user_data)
168
170
  }
169
171
 
170
172
  static VALUE
171
- foreach(VALUE self)
173
+ rg_each(VALUE self)
172
174
  {
173
175
  EachCallbackInfo info;
174
176
 
@@ -211,7 +213,7 @@ map_in_place_cb(GQuark field_id, GValue *value, gpointer user_data)
211
213
  }
212
214
 
213
215
  static VALUE
214
- map_in_place(VALUE self)
216
+ rg_map_bang(VALUE self)
215
217
  {
216
218
  EachCallbackInfo info;
217
219
 
@@ -225,76 +227,76 @@ map_in_place(VALUE self)
225
227
  }
226
228
 
227
229
  static VALUE
228
- n_fields(VALUE self)
230
+ rg_size(VALUE self)
229
231
  {
230
232
  return INT2NUM(gst_structure_n_fields(SELF(self)));
231
233
  }
232
234
 
233
235
  static VALUE
234
- empty_p(VALUE self)
236
+ rg_empty_p(VALUE self)
235
237
  {
236
238
  return CBOOL2RVAL(gst_structure_n_fields(SELF(self)) == 0);
237
239
  }
238
240
 
239
241
  static VALUE
240
- nth_field_name(VALUE self, VALUE index)
242
+ rg_nth_field_name(VALUE self, VALUE index)
241
243
  {
242
244
  return CSTR2RVAL(gst_structure_nth_field_name(SELF(self), NUM2INT(index)));
243
245
  }
244
246
 
245
247
  static VALUE
246
- has_field_p(VALUE self, VALUE name)
248
+ rg_has_field_p(VALUE self, VALUE name)
247
249
  {
248
250
  return CBOOL2RVAL(gst_structure_has_field(SELF(self), RVAL2CSTR(name)));
249
251
  }
250
252
 
251
253
  static VALUE
252
- to_s(VALUE self)
254
+ rg_to_s(VALUE self)
253
255
  {
254
256
  return CSTR2RVAL_FREE(gst_structure_to_string(SELF(self)));
255
257
  }
256
258
 
257
259
  void
258
- Init_gst_structure(void)
260
+ Init_gst_structure(VALUE mGst)
259
261
  {
260
- VALUE rb_cGstStructure;
262
+ VALUE RG_TARGET_NAMESPACE;
261
263
 
262
- rb_cGstStructure = G_DEF_CLASS(GST_TYPE_STRUCTURE, "Structure", mGst);
264
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(GST_TYPE_STRUCTURE, "Structure", mGst);
263
265
 
264
- rb_include_module(rb_cGstStructure, rb_mEnumerable);
266
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
265
267
 
266
- rb_define_singleton_method(rb_cGstStructure, "parse", s_parse, 1);
268
+ RG_DEF_SMETHOD(parse, 1);
267
269
 
268
- rb_define_method(rb_cGstStructure, "initialize", initialize, -1);
270
+ RG_DEF_METHOD(initialize, -1);
269
271
 
270
- rb_define_method(rb_cGstStructure, "name", get_name, 0);
271
- rb_define_method(rb_cGstStructure, "set_name", set_name, 1);
272
- rb_define_method(rb_cGstStructure, "has_name?", has_name_p, 1);
273
- rb_define_alias(rb_cGstStructure, "have_name?", "has_name?");
272
+ RG_DEF_METHOD(name, 0);
273
+ RG_DEF_METHOD(set_name, 1);
274
+ RG_DEF_METHOD_P(has_name, 1);
275
+ RG_DEF_ALIAS("have_name?", "has_name?");
274
276
 
275
- rb_define_method(rb_cGstStructure, "[]", get_value, 1);
276
- rb_define_method(rb_cGstStructure, "[]=", set_value, 2);
277
+ RG_DEF_METHOD_OPERATOR("[]", get_value, 1);
278
+ RG_DEF_METHOD_OPERATOR("[]=", set_value, 2);
277
279
 
278
- rb_define_method(rb_cGstStructure, "remove", remove_fields, -1);
279
- rb_define_alias(rb_cGstStructure, "delete", "remove");
280
- rb_define_method(rb_cGstStructure, "remove_all", remove_all_fields, 0);
281
- rb_define_alias(rb_cGstStructure, "clear", "remove_all");
280
+ RG_DEF_METHOD(remove, -1);
281
+ RG_DEF_ALIAS("delete", "remove");
282
+ RG_DEF_METHOD(remove_all, 0);
283
+ RG_DEF_ALIAS("clear", "remove_all");
282
284
 
283
- rb_define_method(rb_cGstStructure, "each", foreach, 0);
285
+ RG_DEF_METHOD(each, 0);
284
286
 
285
- rb_define_method(rb_cGstStructure, "map!", map_in_place, 0);
286
- rb_define_alias(rb_cGstStructure, "collect!", "map!");
287
+ RG_DEF_METHOD_BANG(map, 0);
288
+ RG_DEF_ALIAS("collect!", "map!");
287
289
 
288
- rb_define_method(rb_cGstStructure, "size", n_fields, 0);
289
- rb_define_alias(rb_cGstStructure, "length", "size");
290
- rb_define_method(rb_cGstStructure, "empty?", empty_p, 0);
290
+ RG_DEF_METHOD(size, 0);
291
+ RG_DEF_ALIAS("length", "size");
292
+ RG_DEF_METHOD_P(empty, 0);
291
293
 
292
- rb_define_method(rb_cGstStructure, "nth_field_name", nth_field_name, 1);
294
+ RG_DEF_METHOD(nth_field_name, 1);
293
295
 
294
- rb_define_method(rb_cGstStructure, "has_field?", has_field_p, 1);
295
- rb_define_alias(rb_cGstStructure, "have_field?", "has_field?");
296
+ RG_DEF_METHOD_P(has_field, 1);
297
+ RG_DEF_ALIAS("have_field?", "has_field?");
296
298
 
297
- rb_define_method(rb_cGstStructure, "to_s", to_s, 0);
299
+ RG_DEF_METHOD(to_s, 0);
298
300
 
299
- G_DEF_SETTERS(rb_cGstStructure);
301
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
300
302
  }