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,24 +1,27 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003-2005 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2011-2012 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003-2005 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 mTag
22
25
 
23
26
  /* Module: Gst::Tag
24
27
  * Helper module to the tagging interface.
@@ -33,7 +36,7 @@
33
36
  * Returns: true if the tag is registered, false otherwise.
34
37
  */
35
38
  static VALUE
36
- rb_gst_tag_exists (VALUE self, VALUE tag)
39
+ rg_m_exists_p (VALUE self, VALUE tag)
37
40
  {
38
41
  return CBOOL2RVAL (gst_tag_exists (RVAL2CSTR (tag)));
39
42
  }
@@ -48,7 +51,7 @@ rb_gst_tag_exists (VALUE self, VALUE tag)
48
51
  * Returns: true if the tag is fixed, false otherwise.
49
52
  */
50
53
  static VALUE
51
- rb_gst_tag_fixed (VALUE self, VALUE tag)
54
+ rg_m_fixed_p (VALUE self, VALUE tag)
52
55
  {
53
56
  return CBOOL2RVAL (gst_tag_is_fixed (RVAL2CSTR (tag)));
54
57
  }
@@ -60,7 +63,7 @@ rb_gst_tag_fixed (VALUE self, VALUE tag)
60
63
  * Returns: the human-readable name of this tag.
61
64
  */
62
65
  static VALUE
63
- rb_gst_tag_get_nick (VALUE self, VALUE tag)
66
+ rg_m_get_nick (VALUE self, VALUE tag)
64
67
  {
65
68
  return CSTR2RVAL (gst_tag_get_nick (RVAL2CSTR (tag)));
66
69
  }
@@ -72,7 +75,7 @@ rb_gst_tag_get_nick (VALUE self, VALUE tag)
72
75
  * Returns: the human-readable description of this tag.
73
76
  */
74
77
  static VALUE
75
- rb_gst_tag_get_description (VALUE self, VALUE tag)
78
+ rg_m_get_description (VALUE self, VALUE tag)
76
79
  {
77
80
  return CSTR2RVAL (gst_tag_get_description (RVAL2CSTR (tag)));
78
81
  }
@@ -86,26 +89,25 @@ rb_gst_tag_get_description (VALUE self, VALUE tag)
86
89
  * Returns: the flag of this tag (see Gst::Tag::Flag).
87
90
  */
88
91
  static VALUE
89
- rb_gst_tag_get_flag (VALUE self, VALUE tag)
92
+ rg_m_get_flag (VALUE self, VALUE tag)
90
93
  {
91
94
  return GFLAGS2RVAL (gst_tag_get_flag (RVAL2CSTR (tag)),
92
95
  GST_TYPE_TAG_FLAG);
93
96
  }
94
97
 
95
98
  void
96
- Init_gst_tag (void)
99
+ Init_gst_tag (VALUE mGst)
97
100
  {
98
- VALUE m = rb_define_module_under (mGst, "Tag");
101
+ VALUE RG_TARGET_NAMESPACE = rb_define_module_under (mGst, "Tag");
99
102
 
100
- rb_define_module_function (m, "exists?", rb_gst_tag_exists, 1);
101
- rb_define_module_function (m, "get_nick", rb_gst_tag_get_nick, 1);
102
- rb_define_module_function (m, "get_description",
103
- rb_gst_tag_get_description, 1);
104
- rb_define_module_function (m, "get_flag", rb_gst_tag_get_flag, 1);
105
- rb_define_module_function (m, "fixed?", rb_gst_tag_fixed, 1);
103
+ RG_DEF_MODFUNC_P(exists, 1);
104
+ RG_DEF_MODFUNC(get_nick, 1);
105
+ RG_DEF_MODFUNC(get_description, 1);
106
+ RG_DEF_MODFUNC(get_flag, 1);
107
+ RG_DEF_MODFUNC_P(fixed, 1);
106
108
 
107
- G_DEF_CLASS (GST_TYPE_TAG_FLAG, "Flag", m);
108
- G_DEF_CONSTANTS (m, GST_TYPE_TAG_FLAG, "GST_TAG_");
109
- G_DEF_CLASS (GST_TYPE_TAG_MERGE_MODE, "MergeMode", m);
110
- G_DEF_CONSTANTS (m, GST_TYPE_TAG_MERGE_MODE, "GST_TAG_");
109
+ G_DEF_CLASS (GST_TYPE_TAG_FLAG, "Flag", RG_TARGET_NAMESPACE);
110
+ G_DEF_CONSTANTS (RG_TARGET_NAMESPACE, GST_TYPE_TAG_FLAG, "GST_TAG_");
111
+ G_DEF_CLASS (GST_TYPE_TAG_MERGE_MODE, "MergeMode", RG_TARGET_NAMESPACE);
112
+ G_DEF_CONSTANTS (RG_TARGET_NAMESPACE, GST_TYPE_TAG_MERGE_MODE, "GST_TAG_");
111
113
  }
