gstreamer 4.2.4 → 4.2.6
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.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/gst/audio-loader.rb +23 -0
- data/lib/gst/caps.rb +14 -1
- data/lib/gst/structure.rb +5 -1
- data/lib/gst.rb +8 -0
- data/sample/audio-extract.rb +75 -0
- data/test/test-audio.rb +54 -0
- data/test/test-caps.rb +28 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5af17ec79557cd16dbda72e1d5999b2d27c49dafa76e78791ba3b92d33db8bee
|
4
|
+
data.tar.gz: ee6d14649868ad5dbaffc61eec891bdee76d53cad6de6fa222cbcac1daf08668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1a4c8a9049f79360a1994c628d73471c048382cb4d8360436d03d6aa2ccb878920f889b5777e03def44fb9b2563f98f10097bc7f42dfc7d9cfdb57753248aa8
|
7
|
+
data.tar.gz: 0dae8b535966a556b1cc0f84f9e6c80d93b0a5cd6de958f5a65544cedc7aba25f1f1a509662ca21af14a55993911751ea937761aba5ec54fff5e8d7806eb00f3
|
data/Rakefile
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
$LOAD_PATH.unshift("./../glib2/lib")
|
20
|
-
require "
|
20
|
+
require "gnome/rake/package-task"
|
21
21
|
|
22
22
|
package_name = File.basename(__dir__)
|
23
23
|
spec = Gem::Specification.load("#{package_name}.gemspec")
|
24
24
|
|
25
|
-
|
25
|
+
GNOME::Rake::PackageTask.define(spec, __dir__) do |package|
|
26
26
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (C) 2024 Ruby-GNOME 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
|
+
module GstAudio
|
18
|
+
class Loader < GObjectIntrospection::Loader
|
19
|
+
def load
|
20
|
+
super("GstAudio")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/gst/caps.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-
|
1
|
+
# Copyright (C) 2013-2025 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -46,5 +46,18 @@ module Gst
|
|
46
46
|
get_structure(i)
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
def set_int_value(name, value)
|
51
|
+
self[name, :int] = value
|
52
|
+
end
|
53
|
+
|
54
|
+
def []=(name, type=nil, value)
|
55
|
+
if type
|
56
|
+
value_type = GLib::Type.const_get(type.to_s.upcase)
|
57
|
+
set_value(name, GLib::Value.new(value_type, value))
|
58
|
+
else
|
59
|
+
set_value(name, value)
|
60
|
+
end
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
data/lib/gst/structure.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Ruby-
|
1
|
+
# Copyright (C) 2013-2025 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -24,5 +24,9 @@ module Gst
|
|
24
24
|
[field_name, value]
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
def [](name)
|
29
|
+
get_value(name)
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
data/lib/gst.rb
CHANGED
@@ -21,6 +21,7 @@ require "gobject-introspection"
|
|
21
21
|
require "gst/loader"
|
22
22
|
require "gst/base-loader"
|
23
23
|
require "gst/controller-loader"
|
24
|
+
require "gst/audio-loader"
|
24
25
|
|
25
26
|
module Gst
|
26
27
|
LOG_DOMAIN = "GStreamer"
|
@@ -55,6 +56,7 @@ module Gst
|
|
55
56
|
loader.load
|
56
57
|
init_base
|
57
58
|
init_controller
|
59
|
+
init_audio
|
58
60
|
end
|
59
61
|
|
60
62
|
private
|
@@ -69,5 +71,11 @@ module Gst
|
|
69
71
|
loader.load
|
70
72
|
Gst.include(GstController)
|
71
73
|
end
|
74
|
+
|
75
|
+
def init_audio
|
76
|
+
loader = GstAudio::Loader.new(GstAudio)
|
77
|
+
loader.load
|
78
|
+
Gst.include(GstAudio)
|
79
|
+
end
|
72
80
|
end
|
73
81
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2024 Ruby-GNOME Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "gst"
|
20
|
+
|
21
|
+
pipeline = Gst::Pipeline.new("audio-extractor")
|
22
|
+
src = Gst::ElementFactory.make("autoaudiosrc", nil)
|
23
|
+
raise "need audiotestsrc from gst-plugins-good" if src.nil?
|
24
|
+
resample = Gst::ElementFactory.make("audioresample", nil)
|
25
|
+
raise "need audioresample from gst-plugins-base" if resample.nil?
|
26
|
+
sink = Gst::ElementFactory.make("appsink", nil)
|
27
|
+
raise "need appsink from gst-plugins-base" if sink.nil?
|
28
|
+
|
29
|
+
# See https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-audio-raw.html
|
30
|
+
caps = Gst::Caps.new("audio/x-raw")
|
31
|
+
caps["format"] = "F32LE"
|
32
|
+
caps["rate", :int] = 16 * 1000
|
33
|
+
caps["channels", :int] = 1
|
34
|
+
sink.caps = caps
|
35
|
+
|
36
|
+
sink.emit_signals = true
|
37
|
+
sink.signal_connect(:new_sample) do |_|
|
38
|
+
sample = sink.pull_sample
|
39
|
+
buffer = sample.buffer
|
40
|
+
success, map = buffer.map(:read)
|
41
|
+
p map.data
|
42
|
+
buffer.unmap(map)
|
43
|
+
Gst::FlowReturn::OK
|
44
|
+
end
|
45
|
+
|
46
|
+
pipeline << src << resample << sink
|
47
|
+
src >> resample >> sink
|
48
|
+
|
49
|
+
loop = GLib::MainLoop.new
|
50
|
+
|
51
|
+
bus = pipeline.bus
|
52
|
+
bus.add_watch do |bus, message|
|
53
|
+
case message.type
|
54
|
+
when Gst::MessageType::EOS
|
55
|
+
puts "End-of-stream"
|
56
|
+
loop.quit
|
57
|
+
when Gst::MessageType::ERROR
|
58
|
+
error, debug = message.parse_error
|
59
|
+
puts "Debugging info: #{debug || 'none'}"
|
60
|
+
puts "Error: #{error.message}"
|
61
|
+
loop.quit
|
62
|
+
end
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
pipeline.play
|
67
|
+
begin
|
68
|
+
loop.run
|
69
|
+
rescue Interrupt
|
70
|
+
puts "Interrupt"
|
71
|
+
rescue => error
|
72
|
+
puts "Error: #{error.message}"
|
73
|
+
ensure
|
74
|
+
pipeline.stop
|
75
|
+
end
|
data/test/test-audio.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (C) 2024-2025 Ruby-GNOME 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
|
+
class TestAudio < Test::Unit::TestCase
|
18
|
+
include GStreamerTestUtils
|
19
|
+
|
20
|
+
def test_audio_info
|
21
|
+
audio_info = Gst::AudioInfo.new
|
22
|
+
audio_info.set_format(:encoded, 44100, 2)
|
23
|
+
structure = audio_info.to_caps.structures[0]
|
24
|
+
assert_equal("ENCODED", structure["format"].value)
|
25
|
+
assert_equal(44100, audio_info.rate)
|
26
|
+
assert_equal(2, audio_info.channels)
|
27
|
+
|
28
|
+
audio_info.set_format(:f32le, 16000, 1)
|
29
|
+
modified_structure = audio_info.to_caps.structures[0]
|
30
|
+
assert_equal("F32LE", modified_structure["format"].value)
|
31
|
+
assert_equal(16000, audio_info.rate)
|
32
|
+
assert_equal(1, audio_info.channels)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_audio_info_from_caps
|
36
|
+
only_gstreamer_version(1, 20)
|
37
|
+
|
38
|
+
caps = Gst::Caps.new("audio/ogg")
|
39
|
+
caps["rate", :int] = 44100
|
40
|
+
caps["channels", :int] = 2
|
41
|
+
|
42
|
+
audio_info = Gst::AudioInfo.new(caps)
|
43
|
+
structure = audio_info.to_caps.structures[0]
|
44
|
+
assert_equal("ENCODED", structure["format"].value)
|
45
|
+
assert_equal(44100, audio_info.rate)
|
46
|
+
assert_equal(2, audio_info.channels)
|
47
|
+
|
48
|
+
audio_info.set_format(:f32le, 16000, 1)
|
49
|
+
modified_structure = audio_info.to_caps.structures[0]
|
50
|
+
assert_equal("F32LE", modified_structure["format"].value)
|
51
|
+
assert_equal(16000, audio_info.rate)
|
52
|
+
assert_equal(1, audio_info.channels)
|
53
|
+
end
|
54
|
+
end
|
data/test/test-caps.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2014 Ruby-
|
1
|
+
# Copyright (C) 2014-2025 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -27,5 +27,32 @@ class TestCaps < Test::Unit::TestCase
|
|
27
27
|
def test_media_type
|
28
28
|
assert_equal("audio/ogg", Gst::Caps.new("audio/ogg").to_s)
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_set_int_value
|
32
|
+
caps = Gst::Caps.new("audio/ogg")
|
33
|
+
caps.set_int_value("rate", 44100)
|
34
|
+
structure = caps.structures[0]
|
35
|
+
value = structure["rate"]
|
36
|
+
assert_equal([GLib::Type::INT, 44100],
|
37
|
+
[value.type, value.value])
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_array_set_no_type
|
41
|
+
caps = Gst::Caps.new("audio/ogg")
|
42
|
+
caps["rate"] = 44100
|
43
|
+
structure = caps.structures[0]
|
44
|
+
value = structure["rate"]
|
45
|
+
assert_equal([GLib::Type::UINT, 44100],
|
46
|
+
[value.type, value.value])
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_array_set_int
|
50
|
+
caps = Gst::Caps.new("audio/ogg")
|
51
|
+
caps["rate", :int] = 44100
|
52
|
+
structure = caps.structures[0]
|
53
|
+
value = structure["rate"]
|
54
|
+
assert_equal([GLib::Type::INT, 44100],
|
55
|
+
[value.type, value.value])
|
56
|
+
end
|
30
57
|
end
|
31
58
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gstreamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-01-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: gobject-introspection
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - '='
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 4.2.
|
18
|
+
version: 4.2.6
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - '='
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 4.2.
|
25
|
+
version: 4.2.6
|
26
26
|
description: Ruby/GStreamer is a Ruby binding for GStreamer.
|
27
27
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
28
28
|
executables: []
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- extconf.rb
|
43
43
|
- gstreamer.gemspec
|
44
44
|
- lib/gst.rb
|
45
|
+
- lib/gst/audio-loader.rb
|
45
46
|
- lib/gst/base-loader.rb
|
46
47
|
- lib/gst/bin.rb
|
47
48
|
- lib/gst/bus.rb
|
@@ -58,6 +59,7 @@ files:
|
|
58
59
|
- lib/gst/version.rb
|
59
60
|
- lib/gstreamer.rb
|
60
61
|
- sample/audio-example.rb
|
62
|
+
- sample/audio-extract.rb
|
61
63
|
- sample/framestep1.rb
|
62
64
|
- sample/gst-inspect.rb
|
63
65
|
- sample/gtk-video.rb
|
@@ -69,6 +71,7 @@ files:
|
|
69
71
|
- sample/typefind.rb
|
70
72
|
- test/gstreamer-test-utils.rb
|
71
73
|
- test/run-test.rb
|
74
|
+
- test/test-audio.rb
|
72
75
|
- test/test-bin.rb
|
73
76
|
- test/test-bus.rb
|
74
77
|
- test/test-caps.rb
|
@@ -96,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
99
|
- !ruby/object:Gem::Version
|
97
100
|
version: '0'
|
98
101
|
requirements: []
|
99
|
-
rubygems_version: 3.6.
|
102
|
+
rubygems_version: 3.6.2
|
100
103
|
specification_version: 4
|
101
104
|
summary: Ruby/GStreamer is a Ruby binding for GStreamer.
|
102
105
|
test_files: []
|