gstreamer 1.2.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/test/test_buffer.rb
DELETED
@@ -1,185 +0,0 @@
|
|
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
|
-
structure = Gst::Structure.new("caps")
|
68
|
-
structure["width"] = 320
|
69
|
-
structure["height"] = 240
|
70
|
-
caps = Gst::Caps.new(structure)
|
71
|
-
buffer.caps = caps
|
72
|
-
assert_equal(caps, buffer.caps)
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_offset
|
76
|
-
buffer = Gst::Buffer.new
|
77
|
-
assert_equal(Gst::Buffer::OFFSET_NONE, buffer.offset)
|
78
|
-
assert(!buffer.valid_offset?)
|
79
|
-
|
80
|
-
offset = 10
|
81
|
-
buffer.offset = offset
|
82
|
-
assert_equal(offset, buffer.offset)
|
83
|
-
assert(buffer.valid_offset?)
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_offset_end
|
87
|
-
buffer = Gst::Buffer.new
|
88
|
-
assert_equal(Gst::Buffer::OFFSET_NONE, buffer.offset_end)
|
89
|
-
assert(!buffer.valid_offset_end?)
|
90
|
-
|
91
|
-
offset_end = 10
|
92
|
-
buffer.offset_end = offset_end
|
93
|
-
assert_equal(offset_end, buffer.offset_end)
|
94
|
-
assert(buffer.valid_offset_end?)
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_discontinuity
|
98
|
-
buffer = Gst::Buffer.new
|
99
|
-
assert(!buffer.discontinuity?)
|
100
|
-
|
101
|
-
buffer.raise_flag(:discont)
|
102
|
-
assert(buffer.discontinuity?)
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_copy_flags
|
106
|
-
all_flags =
|
107
|
-
Gst::Buffer::CopyFlags::FLAGS |
|
108
|
-
Gst::Buffer::CopyFlags::TIMESTAMPS |
|
109
|
-
Gst::Buffer::CopyFlags::CAPS
|
110
|
-
all_flags_shortcut =
|
111
|
-
Gst::Buffer::COPY_FLAGS |
|
112
|
-
Gst::Buffer::COPY_TIMESTAMPS |
|
113
|
-
Gst::Buffer::COPY_CAPS
|
114
|
-
if Gst::Buffer::CopyFlags.const_defined?(:QDATA)
|
115
|
-
all_flags |= Gst::Buffer::CopyFlags::QDATA
|
116
|
-
all_flags_shortcut |= Gst::Buffer::COPY_QDATA
|
117
|
-
end
|
118
|
-
|
119
|
-
assert_equal(all_flags,
|
120
|
-
Gst::Buffer::CopyFlags::ALL)
|
121
|
-
assert_equal(all_flags_shortcut,
|
122
|
-
Gst::Buffer::COPY_ALL)
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_copy_metadata
|
126
|
-
buffer = Gst::Buffer.new
|
127
|
-
buffer.flags = :discont
|
128
|
-
|
129
|
-
copied = buffer.copy_metadata(:all)
|
130
|
-
assert(copied.flag_raised?(:discont))
|
131
|
-
copied = buffer.copy_metadata(0)
|
132
|
-
assert(!copied.flag_raised?(:discont))
|
133
|
-
|
134
|
-
copied = Gst::Buffer.new
|
135
|
-
assert(!copied.flag_raised?(:discont))
|
136
|
-
buffer.copy_metadata(copied, :flags)
|
137
|
-
assert(copied.flag_raised?(:discont))
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_copy_metadata_with_readonly
|
141
|
-
buffer = Gst::Buffer.new
|
142
|
-
buffer.flags = :readonly
|
143
|
-
assert(!buffer.writable?)
|
144
|
-
|
145
|
-
copied = buffer.copy_metadata(:all)
|
146
|
-
assert(!copied.flag_raised?(:readonly))
|
147
|
-
assert(copied.writable?)
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_metadata_writable
|
151
|
-
buffer = Gst::Buffer.new
|
152
|
-
assert(buffer.metadata_writable?)
|
153
|
-
buffer.metadata_writable!
|
154
|
-
# assert(buffer.metadata_writable?) # FIXME
|
155
|
-
|
156
|
-
buffer = Gst::Buffer.new
|
157
|
-
buffer.create_sub(0, 0)
|
158
|
-
assert(!buffer.metadata_writable?)
|
159
|
-
buffer.metadata_writable!
|
160
|
-
# assert(buffer.metadata_writable?) # FIXME
|
161
|
-
|
162
|
-
buffer = Gst::Buffer.new
|
163
|
-
sub = buffer.create_sub(0, 0)
|
164
|
-
assert(!sub.metadata_writable?)
|
165
|
-
sub.metadata_writable!
|
166
|
-
# assert(sub.metadata_writable?) # FIXME
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_span
|
170
|
-
buffer1 = Gst::Buffer.new(5)
|
171
|
-
buffer2 = Gst::Buffer.new(10)
|
172
|
-
|
173
|
-
length = 7
|
174
|
-
merged_buffer = buffer1.span(2, buffer2, length)
|
175
|
-
assert_equal(length, merged_buffer.length)
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_span?
|
179
|
-
buffer = Gst::Buffer.new
|
180
|
-
sub_buffer1 = buffer.create_sub(0, 0)
|
181
|
-
sub_buffer2 = buffer.create_sub(0, 0)
|
182
|
-
assert(sub_buffer1.span?(sub_buffer2))
|
183
|
-
assert(!buffer.span?(sub_buffer1))
|
184
|
-
end
|
185
|
-
end
|
data/test/test_caps.rb
DELETED
@@ -1,24 +0,0 @@
|
|
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_element.rb
DELETED
@@ -1,85 +0,0 @@
|
|
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("fakesrc")
|
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_FAILURE,
|
43
|
-
Gst::STATE_READY,
|
44
|
-
Gst::STATE_PLAYING],
|
45
|
-
pipeline.get_state)
|
46
|
-
|
47
|
-
pipeline.pause
|
48
|
-
assert_equal([Gst::STATE_CHANGE_ASYNC,
|
49
|
-
Gst::STATE_READY,
|
50
|
-
Gst::STATE_PAUSED],
|
51
|
-
pipeline.get_state(1))
|
52
|
-
|
53
|
-
pipeline.stop
|
54
|
-
assert_equal([Gst::STATE_CHANGE_SUCCESS,
|
55
|
-
Gst::STATE_NULL,
|
56
|
-
Gst::STATE_VOID_PENDING],
|
57
|
-
pipeline.get_state)
|
58
|
-
|
59
|
-
pipeline.set_state(:playing)
|
60
|
-
assert_equal([Gst::STATE_CHANGE_FAILURE,
|
61
|
-
Gst::STATE_READY,
|
62
|
-
Gst::STATE_PLAYING],
|
63
|
-
pipeline.get_state)
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_query
|
67
|
-
pipeline = Gst::Pipeline.new
|
68
|
-
assert_boolean(pipeline.query(Gst::QueryFormats.new))
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_send_event
|
72
|
-
pipeline = Gst::Pipeline.new
|
73
|
-
assert_boolean(pipeline.send_event(Gst::EventEOS.new))
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_reference_counting
|
77
|
-
pipeline = Gst::Pipeline.new
|
78
|
-
bin = TestBin.new
|
79
|
-
|
80
|
-
10.times do
|
81
|
-
pipeline.add(bin)
|
82
|
-
pipeline.remove(bin)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class TestElementFactory < Test::Unit::TestCase
|
2
|
-
include GstTestUtils
|
3
|
-
|
4
|
-
def test_long_name
|
5
|
-
assert_equal("Player Bin", play_bin.long_name)
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_klass
|
9
|
-
assert_equal("Generic/Bin/Player", play_bin.klass)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_description
|
13
|
-
assert_equal("Autoplug and play media from an uri", play_bin.description)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_author
|
17
|
-
assert_match(/\AWim Taymans <.*?>\z/, play_bin.author)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_create
|
21
|
-
assert_match(/\Aplaybin\d+\z/, play_bin.create.name)
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
def play_bin
|
26
|
-
find_element_factory("playbin")
|
27
|
-
end
|
28
|
-
end
|
data/test/test_event.rb
DELETED
data/test/test_index_factory.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
class TestInstallPlugins < Test::Unit::TestCase
|
2
|
-
def test_create_return
|
3
|
-
assert_nothing_raised do
|
4
|
-
Gst::InstallPluginsReturn.new(Gst::InstallPluginsReturn::SUCCESS)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_return_name
|
9
|
-
ret = Gst::InstallPluginsReturn.new(Gst::InstallPluginsReturn::SUCCESS)
|
10
|
-
assert_equal("success", ret.name)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_create_context
|
14
|
-
assert_nothing_raised do
|
15
|
-
Gst::InstallPluginsContext.new
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/test/test_message.rb
DELETED
@@ -1,191 +0,0 @@
|
|
1
|
-
class TestMessage < Test::Unit::TestCase
|
2
|
-
def test_create_message
|
3
|
-
assert_nothing_raised do
|
4
|
-
Gst::Message.new(:unknown, nil, nil)
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_message_eos
|
9
|
-
assert_nothing_raised do
|
10
|
-
Gst::MessageEos.new(nil)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_message_error
|
15
|
-
return "FIXME" if true
|
16
|
-
error = nil
|
17
|
-
debug = "ERROR"
|
18
|
-
message = Gst::MessageError.new(nil, error, debug)
|
19
|
-
assert_equal([error, debug], message.parse)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_message_warning
|
23
|
-
return "FIXME" if true
|
24
|
-
error = nil
|
25
|
-
debug = "WARNING"
|
26
|
-
message = Gst::MessageWarning.new(nil, error, debug)
|
27
|
-
assert_equal([error, debug], message.parse)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_message_info
|
31
|
-
return "FIXME" if true
|
32
|
-
error = nil
|
33
|
-
debug = "INFO"
|
34
|
-
message = Gst::MessageInfo.new(nil, error, debug)
|
35
|
-
assert_equal([error, debug], message.parse)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_message_tag
|
39
|
-
return "FIXME" if true
|
40
|
-
tag_list = []
|
41
|
-
message = Gst::MessageTag.new(nil, tag_list)
|
42
|
-
assert_equal(tag_list, message.parse)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_message_buffering
|
46
|
-
percent = 50
|
47
|
-
message = Gst::MessageBuffering.new(nil, percent)
|
48
|
-
assert_equal(percent, message.parse)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_message_state_changed
|
52
|
-
old = Gst::STATE_PAUSED
|
53
|
-
new = Gst::STATE_PLAYING
|
54
|
-
pending = Gst::STATE_VOID_PENDING
|
55
|
-
message = Gst::MessageStateChanged.new(nil, :paused, :playing, :void_pending)
|
56
|
-
assert_equal([old, new, pending], message.parse)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_message_state_dirty
|
60
|
-
assert_nothing_raised do
|
61
|
-
Gst::MessageStateDirty.new(nil)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_message_clock_provide
|
66
|
-
clock = Gst::SystemClock.obtain
|
67
|
-
ready = true
|
68
|
-
message = Gst::MessageClockProvide.new(nil, clock, ready)
|
69
|
-
assert_equal([clock, ready], message.parse)
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_message_clock_lost
|
73
|
-
clock = Gst::SystemClock.obtain
|
74
|
-
message = Gst::MessageClockLost.new(nil, clock)
|
75
|
-
assert_equal(clock, message.parse)
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_create_message_new_clock
|
79
|
-
clock = Gst::SystemClock.obtain
|
80
|
-
message = Gst::MessageNewClock.new(nil, clock)
|
81
|
-
assert_equal(clock, message.parse)
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_message_application
|
85
|
-
assert_nothing_raised do
|
86
|
-
Gst::MessageApplication.new(nil, nil)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_message_element
|
91
|
-
assert_nothing_raised do
|
92
|
-
Gst::MessageElement.new(nil, nil)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_missing_message_installer_detail
|
97
|
-
pipeline = Gst::Pipeline.new
|
98
|
-
message = Gst::MissingURISourceMessage.new(pipeline, "http")
|
99
|
-
assert_match(/HTTP/, message.installer_detail)
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_missing_message_description
|
103
|
-
pipeline = Gst::Pipeline.new
|
104
|
-
message = Gst::MissingURISourceMessage.new(pipeline, "http")
|
105
|
-
assert_match(/HTTP/, message.description)
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_message_segment_start
|
109
|
-
format = Gst::Format::DEFAULT
|
110
|
-
position = 100
|
111
|
-
message = Gst::MessageSegmentStart.new(nil, :default, position)
|
112
|
-
assert_equal([format, position], message.parse)
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_message_segment_done
|
116
|
-
format = Gst::Format::DEFAULT
|
117
|
-
position = 100
|
118
|
-
message = Gst::MessageSegmentDone.new(nil, :default, position)
|
119
|
-
assert_equal([format, position], message.parse)
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_message_duration
|
123
|
-
format = Gst::Format::DEFAULT
|
124
|
-
duration = 10
|
125
|
-
message = Gst::MessageDuration.new(nil, :default, duration)
|
126
|
-
assert_equal([format, duration], message.parse)
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_message_async_start
|
130
|
-
new_base_time = true
|
131
|
-
message = Gst::MessageAsyncStart.new(nil, new_base_time)
|
132
|
-
assert_equal(new_base_time, message.parse)
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_message_async_done
|
136
|
-
assert_nothing_raised do
|
137
|
-
Gst::MessageAsyncDone.new(nil)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_message_latency
|
142
|
-
assert_nothing_raised do
|
143
|
-
Gst::MessageLatency.new(nil)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_type
|
148
|
-
message = Gst::Message.new(:unknown, nil, nil)
|
149
|
-
assert_equal(Gst::Message::UNKNOWN, message.type)
|
150
|
-
message.type = :tag
|
151
|
-
assert_equal(Gst::Message::TAG, message.type)
|
152
|
-
assert_equal("tag", message.type.name)
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_lock
|
156
|
-
message = Gst::MessageEos.new(nil)
|
157
|
-
assert(!message.have_mutex?)
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_cond
|
161
|
-
message = Gst::MessageEos.new(nil)
|
162
|
-
assert(!message.have_cond?)
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_timestamp
|
166
|
-
message = Gst::MessageEos.new(nil)
|
167
|
-
assert(!message.valid_timestamp?)
|
168
|
-
|
169
|
-
timestamp = Time.now.to_i * Gst::NSECOND
|
170
|
-
message.timestamp = timestamp
|
171
|
-
assert_equal(timestamp, message.timestamp)
|
172
|
-
assert(message.valid_timestamp?)
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_source
|
176
|
-
assert_nil(Gst::MessageEos.new(nil).source)
|
177
|
-
|
178
|
-
source = Gst::XML.new
|
179
|
-
message = Gst::MessageEos.new(source)
|
180
|
-
assert_equal(source, message.source)
|
181
|
-
message.source = nil
|
182
|
-
assert_nil(message.source)
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_structure
|
186
|
-
assert_nil(Gst::MessageEos.new(nil).structure)
|
187
|
-
|
188
|
-
message = Gst::Message.new(:unknown, nil, nil)
|
189
|
-
assert_nil(message.structure)
|
190
|
-
end
|
191
|
-
end
|
data/test/test_mini_object.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
class TestMiniObject < Test::Unit::TestCase
|
2
|
-
def test_create_mini_object
|
3
|
-
assert_raise(TypeError) do
|
4
|
-
Gst::MiniObject.new
|
5
|
-
end
|
6
|
-
|
7
|
-
assert_operator(Gst::MiniObject, :>, Gst::Buffer)
|
8
|
-
assert_nothing_raised do
|
9
|
-
Gst::Buffer.new
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_writable
|
14
|
-
mini_object = Gst::Buffer.new
|
15
|
-
assert(mini_object.writable?)
|
16
|
-
mini_object.flags = :readonly
|
17
|
-
assert(!mini_object.writable?)
|
18
|
-
mini_object.writable!
|
19
|
-
assert(mini_object.writable?)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_flag
|
23
|
-
mini_object = Gst::Buffer.new
|
24
|
-
|
25
|
-
assert_equal(0, mini_object.flags)
|
26
|
-
assert(!mini_object.flag_raised?(:readonly))
|
27
|
-
|
28
|
-
mini_object.raise_flag(:readonly)
|
29
|
-
assert(mini_object.flag_raised?(:readonly))
|
30
|
-
mini_object.lower_flag(:readonly)
|
31
|
-
assert(!mini_object.flag_raised?(:readonly))
|
32
|
-
|
33
|
-
mini_object.raise_flag(:readonly)
|
34
|
-
assert(mini_object.flag_raised?(:readonly))
|
35
|
-
mini_object.flags = 0
|
36
|
-
assert(!mini_object.flag_raised?(:readonly))
|
37
|
-
end
|
38
|
-
end
|
data/test/test_object.rb
DELETED
data/test/test_pad.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
class TestPad < Test::Unit::TestCase
|
2
|
-
include GstTestUtils
|
3
|
-
|
4
|
-
def test_link
|
5
|
-
file_src = create_element("filesrc")
|
6
|
-
audio_convert = create_element("audioconvert")
|
7
|
-
audio_resample = create_element("audioresample")
|
8
|
-
file_sink = create_element("filesink")
|
9
|
-
|
10
|
-
current_linked = Proc.new do
|
11
|
-
[
|
12
|
-
file_src["src"].linked?,
|
13
|
-
audio_convert["sink"].linked?,
|
14
|
-
audio_convert["src"].linked?,
|
15
|
-
audio_resample["sink"].linked?,
|
16
|
-
audio_resample["src"].linked?,
|
17
|
-
file_sink["sink"].linked?,
|
18
|
-
]
|
19
|
-
end
|
20
|
-
|
21
|
-
current_peer = Proc.new do
|
22
|
-
[
|
23
|
-
file_src["src"].peer,
|
24
|
-
audio_convert["sink"].peer,
|
25
|
-
audio_convert["src"].peer,
|
26
|
-
audio_resample["sink"].peer,
|
27
|
-
audio_resample["src"].peer,
|
28
|
-
file_sink["sink"].peer,
|
29
|
-
]
|
30
|
-
end
|
31
|
-
|
32
|
-
assert_equal([false, false, false, false, false, false],
|
33
|
-
current_linked.call)
|
34
|
-
assert_equal([nil, nil, nil, nil, nil, nil],
|
35
|
-
current_peer.call)
|
36
|
-
|
37
|
-
file_src["src"].link(audio_convert["sink"])
|
38
|
-
assert_equal([true, true, false, false, false, false],
|
39
|
-
current_linked.call)
|
40
|
-
assert_equal([audio_convert["sink"], file_src["src"], nil, nil, nil, nil],
|
41
|
-
current_peer.call)
|
42
|
-
|
43
|
-
audio_convert["src"] >> audio_resample["sink"]
|
44
|
-
assert_equal([true, true, true, true, false, false],
|
45
|
-
current_linked.call)
|
46
|
-
assert_equal([audio_convert["sink"], file_src["src"],
|
47
|
-
audio_resample["sink"], audio_convert["src"],
|
48
|
-
nil, nil],
|
49
|
-
current_peer.call)
|
50
|
-
|
51
|
-
audio_resample["src"] >> file_sink["sink"]
|
52
|
-
assert_equal([true, true, true, true, true, true],
|
53
|
-
current_linked.call)
|
54
|
-
assert_equal([audio_convert["sink"], file_src["src"],
|
55
|
-
audio_resample["sink"], audio_convert["src"],
|
56
|
-
file_sink["sink"], audio_resample["src"]],
|
57
|
-
current_peer.call)
|
58
|
-
|
59
|
-
audio_convert["src"].unlink(audio_resample["sink"])
|
60
|
-
assert_equal([true, true, false, false, true, true],
|
61
|
-
current_linked.call)
|
62
|
-
assert_equal([audio_convert["sink"], file_src["src"],
|
63
|
-
nil, nil,
|
64
|
-
file_sink["sink"], audio_resample["src"]],
|
65
|
-
current_peer.call)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
data/test/test_plugin.rb
DELETED
data/test/test_plugin_feature.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class TestPluginFeature < Test::Unit::TestCase
|
2
|
-
def test_load!
|
3
|
-
feature = Gst::ElementFactory.find("audiorate")
|
4
|
-
assert(!feature.loaded?)
|
5
|
-
assert(feature.load!)
|
6
|
-
assert(feature.loaded?)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_rank
|
10
|
-
feature = Gst::ElementFactory.find("playbin")
|
11
|
-
assert_equal(Gst::RANK_NONE, feature.rank)
|
12
|
-
feature.rank = :primary
|
13
|
-
assert_equal(Gst::RANK_PRIMARY, feature.rank)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_plugin_name
|
17
|
-
feature = Gst::ElementFactory.find("playbin")
|
18
|
-
assert_equal("playback", feature.plugin_name)
|
19
|
-
end
|
20
|
-
end
|