gstreamer 1.2.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Rakefile +78 -39
  2. data/ext/gstreamer/extconf.rb +8 -22
  3. data/ext/gstreamer/rbgst.c +82 -194
  4. data/lib/gst/base_loader.rb +20 -0
  5. data/lib/gst/bin.rb +32 -0
  6. data/lib/gst/bus.rb +24 -0
  7. data/lib/gst/element.rb +48 -0
  8. data/lib/gst.rb +87 -22
  9. data/sample/helloworld.rb +75 -0
  10. data/sample/mp3parselaunch.rb +74 -0
  11. data/sample/queue.rb +92 -0
  12. data/sample/typefind.rb +101 -0
  13. metadata +29 -84
  14. data/README +0 -33
  15. data/ext/gstreamer/misc.c +0 -63
  16. data/ext/gstreamer/rbgst-bin.c +0 -456
  17. data/ext/gstreamer/rbgst-buffer.c +0 -363
  18. data/ext/gstreamer/rbgst-bus.c +0 -92
  19. data/ext/gstreamer/rbgst-caps.c +0 -446
  20. data/ext/gstreamer/rbgst-child-proxy.c +0 -34
  21. data/ext/gstreamer/rbgst-clock.c +0 -108
  22. data/ext/gstreamer/rbgst-element-factory.c +0 -249
  23. data/ext/gstreamer/rbgst-element.c +0 -1106
  24. data/ext/gstreamer/rbgst-event.c +0 -352
  25. data/ext/gstreamer/rbgst-ghost-pad.c +0 -45
  26. data/ext/gstreamer/rbgst-index-factory.c +0 -69
  27. data/ext/gstreamer/rbgst-install-plugins-context.c +0 -87
  28. data/ext/gstreamer/rbgst-install-plugins-return.c +0 -45
  29. data/ext/gstreamer/rbgst-install-plugins.c +0 -125
  30. data/ext/gstreamer/rbgst-message.c +0 -785
  31. data/ext/gstreamer/rbgst-mini-object.c +0 -221
  32. data/ext/gstreamer/rbgst-object.c +0 -81
  33. data/ext/gstreamer/rbgst-pad-template.c +0 -125
  34. data/ext/gstreamer/rbgst-pad.c +0 -336
  35. data/ext/gstreamer/rbgst-pipeline.c +0 -91
  36. data/ext/gstreamer/rbgst-plugin-feature.c +0 -131
  37. data/ext/gstreamer/rbgst-plugin.c +0 -162
  38. data/ext/gstreamer/rbgst-private.c +0 -88
  39. data/ext/gstreamer/rbgst-private.h +0 -97
  40. data/ext/gstreamer/rbgst-query.c +0 -291
  41. data/ext/gstreamer/rbgst-seek.c +0 -39
  42. data/ext/gstreamer/rbgst-static-caps.c +0 -49
  43. data/ext/gstreamer/rbgst-static-pad-template.c +0 -65
  44. data/ext/gstreamer/rbgst-structure.c +0 -300
  45. data/ext/gstreamer/rbgst-system-clock.c +0 -48
  46. data/ext/gstreamer/rbgst-type-find-factory.c +0 -125
  47. data/ext/gstreamer/rbgst-value.c +0 -527
  48. data/ext/gstreamer/rbgst-x-overlay.c +0 -131
  49. data/ext/gstreamer/rbgst.h +0 -197
  50. data/ext/gstreamer/rbgstclockentry.c +0 -271
  51. data/ext/gstreamer/rbgstformat.c +0 -162
  52. data/ext/gstreamer/rbgstindex.c +0 -315
  53. data/ext/gstreamer/rbgstindexentry.c +0 -99
  54. data/ext/gstreamer/rbgstparse.c +0 -69
  55. data/ext/gstreamer/rbgstquerytype.c +0 -162
  56. data/ext/gstreamer/rbgstregistry.c +0 -288
  57. data/ext/gstreamer/rbgsttag.c +0 -113
  58. data/ext/gstreamer/rbgsttagsetter.c +0 -53
  59. data/ext/gstreamer/rbgstxml.c +0 -192
  60. data/sample/audio-player.rb +0 -54
  61. data/sample/gst-gi.rb +0 -55
  62. data/sample/gst-inspect.rb +0 -417
  63. data/sample/install-plugins.rb +0 -40
  64. data/sample/media-type.rb +0 -55
  65. data/sample/media-type2.rb +0 -268
  66. data/sample/ogg-audio-player.rb +0 -54
  67. data/sample/type-find.rb +0 -46
  68. data/sample/video-player.rb +0 -57
  69. data/sample/xml-player.rb +0 -60
  70. data/test/gst-test-utils.rb +0 -18
  71. data/test/run-test.rb +0 -25
  72. data/test/test_bin.rb +0 -167
  73. data/test/test_buffer.rb +0 -185
  74. data/test/test_caps.rb +0 -24
  75. data/test/test_element.rb +0 -85
  76. data/test/test_element_factory.rb +0 -28
  77. data/test/test_event.rb +0 -10
  78. data/test/test_index_factory.rb +0 -7
  79. data/test/test_install-plugins.rb +0 -18
  80. data/test/test_message.rb +0 -191
  81. data/test/test_mini_object.rb +0 -38
  82. data/test/test_object.rb +0 -10
  83. data/test/test_pad.rb +0 -68
  84. data/test/test_plugin.rb +0 -6
  85. data/test/test_plugin_feature.rb +0 -20
  86. data/test/test_seek.rb +0 -17
  87. data/test/test_static_caps.rb +0 -18
  88. data/test/test_static_pad_template.rb +0 -16
  89. data/test/test_structure.rb +0 -159
  90. data/test/test_thread_handling.rb +0 -58
  91. data/test/test_type_find_factory.rb +0 -8
  92. data/test/test_value.rb +0 -69
