gstreamer 1.2.6 → 2.0.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.
- data/Rakefile +78 -39
- data/ext/gstreamer/extconf.rb +8 -22
- data/ext/gstreamer/rbgst.c +82 -194
- data/lib/gst/base_loader.rb +20 -0
- data/lib/gst/bin.rb +32 -0
- data/lib/gst/bus.rb +24 -0
- data/lib/gst/element.rb +48 -0
- data/lib/gst.rb +87 -22
- data/sample/helloworld.rb +75 -0
- data/sample/mp3parselaunch.rb +74 -0
- data/sample/queue.rb +92 -0
- data/sample/typefind.rb +101 -0
- metadata +29 -84
- data/README +0 -33
- data/ext/gstreamer/misc.c +0 -63
- data/ext/gstreamer/rbgst-bin.c +0 -456
- data/ext/gstreamer/rbgst-buffer.c +0 -363
- data/ext/gstreamer/rbgst-bus.c +0 -92
- data/ext/gstreamer/rbgst-caps.c +0 -446
- data/ext/gstreamer/rbgst-child-proxy.c +0 -34
- data/ext/gstreamer/rbgst-clock.c +0 -108
- data/ext/gstreamer/rbgst-element-factory.c +0 -249
- data/ext/gstreamer/rbgst-element.c +0 -1106
- data/ext/gstreamer/rbgst-event.c +0 -352
- data/ext/gstreamer/rbgst-ghost-pad.c +0 -45
- data/ext/gstreamer/rbgst-index-factory.c +0 -69
- data/ext/gstreamer/rbgst-install-plugins-context.c +0 -87
- data/ext/gstreamer/rbgst-install-plugins-return.c +0 -45
- data/ext/gstreamer/rbgst-install-plugins.c +0 -125
- data/ext/gstreamer/rbgst-message.c +0 -785
- data/ext/gstreamer/rbgst-mini-object.c +0 -221
- data/ext/gstreamer/rbgst-object.c +0 -81
- data/ext/gstreamer/rbgst-pad-template.c +0 -125
- data/ext/gstreamer/rbgst-pad.c +0 -336
- data/ext/gstreamer/rbgst-pipeline.c +0 -91
- data/ext/gstreamer/rbgst-plugin-feature.c +0 -131
- data/ext/gstreamer/rbgst-plugin.c +0 -162
- data/ext/gstreamer/rbgst-private.c +0 -88
- data/ext/gstreamer/rbgst-private.h +0 -97
- data/ext/gstreamer/rbgst-query.c +0 -291
- data/ext/gstreamer/rbgst-seek.c +0 -39
- data/ext/gstreamer/rbgst-static-caps.c +0 -49
- data/ext/gstreamer/rbgst-static-pad-template.c +0 -65
- data/ext/gstreamer/rbgst-structure.c +0 -300
- data/ext/gstreamer/rbgst-system-clock.c +0 -48
- data/ext/gstreamer/rbgst-type-find-factory.c +0 -125
- data/ext/gstreamer/rbgst-value.c +0 -527
- data/ext/gstreamer/rbgst-x-overlay.c +0 -131
- data/ext/gstreamer/rbgst.h +0 -197
- data/ext/gstreamer/rbgstclockentry.c +0 -271
- data/ext/gstreamer/rbgstformat.c +0 -162
- data/ext/gstreamer/rbgstindex.c +0 -315
- data/ext/gstreamer/rbgstindexentry.c +0 -99
- data/ext/gstreamer/rbgstparse.c +0 -69
- data/ext/gstreamer/rbgstquerytype.c +0 -162
- data/ext/gstreamer/rbgstregistry.c +0 -288
- data/ext/gstreamer/rbgsttag.c +0 -113
- data/ext/gstreamer/rbgsttagsetter.c +0 -53
- data/ext/gstreamer/rbgstxml.c +0 -192
- data/sample/audio-player.rb +0 -54
- data/sample/gst-gi.rb +0 -55
- data/sample/gst-inspect.rb +0 -417
- data/sample/install-plugins.rb +0 -40
- data/sample/media-type.rb +0 -55
- data/sample/media-type2.rb +0 -268
- data/sample/ogg-audio-player.rb +0 -54
- data/sample/type-find.rb +0 -46
- data/sample/video-player.rb +0 -57
- data/sample/xml-player.rb +0 -60
- data/test/gst-test-utils.rb +0 -18
- data/test/run-test.rb +0 -25
- data/test/test_bin.rb +0 -167
- data/test/test_buffer.rb +0 -185
- data/test/test_caps.rb +0 -24
- data/test/test_element.rb +0 -85
- data/test/test_element_factory.rb +0 -28
- data/test/test_event.rb +0 -10
- data/test/test_index_factory.rb +0 -7
- data/test/test_install-plugins.rb +0 -18
- data/test/test_message.rb +0 -191
- data/test/test_mini_object.rb +0 -38
- data/test/test_object.rb +0 -10
- data/test/test_pad.rb +0 -68
- data/test/test_plugin.rb +0 -6
- data/test/test_plugin_feature.rb +0 -20
- data/test/test_seek.rb +0 -17
- data/test/test_static_caps.rb +0 -18
- data/test/test_static_pad_template.rb +0 -16
- data/test/test_structure.rb +0 -159
- data/test/test_thread_handling.rb +0 -58
- data/test/test_type_find_factory.rb +0 -8
- data/test/test_value.rb +0 -69
data/sample/gst-gi.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
require "gobject-introspection"
|
18
|
-
|
19
|
-
base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
|
20
|
-
vendor_dir = base_dir + "vendor" + "local"
|
21
|
-
vendor_bin_dir = vendor_dir + "bin"
|
22
|
-
GLib.prepend_environment_path(vendor_bin_dir)
|
23
|
-
|
24
|
-
module Gst
|
25
|
-
LOG_DOMAIN = "GStreamer"
|
26
|
-
GLib::Log.set_log_domain(LOG_DOMAIN)
|
27
|
-
|
28
|
-
class << self
|
29
|
-
@initialized = false
|
30
|
-
def init(argv=ARGV)
|
31
|
-
return if @initialized
|
32
|
-
@initialized = true
|
33
|
-
loader = Loader.new(self, argv)
|
34
|
-
loader.load("Gst")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class Loader < GObjectIntrospection::Loader
|
39
|
-
def initialize(base_module, init_arguments)
|
40
|
-
super(base_module)
|
41
|
-
@init_arguments = init_arguments
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def pre_load(repository, namespace)
|
46
|
-
init = repository.find(namespace, "init")
|
47
|
-
argc, argv = init.invoke(1 + @init_arguments.size,
|
48
|
-
[$0] + @init_arguments)
|
49
|
-
@init_arguments.replace(argv)
|
50
|
-
end
|
51
|
-
|
52
|
-
def post_load(repository, namespace)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/sample/gst-inspect.rb
DELETED
@@ -1,417 +0,0 @@
|
|
1
|
-
#!/usr/bin/evn ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
require 'ostruct'
|
5
|
-
|
6
|
-
argv = ARGV.dup
|
7
|
-
ARGV.clear
|
8
|
-
|
9
|
-
require 'gst'
|
10
|
-
|
11
|
-
def parse(argv)
|
12
|
-
options = OpenStruct.new
|
13
|
-
options.print_all = false
|
14
|
-
options.print_auto_install_info = false
|
15
|
-
|
16
|
-
opts = OptionParser.new do |opts|
|
17
|
-
opts.banner += " [ELEMENT-NAME|PLUGIN-NAME]"
|
18
|
-
|
19
|
-
opts.version = Gst.version
|
20
|
-
|
21
|
-
opts.separator("")
|
22
|
-
opts.on("-a", "--print-all", "Print all elements") do
|
23
|
-
options.print_all = true
|
24
|
-
end
|
25
|
-
|
26
|
-
opts.on("--print-plugin-auto-install-info",
|
27
|
-
"Print a machine-parsable list of features",
|
28
|
-
"the specified plugin provides.",
|
29
|
-
"Useful in connection with external",
|
30
|
-
"automatic plugin installation mechanisms") do
|
31
|
-
options.print_auto_install_info = true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
opts.parse!(argv)
|
35
|
-
|
36
|
-
[options, argv.first]
|
37
|
-
end
|
38
|
-
|
39
|
-
class Inspector
|
40
|
-
def initialize
|
41
|
-
@prefix = ""
|
42
|
-
end
|
43
|
-
|
44
|
-
def print_list(print_all)
|
45
|
-
plugins = {}
|
46
|
-
n_features = 0
|
47
|
-
each_feature do |plugin, feature|
|
48
|
-
plugins[plugin.name] = nil
|
49
|
-
n_features += 1
|
50
|
-
if print_all
|
51
|
-
if feature.is_a?(Gst::ElementFactory)
|
52
|
-
print_element_factory(feature, true)
|
53
|
-
end
|
54
|
-
else
|
55
|
-
print_feature(plugin, feature)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
puts
|
59
|
-
puts("Total count: #{plugins.size} plugins, #{n_features} features")
|
60
|
-
end
|
61
|
-
|
62
|
-
def print_element(name)
|
63
|
-
factory = Gst::ElementFactory.find(name)
|
64
|
-
print_element_factory(factory, false)
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
def puts(*args)
|
69
|
-
if args.empty?
|
70
|
-
super(@prefix)
|
71
|
-
else
|
72
|
-
super(*(args.collect {|arg| "#{@prefix}#{arg}"}))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def prefix(new_prefix)
|
77
|
-
prefix, @prefix = @prefix, new_prefix
|
78
|
-
yield
|
79
|
-
ensure
|
80
|
-
@prefix = prefix
|
81
|
-
end
|
82
|
-
|
83
|
-
def each_feature
|
84
|
-
registry = Gst::Registry.default
|
85
|
-
registry.plugins.sort_by {|plugin| plugin.name}.each do |plugin|
|
86
|
-
features = registry.get_features(plugin.name)
|
87
|
-
features.sort_by {|feature| feature.name}.each do |feature|
|
88
|
-
yield(plugin, feature)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def print_factory_details_info(factory)
|
94
|
-
rank_name = factory.rank.name
|
95
|
-
rank_name ||= "unknown"
|
96
|
-
rank_name = rank_name.gsub(/GST_RANK_/, '').downcase
|
97
|
-
|
98
|
-
puts("Factory Details:",
|
99
|
-
" Long name:\t#{factory.long_name}",
|
100
|
-
" Class:\t#{factory.klass}",
|
101
|
-
" Description:\t#{factory.description}",
|
102
|
-
" Author(s):\t#{factory.author}",
|
103
|
-
" Rank:\t\t#{rank_name} (#{factory.rank.to_i})",
|
104
|
-
"")
|
105
|
-
end
|
106
|
-
|
107
|
-
def print_plugin_info(name)
|
108
|
-
return if name.nil?
|
109
|
-
registry = Gst::Registry.default
|
110
|
-
plugin = registry.find_plugin(name)
|
111
|
-
return if plugin.nil?
|
112
|
-
|
113
|
-
puts("Plugin Details:",
|
114
|
-
" Name:\t\t\t#{plugin.name}",
|
115
|
-
" Description:\t\t#{plugin.description}",
|
116
|
-
" Filename:\t\t#{plugin.filename || '(null)'}",
|
117
|
-
" Version:\t\t#{plugin.version}",
|
118
|
-
" License:\t\t#{plugin.license}",
|
119
|
-
" Source module:\t#{plugin.source}",
|
120
|
-
" Binary package:\t#{plugin.package}",
|
121
|
-
" Origin URL:\t\t#{plugin.origin}",
|
122
|
-
"")
|
123
|
-
end
|
124
|
-
|
125
|
-
def print_hierarchy(element)
|
126
|
-
ancestors = []
|
127
|
-
type = element.gtype
|
128
|
-
while type
|
129
|
-
ancestors << type
|
130
|
-
type = type.parent
|
131
|
-
end
|
132
|
-
ancestors.reverse.each_with_index do |klass, i|
|
133
|
-
if i.zero?
|
134
|
-
mark = ""
|
135
|
-
else
|
136
|
-
mark = " " + (" " * (i - 1)) + "+----"
|
137
|
-
end
|
138
|
-
puts("#{mark}#{klass.name}")
|
139
|
-
end
|
140
|
-
puts
|
141
|
-
end
|
142
|
-
|
143
|
-
def print_interfaces(element)
|
144
|
-
interfaces = element.gtype.interfaces
|
145
|
-
return if interfaces.empty?
|
146
|
-
|
147
|
-
puts("Implemented Interfaces:")
|
148
|
-
interfaces.each do |interface|
|
149
|
-
puts(" #{interface.name}")
|
150
|
-
end
|
151
|
-
puts
|
152
|
-
end
|
153
|
-
|
154
|
-
def print_caps(caps)
|
155
|
-
if caps.any?
|
156
|
-
puts("ANY")
|
157
|
-
return
|
158
|
-
end
|
159
|
-
if caps.empty?
|
160
|
-
puts("EMPTY")
|
161
|
-
return
|
162
|
-
end
|
163
|
-
|
164
|
-
caps.each do |structure|
|
165
|
-
puts(structure.name)
|
166
|
-
structure.each do |key, value|
|
167
|
-
puts(" %15s: %s" % [key, value.inspect])
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def print_pad_template_info(template)
|
173
|
-
prefix("#{@prefix} ") do
|
174
|
-
puts("#{template.direction.nick.upcase} template: '#{template.name}'")
|
175
|
-
prefix("#{@prefix} ") do
|
176
|
-
if template.presence == Gst::Pad::REQUEST
|
177
|
-
puts("Availability: On request")
|
178
|
-
else
|
179
|
-
puts("Availability: #{template.presence.nick.capitalize}")
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
static_caps = template.caps
|
185
|
-
return if static_caps.description.nil?
|
186
|
-
prefix("#{@prefix} ") do
|
187
|
-
puts("Capabilities:")
|
188
|
-
prefix("#{@prefix} ") do
|
189
|
-
print_caps(static_caps.to_caps)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
puts
|
193
|
-
end
|
194
|
-
|
195
|
-
def print_pad_templates_info(element, factory)
|
196
|
-
puts("Pad Templates:")
|
197
|
-
templates = factory.pad_templates
|
198
|
-
|
199
|
-
if templates.empty?
|
200
|
-
puts(" none")
|
201
|
-
return
|
202
|
-
end
|
203
|
-
|
204
|
-
templates.each do |template|
|
205
|
-
print_pad_template_info(template)
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
def print_element_flag_info(element)
|
210
|
-
puts("Element Flags")
|
211
|
-
puts(" no flags set")
|
212
|
-
puts
|
213
|
-
|
214
|
-
return unless element.is_a?(Gst::Bin)
|
215
|
-
puts("Bin Flags:")
|
216
|
-
puts(" no flags set")
|
217
|
-
puts
|
218
|
-
end
|
219
|
-
|
220
|
-
def print_implementation_info(element)
|
221
|
-
puts("Element Implementation:")
|
222
|
-
puts(" not supported")
|
223
|
-
puts
|
224
|
-
end
|
225
|
-
|
226
|
-
def print_clocking_info(element)
|
227
|
-
if !element.require_clock? and
|
228
|
-
!element.provide_clock? and
|
229
|
-
element.clock.nil?
|
230
|
-
puts("Element has no clocking capabilities.")
|
231
|
-
puts
|
232
|
-
return
|
233
|
-
end
|
234
|
-
|
235
|
-
puts("Clocking Interaction:")
|
236
|
-
puts(" element requires a clock") if element.require_clock?
|
237
|
-
if element.provide_clock?
|
238
|
-
clock = element.clock
|
239
|
-
if clock.nil?
|
240
|
-
puts(" element is supported tot provide a clock but returned nil")
|
241
|
-
else
|
242
|
-
puts(" element provides a clock: #{clock.name}")
|
243
|
-
end
|
244
|
-
end
|
245
|
-
puts
|
246
|
-
end
|
247
|
-
|
248
|
-
def print_index_info(element)
|
249
|
-
if element.indexable?
|
250
|
-
puts("Indexing capabilities:")
|
251
|
-
puts(" element can do indexing")
|
252
|
-
else
|
253
|
-
puts("Element has no indexing capabilities.")
|
254
|
-
end
|
255
|
-
puts
|
256
|
-
end
|
257
|
-
|
258
|
-
def print_pad_info(element)
|
259
|
-
puts("Pads:")
|
260
|
-
pads = element.pads
|
261
|
-
if pads.empty?
|
262
|
-
puts(" none")
|
263
|
-
return
|
264
|
-
end
|
265
|
-
|
266
|
-
pads.each do |pad|
|
267
|
-
prefix("#{@prefix} ") do
|
268
|
-
puts("#{pad.direction.nick.upcase}: '#{pad.name}'")
|
269
|
-
prefix("#{@prefix} ") do
|
270
|
-
template = pad.template
|
271
|
-
puts("Pad Template: '#{template.name}'") if template
|
272
|
-
|
273
|
-
caps = pad.caps
|
274
|
-
break if caps.nil?
|
275
|
-
puts("Capabilities:")
|
276
|
-
prefix("#{@prefix} ") do
|
277
|
-
print_caps(caps)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
puts
|
283
|
-
end
|
284
|
-
|
285
|
-
def print_element_properties_info(element)
|
286
|
-
puts("Element Properties:")
|
287
|
-
properties = element.class.properties
|
288
|
-
if properties.empty?
|
289
|
-
puts(" none")
|
290
|
-
return
|
291
|
-
end
|
292
|
-
|
293
|
-
properties.each do |name|
|
294
|
-
param = element.class.property(name)
|
295
|
-
puts(" %-20s: %s" % [param.name, param.blurb])
|
296
|
-
|
297
|
-
flags = []
|
298
|
-
flags << "readable" if param.readable?
|
299
|
-
flags << "writable" if param.writable?
|
300
|
-
# flags << "controllable" if param.controllable?
|
301
|
-
|
302
|
-
prefix("#{@prefix}#{' ' * 23} ") do
|
303
|
-
puts("flags: #{flags.join(', ')}")
|
304
|
-
type_name = param.value_type.name
|
305
|
-
if param.readable?
|
306
|
-
current_value = element.get_property(name)
|
307
|
-
value = "Default: #{param.default.inspect} "
|
308
|
-
value << "Current: #{current_value.inspect}"
|
309
|
-
end
|
310
|
-
write_only = param.readable? ? "" : " Write only"
|
311
|
-
puts("#{type_name}. #{value}#{write_only}")
|
312
|
-
end
|
313
|
-
end
|
314
|
-
puts
|
315
|
-
end
|
316
|
-
|
317
|
-
def print_signal_info(element, signal)
|
318
|
-
args = ["object(#{element.class})"]
|
319
|
-
signal.param_types.each_with_index do |name, i|
|
320
|
-
args << "arg#{i}(#{name})"
|
321
|
-
end
|
322
|
-
args = args.join(", ")
|
323
|
-
signature = "{|#{args}| ...} # => #{signal.return_type}"
|
324
|
-
puts(" #{signal.name.inspect}: #{signature}")
|
325
|
-
end
|
326
|
-
|
327
|
-
def print_signals_info(element)
|
328
|
-
signals = []
|
329
|
-
actions = []
|
330
|
-
element.class.signals.each do |name|
|
331
|
-
signal = element.class.signal(name)
|
332
|
-
next if signal.owner >= Gst::Element
|
333
|
-
if signal.action?
|
334
|
-
actions << signal
|
335
|
-
else
|
336
|
-
signals << signal
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
[[signals, "Signals"],
|
341
|
-
[actions, "Actions"]].each do |target_signals, description|
|
342
|
-
unless target_signals.empty?
|
343
|
-
puts("Element #{description}:")
|
344
|
-
target_signals.each do |signal|
|
345
|
-
print_signal_info(element, signal)
|
346
|
-
end
|
347
|
-
end
|
348
|
-
end
|
349
|
-
puts
|
350
|
-
end
|
351
|
-
|
352
|
-
def print_children_info(element)
|
353
|
-
return unless element.is_a?(Gst::Bin)
|
354
|
-
children = element.children
|
355
|
-
return if children.empty?
|
356
|
-
|
357
|
-
puts("Children:")
|
358
|
-
children.each do |child|
|
359
|
-
puts(" #{child.name}")
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
|
-
def print_element_factory(factory, print_names)
|
364
|
-
if !factory.load!
|
365
|
-
puts("element plugin (#{factory.name}) couldn't be loaded\n")
|
366
|
-
return
|
367
|
-
end
|
368
|
-
|
369
|
-
element = factory.create
|
370
|
-
|
371
|
-
prefix(print_names ? "#{factory.name}: " : "") do
|
372
|
-
print_factory_details_info(factory)
|
373
|
-
print_plugin_info(factory.plugin_name)
|
374
|
-
|
375
|
-
print_hierarchy(element)
|
376
|
-
print_interfaces(element)
|
377
|
-
|
378
|
-
print_pad_templates_info(element, factory)
|
379
|
-
print_element_flag_info(element)
|
380
|
-
print_implementation_info(element)
|
381
|
-
print_clocking_info(element)
|
382
|
-
print_index_info(element)
|
383
|
-
print_pad_info(element)
|
384
|
-
print_element_properties_info(element)
|
385
|
-
print_signals_info(element)
|
386
|
-
print_children_info(element)
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
def print_feature(plugin, feature)
|
391
|
-
prefix("#{plugin.name}: #{feature.name}") do
|
392
|
-
case feature
|
393
|
-
when Gst::ElementFactory
|
394
|
-
puts(": #{feature.long_name}")
|
395
|
-
when Gst::IndexFactory
|
396
|
-
puts(": #{feature.description}")
|
397
|
-
when Gst::TypeFindFactory
|
398
|
-
if feature.extensions.empty?
|
399
|
-
message = "no extensions"
|
400
|
-
else
|
401
|
-
message = feature.extensions.join(", ")
|
402
|
-
end
|
403
|
-
puts(": #{message}")
|
404
|
-
else
|
405
|
-
puts(" (#{feature.gtype})")
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
409
|
-
end
|
410
|
-
|
411
|
-
options, element_name = parse(argv)
|
412
|
-
inspector = Inspector.new
|
413
|
-
if element_name
|
414
|
-
inspector.print_element(element_name)
|
415
|
-
else
|
416
|
-
inspector.print_list(options.print_all)
|
417
|
-
end
|
data/sample/install-plugins.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
require 'gtk2'
|
5
|
-
require 'gst'
|
6
|
-
|
7
|
-
def usage
|
8
|
-
$stderr.puts "Usage: #{$0} uri"
|
9
|
-
exit 1
|
10
|
-
end
|
11
|
-
|
12
|
-
usage unless ARGV.length==1
|
13
|
-
|
14
|
-
playbin=Gst::ElementFactory.make('playbin')
|
15
|
-
playbin.ready
|
16
|
-
playbin.bus.add_watch {|bus, message|
|
17
|
-
case message
|
18
|
-
when Gst::MessageError
|
19
|
-
$stderr.puts "ERROR: "+message.parse.to_s
|
20
|
-
when Gst::MissingMessage
|
21
|
-
puts "Installer detail: "+message.installer_detail.to_s
|
22
|
-
if Gst::InstallPlugins.supported?
|
23
|
-
context=Gst::InstallPluginsContext.new
|
24
|
-
Gst::InstallPlugins.async([message.installer_detail], context){|ret| p ret}
|
25
|
-
else
|
26
|
-
$stderr.puts "Plugins installation is not supported."
|
27
|
-
end
|
28
|
-
end
|
29
|
-
true
|
30
|
-
}
|
31
|
-
playbin.uri=ARGV[0]
|
32
|
-
playbin.play
|
33
|
-
|
34
|
-
label=Gtk::Label.new(ARGV[0])
|
35
|
-
window=Gtk::Window.new
|
36
|
-
window.add(label)
|
37
|
-
window.show_all
|
38
|
-
window.signal_connect('delete-event'){playbin.stop; Gtk.main_quit}
|
39
|
-
|
40
|
-
Gtk.main
|
data/sample/media-type.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
|
2
|
-
# This program uses the media-info library to display information
|
3
|
-
# embedded in media files (tags in MP3/OGG files for instance).
|
4
|
-
|
5
|
-
require 'gst'
|
6
|
-
|
7
|
-
def print_hash(hash)
|
8
|
-
hash.each { |key, val| puts " #{key}: #{val}" }
|
9
|
-
end
|
10
|
-
|
11
|
-
def print_info(stream)
|
12
|
-
puts "- mime type: #{stream.mime}"
|
13
|
-
puts "- length: #{stream.length_time / Gst::SECOND} seconds"
|
14
|
-
puts "- bitrate: #{stream.bitrate / 1000.0} kbps"
|
15
|
-
puts "- number of tracks: #{stream.length_tracks}"
|
16
|
-
i = 0
|
17
|
-
stream.tracks.each do |x|
|
18
|
-
puts "- track #{i += 1}:"
|
19
|
-
puts " - metadata:"
|
20
|
-
if hash = x.metadata
|
21
|
-
print_hash(hash)
|
22
|
-
end
|
23
|
-
puts " - streaminfo:"
|
24
|
-
if hash = x.streaminfo
|
25
|
-
print_hash(hash)
|
26
|
-
end
|
27
|
-
puts " - format:"
|
28
|
-
if caps = x.format
|
29
|
-
caps.length.times { |i| print_hash(caps.get_structure(i)) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
Gst.init
|
35
|
-
|
36
|
-
if ARGV.empty?
|
37
|
-
$stderr.puts "Usage: #{__FILE__} files..."
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
|
41
|
-
begin
|
42
|
-
info = Gst::MediaInfo.new
|
43
|
-
info.source = "filesrc"
|
44
|
-
|
45
|
-
ARGV.each do |x|
|
46
|
-
if stream = info.read(x)
|
47
|
-
print_info(stream)
|
48
|
-
else
|
49
|
-
$stderr.puts "No media info found for file #{x}."
|
50
|
-
end
|
51
|
-
end
|
52
|
-
rescue => e
|
53
|
-
$stderr.puts "Media error: #{e}."
|
54
|
-
exit 1
|
55
|
-
end
|