ffi-shout 0.1.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 +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +278 -0
- data/lib/ffi-shout.rb +5 -0
- data/lib/shout/configuration.rb +157 -0
- data/lib/shout/connection.rb +160 -0
- data/lib/shout/constants.rb +75 -0
- data/lib/shout/delegation.rb +71 -0
- data/lib/shout/error.rb +58 -0
- data/lib/shout/http_metadata.rb +104 -0
- data/lib/shout/library_version.rb +47 -0
- data/lib/shout/metadata.rb +64 -0
- data/lib/shout/native/enums.rb +68 -0
- data/lib/shout/native/functions.rb +192 -0
- data/lib/shout/native/handle.rb +20 -0
- data/lib/shout/native/metadata_handle.rb +21 -0
- data/lib/shout/native.rb +24 -0
- data/lib/shout/version.rb +5 -0
- data/lib/shout.rb +27 -0
- metadata +77 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Shout
|
|
4
|
+
module Native
|
|
5
|
+
# An owned shout_t handle, as returned by Native.shout_new. It is released
|
|
6
|
+
# with shout_free when it is garbage collected.
|
|
7
|
+
class Handle < FFI::AutoPointer
|
|
8
|
+
def self.release(ptr)
|
|
9
|
+
Native.shout_free(ptr)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Called by FFI to wrap the pointer that shout_new returns.
|
|
13
|
+
def self.from_native(ptr, ctx)
|
|
14
|
+
raise MallocError, "Unable to allocate shout_t structure" if ptr.null?
|
|
15
|
+
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Shout
|
|
4
|
+
module Native
|
|
5
|
+
# An owned shout_metadata_t handle, as returned by
|
|
6
|
+
# Native.shout_metadata_new. It is released with shout_metadata_free when
|
|
7
|
+
# it is garbage collected.
|
|
8
|
+
class MetadataHandle < FFI::AutoPointer
|
|
9
|
+
def self.release(ptr)
|
|
10
|
+
Native.shout_metadata_free(ptr)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Called by FFI to wrap the pointer that shout_metadata_new returns.
|
|
14
|
+
def self.from_native(ptr, ctx)
|
|
15
|
+
raise MallocError, "Unable to allocate shout_metadata_t structure" if ptr.null?
|
|
16
|
+
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/shout/native.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "shout/constants"
|
|
4
|
+
require "shout/library_version"
|
|
5
|
+
|
|
6
|
+
module Shout
|
|
7
|
+
# The libshout bindings: an FFI::Library with every function in shout.h.
|
|
8
|
+
module Native
|
|
9
|
+
extend FFI::Library
|
|
10
|
+
|
|
11
|
+
ffi_lib ["shout", "libshout.so.3", "libshout.so"]
|
|
12
|
+
|
|
13
|
+
# Attached first, so the version check below can run before the other
|
|
14
|
+
# functions: attaching a function that an older libshout lacks would fail
|
|
15
|
+
# with an unclear FFI::NotFoundError.
|
|
16
|
+
attach_function :shout_version, %i[pointer pointer pointer], :string
|
|
17
|
+
LibraryVersion.ensure_supported!
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
require "shout/native/enums"
|
|
22
|
+
require "shout/native/handle"
|
|
23
|
+
require "shout/native/metadata_handle"
|
|
24
|
+
require "shout/native/functions"
|
data/lib/shout.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ffi"
|
|
4
|
+
require "shout/version"
|
|
5
|
+
require "shout/constants"
|
|
6
|
+
require "shout/error"
|
|
7
|
+
require "shout/native"
|
|
8
|
+
require "shout/delegation"
|
|
9
|
+
require "shout/configuration"
|
|
10
|
+
require "shout/metadata"
|
|
11
|
+
require "shout/http_metadata"
|
|
12
|
+
require "shout/connection"
|
|
13
|
+
|
|
14
|
+
# Ruby bindings for libshout, the streaming library for Icecast. Start with
|
|
15
|
+
# Shout::Connection; the raw libshout functions live in Shout::Native.
|
|
16
|
+
module Shout
|
|
17
|
+
Native.shout_init
|
|
18
|
+
|
|
19
|
+
# The version of the loaded libshout library.
|
|
20
|
+
def self.version
|
|
21
|
+
LibraryVersion.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.new(**, &)
|
|
25
|
+
Connection.new(**, &)
|
|
26
|
+
end
|
|
27
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ffi-shout
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Roel van Dijk
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ffi
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.15'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.15'
|
|
26
|
+
description: Ruby FFI wrapper around libshout for streaming to Icecast servers.
|
|
27
|
+
email:
|
|
28
|
+
- roel@rustradio.org
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- CHANGELOG.md
|
|
34
|
+
- LICENSE.txt
|
|
35
|
+
- README.md
|
|
36
|
+
- lib/ffi-shout.rb
|
|
37
|
+
- lib/shout.rb
|
|
38
|
+
- lib/shout/configuration.rb
|
|
39
|
+
- lib/shout/connection.rb
|
|
40
|
+
- lib/shout/constants.rb
|
|
41
|
+
- lib/shout/delegation.rb
|
|
42
|
+
- lib/shout/error.rb
|
|
43
|
+
- lib/shout/http_metadata.rb
|
|
44
|
+
- lib/shout/library_version.rb
|
|
45
|
+
- lib/shout/metadata.rb
|
|
46
|
+
- lib/shout/native.rb
|
|
47
|
+
- lib/shout/native/enums.rb
|
|
48
|
+
- lib/shout/native/functions.rb
|
|
49
|
+
- lib/shout/native/handle.rb
|
|
50
|
+
- lib/shout/native/metadata_handle.rb
|
|
51
|
+
- lib/shout/version.rb
|
|
52
|
+
homepage: https://github.com/rdvdijk/ffi-shout
|
|
53
|
+
licenses:
|
|
54
|
+
- MIT
|
|
55
|
+
metadata:
|
|
56
|
+
source_code_uri: https://github.com/rdvdijk/ffi-shout
|
|
57
|
+
bug_tracker_uri: https://github.com/rdvdijk/ffi-shout/issues
|
|
58
|
+
changelog_uri: https://github.com/rdvdijk/ffi-shout/blob/main/CHANGELOG.md
|
|
59
|
+
rubygems_mfa_required: 'true'
|
|
60
|
+
rdoc_options: []
|
|
61
|
+
require_paths:
|
|
62
|
+
- lib
|
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '3.2'
|
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
requirements: []
|
|
74
|
+
rubygems_version: 4.0.23
|
|
75
|
+
specification_version: 4
|
|
76
|
+
summary: Easily connect and stream audio/metadata to Icecast using libshout.
|
|
77
|
+
test_files: []
|