data/test/test_seek.rb DELETED
@@ -1,17 +0,0 @@
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
@@ -1,18 +0,0 @@
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
@@ -1,16 +0,0 @@
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
@@ -1,159 +0,0 @@
1
- class TestStructure < Test::Unit::TestCase
2
- def test_empty_new
3
- assert_raise(ArgumentError) do
4
- Gst::Structure.new
5
- end
6
- end
7
-
8
- def test_new_with_name
9
- structure = Gst::Structure.new("anonymous")
10
- assert_equal("anonymous", structure.name)
11
- end
12
-
13
- def test_name
14
- structure = Gst::Structure.new("anonymous")
15
- assert(structure.have_name?("anonymous"))
16
-
17
- assert(!structure.have_name?("me"))
18
- structure.name = "me"
19
- assert(structure.have_name?("me"))
20
- assert(!structure.have_name?("anonymous"))
21
- end
22
-
23
- def test_accessor
24
- structure = Gst::Structure.new("anonymous")
25
-
26
- structure["string"] = "value"
27
- structure["integer"] = 1
28
-
29
- assert_nil(structure["non-existence"])
30
- assert_equal("value", structure["string"])
31
- assert_equal(1, structure["integer"])
32
- end
33
-
34
- def test_delete
35
- structure = Gst::Structure.new("anonymous")
36
-
37
- structure["string"] = "value"
38
- structure["integer"] = 1
39
-
40
- assert_equal("value", structure["string"])
41
- structure.delete("string")
42
- assert_nil(structure["string"])
43
- assert_equal(1, structure["integer"])
44
- end
45
-
46
- def test_clear
47
- structure = Gst::Structure.new("anonymous")
48
-
49
- structure["string"] = "value"
50
- structure["integer"] = 1
51
-
52
- assert_equal("value", structure["string"])
53
- assert_equal(1, structure["integer"])
54
- structure.clear
55
- assert_nil(structure["string"])
56
- assert_nil(structure["integer"])
57
- end
58
-
59
- def test_each_break
60
- structure = Gst::Structure.new("anonymous")
61
-
62
- structure["string"] = "value"
63
- structure["integer"] = 1
64
-
65
- result = []
66
- structure.each do |key, value|
67
- result << [key, value]
68
- break
69
- end
70
- assert_equal([["string", "value"]], result)
71
- end
72
-
73
- def test_collect
74
- structure = Gst::Structure.new("anonymous")
75
- assert_equal([], structure.collect {|key, value| [key, value]})
76
-
77
- structure["string"] = "value"
78
- structure["integer"] = 1
79
- assert_equal([
80
- ["string", "value" * 2],
81
- ["integer", 1 * 2],
82
- ],
83
- structure.collect {|key, value| [key, value * 2]})
84
-
85
- assert_equal("value", structure["string"])
86
- assert_equal(1, structure["integer"])
87
- end
88
-
89
- def test_collect!
90
- structure = Gst::Structure.new("anonymous")
91
- assert_equal([], structure.collect {|key, value| [key, value]})
92
-
93
- structure["string"] = "value"
94
- structure["integer"] = 1
95
- structure.collect! {|key, value| value * 2}
96
-
97
- assert_equal("value" * 2, structure["string"])
98
- assert_equal(1 * 2, structure["integer"])
99
- end
100
-
101
- def test_size
102
- structure = Gst::Structure.new("anonymous")
103
-
104
- assert_equal(0, structure.size)
105
- assert(structure.empty?)
106
-
107
- structure["string"] = "value"
108
- structure["integer"] = 1
109
- assert_equal(2, structure.size)
110
- assert(!structure.empty?)
111
- end
112
-
113
- def test_nth_field_name
114
- structure = Gst::Structure.new("anonymous")
115
-
116
- structure["string"] = "value"
117
- structure["integer"] = 1
118
- assert_equal("string", structure.nth_field_name(0))
119
- assert_equal("integer", structure.nth_field_name(1))
120
- end
121
-
122
- def test_have_field?
123
- structure = Gst::Structure.new("anonymous")
124
-
125
- assert(!structure.have_field?("string"))
126
-
127
- structure["string"] = "value"
128
- assert(structure.have_field?("string"))
129
- assert(!structure.have_field?("integer"))
130
- end
131
-
132
- def test_to_s
133
- structure = Gst::Structure.new("anonymous")
134
- assert_equal("anonymous;", structure.to_s)
135
-
136
- structure["string"] = "value"
137
- assert_equal("anonymous, string=(string)value;", structure.to_s)
138
-
139
- structure["integer"] = 1
140
- assert_equal("anonymous, string=(string)value, integer=(int)1;",
141
- structure.to_s)
142
-
143
- assert_match(/: #{Regexp.escape(structure.to_s)}>\z/, structure.inspect)
144
- end
145
-
146
- def test_parse
147
- structure = Gst::Structure.new("anonymous")
148
- structure["string"] = "value"
149
- structure["integer"] = 1
150
-
151
- parsed_structure, rest = Gst::Structure.parse(structure.to_s)
152
- assert_equal(["anonymous, string=(string)value, integer=(int)1;", ""],
153
- [parsed_structure.to_s, rest])
154
-
155
- parsed_structure, rest = Gst::Structure.parse(structure.to_s + "XXX")
156
- assert_equal(["anonymous, string=(string)value, integer=(int)1;", "XXX"],
157
- [parsed_structure.to_s, rest])
158
- end
159
- end
@@ -1,58 +0,0 @@
1
- require 'gst-test-utils.rb'
2
-
3
- class TestThreadHandling < Test::Unit::TestCase
4
- include GstTestUtils
5
-
6
- def test_scheduling
7
- only_gst_version(0, 10, 16)
8
- pipeline = Gst::Pipeline.new
9
- buffers_seen = 0
10
-
11
- src = Gst::ElementFactory.make("videotestsrc")
12
- identity = Gst::ElementFactory.make("identity")
13
- sink = Gst::ElementFactory.make("fakesink")
14
- caps = Gst::Caps.parse("video/x-raw-yuv, framerate=\(fraction\)30/1")
15
-
16
- src.live = true
17
- identity.signal_handoffs = true
18
-
19
- identity.signal_connect("handoff") do |element, buffer|
20
- buffers_seen += 1
21
- end
22
-
23
- pipeline.add(src, identity, sink)
24
- src.link_filtered(identity, caps)
25
- identity >> sink
26
-
27
- pipeline.play
28
- sleep 1
29
- pipeline.stop
30
- assert_operator(15, :<, buffers_seen)
31
- end
32
-
33
- def test_state_changes
34
- only_gst_version(0, 10, 16)
35
- pipeline = Gst::Pipeline.new
36
- buffers_seen = 0
37
-
38
- src = Gst::ElementFactory.make("videotestsrc")
39
- identity = Gst::ElementFactory.make("identity")
40
- sink = Gst::ElementFactory.make("fakesink")
41
-
42
- identity.signal_handoffs = true
43
-
44
- identity.signal_connect("handoff") do |element, buffer|
45
- buffers_seen += 1
46
- end
47
-
48
- pipeline.add(src, identity, sink)
49
- src >> identity >> sink
50
- loop = GLib::MainLoop.new(nil, false)
51
-
52
- 10.times do
53
- pipeline.play
54
- sleep 1
55
- pipeline.stop
56
- end
57
- end
58
- end
@@ -1,8 +0,0 @@
1
- class TestTypeFindFactory < Test::Unit::TestCase
2
- def test_extensions
3
- factories = Gst::TypeFindFactory.list
4
- html_factory = factories.find {|f| f.name == "text/html"}
5
- assert_not_nil(html_factory)
6
- assert_equal(["htm", "html"].sort, html_factory.extensions.sort)
7
- end
8
- end
data/test/test_value.rb DELETED
@@ -1,69 +0,0 @@
1
- class TestValue < Test::Unit::TestCase
2
- def test_list
3
- assert_equal([1234, 4321], audio_convert_caps[0]["endianness"])
4
- end
5
-
6
- def test_int_range
7
- range = Gst::IntRange.new(10, 100)
8
- assert_equal(10, range.min)
9
- assert_equal(100, range.max)
10
- assert_equal("[10,100]", range.to_s)
11
-
12
- range.min = 1
13
- range.max = 500
14
- assert_equal(1, range.min)
15
- assert_equal(500, range.max)
16
- assert_equal("[1,500]", range.to_s)
17
-
18
- range.set(100, 9999)
19
- assert_equal(100, range.min)
20
- assert_equal(9999, range.max)
21
- assert_equal("[100,9999]", range.to_s)
22
- end
23
-
24
- def test_fourcc
25
- fourcc = Gst::Fourcc.new("MJPG")
26
- assert_equal(string_to_fourcc("MJPG"), fourcc.to_i)
27
- assert_equal("MJPG", fourcc.to_s)
28
-
29
- fourcc.replace!(string_to_fourcc("abcd"))
30
- assert_equal(string_to_fourcc("abcd"), fourcc.to_i)
31
- assert_equal("abcd", fourcc.to_s)
32
- end
33
-
34
- def test_fraction_range_new
35
- assert_equal("[ 1/2, 3/4 ]",
36
- Gst::FractionRange.new(Rational(1, 2), Rational(3, 4)).to_s)
37
- end
38
-
39
- def test_fraction_range
40
- assert_equal([Rational(0, 1), Rational(2147483647, 1)],
41
- ffmpeg_color_space_caps[0]["framerate"].to_a)
42
- end
43
-
44
- private
45
- def audio_convert_caps
46
- convert = Gst::ElementFactory.find("audioconvert")
47
- assert_not_nil(convert)
48
- convert.pad_templates.find do |template|
49
- template.direction == Gst::Pad::SRC
50
- end.caps.to_caps
51
- end
52
-
53
- def ffmpeg_color_space_caps
54
- convert = Gst::ElementFactory.find("ffmpegcolorspace")
55
- assert_not_nil(convert)
56
- convert.pad_templates.find do |template|
57
- template.direction == Gst::Pad::SRC
58
- end.caps.to_caps
59
- end
60
-
61
- def string_to_fourcc(string)
62
- value = 0
63
- string.unpack("C4").each_with_index do |v, i|
64
- value += v << (i * 8)
65
- end
66
- value
67
- end
68
- end
69
-