gstreamer 0.90.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1157 -0
- data/README +33 -0
- data/Rakefile +15 -0
- data/ext/gstreamer/Makefile +162 -0
- data/ext/gstreamer/depend +5 -0
- data/ext/gstreamer/extconf.rb +63 -0
- data/ext/gstreamer/gst.so +0 -0
- data/ext/gstreamer/misc.c +62 -0
- data/ext/gstreamer/misc.o +0 -0
- data/ext/gstreamer/rbgst-bin.c +466 -0
- data/ext/gstreamer/rbgst-bin.o +0 -0
- data/ext/gstreamer/rbgst-buffer.c +365 -0
- data/ext/gstreamer/rbgst-buffer.o +0 -0
- data/ext/gstreamer/rbgst-bus.c +92 -0
- data/ext/gstreamer/rbgst-bus.o +0 -0
- data/ext/gstreamer/rbgst-caps.c +441 -0
- data/ext/gstreamer/rbgst-caps.o +0 -0
- data/ext/gstreamer/rbgst-child-proxy.c +33 -0
- data/ext/gstreamer/rbgst-child-proxy.o +0 -0
- data/ext/gstreamer/rbgst-clock.c +108 -0
- data/ext/gstreamer/rbgst-clock.o +0 -0
- data/ext/gstreamer/rbgst-element-factory.c +255 -0
- data/ext/gstreamer/rbgst-element-factory.o +0 -0
- data/ext/gstreamer/rbgst-element.c +1053 -0
- data/ext/gstreamer/rbgst-element.o +0 -0
- data/ext/gstreamer/rbgst-event.c +351 -0
- data/ext/gstreamer/rbgst-event.o +0 -0
- data/ext/gstreamer/rbgst-ghost-pad.c +42 -0
- data/ext/gstreamer/rbgst-ghost-pad.o +0 -0
- data/ext/gstreamer/rbgst-index-factory.c +67 -0
- data/ext/gstreamer/rbgst-index-factory.o +0 -0
- data/ext/gstreamer/rbgst-message.c +784 -0
- data/ext/gstreamer/rbgst-message.o +0 -0
- data/ext/gstreamer/rbgst-mini-object.c +220 -0
- data/ext/gstreamer/rbgst-mini-object.o +0 -0
- data/ext/gstreamer/rbgst-object.c +81 -0
- data/ext/gstreamer/rbgst-object.o +0 -0
- data/ext/gstreamer/rbgst-pad-template.c +124 -0
- data/ext/gstreamer/rbgst-pad-template.o +0 -0
- data/ext/gstreamer/rbgst-pad.c +338 -0
- data/ext/gstreamer/rbgst-pad.o +0 -0
- data/ext/gstreamer/rbgst-pipeline.c +90 -0
- data/ext/gstreamer/rbgst-pipeline.o +0 -0
- data/ext/gstreamer/rbgst-plugin-feature.c +134 -0
- data/ext/gstreamer/rbgst-plugin-feature.o +0 -0
- data/ext/gstreamer/rbgst-plugin.c +164 -0
- data/ext/gstreamer/rbgst-plugin.o +0 -0
- data/ext/gstreamer/rbgst-private.c +89 -0
- data/ext/gstreamer/rbgst-private.h +37 -0
- data/ext/gstreamer/rbgst-private.o +0 -0
- data/ext/gstreamer/rbgst-query.c +289 -0
- data/ext/gstreamer/rbgst-query.o +0 -0
- data/ext/gstreamer/rbgst-seek.c +36 -0
- data/ext/gstreamer/rbgst-seek.o +0 -0
- data/ext/gstreamer/rbgst-static-caps.c +49 -0
- data/ext/gstreamer/rbgst-static-caps.o +0 -0
- data/ext/gstreamer/rbgst-static-pad-template.c +64 -0
- data/ext/gstreamer/rbgst-static-pad-template.o +0 -0
- data/ext/gstreamer/rbgst-structure.c +300 -0
- data/ext/gstreamer/rbgst-structure.o +0 -0
- data/ext/gstreamer/rbgst-system-clock.c +45 -0
- data/ext/gstreamer/rbgst-system-clock.o +0 -0
- data/ext/gstreamer/rbgst-type-find-factory.c +124 -0
- data/ext/gstreamer/rbgst-type-find-factory.o +0 -0
- data/ext/gstreamer/rbgst-value.c +517 -0
- data/ext/gstreamer/rbgst-value.o +0 -0
- data/ext/gstreamer/rbgst-x-overlay.c +132 -0
- data/ext/gstreamer/rbgst-x-overlay.o +0 -0
- data/ext/gstreamer/rbgst.c +279 -0
- data/ext/gstreamer/rbgst.h +197 -0
- data/ext/gstreamer/rbgst.o +0 -0
- data/ext/gstreamer/rbgstclockentry.c +268 -0
- data/ext/gstreamer/rbgstclockentry.o +0 -0
- data/ext/gstreamer/rbgstformat.c +159 -0
- data/ext/gstreamer/rbgstformat.o +0 -0
- data/ext/gstreamer/rbgstindex.c +314 -0
- data/ext/gstreamer/rbgstindex.o +0 -0
- data/ext/gstreamer/rbgstindexentry.c +96 -0
- data/ext/gstreamer/rbgstindexentry.o +0 -0
- data/ext/gstreamer/rbgstparse.c +66 -0
- data/ext/gstreamer/rbgstparse.o +0 -0
- data/ext/gstreamer/rbgstquerytype.c +159 -0
- data/ext/gstreamer/rbgstquerytype.o +0 -0
- data/ext/gstreamer/rbgstregistry.c +278 -0
- data/ext/gstreamer/rbgstregistry.o +0 -0
- data/ext/gstreamer/rbgsttag.c +111 -0
- data/ext/gstreamer/rbgsttag.o +0 -0
- data/ext/gstreamer/rbgsttagsetter.c +50 -0
- data/ext/gstreamer/rbgsttagsetter.o +0 -0
- data/ext/gstreamer/rbgstxml.c +189 -0
- data/ext/gstreamer/rbgstxml.o +0 -0
- data/ext/gstreamer/ruby-gstreamer.pc +3 -0
- data/extconf.rb +49 -0
- data/lib/gst.rb +19 -0
- data/sample/audio-player.rb +54 -0
- data/sample/gst-inspect.rb +417 -0
- data/sample/media-type.rb +55 -0
- data/sample/media-type2.rb +268 -0
- data/sample/ogg-audio-player.rb +54 -0
- data/sample/type-find.rb +46 -0
- data/sample/video-player.rb +57 -0
- data/sample/xml-player.rb +60 -0
- data/test/gst-test-utils.rb +18 -0
- data/test/run-test.rb +25 -0
- data/test/test_bin.rb +167 -0
- data/test/test_buffer.rb +174 -0
- data/test/test_caps.rb +24 -0
- data/test/test_clock.rb +7 -0
- data/test/test_element.rb +87 -0
- data/test/test_element_factory.rb +28 -0
- data/test/test_event.rb +10 -0
- data/test/test_index_factory.rb +7 -0
- data/test/test_message.rb +191 -0
- data/test/test_mini_object.rb +38 -0
- data/test/test_object.rb +10 -0
- data/test/test_pad.rb +68 -0
- data/test/test_plugin.rb +6 -0
- data/test/test_plugin_feature.rb +20 -0
- data/test/test_seek.rb +17 -0
- data/test/test_static_caps.rb +18 -0
- data/test/test_static_pad_template.rb +16 -0
- data/test/test_structure.rb +159 -0
- data/test/test_thread_handling.rb +58 -0
- data/test/test_type_find_factory.rb +8 -0
- data/test/test_value.rb +69 -0
- metadata +208 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
module GstTestUtils
|
2
|
+
private
|
3
|
+
def only_gst_version(major, minor, micro)
|
4
|
+
unless Gst.check_version?(major, minor, micro)
|
5
|
+
omit("Require GStreamer >= #{major}.#{minor}.#{micro}")
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def find_element_factory(name)
|
10
|
+
factory = Gst::ElementFactory.find(name)
|
11
|
+
assert_not_nil(factory, "#{name}'s factory should be found.")
|
12
|
+
factory
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_element(element_name, name=nil)
|
16
|
+
find_element_factory(element_name).create(name)
|
17
|
+
end
|
18
|
+
end
|
data/test/run-test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# ENV["GST_DEBUG"] = "GST_BUFFER:5"
|
4
|
+
|
5
|
+
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
6
|
+
|
7
|
+
if system("which make > /dev/null")
|
8
|
+
system("cd #{base_dir.dump} && make > /dev/null") or exit(1)
|
9
|
+
end
|
10
|
+
|
11
|
+
glib_dir = File.expand_path(File.join(base_dir, "..", "glib2"))
|
12
|
+
$LOAD_PATH.unshift(File.join(glib_dir, "test"))
|
13
|
+
require 'glib-test-init'
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift(File.join(glib_dir, "ext", "glib2"))
|
16
|
+
$LOAD_PATH.unshift(File.join(glib_dir, "lib"))
|
17
|
+
|
18
|
+
$LOAD_PATH.unshift(File.join(base_dir, "src"))
|
19
|
+
$LOAD_PATH.unshift(File.join(base_dir, "src", "lib"))
|
20
|
+
require "gst"
|
21
|
+
|
22
|
+
$LOAD_PATH.unshift(File.join(base_dir, "test"))
|
23
|
+
require 'gst-test-utils'
|
24
|
+
|
25
|
+
exit Test::Unit::AutoRunner.run(true)
|
data/test/test_bin.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
class TestBin < Test::Unit::TestCase
|
2
|
+
include GstTestUtils
|
3
|
+
|
4
|
+
def test_children
|
5
|
+
bin = Gst::Bin.new
|
6
|
+
|
7
|
+
element = create_element("filesink")
|
8
|
+
no_interface_element = create_element("fakesink")
|
9
|
+
bin << element << no_interface_element
|
10
|
+
|
11
|
+
assert_equal([no_interface_element, element], bin.children)
|
12
|
+
assert_equal([element], bin.children(Gst::ElementURIHandler))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_size
|
16
|
+
bin = Gst::Bin.new
|
17
|
+
assert_equal(0, bin.size)
|
18
|
+
bin << create_element("fakesink")
|
19
|
+
assert_equal(1, bin.size)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_children_cookie
|
23
|
+
bin = Gst::Bin.new
|
24
|
+
cookie = bin.children_cookie
|
25
|
+
assert_equal(cookie, bin.children_cookie)
|
26
|
+
bin << create_element("fakesink")
|
27
|
+
assert_not_equal(cookie, bin.children_cookie)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_child_bus
|
31
|
+
bin = Gst::Bin.new
|
32
|
+
assert_not_nil(bin.child_bus)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_messages
|
36
|
+
bin = Gst::Bin.new
|
37
|
+
assert_equal([], bin.messages)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_polling?
|
41
|
+
bin = Gst::Bin.new
|
42
|
+
assert(!bin.polling?)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_clock_dirty?
|
46
|
+
bin = Gst::Bin.new
|
47
|
+
assert(!bin.clock_dirty?)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_provided_clock
|
51
|
+
bin = Gst::Bin.new
|
52
|
+
assert_nil(bin.provided_clock)
|
53
|
+
bin.provided_clock = Gst::SystemClock.new
|
54
|
+
assert_not_nil(bin.provided_clock)
|
55
|
+
bin.provided_clock = nil
|
56
|
+
assert_nil(bin.provided_clock)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_clock_provider
|
60
|
+
bin = Gst::Bin.new
|
61
|
+
assert_nil(bin.clock_provider)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_add
|
65
|
+
bin = Gst::Bin.new
|
66
|
+
element = create_element("fakesink")
|
67
|
+
bin << element
|
68
|
+
assert_equal(element, bin.children[0])
|
69
|
+
assert_raise(TypeError) do
|
70
|
+
bin << "XXX"
|
71
|
+
end
|
72
|
+
|
73
|
+
element2 = create_element("fakesink")
|
74
|
+
element3 = create_element("fakesink")
|
75
|
+
bin.add(element2, element3)
|
76
|
+
assert_equal([element3, element2], bin.children[0, 2])
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_remove
|
80
|
+
bin = Gst::Bin.new
|
81
|
+
element1 = create_element("fakesink")
|
82
|
+
element2 = create_element("fakesink")
|
83
|
+
bin << element1 << element2
|
84
|
+
assert_equal(2, bin.size)
|
85
|
+
bin.remove(element1, element2)
|
86
|
+
assert_equal(0, bin.size)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_clear
|
90
|
+
bin = Gst::Bin.new
|
91
|
+
element1 = create_element("fakesink")
|
92
|
+
element2 = create_element("fakesink")
|
93
|
+
bin << element1 << element2
|
94
|
+
assert_equal(2, bin.size)
|
95
|
+
bin.clear
|
96
|
+
assert_equal(0, bin.size)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_refer_by_name
|
100
|
+
bin = Gst::Bin.new
|
101
|
+
sub_bin = Gst::Bin.new
|
102
|
+
bin << sub_bin
|
103
|
+
|
104
|
+
element = create_element("fakesink")
|
105
|
+
assert_nil(bin.get_child(element.name))
|
106
|
+
assert_nil(sub_bin.get_child(element.name))
|
107
|
+
assert_nil(sub_bin.get_child(element.name, true))
|
108
|
+
|
109
|
+
bin << element
|
110
|
+
assert_equal(element, bin.get_child(element.name))
|
111
|
+
assert_equal(element, bin.get_child(element.name, true))
|
112
|
+
assert_nil(sub_bin.get_child(element.name))
|
113
|
+
assert_equal(element, sub_bin.get_child(element.name, true))
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_refer_by_interface
|
117
|
+
bin = Gst::Bin.new
|
118
|
+
element = create_element("filesink")
|
119
|
+
|
120
|
+
assert_nil(bin.get_child(Gst::ElementURIHandler))
|
121
|
+
|
122
|
+
bin << create_element("fakesink")
|
123
|
+
assert_nil(bin.get_child(Gst::ElementURIHandler))
|
124
|
+
|
125
|
+
bin << element
|
126
|
+
assert_equal(element, bin.get_child(Gst::ElementURIHandler))
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_refer_by_index
|
130
|
+
bin = Gst::Bin.new
|
131
|
+
element1 = create_element("filesink")
|
132
|
+
element2 = create_element("fakesink")
|
133
|
+
|
134
|
+
assert_nil(bin.get_child(0))
|
135
|
+
assert_nil(bin.get_child(1))
|
136
|
+
assert_nil(bin.get_child(2))
|
137
|
+
|
138
|
+
bin << element1 << element2
|
139
|
+
assert_equal(element2, bin.get_child(0))
|
140
|
+
assert_equal(element1, bin.get_child(1))
|
141
|
+
assert_nil(bin.get_child(2))
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_sinks
|
145
|
+
bin = Gst::Bin.new
|
146
|
+
sink1 = create_element("filesink")
|
147
|
+
sink2 = create_element("fakesink")
|
148
|
+
src = create_element("fakesrc")
|
149
|
+
|
150
|
+
assert_equal([], bin.sinks)
|
151
|
+
|
152
|
+
bin << src << sink1 << sink2
|
153
|
+
assert_equal([sink2, sink1], bin.sinks)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_sources
|
157
|
+
bin = Gst::Bin.new
|
158
|
+
src1 = create_element("filesrc")
|
159
|
+
src2 = create_element("fakesrc")
|
160
|
+
sink = create_element("fakesink")
|
161
|
+
|
162
|
+
assert_equal([], bin.sources)
|
163
|
+
|
164
|
+
bin << src1 << src2 << sink
|
165
|
+
assert_equal([src2, src1], bin.sources)
|
166
|
+
end
|
167
|
+
end
|
data/test/test_buffer.rb
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
class TestBuffer < Test::Unit::TestCase
|
2
|
+
def test_create_mini_object
|
3
|
+
assert_nothing_raised do
|
4
|
+
Gst::Buffer.new
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_flag
|
9
|
+
buffer = Gst::Buffer.new
|
10
|
+
|
11
|
+
assert_nothing_raised do
|
12
|
+
buffer.raise_flag(:preroll)
|
13
|
+
end
|
14
|
+
assert(!buffer.flag_raised?(:discont))
|
15
|
+
assert_nothing_raised do
|
16
|
+
buffer.lower_flag(:in_caps)
|
17
|
+
end
|
18
|
+
|
19
|
+
buffer.flags = [:gap, :delta_unit]
|
20
|
+
assert_equal(Gst::Buffer::FLAG_GAP | Gst::Buffer::FLAG_DELTA_UNIT,
|
21
|
+
buffer.flags)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_size
|
25
|
+
assert_equal(0, Gst::Buffer.new.size)
|
26
|
+
buffer = Gst::Buffer.new(5)
|
27
|
+
assert_equal(5, buffer.size)
|
28
|
+
buffer.size = 3
|
29
|
+
assert_equal(3, buffer.size)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_data
|
33
|
+
buffer = Gst::Buffer.new
|
34
|
+
assert_equal([nil, 0], [buffer.data, buffer.size])
|
35
|
+
buffer.data = "XXX"
|
36
|
+
assert_equal(["XXX", 3], [buffer.data, buffer.size])
|
37
|
+
buffer.data = nil
|
38
|
+
assert_equal([nil, 0], [buffer.data, buffer.size])
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_timestamp
|
42
|
+
buffer = Gst::Buffer.new
|
43
|
+
assert_equal(Gst::ClockTime::NONE, buffer.timestamp)
|
44
|
+
assert(!buffer.valid_timestamp?)
|
45
|
+
|
46
|
+
timestamp = Time.now.to_i * Gst::NSECOND
|
47
|
+
buffer.timestamp = timestamp
|
48
|
+
assert_equal(timestamp, buffer.timestamp)
|
49
|
+
assert(buffer.valid_timestamp?)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_duration
|
53
|
+
buffer = Gst::Buffer.new
|
54
|
+
assert_equal(Gst::ClockTime::NONE, buffer.duration)
|
55
|
+
assert(!buffer.valid_duration?)
|
56
|
+
|
57
|
+
duration = 10 * 60 * Gst::NSECOND
|
58
|
+
buffer.duration = duration
|
59
|
+
assert_equal(duration, buffer.duration)
|
60
|
+
assert(buffer.valid_duration?)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_caps
|
64
|
+
buffer = Gst::Buffer.new
|
65
|
+
assert_nil(buffer.caps)
|
66
|
+
|
67
|
+
caps = Gst::Caps.new
|
68
|
+
buffer.caps = caps
|
69
|
+
assert_equal(caps, buffer.caps)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_offset
|
73
|
+
buffer = Gst::Buffer.new
|
74
|
+
assert_equal(Gst::Buffer::OFFSET_NONE, buffer.offset)
|
75
|
+
assert(!buffer.valid_offset?)
|
76
|
+
|
77
|
+
offset = 10
|
78
|
+
buffer.offset = offset
|
79
|
+
assert_equal(offset, buffer.offset)
|
80
|
+
assert(buffer.valid_offset?)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_offset_end
|
84
|
+
buffer = Gst::Buffer.new
|
85
|
+
assert_equal(Gst::Buffer::OFFSET_NONE, buffer.offset_end)
|
86
|
+
assert(!buffer.valid_offset_end?)
|
87
|
+
|
88
|
+
offset_end = 10
|
89
|
+
buffer.offset_end = offset_end
|
90
|
+
assert_equal(offset_end, buffer.offset_end)
|
91
|
+
assert(buffer.valid_offset_end?)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_discontinuity
|
95
|
+
buffer = Gst::Buffer.new
|
96
|
+
assert(!buffer.discontinuity?)
|
97
|
+
|
98
|
+
buffer.raise_flag(:discont)
|
99
|
+
assert(buffer.discontinuity?)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_copy_flags
|
103
|
+
assert_equal(Gst::Buffer::CopyFlags::FLAGS |
|
104
|
+
Gst::Buffer::CopyFlags::TIMESTAMPS |
|
105
|
+
Gst::Buffer::CopyFlags::CAPS,
|
106
|
+
Gst::Buffer::CopyFlags::ALL)
|
107
|
+
|
108
|
+
assert_equal(Gst::Buffer::COPY_FLAGS |
|
109
|
+
Gst::Buffer::COPY_TIMESTAMPS |
|
110
|
+
Gst::Buffer::COPY_CAPS,
|
111
|
+
Gst::Buffer::COPY_ALL)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_copy_metadata
|
115
|
+
buffer = Gst::Buffer.new
|
116
|
+
buffer.flags = :discont
|
117
|
+
|
118
|
+
copied = buffer.copy_metadata(:all)
|
119
|
+
assert(copied.flag_raised?(:discont))
|
120
|
+
copied = buffer.copy_metadata(0)
|
121
|
+
assert(!copied.flag_raised?(:discont))
|
122
|
+
|
123
|
+
copied = Gst::Buffer.new
|
124
|
+
assert(!copied.flag_raised?(:discont))
|
125
|
+
buffer.copy_metadata(copied, :flags)
|
126
|
+
assert(copied.flag_raised?(:discont))
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_copy_metadata_with_readonly
|
130
|
+
buffer = Gst::Buffer.new
|
131
|
+
buffer.flags = :readonly
|
132
|
+
assert(!buffer.writable?)
|
133
|
+
|
134
|
+
copied = buffer.copy_metadata(:all)
|
135
|
+
assert(!copied.flag_raised?(:readonly))
|
136
|
+
assert(copied.writable?)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_metadata_writable
|
140
|
+
buffer = Gst::Buffer.new
|
141
|
+
assert(buffer.metadata_writable?)
|
142
|
+
buffer.metadata_writable!
|
143
|
+
# assert(buffer.metadata_writable?) # FIXME
|
144
|
+
|
145
|
+
buffer = Gst::Buffer.new
|
146
|
+
buffer.create_sub(0, 0)
|
147
|
+
assert(!buffer.metadata_writable?)
|
148
|
+
buffer.metadata_writable!
|
149
|
+
# assert(buffer.metadata_writable?) # FIXME
|
150
|
+
|
151
|
+
buffer = Gst::Buffer.new
|
152
|
+
sub = buffer.create_sub(0, 0)
|
153
|
+
assert(!sub.metadata_writable?)
|
154
|
+
sub.metadata_writable!
|
155
|
+
# assert(sub.metadata_writable?) # FIXME
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_span
|
159
|
+
buffer1 = Gst::Buffer.new(5)
|
160
|
+
buffer2 = Gst::Buffer.new(10)
|
161
|
+
|
162
|
+
length = 7
|
163
|
+
merged_buffer = buffer1.span(2, buffer2, length)
|
164
|
+
assert(length, merged_buffer.length)
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_span?
|
168
|
+
buffer = Gst::Buffer.new
|
169
|
+
sub_buffer1 = buffer.create_sub(0, 0)
|
170
|
+
sub_buffer2 = buffer.create_sub(0, 0)
|
171
|
+
assert(sub_buffer1.span?(sub_buffer2))
|
172
|
+
assert(!buffer.span?(sub_buffer1))
|
173
|
+
end
|
174
|
+
end
|
data/test/test_caps.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class TestCaps < Test::Unit::TestCase
|
2
|
+
def test_size
|
3
|
+
assert_equal(1, smpte_caps.size)
|
4
|
+
end
|
5
|
+
|
6
|
+
def test_get_structure
|
7
|
+
assert_equal("video/x-raw-yuv", smpte_caps[0].name)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_each
|
11
|
+
assert_equal(["video/x-raw-yuv"],
|
12
|
+
smpte_caps.collect {|structure| structure.name})
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def smpte_caps
|
17
|
+
smpte = Gst::ElementFactory.find("smpte")
|
18
|
+
assert_not_nil(smpte)
|
19
|
+
smpte.pad_templates.find do |template|
|
20
|
+
template.direction == Gst::Pad::SRC
|
21
|
+
end.caps.to_caps
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/test/test_clock.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
class TestElement < Test::Unit::TestCase
|
2
|
+
include GstTestUtils
|
3
|
+
|
4
|
+
class TestBin < Gst::Bin
|
5
|
+
type_register
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def test_clock
|
10
|
+
bin = create_element("playbin")
|
11
|
+
assert(bin.require_clock?)
|
12
|
+
assert(bin.provide_clock?)
|
13
|
+
assert_nil(bin.clock)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_each_pad
|
17
|
+
pads = []
|
18
|
+
create_element("filesrc").each_pad do |pad|
|
19
|
+
pads << pad.name
|
20
|
+
end
|
21
|
+
assert_equal(["src"], pads)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_state
|
25
|
+
pipeline = Gst::Pipeline.new
|
26
|
+
src = create_element("videotestsrc")
|
27
|
+
sink = create_element("fakesink")
|
28
|
+
pipeline.add(src, sink)
|
29
|
+
|
30
|
+
assert_equal([Gst::STATE_CHANGE_SUCCESS,
|
31
|
+
Gst::STATE_NULL,
|
32
|
+
Gst::STATE_VOID_PENDING],
|
33
|
+
pipeline.get_state)
|
34
|
+
|
35
|
+
pipeline.ready
|
36
|
+
assert_equal([Gst::STATE_CHANGE_SUCCESS,
|
37
|
+
Gst::STATE_READY,
|
38
|
+
Gst::STATE_VOID_PENDING],
|
39
|
+
pipeline.get_state)
|
40
|
+
|
41
|
+
pipeline.play
|
42
|
+
assert_equal([Gst::STATE_CHANGE_ASYNC,
|
43
|
+
Gst::STATE_READY,
|
44
|
+
Gst::STATE_PLAYING],
|
45
|
+
pipeline.get_state(10))
|
46
|
+
|
47
|
+
pipeline.pause
|
48
|
+
assert_equal([Gst::STATE_CHANGE_ASYNC,
|
49
|
+
Gst::STATE_READY,
|
50
|
+
Gst::STATE_PAUSED],
|
51
|
+
pipeline.get_state(10))
|
52
|
+
|
53
|
+
pipeline.stop
|
54
|
+
assert_equal([Gst::STATE_CHANGE_SUCCESS,
|
55
|
+
Gst::STATE_NULL,
|
56
|
+
Gst::STATE_VOID_PENDING],
|
57
|
+
pipeline.get_state(10))
|
58
|
+
|
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
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_query
|
69
|
+
pipeline = Gst::Pipeline.new
|
70
|
+
assert_boolean(pipeline.query(Gst::QueryFormats.new))
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_send_event
|
74
|
+
pipeline = Gst::Pipeline.new
|
75
|
+
assert_boolean(pipeline.send_event(Gst::EventEOS.new))
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_reference_counting
|
79
|
+
pipeline = Gst::Pipeline.new
|
80
|
+
bin = TestBin.new
|
81
|
+
|
82
|
+
10.times do
|
83
|
+
pipeline.add(bin)
|
84
|
+
pipeline.remove(bin)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|