gstreamer 0.90.6

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 (126) hide show
  1. data/ChangeLog +1157 -0
  2. data/README +33 -0
  3. data/Rakefile +15 -0
  4. data/ext/gstreamer/Makefile +162 -0
  5. data/ext/gstreamer/depend +5 -0
  6. data/ext/gstreamer/extconf.rb +63 -0
  7. data/ext/gstreamer/gst.so +0 -0
  8. data/ext/gstreamer/misc.c +62 -0
  9. data/ext/gstreamer/misc.o +0 -0
  10. data/ext/gstreamer/rbgst-bin.c +466 -0
  11. data/ext/gstreamer/rbgst-bin.o +0 -0
  12. data/ext/gstreamer/rbgst-buffer.c +365 -0
  13. data/ext/gstreamer/rbgst-buffer.o +0 -0
  14. data/ext/gstreamer/rbgst-bus.c +92 -0
  15. data/ext/gstreamer/rbgst-bus.o +0 -0
  16. data/ext/gstreamer/rbgst-caps.c +441 -0
  17. data/ext/gstreamer/rbgst-caps.o +0 -0
  18. data/ext/gstreamer/rbgst-child-proxy.c +33 -0
  19. data/ext/gstreamer/rbgst-child-proxy.o +0 -0
  20. data/ext/gstreamer/rbgst-clock.c +108 -0
  21. data/ext/gstreamer/rbgst-clock.o +0 -0
  22. data/ext/gstreamer/rbgst-element-factory.c +255 -0
  23. data/ext/gstreamer/rbgst-element-factory.o +0 -0
  24. data/ext/gstreamer/rbgst-element.c +1053 -0
  25. data/ext/gstreamer/rbgst-element.o +0 -0
  26. data/ext/gstreamer/rbgst-event.c +351 -0
  27. data/ext/gstreamer/rbgst-event.o +0 -0
  28. data/ext/gstreamer/rbgst-ghost-pad.c +42 -0
  29. data/ext/gstreamer/rbgst-ghost-pad.o +0 -0
  30. data/ext/gstreamer/rbgst-index-factory.c +67 -0
  31. data/ext/gstreamer/rbgst-index-factory.o +0 -0
  32. data/ext/gstreamer/rbgst-message.c +784 -0
  33. data/ext/gstreamer/rbgst-message.o +0 -0
  34. data/ext/gstreamer/rbgst-mini-object.c +220 -0
  35. data/ext/gstreamer/rbgst-mini-object.o +0 -0
  36. data/ext/gstreamer/rbgst-object.c +81 -0
  37. data/ext/gstreamer/rbgst-object.o +0 -0
  38. data/ext/gstreamer/rbgst-pad-template.c +124 -0
  39. data/ext/gstreamer/rbgst-pad-template.o +0 -0
  40. data/ext/gstreamer/rbgst-pad.c +338 -0
  41. data/ext/gstreamer/rbgst-pad.o +0 -0
  42. data/ext/gstreamer/rbgst-pipeline.c +90 -0
  43. data/ext/gstreamer/rbgst-pipeline.o +0 -0
  44. data/ext/gstreamer/rbgst-plugin-feature.c +134 -0
  45. data/ext/gstreamer/rbgst-plugin-feature.o +0 -0
  46. data/ext/gstreamer/rbgst-plugin.c +164 -0
  47. data/ext/gstreamer/rbgst-plugin.o +0 -0
  48. data/ext/gstreamer/rbgst-private.c +89 -0
  49. data/ext/gstreamer/rbgst-private.h +37 -0
  50. data/ext/gstreamer/rbgst-private.o +0 -0
  51. data/ext/gstreamer/rbgst-query.c +289 -0
  52. data/ext/gstreamer/rbgst-query.o +0 -0
  53. data/ext/gstreamer/rbgst-seek.c +36 -0
  54. data/ext/gstreamer/rbgst-seek.o +0 -0
  55. data/ext/gstreamer/rbgst-static-caps.c +49 -0
  56. data/ext/gstreamer/rbgst-static-caps.o +0 -0
  57. data/ext/gstreamer/rbgst-static-pad-template.c +64 -0
  58. data/ext/gstreamer/rbgst-static-pad-template.o +0 -0
  59. data/ext/gstreamer/rbgst-structure.c +300 -0
  60. data/ext/gstreamer/rbgst-structure.o +0 -0
  61. data/ext/gstreamer/rbgst-system-clock.c +45 -0
  62. data/ext/gstreamer/rbgst-system-clock.o +0 -0
  63. data/ext/gstreamer/rbgst-type-find-factory.c +124 -0
  64. data/ext/gstreamer/rbgst-type-find-factory.o +0 -0
  65. data/ext/gstreamer/rbgst-value.c +517 -0
  66. data/ext/gstreamer/rbgst-value.o +0 -0
  67. data/ext/gstreamer/rbgst-x-overlay.c +132 -0
  68. data/ext/gstreamer/rbgst-x-overlay.o +0 -0
  69. data/ext/gstreamer/rbgst.c +279 -0
  70. data/ext/gstreamer/rbgst.h +197 -0
  71. data/ext/gstreamer/rbgst.o +0 -0
  72. data/ext/gstreamer/rbgstclockentry.c +268 -0
  73. data/ext/gstreamer/rbgstclockentry.o +0 -0
  74. data/ext/gstreamer/rbgstformat.c +159 -0
  75. data/ext/gstreamer/rbgstformat.o +0 -0
  76. data/ext/gstreamer/rbgstindex.c +314 -0
  77. data/ext/gstreamer/rbgstindex.o +0 -0
  78. data/ext/gstreamer/rbgstindexentry.c +96 -0
  79. data/ext/gstreamer/rbgstindexentry.o +0 -0
  80. data/ext/gstreamer/rbgstparse.c +66 -0
  81. data/ext/gstreamer/rbgstparse.o +0 -0
  82. data/ext/gstreamer/rbgstquerytype.c +159 -0
  83. data/ext/gstreamer/rbgstquerytype.o +0 -0
  84. data/ext/gstreamer/rbgstregistry.c +278 -0
  85. data/ext/gstreamer/rbgstregistry.o +0 -0
  86. data/ext/gstreamer/rbgsttag.c +111 -0
  87. data/ext/gstreamer/rbgsttag.o +0 -0
  88. data/ext/gstreamer/rbgsttagsetter.c +50 -0
  89. data/ext/gstreamer/rbgsttagsetter.o +0 -0
  90. data/ext/gstreamer/rbgstxml.c +189 -0
  91. data/ext/gstreamer/rbgstxml.o +0 -0
  92. data/ext/gstreamer/ruby-gstreamer.pc +3 -0
  93. data/extconf.rb +49 -0
  94. data/lib/gst.rb +19 -0
  95. data/sample/audio-player.rb +54 -0
  96. data/sample/gst-inspect.rb +417 -0
  97. data/sample/media-type.rb +55 -0
  98. data/sample/media-type2.rb +268 -0
  99. data/sample/ogg-audio-player.rb +54 -0
  100. data/sample/type-find.rb +46 -0
  101. data/sample/video-player.rb +57 -0
  102. data/sample/xml-player.rb +60 -0
  103. data/test/gst-test-utils.rb +18 -0
  104. data/test/run-test.rb +25 -0
  105. data/test/test_bin.rb +167 -0
  106. data/test/test_buffer.rb +174 -0
  107. data/test/test_caps.rb +24 -0
  108. data/test/test_clock.rb +7 -0
  109. data/test/test_element.rb +87 -0
  110. data/test/test_element_factory.rb +28 -0
  111. data/test/test_event.rb +10 -0
  112. data/test/test_index_factory.rb +7 -0
  113. data/test/test_message.rb +191 -0
  114. data/test/test_mini_object.rb +38 -0
  115. data/test/test_object.rb +10 -0
  116. data/test/test_pad.rb +68 -0
  117. data/test/test_plugin.rb +6 -0
  118. data/test/test_plugin_feature.rb +20 -0
  119. data/test/test_seek.rb +17 -0
  120. data/test/test_static_caps.rb +18 -0
  121. data/test/test_static_pad_template.rb +16 -0
  122. data/test/test_structure.rb +159 -0
  123. data/test/test_thread_handling.rb +58 -0
  124. data/test/test_type_find_factory.rb +8 -0
  125. data/test/test_value.rb +69 -0
  126. metadata +208 -0
