gstreamer_pbutils 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 +42 -0
- data/README.md +171 -0
- data/lib/gstreamer_pbutils/loader.rb +86 -0
- data/lib/gstreamer_pbutils/version.rb +8 -0
- data/lib/gstreamer_pbutils/version.rb.erb +8 -0
- data/lib/gstreamer_pbutils.rb +58 -0
- metadata +96 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 64d8b5f3be4efa46b025bc7b75215f5d0b2f886daf21c981866284f2aca8ece3
|
|
4
|
+
data.tar.gz: a5723cb26fa3c11c53f62f808fc224d4cee8f71de65b0ab6d953e34c8cc13d10
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: '09534766d4f2d0aa65954e90114a4bb5e84fb22ac53daa0a071caece3abbf1f2b86d5a09d9e1e30409481b6d4ce9e2038f256a52fa1e1f1b3216d373cc36ca66'
|
|
7
|
+
data.tar.gz: 17d3d4d342f766eaa7fb26e155f26f4b8089c974cc1d195b44b1c919cb2f756d90dd56da7997ae613ced9c830e682f8cbac711de223cfc1d02d389326c892b13
|
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
|
+
- `GstPbutils`, defined from the `GstPbutils-1.0` GObject Introspection typelib at
|
|
15
|
+
require time, giving the discoverer that inspects a media file, encoding profiles, and human-readable codec descriptions. `GstPbutils::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,42 @@
|
|
|
1
|
+
GstreamerPbutils for Ruby
|
|
2
|
+
Copyright 2026 General Intelligence Systems
|
|
3
|
+
|
|
4
|
+
This product includes no software developed by the GStreamer project. It reads
|
|
5
|
+
a machine-readable description of it at runtime.
|
|
6
|
+
|
|
7
|
+
--------------------------------------------------------------------------------
|
|
8
|
+
gst-plugins-base
|
|
9
|
+
--------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
The library this gem binds is libgstpbutils, from gst-plugins-base.
|
|
12
|
+
|
|
13
|
+
https://gitlab.freedesktop.org/gstreamer/gstreamer
|
|
14
|
+
Copyright 1999-2026 the GStreamer contributors
|
|
15
|
+
Licensed under the GNU Lesser General Public License, version 2.1 or later
|
|
16
|
+
|
|
17
|
+
Nothing is linked and nothing is copied. This gem has no compiled extension:
|
|
18
|
+
GObjectIntrospection::Loader opens GstPbutils-1.0.typelib at require time and
|
|
19
|
+
defines Ruby classes from what it finds there. The typelib is a description of
|
|
20
|
+
the library's API, it belongs to the host's gst-plugins-base installation, and
|
|
21
|
+
it is not distributed with this gem. No part of gst-plugins-base is copied into
|
|
22
|
+
this repository or into a built gem, and no header, source file or declaration
|
|
23
|
+
of it is reproduced here.
|
|
24
|
+
|
|
25
|
+
The LGPL applies to that library, not to this work. Loading an
|
|
26
|
+
LGPL-2.1-or-later library's introspection data from an Apache-2.0 work is
|
|
27
|
+
further from the licence's reach than the dynamic linkage it already permits.
|
|
28
|
+
|
|
29
|
+
--------------------------------------------------------------------------------
|
|
30
|
+
ruby-gnome
|
|
31
|
+
--------------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
The loader in lib/gstreamer_pbutils/loader.rb is written on the model of
|
|
34
|
+
ruby-gnome's own GObject Introspection loaders -- gtksourceview5 and libsecret
|
|
35
|
+
in particular -- and runs on ruby-gnome's gobject-introspection gem.
|
|
36
|
+
|
|
37
|
+
https://github.com/ruby-gnome/ruby-gnome
|
|
38
|
+
Copyright 2003-2026 the Ruby-GNOME Project Team
|
|
39
|
+
Licensed under the GNU Lesser General Public License, version 2.1 or later
|
|
40
|
+
|
|
41
|
+
ruby-gnome is a gem dependency, resolved by RubyGems at install time. No part
|
|
42
|
+
of it is copied into this repository or into a built gem.
|
data/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# gstreamer_pbutils
|
|
2
|
+
|
|
3
|
+
Ruby bindings for [GStreamer Base Utils](https://gstreamer.freedesktop.org/documentation/pbutils/),
|
|
4
|
+
the `libgstpbutils` library that ships with gst-plugins-base.
|
|
5
|
+
|
|
6
|
+
Base Utils is the part of the GStreamer stack that answers questions *about*
|
|
7
|
+
media rather than moving any, and none of it wants a window or a main loop.
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
require "gstreamer_pbutils"
|
|
11
|
+
|
|
12
|
+
# What profile and level does this H.264 SPS declare?
|
|
13
|
+
GstPbutils.codec_utils_h264_get_level_idc("4.1") # => 41
|
|
14
|
+
|
|
15
|
+
# What is in this two-byte AAC AudioSpecificConfig?
|
|
16
|
+
GstPbutils.codec_utils_aac_get_profile("\x12\x10".b) # => "lc"
|
|
17
|
+
|
|
18
|
+
# What streams does a file actually contain?
|
|
19
|
+
discoverer = GstPbutils::Discoverer.new(5 * 1_000_000_000) # 5s, in nanoseconds
|
|
20
|
+
info = discoverer.discover_uri("file:///tmp/clip.mp4")
|
|
21
|
+
info.stream_list.map(&:caps)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The gem is `gstreamer_pbutils`; the module is `GstPbutils`. That is the
|
|
25
|
+
typelib's own name for the namespace, and renaming it would put the Ruby docs
|
|
26
|
+
and the C docs under different names for the same class.
|
|
27
|
+
|
|
28
|
+
## How this works
|
|
29
|
+
|
|
30
|
+
gst-plugins-base ships a GObject Introspection typelib that describes every
|
|
31
|
+
class, method, property and signal `libgstpbutils` has. `GstPbutils::Loader`
|
|
32
|
+
hands that typelib to ruby-gnome's `GObjectIntrospection::Loader`, which
|
|
33
|
+
defines the Ruby classes from it at `require` time.
|
|
34
|
+
|
|
35
|
+
So this gem has no extension of its own: no C, no Cargo workspace, no
|
|
36
|
+
per-platform binary. You get the whole library rather than the subset somebody
|
|
37
|
+
got round to wrapping by hand, and it does not drift when gst-plugins-base
|
|
38
|
+
gains API.
|
|
39
|
+
|
|
40
|
+
It is worth being precise about what that does and does not buy you at install
|
|
41
|
+
time. `gem install gstreamer_pbutils` still compiles C, because
|
|
42
|
+
`gobject-introspection` and `glib2` are themselves native extensions built
|
|
43
|
+
against glib — so a compiler and glib's development headers are needed. What
|
|
44
|
+
this gem adds on top of that is nothing: those two are what every ruby-gnome
|
|
45
|
+
application already has, since `gtk4` depends on them. If you are writing a
|
|
46
|
+
Ruby GTK app, this gem costs you no build step you were not already paying.
|
|
47
|
+
|
|
48
|
+
This is how [ruby-gnome](https://github.com/ruby-gnome/ruby-gnome) itself ships
|
|
49
|
+
gtksourceview5, libsecret and the rest.
|
|
50
|
+
|
|
51
|
+
## What you must install
|
|
52
|
+
|
|
53
|
+
Two things, and the gem can install neither — both are C-library artefacts and
|
|
54
|
+
belong to your distribution:
|
|
55
|
+
|
|
56
|
+
- **the typelibs**, `GstPbutils-1.0.typelib` and the `Gst-1.0.typelib` it
|
|
57
|
+
declares as a dependency;
|
|
58
|
+
- **a plugin registry**, because `GstPbutils::Discoverer` builds a
|
|
59
|
+
`uridecodebin` and raises `Couldn't create 'uridecodebin' element` without
|
|
60
|
+
one. The `codec_utils_*` parsers and the description functions do not need it.
|
|
61
|
+
|
|
62
|
+
| | |
|
|
63
|
+
|---|---|
|
|
64
|
+
| Debian / Ubuntu | `gir1.2-gst-plugins-base-1.0`, `gir1.2-gstreamer-1.0`, `gstreamer1.0-plugins-base` |
|
|
65
|
+
| Fedora | `gstreamer1-plugins-base-devel`, `gstreamer1-devel` (the typelibs are in the `-devel` packages) |
|
|
66
|
+
| Arch | `gst-plugins-base`, `gstreamer` |
|
|
67
|
+
| nix | `pkgs.gst_all_1.gst-plugins-base`, `pkgs.gst_all_1.gstreamer` |
|
|
68
|
+
|
|
69
|
+
If the typelibs are not in the default search path, point `GI_TYPELIB_PATH` at
|
|
70
|
+
the directories holding them, and `GST_PLUGIN_SYSTEM_PATH_1_0` at the
|
|
71
|
+
`gstreamer-1.0` plugin directories. The dev shell in `flake.nix` does both.
|
|
72
|
+
|
|
73
|
+
**One trap worth knowing.** The typelib must come from the same glib build as
|
|
74
|
+
the `gobject-introspection` gem. Mixing two registers GObject's types twice in
|
|
75
|
+
one process and fails with `cannot register existing type 'GTlsCertificate'`.
|
|
76
|
+
Under nix, take both from one nixpkgs — and note that glib's and gstreamer's
|
|
77
|
+
typelibs are in their `out` output, not the default `bin` one.
|
|
78
|
+
|
|
79
|
+
## On the `gstreamer` gem
|
|
80
|
+
|
|
81
|
+
`GstPbutils-1.0` depends on `Gst-1.0`, and GStreamer core has to be initialised
|
|
82
|
+
before a single pbutils type can even be described. The loader does that
|
|
83
|
+
through the `Gst-1.0` typelib directly, so there is no gem dependency on
|
|
84
|
+
ruby-gnome's `gstreamer`.
|
|
85
|
+
|
|
86
|
+
Add that gem yourself if you want the `Gst` namespace as Ruby classes — which
|
|
87
|
+
you will, as soon as you want to build a `Gst::Caps` to pass to
|
|
88
|
+
`GstPbutils.pb_utils_get_codec_description`, or to read the `caps` off a
|
|
89
|
+
discovered stream as anything richer than an opaque handle. It is a native
|
|
90
|
+
extension compiled against gstreamer's headers, which is exactly why it is not
|
|
91
|
+
a dependency here: this gem would then carry a build step it does not need.
|
|
92
|
+
`gst_init_check` is idempotent, so the two compose in either order.
|
|
93
|
+
|
|
94
|
+
## Using it from a flake
|
|
95
|
+
|
|
96
|
+
The gem needs `GstPbutils-1.0.typelib` and everything that typelib declares, resolved
|
|
97
|
+
transitively by the loader at `require` time. A missing one surfaces as
|
|
98
|
+
`Typelib file for namespace 'X' not found`, one at a time, so the whole chain
|
|
99
|
+
is listed here rather than discovered by repeated failure:
|
|
100
|
+
|
|
101
|
+
- `pkgs.gst_all_1.gst-plugins-base` — GstPbutils-1.0, plus GstVideo, GstAudio and GstTag, which is where `GstPbutils-1.0.typelib` lives
|
|
102
|
+
- `pkgs.gst_all_1.gstreamer` — Gst-1.0, and the gst_init this namespace cannot load without
|
|
103
|
+
- `pkgs.glib` — GLib-2.0, GObject-2.0 and Gio-2.0, which nearly every GNOME typelib declares
|
|
104
|
+
|
|
105
|
+
Note the `.out`: a package's default output is often `bin`, which carries no
|
|
106
|
+
typelibs. `makeSearchPath` takes the first output, so it has to be asked for
|
|
107
|
+
`out` explicitly — this is the single most common way to get a search path that
|
|
108
|
+
looks right and finds nothing.
|
|
109
|
+
|
|
110
|
+
```nix
|
|
111
|
+
{
|
|
112
|
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
113
|
+
|
|
114
|
+
outputs = { nixpkgs, ... }:
|
|
115
|
+
let
|
|
116
|
+
system = "x86_64-linux";
|
|
117
|
+
pkgs = nixpkgs.legacyPackages.${system};
|
|
118
|
+
|
|
119
|
+
typelibPath = pkgs.lib.makeSearchPath "lib/girepository-1.0"
|
|
120
|
+
(map (drv: drv.out or drv) [ pkgs.gst_all_1.gst-plugins-base pkgs.gst_all_1.gstreamer pkgs.glib ]);
|
|
121
|
+
in
|
|
122
|
+
{
|
|
123
|
+
devShells.${system}.default = pkgs.mkShell {
|
|
124
|
+
packages = [ pkgs.ruby_3_4 pkgs.bundler ] ++ [ pkgs.gst_all_1.gst-plugins-base pkgs.gst_all_1.gstreamer pkgs.glib ];
|
|
125
|
+
|
|
126
|
+
shellHook = ''
|
|
127
|
+
export GI_TYPELIB_PATH="${typelibPath}''${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
|
|
128
|
+
'';
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Everything must come from **one** nixpkgs. A typelib built against a different
|
|
135
|
+
glib than the `gobject-introspection` gem registers GIO twice in the process
|
|
136
|
+
and fails with `cannot register existing type 'GTlsCertificate'`.
|
|
137
|
+
|
|
138
|
+
If you are packaging an application rather than entering a shell, the same
|
|
139
|
+
`typelibPath` goes on the wrapper:
|
|
140
|
+
|
|
141
|
+
```nix
|
|
142
|
+
makeWrapper ${ruby}/bin/ruby $out/bin/my-app \
|
|
143
|
+
--set GI_TYPELIB_PATH "${typelibPath}"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
nix develop
|
|
150
|
+
bin/test
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Releasing
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
gem kit release
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
That is the whole thing. It gates on the changelog having an entry for this
|
|
160
|
+
version, on no deprecation deadline coming due, and on a clean working tree;
|
|
161
|
+
then builds, pushes and tags.
|
|
162
|
+
|
|
163
|
+
There is nothing to wait for in CI. This gem is pure Ruby, so `gem build`
|
|
164
|
+
produces one `gstreamer_pbutils-X.Y.Z.gem` that is the same artefact wherever it is built —
|
|
165
|
+
no extension, no per-platform gems, nothing for a workflow to hand back.
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## Licence
|
|
169
|
+
|
|
170
|
+
Apache-2.0. gst-plugins-base itself is LGPL-2.1-or-later; this gem links
|
|
171
|
+
nothing and copies no GStreamer code — it reads a description of it at runtime.
|
|
@@ -0,0 +1,86 @@
|
|
|
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 GstPbutils
|
|
7
|
+
# Defines everything in the GstPbutils namespace from `GstPbutils-1.0.typelib`.
|
|
8
|
+
#
|
|
9
|
+
# Modelled on ruby-gnome's own loaders -- see
|
|
10
|
+
# gtksourceview5/lib/gtksourceview5/loader.rb for one that has to call the
|
|
11
|
+
# library's init function first, and libsecret/lib/libsecret/loader.rb for
|
|
12
|
+
# one that does not.
|
|
13
|
+
#
|
|
14
|
+
# The version string is the typelib's rather than the library's release
|
|
15
|
+
# number, and the two often differ: this one is "1.0", from
|
|
16
|
+
# `GstPbutils-1.0.typelib`, which ships in gst-plugins-base 1.28.
|
|
17
|
+
class Loader < GObjectIntrospection::Loader
|
|
18
|
+
def load
|
|
19
|
+
self.version = "1.0"
|
|
20
|
+
super("GstPbutils")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# Two initialisations have to happen before a single GstPbutils type can be
|
|
26
|
+
# described, and getting either wrong does not fail cleanly. It prints
|
|
27
|
+
# `GLib-CRITICAL **: g_array_append_vals: assertion 'array' failed` from
|
|
28
|
+
# the middle of the load and then segfaults the VM.
|
|
29
|
+
#
|
|
30
|
+
# `gst_init` is the first, and it is not this library's own:
|
|
31
|
+
# `GstPbutils-1.0` declares `Gst-1.0` as a dependency, and GStreamer's type
|
|
32
|
+
# system, plugin registry and value tables do not exist until core is
|
|
33
|
+
# initialised. The GI loader starts registering GTypes immediately, which
|
|
34
|
+
# is what walks off the end of an array core never allocated.
|
|
35
|
+
#
|
|
36
|
+
# `gst_pb_utils_init` is the second, and it is this library's own: it
|
|
37
|
+
# installs the description tables that `pb_utils_get_codec_description` and
|
|
38
|
+
# its neighbours read.
|
|
39
|
+
def pre_load(repository, namespace)
|
|
40
|
+
init_gstreamer(repository)
|
|
41
|
+
init_pb_utils(repository, namespace)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Deliberately through the typelib rather than through ruby-gnome's
|
|
45
|
+
# `gstreamer` gem. That gem would define the Gst namespace as Ruby classes,
|
|
46
|
+
# which is a real convenience -- but it is a native extension compiled
|
|
47
|
+
# against gstreamer's headers, so depending on it would add a build step
|
|
48
|
+
# this gem does not otherwise have. Callers who want `Gst::Caps` install it
|
|
49
|
+
# themselves; see the README. `gst_init_check` is idempotent, so calling it
|
|
50
|
+
# here does not conflict with that gem calling it later.
|
|
51
|
+
def init_gstreamer(repository)
|
|
52
|
+
repository.require("Gst", "1.0")
|
|
53
|
+
|
|
54
|
+
succeeded, = repository.find("Gst", "init_check").invoke([[$PROGRAM_NAME]])
|
|
55
|
+
|
|
56
|
+
raise Error, "gst_init_check failed: GStreamer core is unusable" unless succeeded
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def init_pb_utils(repository, namespace)
|
|
60
|
+
repository.find(namespace, "pb_utils_init").invoke([])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# `pb_utils_init` is not API for a caller: by the time the namespace exists
|
|
64
|
+
# it has already run. ruby-gnome's own loaders drop their init functions
|
|
65
|
+
# the same way.
|
|
66
|
+
def load_function_info(info)
|
|
67
|
+
case info.name
|
|
68
|
+
when "pb_utils_init"
|
|
69
|
+
# ignore
|
|
70
|
+
else
|
|
71
|
+
super
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def post_load(repository, namespace)
|
|
76
|
+
require_libraries
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def require_libraries
|
|
80
|
+
# Nothing yet. Hand-written Ruby that improves on what the typelib gives
|
|
81
|
+
# -- an each that yields, a to_s, a keyword-argument constructor -- goes
|
|
82
|
+
# in files required from here, which is the convention ruby-gnome uses
|
|
83
|
+
# for exactly that purpose.
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
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 "English"
|
|
7
|
+
|
|
8
|
+
require "gobject-introspection"
|
|
9
|
+
|
|
10
|
+
require_relative "gstreamer_pbutils/version"
|
|
11
|
+
require_relative "gstreamer_pbutils/loader"
|
|
12
|
+
|
|
13
|
+
# Ruby bindings for GStreamer Base Utils, the `libgstpbutils` library that
|
|
14
|
+
# ships with gst-plugins-base: the GstDiscoverer, the `gst_codec_utils_*`
|
|
15
|
+
# bitstream header parsers, the registry's codec and element descriptions, and
|
|
16
|
+
# the encoding profiles.
|
|
17
|
+
#
|
|
18
|
+
# Base Utils is the part of the GStreamer stack that answers questions *about*
|
|
19
|
+
# media rather than moving any, and none of it wants a window or a main loop,
|
|
20
|
+
# which is what makes it pleasant to use from a script.
|
|
21
|
+
#
|
|
22
|
+
# Nothing here wraps a C function by hand. gst-plugins-base ships a GObject
|
|
23
|
+
# Introspection typelib describing every class, method, property and signal the
|
|
24
|
+
# library has, and ruby-gnome's GObjectIntrospection::Loader reads that at
|
|
25
|
+
# require time and defines the Ruby classes from it. {GstPbutils::Loader} is
|
|
26
|
+
# the whole binding; what you get is the whole library, and it does not drift
|
|
27
|
+
# when gst-plugins-base gains API.
|
|
28
|
+
#
|
|
29
|
+
# This is how ruby-gnome itself ships gtksourceview5, libsecret and the rest.
|
|
30
|
+
#
|
|
31
|
+
# The gem is `gstreamer_pbutils` and the module is `GstPbutils`, which is not
|
|
32
|
+
# an oversight: the namespace a GI loader defines is the typelib's own, and
|
|
33
|
+
# renaming it would put the Ruby docs and the C docs under different names for
|
|
34
|
+
# the same class. `GstreamerPbutils::VERSION` is the gem's version and the only
|
|
35
|
+
# thing under the gem's own name.
|
|
36
|
+
#
|
|
37
|
+
# The typelib has to be findable at require time, which means
|
|
38
|
+
# gst-plugins-base's `girepository-1.0` directory on `GI_TYPELIB_PATH` or in
|
|
39
|
+
# the system default -- along with GStreamer core's, because `GstPbutils-1.0`
|
|
40
|
+
# declares `Gst-1.0` as a dependency and the loader resolves that
|
|
41
|
+
# transitively. This gem cannot install either: they are C library artefacts
|
|
42
|
+
# and belong to the distribution. See the README for the package names;
|
|
43
|
+
# `flake.nix` wires up a dev shell that has them.
|
|
44
|
+
#
|
|
45
|
+
# One trap, paid for already: the typelib must come from the same glib build as
|
|
46
|
+
# the `gobject-introspection` gem. Mix two and GObject's types are registered
|
|
47
|
+
# twice in one process, which fails as
|
|
48
|
+
# `cannot register existing type 'GTlsCertificate'`.
|
|
49
|
+
module GstPbutils
|
|
50
|
+
LOG_DOMAIN = "GstPbutils"
|
|
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,96 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gstreamer_pbutils
|
|
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: 'GStreamer Base Utils: discoverer, encoding profiles and codec descriptions,
|
|
55
|
+
for Ruby. Defined from its GObject Introspection typelib at require time rather
|
|
56
|
+
than wrapped by hand, so the binding is the whole library and does not drift as
|
|
57
|
+
it gains API.'
|
|
58
|
+
email:
|
|
59
|
+
- nathankidd@hey.com
|
|
60
|
+
executables: []
|
|
61
|
+
extensions: []
|
|
62
|
+
extra_rdoc_files: []
|
|
63
|
+
files:
|
|
64
|
+
- CHANGELOG.md
|
|
65
|
+
- LICENSE
|
|
66
|
+
- NOTICE
|
|
67
|
+
- README.md
|
|
68
|
+
- lib/gstreamer_pbutils.rb
|
|
69
|
+
- lib/gstreamer_pbutils/loader.rb
|
|
70
|
+
- lib/gstreamer_pbutils/version.rb
|
|
71
|
+
- lib/gstreamer_pbutils/version.rb.erb
|
|
72
|
+
homepage: https://github.com/n-at-han-k/gstreamer-pbutils-rb
|
|
73
|
+
licenses:
|
|
74
|
+
- Apache-2.0
|
|
75
|
+
metadata:
|
|
76
|
+
source_code_uri: https://github.com/n-at-han-k/gstreamer-pbutils-rb
|
|
77
|
+
documentation_uri: https://n-at-han-k.github.io/gstreamer-pbutils-rb/
|
|
78
|
+
rdoc_options: []
|
|
79
|
+
require_paths:
|
|
80
|
+
- lib
|
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '3.3'
|
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
requirements: []
|
|
92
|
+
rubygems_version: 3.7.2
|
|
93
|
+
specification_version: 4
|
|
94
|
+
summary: 'Ruby bindings for GStreamer Base Utils: discoverer, encoding profiles and
|
|
95
|
+
codec descriptions.'
|
|
96
|
+
test_files: []
|