aviglitch 0.0.3 → 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.
- data/ChangeLog +6 -1
- data/VERSION +1 -1
- data/bin/datamosh +3 -3
- data/lib/aviglitch.rb +6 -1
- data/lib/aviglitch/base.rb +0 -5
- data/lib/aviglitch/frames.rb +2 -3
- data/spec/datamosh_spec.rb +18 -25
- metadata +17 -5
data/ChangeLog
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
== 0.1.0 / 2010-07-09
|
2
|
+
|
3
|
+
* Minor version up.
|
4
|
+
* Fixed bugs with Ruby 1.8.7.
|
5
|
+
* Fixed the synchronization problem with datamosh cli.
|
6
|
+
|
1
7
|
== 0.0.3 / 2010-07-07
|
2
8
|
|
3
9
|
* Changed AviGlitch::Frames allowing to slice and concatenate frames
|
4
10
|
(like Array).
|
5
11
|
* Changed datamosh cli to accept multiple files.
|
6
|
-
* And some tiny fixes.
|
7
12
|
|
8
13
|
== 0.0.2 / 2010-05-17
|
9
14
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/datamosh
CHANGED
@@ -10,7 +10,7 @@ all = false
|
|
10
10
|
|
11
11
|
opts = OptionParser.new do |opts|
|
12
12
|
opts.banner = "datamosh - AviGlitch's datamoshing video generator."
|
13
|
-
opts.define_head "Usage: #{File.basename($0)}
|
13
|
+
opts.define_head "Usage: #{File.basename($0)} [options] file [file2 ...]"
|
14
14
|
opts.separator "Options:"
|
15
15
|
opts.on("-o", "--output [OUTPUT]",
|
16
16
|
"Output the video to OUTPUT (./out.avi by default)") do |f|
|
@@ -34,12 +34,12 @@ end
|
|
34
34
|
|
35
35
|
a = AviGlitch.open input.shift
|
36
36
|
a.glitch_with_index :keyframe do |frame, i|
|
37
|
-
(!all && i == 0) ? frame :
|
37
|
+
(!all && i == 0) ? frame : nil # keep the first frame
|
38
38
|
end
|
39
39
|
input.each do |file|
|
40
40
|
b = AviGlitch.open file
|
41
41
|
b.glitch :keyframe do |frame|
|
42
|
-
|
42
|
+
nil
|
43
43
|
end
|
44
44
|
a.frames.concat b.frames
|
45
45
|
end
|
data/lib/aviglitch.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'readline'
|
4
|
+
require 'pathname'
|
5
|
+
require 'stringio'
|
1
6
|
require 'aviglitch/base'
|
2
7
|
require 'aviglitch/frame'
|
3
8
|
require 'aviglitch/frames'
|
@@ -29,7 +34,7 @@ require 'aviglitch/frames'
|
|
29
34
|
#
|
30
35
|
module AviGlitch
|
31
36
|
|
32
|
-
VERSION = '0.0
|
37
|
+
VERSION = '0.1.0'
|
33
38
|
|
34
39
|
class << self
|
35
40
|
##
|
data/lib/aviglitch/base.rb
CHANGED
data/lib/aviglitch/frames.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'stringio'
|
2
|
-
|
3
1
|
module AviGlitch
|
4
2
|
|
5
3
|
# Frames provides the interface to access each frame
|
@@ -230,7 +228,8 @@ module AviGlitch
|
|
230
228
|
##
|
231
229
|
# Removes frame(s) at the given index or the range (same as []).
|
232
230
|
# Inserts the given Frame or Frames's contents into the removed index.
|
233
|
-
def []= *args
|
231
|
+
def []= *args
|
232
|
+
value = args.pop
|
234
233
|
b, l = get_beginning_and_length *args
|
235
234
|
ll = l.nil? ? 1 : l
|
236
235
|
head = self.slice(0, b)
|
data/spec/datamosh_spec.rb
CHANGED
@@ -6,10 +6,10 @@ describe AviGlitch, 'datamosh cli' do
|
|
6
6
|
FileUtils.mkdir OUTPUT_DIR unless File.exist? OUTPUT_DIR
|
7
7
|
@in = FILES_DIR + 'sample.avi'
|
8
8
|
@out = OUTPUT_DIR + 'out.avi'
|
9
|
-
|
10
|
-
|
11
|
-
).realpath
|
12
|
-
@cmd = "ruby %s -o %s " % [datamosh, @out]
|
9
|
+
here = File.dirname(__FILE__)
|
10
|
+
lib = Pathname.new(File.join(here, '..', 'lib')).realpath
|
11
|
+
datamosh = Pathname.new(File.join(here, '..', 'bin/datamosh')).realpath
|
12
|
+
@cmd = "ruby -I%s %s -o %s " % [lib, datamosh, @out]
|
13
13
|
end
|
14
14
|
|
15
15
|
after :each do
|
@@ -21,39 +21,32 @@ describe AviGlitch, 'datamosh cli' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should correctly process files' do
|
24
|
+
a = AviGlitch.open @in
|
25
|
+
keys = a.frames.inject(0) do |c, f|
|
26
|
+
c += 1 if f.is_keyframe?
|
27
|
+
c
|
28
|
+
end
|
29
|
+
total = a.frames.size
|
30
|
+
a.close
|
31
|
+
|
24
32
|
system [@cmd, @in].join(' ')
|
25
33
|
o = AviGlitch.open @out
|
26
|
-
o.frames.
|
27
|
-
|
28
|
-
f.data.should_not match /^\000+$/
|
29
|
-
elsif f.is_keyframe?
|
30
|
-
f.data.should match /^\000+$/
|
31
|
-
end
|
32
|
-
end
|
34
|
+
o.frames.size.should == total - keys + 1
|
35
|
+
o.frames.first.is_keyframe?.should be true
|
33
36
|
o.close
|
34
37
|
AviGlitch::Base.surely_formatted?(@out, true).should be true
|
35
38
|
|
36
39
|
system [@cmd, '-a', @in].join(' ')
|
37
40
|
o = AviGlitch.open @out
|
38
|
-
o.frames.
|
39
|
-
|
40
|
-
f.data.should match /^\000+$/
|
41
|
-
end
|
42
|
-
end
|
41
|
+
o.frames.size.should == total - keys
|
42
|
+
o.frames.first.is_keyframe?.should be false
|
43
43
|
o.close
|
44
44
|
AviGlitch::Base.surely_formatted?(@out, true).should be true
|
45
45
|
|
46
46
|
system [@cmd, @in, @in, @in].join(' ')
|
47
|
-
a = AviGlitch.open @in
|
48
47
|
o = AviGlitch.open @out
|
49
|
-
o.frames.size.should ==
|
50
|
-
o.frames.
|
51
|
-
if f.is_keyframe? && i == 0
|
52
|
-
f.data.should_not match /^\000+$/
|
53
|
-
elsif f.is_keyframe?
|
54
|
-
f.data.should match /^\000+$/
|
55
|
-
end
|
56
|
-
end
|
48
|
+
o.frames.size.should == 1 + (total - keys) * 3
|
49
|
+
o.frames.first.is_keyframe?.should be true
|
57
50
|
o.close
|
58
51
|
AviGlitch::Base.surely_formatted?(@out, true).should be true
|
59
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aviglitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- ucnv
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-09 00:00:00 +09:00
|
13
19
|
default_executable: datamosh
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -50,21 +56,27 @@ rdoc_options:
|
|
50
56
|
require_paths:
|
51
57
|
- lib
|
52
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
53
60
|
requirements:
|
54
61
|
- - ">="
|
55
62
|
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
56
66
|
version: "0"
|
57
|
-
version:
|
58
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
59
69
|
requirements:
|
60
70
|
- - ">="
|
61
71
|
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
62
75
|
version: "0"
|
63
|
-
version:
|
64
76
|
requirements: []
|
65
77
|
|
66
78
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.3.
|
79
|
+
rubygems_version: 1.3.7
|
68
80
|
signing_key:
|
69
81
|
specification_version: 3
|
70
82
|
summary: A Ruby library to destroy your AVI files.
|