@@ -1,24 +1,27 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003-2005 Laurent Sansonetti <lrz@gnome.org>
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003-2005 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 mTagSetter
22
25
 
23
26
  /* Class: Gst::TagSetter
24
27
  * Element interface that allows the setting and retrieval of media metadata.
@@ -34,7 +37,7 @@
34
37
  * Returns: self.
35
38
  */
36
39
  static VALUE
37
- rb_gst_tag_setter_merge (VALUE self, VALUE structure, VALUE merge_mode)
40
+ rg_merge (VALUE self, VALUE structure, VALUE merge_mode)
38
41
  {
39
42
  gst_tag_setter_merge_tags(RGST_TAG_SETTER(self),
40
43
  RVAL2GST_STRUCT(structure),
@@ -43,8 +46,8 @@ rb_gst_tag_setter_merge (VALUE self, VALUE structure, VALUE merge_mode)
43
46
  }
44
47
 
45
48
  void
46
- Init_gst_tag_setter (void)
49
+ Init_gst_tag_setter (VALUE mGst)
47
50
  {
48
- VALUE c = G_DEF_INTERFACE (GST_TYPE_TAG_SETTER, "TagSetter", mGst);
49
- rb_define_method (c, "merge", rb_gst_tag_setter_merge, 2);
51
+ VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE (GST_TYPE_TAG_SETTER, "TagSetter", mGst);
52
+ RG_DEF_METHOD(merge, 2);
50
53
  }
@@ -1,24 +1,27 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
1
2
  /*
2
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
3
- *
4
- * This file is part of Ruby/GStreamer.
5
- *
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.
10
- *
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
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
+ *
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.
10
+ *
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.
15
+ *
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 cXML
22
25
 
23
26
  /* Class: Gst::XML
24
27
  * Convert Gst::Element objects into an XML presentation.
@@ -32,12 +35,12 @@
32
35
  * Returns: a newly created Gst::XML object.
33
36
  */
34
37
  static VALUE
35
- rb_gst_xml_new (VALUE self)
38
+ rg_initialize (VALUE self)
36
39
  {
37
- GstXML *xml = gst_xml_new ();
38
- if (xml != NULL)
39
- G_INITIALIZE (self, xml);
40
- return Qnil;
40
+ GstXML *xml = gst_xml_new ();
41
+ if (xml != NULL)
42
+ G_INITIALIZE (self, xml);
43
+ return Qnil;
41
44
  }
42
45
 
43
46
  /*
@@ -51,15 +54,15 @@ rb_gst_xml_new (VALUE self)
51
54
  * Returns: true on success, false on failure.
52
55
  */
53
56
  static VALUE
54
- rb_gst_xml_write_file (VALUE self, VALUE element, VALUE filename)
57
+ rg_s_write_file (VALUE self, VALUE element, VALUE filename)
55
58
  {
56
- FILE *file = fopen (RVAL2CSTR (filename), "w");
57
- gboolean ret = FALSE;
58
- if (file != NULL) {
59
- ret = gst_xml_write_file (RGST_ELEMENT (element), file) != -1;
60
- fclose (file);
61
- }
62
- return CBOOL2RVAL (ret);
59
+ FILE *file = fopen (RVAL2CSTR (filename), "w");
60
+ gboolean ret = FALSE;
61
+ if (file != NULL) {
62
+ ret = gst_xml_write_file (RGST_ELEMENT (element), file) != -1;
63
+ fclose (file);
64
+ }
65
+ return CBOOL2RVAL (ret);
63
66
  }
64
67
 
65
68
  /*
@@ -80,13 +83,13 @@ rb_gst_xml_write_file (VALUE self, VALUE element, VALUE filename)
80
83
  * Returns: true on success, false on failure.
81
84
  */
82
85
  static VALUE
83
- rb_gst_xml_parse_file (int argc, VALUE *argv, VALUE self)
86
+ rg_parse_file (int argc, VALUE *argv, VALUE self)
84
87
  {
85
- VALUE fname, rootname;
86
- rb_scan_args (argc, argv, "11", &fname, &rootname);
87
- return CBOOL2RVAL (gst_xml_parse_file (RGST_XML (self),
88
- (const guchar*) RVAL2CSTR (fname),
89
- (const guchar*)(NIL_P (rootname)
88
+ VALUE fname, rootname;
89
+ rb_scan_args (argc, argv, "11", &fname, &rootname);
90
+ return CBOOL2RVAL (gst_xml_parse_file (RGST_XML (self),
91
+ (const guchar*) RVAL2CSTR (fname),
92
+ (const guchar*)(NIL_P (rootname)
90
93
  ? NULL
91
94
  : RVAL2CSTR (rootname))));
92
95
  }
@@ -102,17 +105,17 @@ rb_gst_xml_parse_file (int argc, VALUE *argv, VALUE self)
102
105
  * Returns: true on success, false on failure.
103
106
  */
104
107
  static VALUE
105
- rb_gst_xml_parse_memory (int argc, VALUE *argv, VALUE self)
108
+ rg_parse_memory (int argc, VALUE *argv, VALUE self)
106
109
  {
107
- VALUE memory, rootname;
108
- gchar *cstr;
109
-
110
- rb_scan_args (argc, argv, "11", &memory, &rootname);
111
- cstr = RVAL2CSTR (memory);
112
- return CBOOL2RVAL (gst_xml_parse_memory (RGST_XML (self),
113
- (guchar*)cstr,
114
- strlen (cstr),
115
- (const gchar*)(NIL_P (rootname)
110
+ VALUE memory, rootname;
111
+ gchar *cstr;
112
+
113
+ rb_scan_args (argc, argv, "11", &memory, &rootname);
114
+ cstr = RVAL2CSTR (memory);
115
+ return CBOOL2RVAL (gst_xml_parse_memory (RGST_XML (self),
116
+ (guchar*)cstr,
117
+ strlen (cstr),
118
+ (const gchar*)(NIL_P (rootname)
116
119
  ? NULL
117
120
  : RVAL2CSTR (rootname))));
118
121
  }
@@ -129,13 +132,13 @@ rb_gst_xml_parse_memory (int argc, VALUE *argv, VALUE self)
129
132
  * returns nil.
130
133
  */
131
134
  static VALUE
132
- rb_gst_xml_get_element (VALUE self, VALUE element_name)
135
+ rg_get_element (VALUE self, VALUE element_name)
133
136
  {
134
- GstElement *element = gst_xml_get_element (RGST_XML (self),
135
- (const guchar*)RVAL2CSTR (element_name));
136
- return element != NULL
137
- ? RGST_ELEMENT_NEW (element)
138
- : Qnil;
137
+ GstElement *element = gst_xml_get_element (RGST_XML (self),
138
+ (const guchar*)RVAL2CSTR (element_name));
139
+ return element != NULL
140
+ ? RGST_ELEMENT_NEW (element)
141
+ : Qnil;
139
142
  }
140
143
 
141
144
  /*
@@ -146,17 +149,17 @@ rb_gst_xml_get_element (VALUE self, VALUE element_name)
146
149
  * Returns: an array of Gst::Element objects.
147
150
  */
148
151
  static VALUE
149
- rb_gst_xml_get_topelements (VALUE self)
152
+ rg_topelements (VALUE self)
150
153
  {
151
- GList *list;
152
- VALUE arr;
154
+ GList *list;
155
+ VALUE arr;
153
156
 
154
- arr = rb_ary_new ();
155
- for (list = gst_xml_get_topelements (RGST_XML (self));
156
- list != NULL;
157
- list = g_list_next (list))
158
- rb_ary_push (arr, RGST_ELEMENT_NEW (list->data));
159
- return arr;
157
+ arr = rb_ary_new ();
158
+ for (list = gst_xml_get_topelements (RGST_XML (self));
159
+ list != NULL;
160
+ list = g_list_next (list))
161
+ rb_ary_push (arr, RGST_ELEMENT_NEW (list->data));
162
+ return arr;
160
163
  }
161
164
 
162
165
  /*
@@ -168,22 +171,22 @@ rb_gst_xml_get_topelements (VALUE self)
168
171
  * Returns: always nil.
169
172
  */
170
173
  static VALUE
171
- rb_gst_xml_each_topelement (VALUE self)
174
+ rg_each_topelement (VALUE self)
172
175
  {
173
- return rb_ary_yield (rb_gst_xml_get_topelements (self));
176
+ return rb_ary_yield (rg_topelements (self));
174
177
  }
175
178
 
176
179
  void
177
- Init_gst_xml (void)
180
+ Init_gst_xml (VALUE mGst)
178
181
  {
179
- VALUE c = G_DEF_CLASS (GST_TYPE_XML, "XML", mGst);
180
-
181
- rb_define_singleton_method (c, "write_file", rb_gst_xml_write_file, 2);
182
-
183
- rb_define_method (c, "initialize", rb_gst_xml_new, 0);
184
- rb_define_method (c, "parse_file", rb_gst_xml_parse_file, -1);
185
- rb_define_method (c, "parse_memory", rb_gst_xml_parse_memory, -1);
186
- rb_define_method (c, "get_element", rb_gst_xml_get_element, 1);
187
- rb_define_method (c, "topelements", rb_gst_xml_get_topelements, 0);
188
- rb_define_method (c, "each_topelement", rb_gst_xml_each_topelement, 0);
182
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_XML, "XML", mGst);
183
+
184
+ RG_DEF_SMETHOD(write_file, 2);
185
+
186
+ RG_DEF_METHOD(initialize, 0);
187
+ RG_DEF_METHOD(parse_file, -1);
188
+ RG_DEF_METHOD(parse_memory, -1);
189
+ RG_DEF_METHOD(get_element, 1);
190
+ RG_DEF_METHOD(topelements, 0);
191
+ RG_DEF_METHOD(each_topelement, 0);
189
192
  }
data/lib/gst.rb CHANGED
@@ -1,6 +1,20 @@
1
1
  require 'rational'
2
2
  require 'glib2'
3
- require 'gst.so'
3
+
4
+ base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
5
+ vendor_dir = base_dir + "vendor" + "local"
6
+ vendor_bin_dir = vendor_dir + "bin"
7
+ GLib.prepend_environment_path(vendor_bin_dir)
8
+ if vendor_bin_dir.exist?
9
+ require 'pango'
10
+ require 'gdk_pixbuf2'
11
+ end
12
+ begin
13
+ major, minor, _ = RUBY_VERSION.split(/\./)
14
+ require "#{major}.#{minor}/gstreamer.so"
15
+ rescue LoadError
16
+ require "gstreamer.so"
17
+ end
4
18
 
5
19
  Gst.init
6
20
 
data/test/test_buffer.rb CHANGED
@@ -64,7 +64,10 @@ class TestBuffer < Test::Unit::TestCase
64
64
  buffer = Gst::Buffer.new
65
65
  assert_nil(buffer.caps)
66
66
 
67
- caps = Gst::Caps.new
67
+ structure = Gst::Structure.new("caps")
68
+ structure["width"] = 320
69
+ structure["height"] = 240
70
+ caps = Gst::Caps.new(structure)
68
71
  buffer.caps = caps
69
72
  assert_equal(caps, buffer.caps)
70
73
  end
@@ -161,7 +164,7 @@ class TestBuffer < Test::Unit::TestCase
161
164
 
162
165
  length = 7
163
166
  merged_buffer = buffer1.span(2, buffer2, length)
164
- assert(length, merged_buffer.length)
167
+ assert_equal(length, merged_buffer.length)
165
168
  end
166
169
 
167
170
  def test_span?
data/test/test_element.rb CHANGED
@@ -39,10 +39,10 @@ class TestElement < Test::Unit::TestCase
39
39
  pipeline.get_state)
40
40
 
41
41
  pipeline.play
42
- assert_equal([Gst::STATE_CHANGE_ASYNC,
42
+ assert_equal([Gst::STATE_CHANGE_FAILURE,
43
43
  Gst::STATE_READY,
44
44
  Gst::STATE_PLAYING],
45
- pipeline.get_state(10))
45
+ pipeline.get_state(1000))
46
46
 
47
47
  pipeline.pause
48
48
  assert_equal([Gst::STATE_CHANGE_ASYNC,
@@ -54,15 +54,13 @@ class TestElement < Test::Unit::TestCase
54
54
  assert_equal([Gst::STATE_CHANGE_SUCCESS,
55
55
  Gst::STATE_NULL,
56
56
  Gst::STATE_VOID_PENDING],
57
- pipeline.get_state(10))
57
+ pipeline.get_state(1000))
58
58
 
59
59
  pipeline.set_state(:playing)
60
- pend("Async is correct behavior?") do
61
- assert_equal([Gst::STATE_CHANGE_SUCCESS,
62
- Gst::STATE_PLAYING,
63
- Gst::STATE_VOID_PENDING],
64
- pipeline.get_state(10))
65
- end
60
+ assert_equal([Gst::STATE_CHANGE_FAILURE,
61
+ Gst::STATE_READY,
62
+ Gst::STATE_PLAYING],
63
+ pipeline.get_state(1000))
66
64
  end
67
65
 
68
66
  def test_query