gstreamer 4.2.4 → 4.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/sample/audio-extract.rb +75 -0
  4. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7675f1b5c75956ddac6cd5b7a1c9616a2fe5abfe7377788fe6f840dad5a258f0
4
- data.tar.gz: 167d1108228893b7a4918cf7b84ce66e3c83024dd5bd46a8bc101ccba7a11086
3
+ metadata.gz: 19d2d0d2f3ed1a74905374073caf4b7c66d466b5fd712c213a27e60ccf775fae
4
+ data.tar.gz: fc112efd7a3fe32845772cc51085b1562f92147997e66e6b1312d67d2bcf1abd
5
5
  SHA512:
6
- metadata.gz: d322298e7cb291ee062a847c4ddc6576a769fd00cac877112ffc9645bb37128ace9746b56b997e24772710fd7ea6b2a206d4ffb15db66dcff9956061364af905
7
- data.tar.gz: da33168f38fc82aeea5be85fcbf3687114b78f6774271b77e87c6b3e7537b76783e52f4407878e495ef3d1899898994a875b73dc6cd9836e25e89d03889576c1
6
+ metadata.gz: d642128fee3e8839e78bafc913bdfef6814cbf4eef223968006c8215523bfb8cf88a1d3e6e0d610cb814a95ded1e93f936a97e48ac1a696768b7090d3c6f6d85
7
+ data.tar.gz: c734c84a25d0d86be292110f2616e19b868b8d594bb6ad54ce457026de47fb1580bd17812e8c384c2449e964d79187aeb5cca90254618235e7260df5a0937dd7
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 "gnome2/rake/package-task"
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
- GNOME2::Rake::PackageTask.define(spec, __dir__) do |package|
25
+ GNOME::Rake::PackageTask.define(spec, __dir__) do |package|
26
26
  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.set_value("format", "F32LE")
32
+ caps.set_value("rate", 16 * 1000)
33
+ caps.set_value("channels", 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
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gstreamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.4
4
+ version: 4.2.5
5
5
  platform: ruby
6
+ original_platform: ''
6
7
  authors:
7
8
  - The Ruby-GNOME Project Team
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2024-09-23 00:00:00.000000000 Z
11
+ date: 2024-12-15 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: gobject-introspection
@@ -15,14 +16,14 @@ dependencies:
15
16
  requirements:
16
17
  - - '='
17
18
  - !ruby/object:Gem::Version
18
- version: 4.2.4
19
+ version: 4.2.5
19
20
  type: :runtime
20
21
  prerelease: false
21
22
  version_requirements: !ruby/object:Gem::Requirement
22
23
  requirements:
23
24
  - - '='
24
25
  - !ruby/object:Gem::Version
25
- version: 4.2.4
26
+ version: 4.2.5
26
27
  description: Ruby/GStreamer is a Ruby binding for GStreamer.
27
28
  email: ruby-gnome2-devel-en@lists.sourceforge.net
28
29
  executables: []
@@ -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