gstreamer 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,28 @@
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
@@ -0,0 +1,10 @@
1
+ class TestEvent < Test::Unit::TestCase
2
+ include GstTestUtils
3
+
4
+ def test_type
5
+ assert_operator(Gst, :const_defined?, :EventType)
6
+ assert_nothing_raised do
7
+ Gst::Event::EOS
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ class TestIndexFactory < Test::Unit::TestCase
2
+ def test_description
3
+ index = Gst::IndexFactory.find("fileindex")
4
+ assert_not_nil(index)
5
+ assert_equal("A index that stores entries in file", index.description)
6
+ end
7
+ end
@@ -0,0 +1,191 @@
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
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,10 @@
1
+ class TestObject < Test::Unit::TestCase
2
+ include GstTestUtils
3
+
4
+ def test_name
5
+ sink = create_element("fakesink", "my-fakesink")
6
+ assert_equal("my-fakesink", sink.name)
7
+ sink.name += "0"
8
+ assert_equal("my-fakesink0", sink.name)
9
+ end
10
+ end
data/test/test_pad.rb ADDED
@@ -0,0 +1,68 @@
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
+
@@ -0,0 +1,6 @@
1
+ class TestPlugin < Test::Unit::TestCase
2
+ def test_source
3
+ plugin = Gst::Registry.default.find_plugin("playback")
4
+ assert_equal("gst-plugins-base", plugin.source)
5
+ end
6
+ end
@@ -0,0 +1,20 @@
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
data/test/test_seek.rb ADDED
@@ -0,0 +1,17 @@
1
+ class TestSeek < Test::Unit::TestCase
2
+ include GstTestUtils
3
+
4
+ def test_type
5
+ assert_operator(Gst, :const_defined?, :SeekType)
6
+ assert_nothing_raised do
7
+ Gst::Seek::TYPE_NONE
8
+ end
9
+ end
10
+
11
+ def test_flags
12
+ assert_operator(Gst, :const_defined?, :SeekFlags)
13
+ assert_nothing_raised do
14
+ Gst::Seek::FLAG_NONE
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ class TestStaticCaps < Test::Unit::TestCase
2
+ def test_description
3
+ assert_equal("ANY", file_src_caps.description)
4
+ end
5
+
6
+ def test_to_caps
7
+ static_caps = file_src_caps
8
+ assert_kind_of(Gst::StaticCaps, static_caps)
9
+ assert_kind_of(Gst::Caps, static_caps.to_caps)
10
+ end
11
+
12
+ private
13
+ def file_src_caps
14
+ file_src = Gst::ElementFactory.find("filesrc")
15
+ assert_not_nil(file_src)
16
+ file_src.pad_templates[0].caps
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ class TestStaticPadTemplate < Test::Unit::TestCase
2
+ def test_reader
3
+ templates = file_src.pad_templates.collect do |template|
4
+ [template.name, template.direction, template.presence]
5
+ end
6
+ assert_equal([["src", Gst::Pad::SRC, Gst::Pad::ALWAYS]],
7
+ templates)
8
+ end
9
+
10
+ private
11
+ def file_src
12
+ file_src = Gst::ElementFactory.find("filesrc")
13
+ assert_not_nil(file_src)
14
+ file_src
15
+ end
16
+ end