Binary file
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright (C) 2003-2005 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
19
+ */
20
+
21
+ #include "rbgst.h"
22
+
23
+ /* Module: Gst::Tag
24
+ * Helper module to the tagging interface.
25
+ */
26
+
27
+ /*
28
+ * Class method: exists?(tag)
29
+ * tag: the name of the tag.
30
+ *
31
+ * Checks if the given tag is already registered.
32
+ *
33
+ * Returns: true if the tag is registered, false otherwise.
34
+ */
35
+ static VALUE
36
+ rb_gst_tag_exists (VALUE self, VALUE tag)
37
+ {
38
+ return CBOOL2RVAL (gst_tag_exists (RVAL2CSTR (tag)));
39
+ }
40
+
41
+ /*
42
+ * Class method: fixed?(tag)
43
+ * tag: the name of the tag.
44
+ *
45
+ * Checks if the given tag is fixed. A fixed tag can only contain one value.
46
+ * Unfixed tags can contain lists of values.
47
+ *
48
+ * Returns: true if the tag is fixed, false otherwise.
49
+ */
50
+ static VALUE
51
+ rb_gst_tag_fixed (VALUE self, VALUE tag)
52
+ {
53
+ return CBOOL2RVAL (gst_tag_is_fixed (RVAL2CSTR (tag)));
54
+ }
55
+
56
+ /*
57
+ * Class method: get_nick(tag)
58
+ * tag: the name of the tag.
59
+ *
60
+ * Returns: the human-readable name of this tag.
61
+ */
62
+ static VALUE
63
+ rb_gst_tag_get_nick (VALUE self, VALUE tag)
64
+ {
65
+ return CSTR2RVAL (gst_tag_get_nick (RVAL2CSTR (tag)));
66
+ }
67
+
68
+ /*
69
+ * Class method: get_description(tag)
70
+ * tag: the name of the tag.
71
+ *
72
+ * Returns: the human-readable description of this tag.
73
+ */
74
+ static VALUE
75
+ rb_gst_tag_get_description (VALUE self, VALUE tag)
76
+ {
77
+ return CSTR2RVAL (gst_tag_get_description (RVAL2CSTR (tag)));
78
+ }
79
+
80
+ /*
81
+ * Class method: get_flag(tag)
82
+ * tag: the name of the tag.
83
+ *
84
+ * Gets the flag of the given tag.
85
+ *
86
+ * Returns: the flag of this tag (see Gst::Tag::Flag).
87
+ */
88
+ static VALUE
89
+ rb_gst_tag_get_flag (VALUE self, VALUE tag)
90
+ {
91
+ return GFLAGS2RVAL (gst_tag_get_flag (RVAL2CSTR (tag)),
92
+ GST_TYPE_TAG_FLAG);
93
+ }
94
+
95
+ void
96
+ Init_gst_tag (void)
97
+ {
98
+ VALUE m = rb_define_module_under (mGst, "Tag");
99
+
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);
106
+
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_");
111
+ }
Binary file
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (C) 2003-2005 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
19
+ */
20
+
21
+ #include "rbgst.h"
22
+
23
+ /* Class: Gst::TagSetter
24
+ * Element interface that allows the setting and retrieval of media metadata.
25
+ */
26
+
27
+ /*
28
+ * Method: merge(structure, merge_mode)
29
+ * structure: a Ruby hash representing the tag list of merge from.
30
+ * merge_mode: the mode to merge with (see Gst::Tag::MergeMode).
31
+ *
32
+ * Merges the given tag list in the setter's list using the given mode.
33
+ *
34
+ * Returns: self.
35
+ */
36
+ static VALUE
37
+ rb_gst_tag_setter_merge (VALUE self, VALUE structure, VALUE merge_mode)
38
+ {
39
+ gst_tag_setter_merge_tags(RGST_TAG_SETTER(self),
40
+ RVAL2GST_STRUCT(structure),
41
+ RVAL2GENUM(merge_mode, GST_TYPE_TAG_MERGE_MODE));
42
+ return self;
43
+ }
44
+
45
+ void
46
+ Init_gst_tag_setter (void)
47
+ {
48
+ VALUE c = G_DEF_INTERFACE (GST_TYPE_TAG_SETTER, "TagSetter", mGst);
49
+ rb_define_method (c, "merge", rb_gst_tag_setter_merge, 2);
50
+ }
Binary file
@@ -0,0 +1,189 @@
1
+ /*
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
19
+ */
20
+
21
+ #include "rbgst.h"
22
+
23
+ /* Class: Gst::XML
24
+ * Convert Gst::Element objects into an XML presentation.
25
+ */
26
+
27
+ /*
28
+ * Class method: new
29
+ *
30
+ * Creates a new Gst::XML parser object.
31
+ *
32
+ * Returns: a newly created Gst::XML object.
33
+ */
34
+ static VALUE
35
+ rb_gst_xml_new (VALUE self)
36
+ {
37
+ GstXML *xml = gst_xml_new ();
38
+ if (xml != NULL)
39
+ G_INITIALIZE (self, xml);
40
+ return Qnil;
41
+ }
42
+
43
+ /*
44
+ * Class method: write_file(element, filename)
45
+ * element: a Gst::Element.
46
+ * filename: a file name.
47
+ *
48
+ * Converts the given element into XML and writes the formatted XML
49
+ * to the specified file name.
50
+ *
51
+ * Returns: true on success, false on failure.
52
+ */
53
+ static VALUE
54
+ rb_gst_xml_write_file (VALUE self, VALUE element, VALUE filename)
55
+ {
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);
63
+ }
64
+
65
+ /*
66
+ * Method: parse_file(filename, rootname=nil)
67
+ * filename: a file name.
68
+ * rootname: a root name (optional).
69
+ *
70
+ * Fills the Gst::XML object with the corresponding elements from
71
+ * the XML file name. Optionally it will only build the element
72
+ * from the element node root (if it is not nil).
73
+ *
74
+ * This feature is useful if you only want to build a specific
75
+ * element from an XML file but not the pipeline it is embedded in.
76
+ *
77
+ * Pass "-" as file name to read from stdin. You can also pass a
78
+ * URI of any format that libxml supports, including http.
79
+ *
80
+ * Returns: true on success, false on failure.
81
+ */
82
+ static VALUE
83
+ rb_gst_xml_parse_file (int argc, VALUE *argv, VALUE self)
84
+ {
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)
90
+ ? NULL
91
+ : RVAL2CSTR (rootname))));
92
+ }
93
+
94
+ /*
95
+ * Method: parse_memory(string, rootname=nil)
96
+ * string: an XML description inside a string.
97
+ * rootname: a root name (optional).
98
+ *
99
+ * Basically the same as Gst::XML#parse_file except that this method will
100
+ * take the XML directly from the memory.
101
+ *
102
+ * Returns: true on success, false on failure.
103
+ */
104
+ static VALUE
105
+ rb_gst_xml_parse_memory (int argc, VALUE *argv, VALUE self)
106
+ {
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)
116
+ ? NULL
117
+ : RVAL2CSTR (rootname))));
118
+ }
119
+
120
+ /*
121
+ * Method: get_element(element_name)
122
+ * element_name: the name of an element.
123
+ *
124
+ * This method is used to get a reference to the Gst::Element
125
+ * corresponding to name in the pipeline description. You would use
126
+ * this if you have to do anything to the element after loading.
127
+ *
128
+ * Returns: a reference to a Gst::Element object if found, otherwise
129
+ * returns nil.
130
+ */
131
+ static VALUE
132
+ rb_gst_xml_get_element (VALUE self, VALUE element_name)
133
+ {
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;
139
+ }
140
+
141
+ /*
142
+ * Method: topelements
143
+ *
144
+ * Retrieves a list of all toplevel elements.
145
+ *
146
+ * Returns: an array of Gst::Element objects.
147
+ */
148
+ static VALUE
149
+ rb_gst_xml_get_topelements (VALUE self)
150
+ {
151
+ GList *list;
152
+ VALUE arr;
153
+
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;
160
+ }
161
+
162
+ /*
163
+ * Method: each_topelement { |element| ... }
164
+ *
165
+ * Calls the block for each topelement, passing a reference to
166
+ * a Gst::Element object as parameter.
167
+ *
168
+ * Returns: always nil.
169
+ */
170
+ static VALUE
171
+ rb_gst_xml_each_topelement (VALUE self)
172
+ {
173
+ return rb_ary_yield (rb_gst_xml_get_topelements (self));
174
+ }
175
+
176
+ void
177
+ Init_gst_xml (void)
178
+ {
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);
189
+ }
Binary file
@@ -0,0 +1,3 @@
1
+ Name: Ruby/GStreamer
2
+ Description: Ruby bindings for Streaming media framework
3
+ Version: 0.90.6
data/extconf.rb ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'mkmf'
5
+ require 'rbconfig'
6
+ require 'fileutils'
7
+
8
+ package = "gstreamer"
9
+
10
+ base_dir = Pathname(__FILE__).dirname.expand_path
11
+ ext_dir = base_dir + "ext" + package
12
+ mkmf_gnome2_dir = base_dir + 'lib'
13
+
14
+ ruby = File.join(RbConfig::CONFIG['bindir'],
15
+ RbConfig::CONFIG['ruby_install_name'] +
16
+ RbConfig::CONFIG["EXEEXT"])
17
+
18
+ build_dir = Pathname("ext") + package
19
+ FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
20
+ extconf_rb_path = ext_dir + "extconf.rb"
21
+ system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
22
+
23
+ create_makefile(package)
24
+ FileUtils.mv("Makefile", "Makefile.lib")
25
+
26
+ File.open("Makefile", "w") do |makefile|
27
+ makefile.puts(<<-EOM)
28
+ all:
29
+ (cd ext/#{package} && $(MAKE))
30
+ $(MAKE) -f Makefile.lib
31
+
32
+ install:
33
+ (cd ext/#{package} && $(MAKE) install)
34
+ $(MAKE) -f Makefile.lib install
35
+
36
+ site-install:
37
+ (cd ext/#{package} && $(MAKE) site-install)
38
+ $(MAKE) -f Makefile.lib site-install
39
+
40
+ clean:
41
+ (cd ext/#{package} && $(MAKE) clean)
42
+ $(MAKE) -f Makefile.lib clean
43
+
44
+ distclean:
45
+ (cd ext/#{package} && $(MAKE) distclean)
46
+ $(MAKE) -f Makefile.lib distclean
47
+ @rm -f Makefile.lib
48
+ EOM
49
+ end
data/lib/gst.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'rational'
2
+ require 'glib2'
3
+ require 'gst.so'
4
+
5
+ Gst.init
6
+
7
+ module Gst
8
+ class Plugin
9
+ def each_feature(&block)
10
+ Registry.default.each_feature(name, &block)
11
+ end
12
+ end
13
+
14
+ class Structure
15
+ def inspect
16
+ super.gsub(/>\z/, ": #{to_s}>")
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gst'
4
+
5
+ if ARGV.size != 1
6
+ puts "Usage: #{$0} audio-file"
7
+ exit
8
+ end
9
+
10
+ file = ARGV.first
11
+
12
+ pipeline = Gst::Pipeline.new
13
+
14
+ file_src = Gst::ElementFactory.make("filesrc")
15
+ file_src.location = file
16
+
17
+ decoder = Gst::ElementFactory.make("decodebin")
18
+
19
+ audio_convert = Gst::ElementFactory.make("audioconvert")
20
+
21
+ audio_resample = Gst::ElementFactory.make("audioresample")
22
+
23
+ audio_sink = Gst::ElementFactory.make("autoaudiosink")
24
+
25
+ pipeline.add(file_src, decoder, audio_convert, audio_resample, audio_sink)
26
+ file_src >> decoder
27
+ audio_convert >> audio_resample >> audio_sink
28
+
29
+ decoder.signal_connect("new-decoded-pad") do |element, pad|
30
+ sink_pad = audio_convert["sink"]
31
+ pad.link(sink_pad)
32
+ end
33
+
34
+ loop = GLib::MainLoop.new(nil, false)
35
+
36
+ bus = pipeline.bus
37
+ bus.add_watch do |bus, message|
38
+ case message.type
39
+ when Gst::Message::EOS
40
+ loop.quit
41
+ when Gst::Message::ERROR
42
+ p message.parse
43
+ loop.quit
44
+ end
45
+ true
46
+ end
47
+
48
+ pipeline.play
49
+ begin
50
+ loop.run
51
+ rescue Interrupt
52
+ ensure
53
+ pipeline.stop
54
+ end