aviglitch 0.1.2 → 0.1.3

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 CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.3 / 2011-08-19
2
+ * Added has_keyframe? method to AviGlitch::Base
3
+ * Added a --fake option to datamosh cli.
4
+
1
5
  == 0.1.2 / 2011-04-10
2
6
 
3
7
  * Fix to be able to handle data with offsets from 0 of the file.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -7,6 +7,7 @@ require 'aviglitch'
7
7
 
8
8
  output = './out.avi'
9
9
  all = false
10
+ fake = false
10
11
 
11
12
  opts = OptionParser.new do |opts|
12
13
  opts.banner = "datamosh - AviGlitch's datamoshing video generator."
@@ -20,6 +21,13 @@ opts = OptionParser.new do |opts|
20
21
  "Remove all keyframes (It remains a first keyframe by default)") do
21
22
  all = true
22
23
  end
24
+ opts.on("--fake", "Remains all keyframes as full pixel included deltaframe") do
25
+ fake = true
26
+ if all
27
+ warn "The --fake option cannot use with -a/--all option.\n"
28
+ exit
29
+ end
30
+ end
23
31
  opts.on_tail("-h", "--help", "Show this message") do
24
32
  puts opts
25
33
  exit
@@ -33,15 +41,19 @@ if input.empty?
33
41
  end
34
42
 
35
43
  a = AviGlitch.open input.shift
36
- a.glitch_with_index :keyframe do |frame, i|
37
- (!all && i == 0) ? frame : "" # keep the first frame
44
+ unless fake
45
+ a.glitch_with_index :keyframe do |frame, i|
46
+ (!all && i == 0) ? frame : "" # keep the first frame
47
+ end
38
48
  end
39
- a.clear_keyframes!(!all ? 1..a.frames.size : nil)
49
+ a.clear_keyframes!(!all && !fake ? 1..a.frames.size : nil)
40
50
 
41
51
  input.each do |file|
42
52
  b = AviGlitch.open file
43
- b.glitch :keyframe do |frame|
44
- ""
53
+ unless fake
54
+ b.glitch :keyframe do |frame|
55
+ ""
56
+ end
45
57
  end
46
58
  b.clear_keyframes!
47
59
  a.frames.concat b.frames
@@ -35,7 +35,7 @@ require 'aviglitch/tempfile'
35
35
  #
36
36
  module AviGlitch
37
37
 
38
- VERSION = '0.1.2'
38
+ VERSION = '0.1.3'
39
39
 
40
40
  class << self
41
41
  ##
@@ -90,6 +90,19 @@ module AviGlitch
90
90
  self
91
91
  end
92
92
 
93
+ ##
94
+ # Check if it has keyframes.
95
+ def has_keyframe?
96
+ result = false
97
+ self.frames.each do |f|
98
+ if f.is_keyframe?
99
+ result = true
100
+ break
101
+ end
102
+ end
103
+ result
104
+ end
105
+
93
106
  ##
94
107
  # Swaps the frames with other Frames data.
95
108
  def frames= other
@@ -99,6 +112,7 @@ module AviGlitch
99
112
  end
100
113
 
101
114
  alias_method :write, :output
115
+ alias_method :has_keyframes?, :has_keyframe?
102
116
 
103
117
  def valid_target? target, frame #:nodoc:
104
118
  return true if target == :all
@@ -163,4 +163,13 @@ describe AviGlitch do
163
163
  end
164
164
  end
165
165
 
166
+ it 'should check if keyframes exist.' do
167
+ a = AviGlitch.open @in
168
+ a.has_keyframe?.should be true
169
+ a.glitch :keyframe do |f|
170
+ nil
171
+ end
172
+ a.has_keyframe?.should be false
173
+ end
174
+
166
175
  end
@@ -33,6 +33,7 @@ describe AviGlitch, 'datamosh cli' do
33
33
  o = AviGlitch.open @out
34
34
  o.frames.size.should == total
35
35
  o.frames.first.is_keyframe?.should be true
36
+ o.has_keyframe?.should be true
36
37
  o.close
37
38
  AviGlitch::Base.surely_formatted?(@out, true).should be true
38
39
 
@@ -40,6 +41,7 @@ describe AviGlitch, 'datamosh cli' do
40
41
  o = AviGlitch.open @out
41
42
  o.frames.size.should == total
42
43
  o.frames.first.is_keyframe?.should be false
44
+ o.has_keyframe?.should be false
43
45
  o.close
44
46
  AviGlitch::Base.surely_formatted?(@out, true).should be true
45
47
 
@@ -49,6 +51,11 @@ describe AviGlitch, 'datamosh cli' do
49
51
  o.frames.first.is_keyframe?.should be true
50
52
  o.close
51
53
  AviGlitch::Base.surely_formatted?(@out, true).should be true
52
- end
53
54
 
55
+ system [@cmd, '--fake', @in].join(' ')
56
+ o = AviGlitch.open @out
57
+ o.has_keyframe?.should be false
58
+ o.close
59
+
60
+ end
54
61
  end
metadata CHANGED
@@ -1,48 +1,37 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: aviglitch
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 2
9
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - ucnv
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-04-10 00:00:00 +09:00
18
- default_executable: datamosh
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2157607660 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 0
31
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
32
21
  version: 2.0.0
33
22
  type: :development
34
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: *2157607660
35
25
  description:
36
26
  email: ucnvvv@gmail.com
37
- executables:
27
+ executables:
38
28
  - datamosh
39
29
  extensions: []
40
-
41
- extra_rdoc_files:
30
+ extra_rdoc_files:
42
31
  - ChangeLog
43
32
  - LICENSE
44
33
  - README.rdoc
45
- files:
34
+ files:
46
35
  - ChangeLog
47
36
  - README.rdoc
48
37
  - Rakefile
@@ -59,39 +48,31 @@ files:
59
48
  - spec/frames_spec.rb
60
49
  - spec/spec_helper.rb
61
50
  - LICENSE
62
- has_rdoc: true
63
51
  homepage: http://ucnv.github.com/aviglitch/
64
52
  licenses: []
65
-
66
53
  post_install_message:
67
54
  rdoc_options: []
68
-
69
- require_paths:
55
+ require_paths:
70
56
  - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
72
58
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- segments:
77
- - 0
78
- version: "0"
79
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
64
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
- version: "0"
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
87
69
  requirements: []
88
-
89
70
  rubyforge_project:
90
- rubygems_version: 1.3.7
71
+ rubygems_version: 1.8.8
91
72
  signing_key:
92
73
  specification_version: 3
93
74
  summary: A Ruby library to destroy your AVI files.
94
- test_files:
75
+ test_files:
95
76
  - spec/aviglitch_spec.rb
96
77
  - spec/datamosh_spec.rb
97
78
  - spec/frames_spec.rb