rbsrt 0.1.1 → 0.2.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 +4 -4
- data/README.md +14 -0
- data/Rakefile +5 -2
- data/bin/rbsrt-client +0 -0
- data/bin/rbsrt-server +2 -2
- data/ext/rbsrt/extconf.rb +32 -16
- data/lib/rbsrt/rbsrt.bundle +0 -0
- data/lib/rbsrt/streamid_components.rb +17 -0
- data/lib/rbsrt/version.rb +1 -1
- data/rbsrt.gemspec +2 -1
- data/test/rbsrt/streamid_components_test.rb +36 -0
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe25549f98a85f696d9c7b3ef988bc919530d5e17e34acc9366f587e438101e9
|
4
|
+
data.tar.gz: 2802528da33bdfd9a89c79ffe8ce79694e4d75068bc68938f481ba97b374d5eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011d75248ff0ffdc146e5069cc5050c017b0aa56416e8957020a2e010ed660cab32d8315a0e57232609e4454a6393e03cb182608cec7444011fd595b5e23185a
|
7
|
+
data.tar.gz: 632898f852865c06668b45da82639c69ac53c0c0354efbde8ee01ff78fcaab029c679a3a67bdfa0fded1466ecab7faa64b340caecca5b10ce0a30d1d5e676372
|
data/README.md
CHANGED
@@ -70,9 +70,23 @@ Install:
|
|
70
70
|
|
71
71
|
```
|
72
72
|
cd rbsrt
|
73
|
+
bundle install
|
73
74
|
rake install
|
74
75
|
```
|
75
76
|
|
77
|
+
It is possible to provide some information about the location of your srt installation by providing one or more of the following environment variables:
|
78
|
+
|
79
|
+
```sh
|
80
|
+
RBSRT_LIBSRT_HOME # a path to the install directory of srt containing the lib and include dirs
|
81
|
+
RBSRT_LIBSRT_LIB_DIR # a path to the directory containing libsrt
|
82
|
+
RBSRT_LIBSRT_INCLUDE_DIR # a path to the directory containing libsrt headers
|
83
|
+
```
|
84
|
+
|
85
|
+
For example, you could use the your local srt development repo:
|
86
|
+
|
87
|
+
```
|
88
|
+
RBSRT_LIBSRT_HOME="/home/me/code/srt/.build" rake install
|
89
|
+
```
|
76
90
|
|
77
91
|
## Examples
|
78
92
|
|
data/Rakefile
CHANGED
@@ -16,7 +16,10 @@ task :default => :test
|
|
16
16
|
# sh "make"
|
17
17
|
# end
|
18
18
|
|
19
|
-
|
19
|
+
desc "Open an irb session with rbsrt library"
|
20
|
+
task :console do
|
21
|
+
sh "irb -r ./lib/rbsrt.rb"
|
22
|
+
end
|
20
23
|
|
21
24
|
Rake::ExtensionTask.new 'rbsrt' do |ext|
|
22
25
|
ext.lib_dir = "lib/rbsrt"
|
@@ -26,4 +29,4 @@ desc "Run tests"
|
|
26
29
|
task :test => [ :compile ] do
|
27
30
|
require './test/test_helper'
|
28
31
|
Dir.glob( './test/**/*_test.rb').each { |file| require file }
|
29
|
-
end
|
32
|
+
end
|
data/bin/rbsrt-client
CHANGED
File without changes
|
data/bin/rbsrt-server
CHANGED
@@ -53,11 +53,11 @@ puts "starting server"
|
|
53
53
|
server.start do |connection|
|
54
54
|
puts "new connection: connections=#{connection_count}, id=#{connection.id}, streamid=#{connection.streamid}"
|
55
55
|
|
56
|
-
|
56
|
+
output_file_path = File.join options.recording_path, "recording-#{Process.pid}-#{connection.id}.ts"
|
57
|
+
output_file = File.new output_file_path, "w+"
|
57
58
|
output_file.close_on_exec = true
|
58
59
|
|
59
60
|
connection.at_data do |chunk|
|
60
|
-
puts "data"
|
61
61
|
output_file.write(chunk)
|
62
62
|
end
|
63
63
|
|
data/ext/rbsrt/extconf.rb
CHANGED
@@ -2,35 +2,51 @@ require 'mkmf'
|
|
2
2
|
|
3
3
|
extension_name = 'rbsrt/rbsrt'
|
4
4
|
|
5
|
-
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
5
|
+
# RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
LIBDIR = CONFIG['libdir']
|
8
|
+
INCLUDEDIR = CONFIG['includedir']
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
HEADER_DIRS = []
|
11
|
+
HEADER_DIRS << '/opt/local/include' if File.directory?('/opt/local/include')
|
12
|
+
HEADER_DIRS << '/usr/local/include' if File.directory?('/usr/local/include')
|
13
|
+
HEADER_DIRS << '/opt/homebrew/include' if File.directory?('/opt/homebrew/include')
|
14
|
+
HEADER_DIRS << INCLUDEDIR
|
15
|
+
HEADER_DIRS << '/usr/include' if File.directory?('/usr/include')
|
15
16
|
|
16
|
-
# LIB_DIRS = []
|
17
|
-
# LIB_DIRS << '/opt/local/lib' if File.directory?('/opt/local/lib')
|
18
|
-
# LIB_DIRS << '/usr/local/lib' if File.directory?('/usr/local/lib')
|
19
|
-
# LIB_DIRS << LIBDIR
|
20
|
-
# LIB_DIRS << '/usr/lib' if File.directory?('/usr/lib')
|
21
17
|
|
22
|
-
|
18
|
+
LIB_DIRS = []
|
19
|
+
LIB_DIRS << '/opt/local/lib' if File.directory?('/opt/local/lib')
|
20
|
+
LIB_DIRS << '/usr/local/lib' if File.directory?('/usr/local/lib')
|
21
|
+
LIB_DIRS << '/opt/homebrew/lib' if File.directory?('/opt/homebrew/lib')
|
22
|
+
LIB_DIRS << LIBDIR
|
23
|
+
LIB_DIRS << '/usr/lib' if File.directory?('/usr/lib')
|
24
|
+
|
25
|
+
if lib_srt_home_path = ENV["RBSRT_LIBSRT_HOME"]
|
26
|
+
HEADER_DIRS << File.join(lib_srt_home_path, "include") if File.directory?(File.join(lib_srt_home_path, "include"))
|
27
|
+
LIB_DIRS << File.join(lib_srt_home_path, "lib") if File.directory?(File.join(lib_srt_home_path, "lib"))
|
28
|
+
end
|
29
|
+
|
30
|
+
if lib_srt_lib_path = ENV["RBSRT_LIBSRT_LIB_DIR"]
|
31
|
+
LIB_DIRS << lib_srt_lib_path if File.directory?(lib_srt_lib_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
if lib_srt_include_path = ENV["RBSRT_LIBSRT_INCLUDE_DIR"]
|
35
|
+
LIB_DIRS << lib_srt_include_path if File.directory?(lib_srt_include_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
dir_config('srt', HEADER_DIRS, LIB_DIRS)
|
23
39
|
# dir_config('srt', HEADER_DIRS, LIB_DIRS)
|
24
40
|
# dir_config('c++', HEADER_DIRS, LIB_DIRS)
|
25
41
|
|
26
42
|
# srt dependencies
|
27
43
|
|
28
44
|
unless find_header('srt/srt.h')
|
29
|
-
abort "libsrt is missing. please install libsrt: https://github.com/Haivision/srt"
|
45
|
+
abort "libsrt is missing no header. please install libsrt: https://github.com/Haivision/srt"
|
30
46
|
end
|
31
47
|
|
32
48
|
unless find_library('srt', 'srt_create_socket')
|
33
|
-
abort "libsrt is missing. please install libsrt: https://github.com/Haivision/srt"
|
49
|
+
abort "libsrt is missing no sock. please install libsrt: https://github.com/Haivision/srt"
|
34
50
|
end
|
35
51
|
|
36
52
|
dir_config(extension_name)
|
data/lib/rbsrt/rbsrt.bundle
CHANGED
Binary file
|
@@ -58,6 +58,23 @@ module SRT
|
|
58
58
|
streamid + vars.join(",")
|
59
59
|
end
|
60
60
|
|
61
|
+
def to_h
|
62
|
+
h = {}
|
63
|
+
|
64
|
+
@extra.each do |key, value|
|
65
|
+
h[key] = value
|
66
|
+
end
|
67
|
+
|
68
|
+
h[:resource_name] = resource_name if resource_name
|
69
|
+
h[:user_name] = user_name if user_name
|
70
|
+
h[:mode] = mode if mode
|
71
|
+
h[:host_name] = host_name if host_name
|
72
|
+
h[:type] = type if type
|
73
|
+
h[:sessionid] = sessionid if sessionid
|
74
|
+
|
75
|
+
return h
|
76
|
+
end
|
77
|
+
|
61
78
|
def method_missing(name, *args)
|
62
79
|
return extra[name.to_s] if extra.key? name.to_s
|
63
80
|
match = name.to_s.match(/^(.*?)(=?)$/)
|
data/lib/rbsrt/version.rb
CHANGED
data/rbsrt.gemspec
CHANGED
@@ -277,5 +277,41 @@ describe SRT::StreamIDComponents do
|
|
277
277
|
s.baz.must_equal "bar"
|
278
278
|
end
|
279
279
|
end
|
280
|
+
|
281
|
+
describe "#to_h" do
|
282
|
+
let(:streamid) { "#!::r=foobar,u=admin,h=stream.recce.nl,s=12345,t=stream,m=publish,foo=bar" }
|
283
|
+
|
284
|
+
let(:parser) {
|
285
|
+
SRT::StreamIDComponents.new(streamid)
|
286
|
+
}
|
287
|
+
|
288
|
+
it "stores the 'r' as the :resource_name" do
|
289
|
+
parser.to_h[:resource_name].must_equal "foobar"
|
290
|
+
end
|
291
|
+
|
292
|
+
it "stores the 'u' var to :user_name" do
|
293
|
+
parser.to_h[:user_name].must_equal "admin"
|
294
|
+
end
|
295
|
+
|
296
|
+
it "stores the 'm' var to :mode" do
|
297
|
+
parser.to_h[:mode].must_equal :publish
|
298
|
+
end
|
299
|
+
|
300
|
+
it "stores the 'h' to :host_name" do
|
301
|
+
parser.to_h[:host_name].must_equal "stream.recce.nl"
|
302
|
+
end
|
303
|
+
|
304
|
+
it "stores the 't' var to :type" do
|
305
|
+
parser.to_h[:type].must_equal :stream
|
306
|
+
end
|
307
|
+
|
308
|
+
it "stores the 's' var to :sessionid" do
|
309
|
+
parser.to_h[:sessionid].must_equal "12345"
|
310
|
+
end
|
311
|
+
|
312
|
+
it "stores extra attributes when available" do
|
313
|
+
parser.to_h["foo"].must_equal "bar"
|
314
|
+
end
|
315
|
+
end
|
280
316
|
end
|
281
317
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbsrt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaas Speller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gem-release
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.2'
|
27
41
|
description: Build SRT (Secure Reliable Transport) servers and clients with Ruby
|
28
42
|
email:
|
29
43
|
- klaas@recce.nl
|
@@ -58,7 +72,7 @@ licenses:
|
|
58
72
|
- MIT
|
59
73
|
metadata:
|
60
74
|
source_code_uri: https://github.com/spllr/rbsrt
|
61
|
-
post_install_message:
|
75
|
+
post_install_message:
|
62
76
|
rdoc_options: []
|
63
77
|
require_paths:
|
64
78
|
- lib
|
@@ -73,11 +87,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: '0'
|
75
89
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
77
|
-
signing_key:
|
90
|
+
rubygems_version: 3.2.32
|
91
|
+
signing_key:
|
78
92
|
specification_version: 4
|
79
93
|
summary: Ruby API for SRT (Secure Reliable Transport)
|
80
94
|
test_files:
|
95
|
+
- test/rbsrt/poll_test.rb
|
81
96
|
- test/rbsrt/stats_test.rb
|
82
97
|
- test/rbsrt/streamid_components_test.rb
|
83
|
-
- test/rbsrt/poll_test.rb
|