gstreamer_play 1.0.0
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 +7 -0
- data/CHANGELOG.md +48 -0
- data/LICENSE +200 -0
- data/NOTICE +33 -0
- data/README.md +186 -0
- data/lib/gstreamer_play/loader.rb +69 -0
- data/lib/gstreamer_play/version.rb +8 -0
- data/lib/gstreamer_play/version.rb.erb +8 -0
- data/lib/gstreamer_play.rb +58 -0
- metadata +97 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ac76009104de8c5a51f2eba55866aa48a41f6aa953c2c1393b0a9c8b6b1435dd
|
|
4
|
+
data.tar.gz: 56fc40c74fd0891f27e5f538e497b81d1b366943bd1d4b15d86dbb38def5be92
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d80b21610a6583f6e10043858cee7e0135b9682b6bff1d6622a7e052804c7727b801c5a7022b0850b4bb02e348305417a0972d947a401ab1423d8cde372cf04a
|
|
7
|
+
data.tar.gz: f1d55496d0384f3c3e764cc63b59618133885b094e805a5c31c07e55a037a574937bc1dd6e64921b163648f7353afaff27dd0ed3802606c0e7e1dc9687b15f23
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.0.0] - 2026-11-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `GstPlay`, defined from the `GstPlay-1.0` GObject Introspection typelib at
|
|
15
|
+
require time, giving a high-level playback pipeline, which is what a media player wants rather than assembling elements by hand. `GstPlay::Loader` is a
|
|
16
|
+
`GObjectIntrospection::Loader` subclass, so the binding is the whole
|
|
17
|
+
namespace rather than a hand-written subset, and it does not drift as the
|
|
18
|
+
library gains API.
|
|
19
|
+
- A dev shell (`flake.nix`) that pins the library and glib from one nixpkgs and
|
|
20
|
+
puts their typelibs on `GI_TYPELIB_PATH`, and CI that runs the suite inside
|
|
21
|
+
it, because the environment is the hard part of an introspection binding.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- The binding no longer goes through Rust. Earlier revisions wrapped a
|
|
26
|
+
gir-generated crate with magnus, which meant an `ext/` directory, a Cargo
|
|
27
|
+
workspace, system libraries at build time and a nine-platform cross-compile
|
|
28
|
+
matrix, to expose the handful of functions someone had written by hand. The
|
|
29
|
+
typelib loader replaces all of it with about twenty lines of Ruby.
|
|
30
|
+
- The gem is pure Ruby and declares no extensions. Installing it still
|
|
31
|
+
compiles C, because `glib2` and `gobject-introspection` are native
|
|
32
|
+
extensions built against glib — but this gem adds no build step of its own,
|
|
33
|
+
and those two are what every ruby-gnome application already has via `gtk4`.
|
|
34
|
+
- `bin/release-gem` releases one gem. It was built for the Rust model, where a
|
|
35
|
+
release meant a source gem plus one precompiled gem per platform downloaded
|
|
36
|
+
from the Cross Compile workflow; that workflow is gone and there are no
|
|
37
|
+
platform gems, so left alone it aborted before doing anything.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
41
|
+
- `ext/`, `Cargo.toml`, `Cargo.lock`, the cross-compile workflow, and the
|
|
42
|
+
`rb_sys` and `rake-compiler` dependencies.
|
|
43
|
+
- `bin/release-gem`. It existed because releasing a Rust gem meant publishing a
|
|
44
|
+
source gem plus one precompiled gem per platform, downloaded from the Cross
|
|
45
|
+
Compile workflow's artifacts. There is nothing to compile here, so there is
|
|
46
|
+
one gem and one push, which is exactly what `gem kit release` does. The
|
|
47
|
+
script added only a check that the local version was ahead of RubyGems, and
|
|
48
|
+
`gem push` already refuses a version that has been pushed.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. Please also get an
|
|
186
|
+
individualized contributor license agreement from each contributor.
|
|
187
|
+
|
|
188
|
+
Copyright 2026 General Intelligence Systems
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
data/NOTICE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
GstPlay for Ruby
|
|
2
|
+
Copyright 2026 General Intelligence Systems
|
|
3
|
+
|
|
4
|
+
This product includes software developed by the GStreamer project.
|
|
5
|
+
|
|
6
|
+
--------------------------------------------------------------------------------
|
|
7
|
+
GStreamer
|
|
8
|
+
--------------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
This gem is a binding, not an implementation. It contains no GStreamer code:
|
|
11
|
+
GObjectIntrospection::Loader reads GstPlay-1.0.typelib -- a machine-readable
|
|
12
|
+
description of the library, installed by gst-plugins-bad -- at require time and
|
|
13
|
+
defines Ruby classes from it. Nothing is linked, vendored, bundled or
|
|
14
|
+
redistributed here, and nothing in this repository is derived from GStreamer's
|
|
15
|
+
source.
|
|
16
|
+
|
|
17
|
+
GStreamer and its plugin modules are licensed LGPL-2.1-or-later. The gem reads
|
|
18
|
+
whatever copy the system already has.
|
|
19
|
+
|
|
20
|
+
https://gitlab.freedesktop.org/gstreamer/gstreamer
|
|
21
|
+
Copyright 1999-2026 the GStreamer contributors
|
|
22
|
+
Licensed under the GNU Lesser General Public License v2.1 or later
|
|
23
|
+
|
|
24
|
+
--------------------------------------------------------------------------------
|
|
25
|
+
ruby-gnome
|
|
26
|
+
--------------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
The loader follows ruby-gnome's own, and the gem depends on its
|
|
29
|
+
gobject-introspection and glib2 gems, which are not redistributed here.
|
|
30
|
+
|
|
31
|
+
https://github.com/ruby-gnome/ruby-gnome
|
|
32
|
+
Copyright 2002-2026 the Ruby-GNOME Project Team
|
|
33
|
+
Licensed under the GNU Lesser General Public License v2.1 or later
|
data/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# gstreamer_play
|
|
2
|
+
|
|
3
|
+
Ruby bindings for [GstPlay](https://gstreamer.freedesktop.org/documentation/play/index.html),
|
|
4
|
+
GStreamer's high-level playback library.
|
|
5
|
+
|
|
6
|
+
```ruby
|
|
7
|
+
require "gstreamer_play"
|
|
8
|
+
|
|
9
|
+
play = GstPlay::Play.new
|
|
10
|
+
play.uri = "file:///music/track.opus"
|
|
11
|
+
play.volume = 0.8
|
|
12
|
+
play.play
|
|
13
|
+
|
|
14
|
+
main_loop = GLib::MainLoop.new
|
|
15
|
+
|
|
16
|
+
# Everything it does, it reports. GstPlay::PlaySignalAdapter turns that into
|
|
17
|
+
# GObject signals on a main context of your choosing -- the application's, if
|
|
18
|
+
# you have one.
|
|
19
|
+
adapter = GstPlay::PlaySignalAdapter.new(play)
|
|
20
|
+
adapter.signal_connect("state-changed") { |_adapter, state| puts state }
|
|
21
|
+
adapter.signal_connect("position-updated") { |_adapter, position| puts position }
|
|
22
|
+
adapter.signal_connect("end-of-stream") { main_loop.quit }
|
|
23
|
+
|
|
24
|
+
main_loop.run
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Give `GstPlay::Play` a URI and it builds and drives a `playbin3` underneath, on
|
|
28
|
+
its own GLib main context and its own thread. Nothing above needs an event loop
|
|
29
|
+
of its own for playback to run — the main loop there is only so that the
|
|
30
|
+
process stays alive to hear the signals, and in a GTK application you already
|
|
31
|
+
have one.
|
|
32
|
+
|
|
33
|
+
The other way to read what it is doing is `play.message_bus`, which carries
|
|
34
|
+
`GstPlay::PlayMessage`s. Pulling them off that bus means calling `Gst::Bus`
|
|
35
|
+
methods, which belong to the `gstreamer` gem rather than to this one — with
|
|
36
|
+
just this gem, use the signal adapter.
|
|
37
|
+
|
|
38
|
+
## How this works, and why there is nothing here to compile
|
|
39
|
+
|
|
40
|
+
gst-plugins-bad ships a GObject Introspection typelib that describes every
|
|
41
|
+
class, method, property and signal GstPlay has. `GstPlay::Loader` hands that
|
|
42
|
+
typelib to ruby-gnome's `GObjectIntrospection::Loader`, which defines the Ruby
|
|
43
|
+
classes from it at `require` time.
|
|
44
|
+
|
|
45
|
+
So this gem is pure Ruby: no extension of its own, no Cargo workspace, no
|
|
46
|
+
per-platform binary. You get the whole library rather than the subset somebody
|
|
47
|
+
got round to wrapping by hand, and it does not drift when GstPlay gains API.
|
|
48
|
+
|
|
49
|
+
It is worth being precise about what that does and does not buy you at install
|
|
50
|
+
time. `gem install gstreamer_play` still compiles C, because
|
|
51
|
+
`gobject-introspection` and `glib2` are themselves native extensions built
|
|
52
|
+
against glib — so a compiler and glib's development headers are needed. What
|
|
53
|
+
this gem adds on top of that is nothing: those two are what every ruby-gnome
|
|
54
|
+
application already has, since `gtk4` depends on them. If you are writing a
|
|
55
|
+
Ruby GTK app, gstreamer_play costs you no build step you were not already
|
|
56
|
+
paying.
|
|
57
|
+
|
|
58
|
+
Note also what is *not* a dependency: the `gstreamer` gem. GStreamer has to be
|
|
59
|
+
initialised before GstPlay's types exist, and the loader does that by calling
|
|
60
|
+
`gst_init_check` through the typelib — so this gem does not pull in that gem's
|
|
61
|
+
compiled extension to make one call. If your application wants the `Gst`
|
|
62
|
+
namespace in Ruby as well, add the `gstreamer` gem for it; the two coexist.
|
|
63
|
+
|
|
64
|
+
This is how [ruby-gnome](https://github.com/ruby-gnome/ruby-gnome) itself ships
|
|
65
|
+
gtksourceview5, libsecret and the rest.
|
|
66
|
+
|
|
67
|
+
## What you must install
|
|
68
|
+
|
|
69
|
+
The typelib and the plugins are C-library artefacts, so they belong to your
|
|
70
|
+
distribution and this gem cannot install them. GstPlay is in
|
|
71
|
+
**gst-plugins-bad**, not in GStreamer core:
|
|
72
|
+
|
|
73
|
+
| | |
|
|
74
|
+
|---|---|
|
|
75
|
+
| Debian / Ubuntu | `gstreamer1.0-plugins-bad`, plus `gir1.2-gst-plugins-bad-1.0` for the typelib and `gstreamer1.0-plugins-base` and `-good` for `playbin3` and its decoders |
|
|
76
|
+
| Fedora | `gstreamer1-plugins-bad-free`, `gstreamer1-plugins-base`, `gstreamer1-plugins-good` |
|
|
77
|
+
| Arch | `gst-plugins-bad`, `gst-plugins-base`, `gst-plugins-good` |
|
|
78
|
+
| nix | `pkgs.gst_all_1.gst-plugins-bad`, `pkgs.gst_all_1.gst-plugins-base`, `pkgs.gst_all_1.gst-plugins-good`, `pkgs.gst_all_1.gstreamer` |
|
|
79
|
+
|
|
80
|
+
If the typelibs are not in the default search path, point `GI_TYPELIB_PATH` at
|
|
81
|
+
the directory holding `GstPlay-1.0.typelib` — and at the ones holding the
|
|
82
|
+
typelibs it depends on: `Gst-1.0`, `GstBase-1.0` (GStreamer core),
|
|
83
|
+
`GstVideo-1.0`, `GstAudio-1.0`, `GstTag-1.0` and `GstPbutils-1.0`
|
|
84
|
+
(gst-plugins-base). The dev shell in `flake.nix` does all of this.
|
|
85
|
+
|
|
86
|
+
**The plugins are not optional.** `GstPlay::Play.new` constructs a `playbin3`,
|
|
87
|
+
and GstPlay treats a missing `playbin3` as a fatal error that aborts the
|
|
88
|
+
process rather than something it can report. If GStreamer cannot find its
|
|
89
|
+
plugins, set `GST_PLUGIN_SYSTEM_PATH_1_0`.
|
|
90
|
+
|
|
91
|
+
**One trap worth knowing.** The typelibs must come from the same glib build as
|
|
92
|
+
the `gobject-introspection` gem. Mixing two registers GIO twice in one process
|
|
93
|
+
and fails with `cannot register existing type 'GTlsCertificate'`. Under nix,
|
|
94
|
+
take both from one nixpkgs — and note that glib's and gstreamer's typelibs are
|
|
95
|
+
in their `out` output, not the default `bin` one.
|
|
96
|
+
|
|
97
|
+
## Using it from a flake
|
|
98
|
+
|
|
99
|
+
The gem needs `GstPlay-1.0.typelib` and everything that typelib declares,
|
|
100
|
+
resolved transitively by the loader at `require` time — six GStreamer
|
|
101
|
+
namespaces (Gst, GstBase, GstVideo, GstAudio, GstTag, GstPbutils) and
|
|
102
|
+
GLib/GObject/Gio under those. A missing one surfaces as
|
|
103
|
+
`Typelib file for namespace 'X' not found`, one at a time, so the whole chain
|
|
104
|
+
is listed here rather than discovered by repeated failure:
|
|
105
|
+
|
|
106
|
+
- `pkgs.gst_all_1.gst-plugins-bad` — `GstPlay-1.0` itself, plus `GstBadAudio-1.0`
|
|
107
|
+
- `pkgs.gst_all_1.gst-plugins-base` — `GstPbutils`, `GstVideo`, `GstAudio`, `GstTag`
|
|
108
|
+
- `pkgs.gst_all_1.gstreamer` — `Gst-1.0` and `GstBase-1.0`, and the `gst_init`
|
|
109
|
+
this namespace cannot load without
|
|
110
|
+
- `pkgs.gst_all_1.gst-plugins-good` — no typelib; it carries plugins (see below)
|
|
111
|
+
- `pkgs.glib` — `GLib-2.0`, `GObject-2.0` and `Gio-2.0`
|
|
112
|
+
|
|
113
|
+
Note the `.out`: a package's default output is often `bin`, which carries no
|
|
114
|
+
typelibs — true of both glib and gstreamer here. `makeSearchPath` takes the
|
|
115
|
+
first output, so it has to be asked for `out` explicitly. This is the single
|
|
116
|
+
most common way to get a search path that looks right and finds nothing.
|
|
117
|
+
|
|
118
|
+
`GST_PLUGIN_SYSTEM_PATH_1_0` is the second thing, and it is not optional for
|
|
119
|
+
this namespace: `GstPlay::Play.new` builds a `playbin3`, and GstPlay treats a
|
|
120
|
+
missing `playbin3` as a fatal `g_error` rather than as something it can report.
|
|
121
|
+
A shell with the typelibs but no plugins aborts instead of raising.
|
|
122
|
+
|
|
123
|
+
```nix
|
|
124
|
+
{
|
|
125
|
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
126
|
+
|
|
127
|
+
outputs = { nixpkgs, ... }:
|
|
128
|
+
let
|
|
129
|
+
system = "x86_64-linux";
|
|
130
|
+
pkgs = nixpkgs.legacyPackages.${system};
|
|
131
|
+
|
|
132
|
+
gstPackages = with pkgs.gst_all_1; [
|
|
133
|
+
gst-plugins-bad
|
|
134
|
+
gst-plugins-base
|
|
135
|
+
gstreamer
|
|
136
|
+
gst-plugins-good
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
typelibPath = pkgs.lib.makeSearchPath "lib/girepository-1.0"
|
|
140
|
+
(map (drv: drv.out or drv) (gstPackages ++ [ pkgs.glib ]));
|
|
141
|
+
|
|
142
|
+
pluginPath = pkgs.lib.makeSearchPath "lib/gstreamer-1.0" gstPackages;
|
|
143
|
+
in
|
|
144
|
+
{
|
|
145
|
+
devShells.${system}.default = pkgs.mkShell {
|
|
146
|
+
packages = [ pkgs.ruby_3_4 pkgs.bundler ] ++ gstPackages;
|
|
147
|
+
|
|
148
|
+
shellHook = ''
|
|
149
|
+
export GI_TYPELIB_PATH="${typelibPath}''${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
|
|
150
|
+
export GST_PLUGIN_SYSTEM_PATH_1_0="${pluginPath}"
|
|
151
|
+
'';
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Everything must come from **one** nixpkgs. A typelib built against a different
|
|
158
|
+
glib than the `gobject-introspection` gem registers GIO twice in the process
|
|
159
|
+
and fails with `cannot register existing type 'GTlsCertificate'`.
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
nix develop
|
|
165
|
+
bin/test
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Releasing
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
gem kit release
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
That is the whole thing. It gates on the changelog having an entry for this
|
|
175
|
+
version, on no deprecation deadline coming due, and on a clean working tree;
|
|
176
|
+
then builds, pushes and tags.
|
|
177
|
+
|
|
178
|
+
There is nothing to wait for in CI. This gem is pure Ruby, so `gem build`
|
|
179
|
+
produces one `gstreamer_play-X.Y.Z.gem` that is the same artefact wherever it is built —
|
|
180
|
+
no extension, no per-platform gems, nothing for a workflow to hand back.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
## Licence
|
|
184
|
+
|
|
185
|
+
Apache-2.0. GStreamer itself is LGPL-2.1-or-later; this gem links nothing and
|
|
186
|
+
copies no GStreamer code — it reads a description of it at runtime.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the Apache License, Version 2.0.
|
|
4
|
+
# Copyright, 2026, by General Intelligence Systems.
|
|
5
|
+
|
|
6
|
+
module GstPlay
|
|
7
|
+
# Defines everything in the GstPlay namespace from gst-plugins-bad's typelib.
|
|
8
|
+
#
|
|
9
|
+
# Modelled on ruby-gnome's own loaders (see gtksourceview5/lib/gtksourceview5/loader.rb,
|
|
10
|
+
# which also has an init function to call, and gstreamer/lib/gst/loader.rb,
|
|
11
|
+
# which is where the `gst_init_check` call below comes from).
|
|
12
|
+
#
|
|
13
|
+
# The version string is the typelib's, not the library's: GStreamer 1.28
|
|
14
|
+
# ships `GstPlay-1.0.typelib`, so the version here is "1.0".
|
|
15
|
+
class Loader < GObjectIntrospection::Loader
|
|
16
|
+
def load
|
|
17
|
+
self.version = "1.0"
|
|
18
|
+
super("GstPlay")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
# GStreamer must be initialised before the GstPlay namespace is read.
|
|
24
|
+
#
|
|
25
|
+
# This is not a nicety. `gst_init` is what registers GStreamer's GTypes,
|
|
26
|
+
# and the loader walks the typelib asking GObject about each one as it
|
|
27
|
+
# goes. Without it, loading GstPlaySignalAdapter dies in GLib with
|
|
28
|
+
#
|
|
29
|
+
# gsignal.c: parameter 2 of type '<invalid>' for signal
|
|
30
|
+
# "GstPlaySignalAdapter::error" is not a value type
|
|
31
|
+
#
|
|
32
|
+
# and what you are left with is a namespace that looks loaded -- the
|
|
33
|
+
# constants are all there -- and then misbehaves. GtkSource has the same
|
|
34
|
+
# shape of problem and ruby-gnome solves it the same way, in `pre_load`.
|
|
35
|
+
def pre_load(repository, namespace)
|
|
36
|
+
initialize_gstreamer(repository)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# `gst_init_check` rather than `gst_init`, because `gst_init` aborts the
|
|
40
|
+
# process on failure and this returns the GError instead. argv is passed
|
|
41
|
+
# and read back the way ruby-gnome's own Gst::Loader does it: GStreamer
|
|
42
|
+
# consumes its own `--gst-*` options out of it.
|
|
43
|
+
#
|
|
44
|
+
# Done through the repository rather than through a Ruby `Gst` module on
|
|
45
|
+
# purpose. This gem defines one namespace, GstPlay, and depends only on
|
|
46
|
+
# `gobject-introspection`; initialising the C library does not need the
|
|
47
|
+
# `gstreamer` gem's compiled extension, and taking a dependency on it to
|
|
48
|
+
# make one call would make this gem's install a GStreamer build too.
|
|
49
|
+
# `gst_init_check` is idempotent, so an application that also uses the
|
|
50
|
+
# `gstreamer` gem can call `Gst.init` whenever it likes.
|
|
51
|
+
def initialize_gstreamer(repository)
|
|
52
|
+
repository.require("Gst", "1.0")
|
|
53
|
+
|
|
54
|
+
succeeded, _argv, error = repository.find("Gst", "init_check").invoke([[$0]])
|
|
55
|
+
raise error unless succeeded
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def post_load(repository, namespace)
|
|
59
|
+
require_libraries
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def require_libraries
|
|
63
|
+
# Nothing yet. Hand-written Ruby that improves on what the typelib gives
|
|
64
|
+
# -- an each that yields, a to_s, a keyword-argument constructor -- goes
|
|
65
|
+
# in files required from here, which is the convention ruby-gnome uses
|
|
66
|
+
# for exactly that purpose.
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the Apache License, Version 2.0.
|
|
4
|
+
# Copyright, 2026, by General Intelligence Systems.
|
|
5
|
+
|
|
6
|
+
require "gobject-introspection"
|
|
7
|
+
|
|
8
|
+
require_relative "gstreamer_play/version"
|
|
9
|
+
require_relative "gstreamer_play/loader"
|
|
10
|
+
|
|
11
|
+
# Ruby bindings for GstPlay, GStreamer's high-level playback library.
|
|
12
|
+
#
|
|
13
|
+
# There is no compiled extension here and nothing in this gem wraps a GstPlay
|
|
14
|
+
# function by hand. gst-plugins-bad ships a GObject Introspection typelib
|
|
15
|
+
# describing every class, method, property and signal GstPlay has, and
|
|
16
|
+
# ruby-gnome's GObjectIntrospection::Loader reads that at require time and
|
|
17
|
+
# defines the Ruby classes from it. {GstPlay::Loader} is a few dozen lines;
|
|
18
|
+
# what you get is the whole library, and it does not drift when GstPlay gains
|
|
19
|
+
# a method.
|
|
20
|
+
#
|
|
21
|
+
# This is how ruby-gnome itself ships gtksourceview5, adwaita and the rest.
|
|
22
|
+
#
|
|
23
|
+
# {Play} is the playback object: give it a URI, call `play`, and it builds and
|
|
24
|
+
# drives a `playbin3` underneath, on its own main context and its own thread.
|
|
25
|
+
# It reports state, position, errors and discovered media as {PlayMessage}s on
|
|
26
|
+
# a bus, and {PlaySignalAdapter} turns those into GObject signals -- so it
|
|
27
|
+
# needs no event loop of yours to run, in a GTK application or out of one.
|
|
28
|
+
#
|
|
29
|
+
# require "gstreamer_play"
|
|
30
|
+
#
|
|
31
|
+
# play = GstPlay::Play.new
|
|
32
|
+
# play.uri = "file:///music/track.opus"
|
|
33
|
+
# play.play
|
|
34
|
+
#
|
|
35
|
+
# GStreamer has to be initialised before any of these types exist, which the
|
|
36
|
+
# loader does in `pre_load` -- see the comment there for why that is not
|
|
37
|
+
# optional, and why it does not require the `gstreamer` gem to do it.
|
|
38
|
+
#
|
|
39
|
+
# The typelib has to be findable at require time, which means gst-plugins-bad's
|
|
40
|
+
# `girepository-1.0` directory on `GI_TYPELIB_PATH` (or in the system default),
|
|
41
|
+
# along with the ones GstPlay-1.0.typelib names as dependencies: Gst, GstBase,
|
|
42
|
+
# GstVideo, GstAudio, GstTag and GstPbutils. This gem cannot install them: they
|
|
43
|
+
# are C libraries, so they belong to the distribution. See the README for the
|
|
44
|
+
# package names. The dev shell in `flake.nix` wires it all up.
|
|
45
|
+
#
|
|
46
|
+
# One trap, paid for already: the typelib must come from the same glib build as
|
|
47
|
+
# the `gobject-introspection` gem. Mix two and GIO gets registered twice in one
|
|
48
|
+
# process, which fails as `cannot register existing type 'GTlsCertificate'`.
|
|
49
|
+
module GstPlay
|
|
50
|
+
LOG_DOMAIN = "GstPlay"
|
|
51
|
+
GLib::Log.set_log_domain(LOG_DOMAIN)
|
|
52
|
+
|
|
53
|
+
class Error < StandardError
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
loader = Loader.new(self)
|
|
57
|
+
loader.load
|
|
58
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gstreamer_play
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nathan Kidd
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: gem_kit
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.2'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: gobject-introspection
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4.3'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '4.3'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: lefthook
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.2'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.2'
|
|
54
|
+
description: 'GstPlay for Ruby, defined from its GObject Introspection typelib at
|
|
55
|
+
require time rather than wrapped by hand. A URI in, playback out: GstPlay builds
|
|
56
|
+
and drives the pipeline itself, runs its own main context, and reports state, position,
|
|
57
|
+
errors and discovered media as signals and bus messages -- so it needs no event
|
|
58
|
+
loop of yours to run, in a GTK application or out of one. Pure Ruby: there is no
|
|
59
|
+
extension to compile, and the binding does not drift as GstPlay gains API.'
|
|
60
|
+
email:
|
|
61
|
+
- nathankidd@hey.com
|
|
62
|
+
executables: []
|
|
63
|
+
extensions: []
|
|
64
|
+
extra_rdoc_files: []
|
|
65
|
+
files:
|
|
66
|
+
- CHANGELOG.md
|
|
67
|
+
- LICENSE
|
|
68
|
+
- NOTICE
|
|
69
|
+
- README.md
|
|
70
|
+
- lib/gstreamer_play.rb
|
|
71
|
+
- lib/gstreamer_play/loader.rb
|
|
72
|
+
- lib/gstreamer_play/version.rb
|
|
73
|
+
- lib/gstreamer_play/version.rb.erb
|
|
74
|
+
homepage: https://github.com/n-at-han-k/gstreamer-play-rb
|
|
75
|
+
licenses:
|
|
76
|
+
- Apache-2.0
|
|
77
|
+
metadata:
|
|
78
|
+
source_code_uri: https://github.com/n-at-han-k/gstreamer-play-rb
|
|
79
|
+
documentation_uri: https://n-at-han-k.github.io/gstreamer-play-rb/
|
|
80
|
+
rdoc_options: []
|
|
81
|
+
require_paths:
|
|
82
|
+
- lib
|
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '3.3'
|
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '0'
|
|
93
|
+
requirements: []
|
|
94
|
+
rubygems_version: 3.7.2
|
|
95
|
+
specification_version: 4
|
|
96
|
+
summary: Ruby bindings for GstPlay, GStreamer's high-level playback library.
|
|
97
|
+
test_files: []
|