rays-video 0.1.2
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/.doc/ext/rays-video/native.cpp +17 -0
- data/.doc/ext/rays-video/video.cpp +257 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +12 -0
- data/.github/workflows/release-gem.yml +51 -0
- data/.github/workflows/tag.yml +35 -0
- data/.github/workflows/test.yml +37 -0
- data/.github/workflows/utils.rb +127 -0
- data/CONTRIBUTING.md +7 -0
- data/ChangeLog.md +19 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +147 -0
- data/Rakefile +25 -0
- data/VERSION +1 -0
- data/ext/rays-video/defs.h +17 -0
- data/ext/rays-video/extconf.rb +23 -0
- data/ext/rays-video/native.cpp +17 -0
- data/ext/rays-video/video.cpp +282 -0
- data/include/rays/video.h +102 -0
- data/include/rays-video/ruby/video.h +47 -0
- data/include/rays-video/ruby.h +10 -0
- data/include/rays-video.h +10 -0
- data/lib/rays/video.rb +45 -0
- data/lib/rays-video/ext.rb +1 -0
- data/lib/rays-video/extension.rb +41 -0
- data/lib/rays-video.rb +3 -0
- data/rays-video.gemspec +39 -0
- data/src/ios/video.mm +633 -0
- data/src/ios/video_audio_in.h +22 -0
- data/src/ios/video_audio_in.mm +252 -0
- data/src/osx/video.mm +633 -0
- data/src/osx/video_audio_in.h +22 -0
- data/src/osx/video_audio_in.mm +252 -0
- data/src/sdl/video.cpp +86 -0
- data/src/sdl/video_audio_in.cpp +63 -0
- data/src/video.cpp +278 -0
- data/src/video.h +50 -0
- data/src/video_audio_in.h +57 -0
- data/src/win32/video.cpp +86 -0
- data/src/win32/video_audio_in.cpp +63 -0
- data/test/helper.rb +15 -0
- data/test/test_video.rb +165 -0
- metadata +145 -0
data/lib/rays/video.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'xot/block_util'
|
|
2
|
+
require 'beeps/ext'
|
|
3
|
+
require 'rays/ext'
|
|
4
|
+
require 'rays-video/ext'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Rays
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Video
|
|
11
|
+
|
|
12
|
+
include Enumerable
|
|
13
|
+
|
|
14
|
+
def initialize(width, height, fps: 0, pixel_density: 1, &block)
|
|
15
|
+
initialize! width, height, fps, pixel_density
|
|
16
|
+
Xot::BlockUtil.instance_eval_or_block_call self, &block if block
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def insert(index, *images)
|
|
20
|
+
images.each.with_index {|image, i| insert! index + i, image}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def append(*images)
|
|
24
|
+
images.each {|image| append! image}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def remove(index_or_range)
|
|
28
|
+
case index_or_range
|
|
29
|
+
when Range then raise NotImplementedError
|
|
30
|
+
else remove! index_or_range
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
alias pos= position=
|
|
35
|
+
alias pos position
|
|
36
|
+
|
|
37
|
+
def each(&block)
|
|
38
|
+
return enum_for :each unless block
|
|
39
|
+
each!(&block)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end# Video
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
end# Rays
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'rays_video_ext'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module RaysVideo
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module Extension
|
|
5
|
+
|
|
6
|
+
module_function
|
|
7
|
+
|
|
8
|
+
def name(downcase = false)
|
|
9
|
+
super().split('::')[-2].then {|s|
|
|
10
|
+
downcase ? s.gsub(/([a-z])([A-Z])/) {"#{$1}-#{$2}"}.downcase : s
|
|
11
|
+
}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def version()
|
|
15
|
+
File.read(root_dir 'VERSION')[/[\d\.]+/]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def root_dir(path = '')
|
|
19
|
+
File.expand_path "../../#{path}", __dir__
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def inc_dir()
|
|
23
|
+
root_dir 'include'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def lib_dir()
|
|
27
|
+
root_dir 'lib'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def ext_dir()
|
|
31
|
+
root_dir 'ext'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def lib_name()
|
|
35
|
+
"#{name true}.dll" if /mswin|ming|cygwin/.match? RUBY_PLATFORM
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end# Extension
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
end# RaysVideo
|
data/lib/rays-video.rb
ADDED
data/rays-video.gemspec
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# -*- mode: ruby -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
require_relative 'lib/rays-video/extension'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
glob = -> *patterns do
|
|
9
|
+
patterns.map {|pat| Dir.glob(pat).to_a}.flatten
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
ext = RaysVideo::Extension
|
|
13
|
+
name = ext.name true
|
|
14
|
+
rdocs = glob.call *%w[README .doc/ext/**/*.cpp]
|
|
15
|
+
|
|
16
|
+
s.name = name
|
|
17
|
+
s.version = ext.version
|
|
18
|
+
s.license = 'MIT'
|
|
19
|
+
s.summary = 'Video support for Rays.'
|
|
20
|
+
s.description = 'Video encoding/decoding with audio support using Rays and Beeps.'
|
|
21
|
+
s.authors = %w[xordog]
|
|
22
|
+
s.email = 'xordog@gmail.com'
|
|
23
|
+
s.homepage = "https://github.com/xord/rays-video"
|
|
24
|
+
|
|
25
|
+
s.platform = Gem::Platform::RUBY
|
|
26
|
+
s.required_ruby_version = '>= 3.0.0'
|
|
27
|
+
|
|
28
|
+
s.add_dependency 'xot', '~> 0.3.13'
|
|
29
|
+
s.add_dependency 'rucy', '~> 0.3.13'
|
|
30
|
+
s.add_dependency 'beeps', '~> 0.3.13'
|
|
31
|
+
s.add_dependency 'rays', '~> 0.3.13'
|
|
32
|
+
|
|
33
|
+
s.files = `git ls-files`.split $/
|
|
34
|
+
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
|
35
|
+
s.test_files = s.files.grep %r{^(test|spec|features)/}
|
|
36
|
+
s.extra_rdoc_files = rdocs.to_a
|
|
37
|
+
|
|
38
|
+
s.extensions << 'Rakefile'
|
|
39
|
+
end
|