av 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c457580a1a913b757c7451679a5ee05779b1e180
4
- data.tar.gz: 789e34475f417dbf0371f7bc2bc6e7ec2ac655fa
3
+ metadata.gz: b3a866330bd9c784df99f3235220e5184973215f
4
+ data.tar.gz: 671c46357af67d353a607948e6bdc03beefb2962
5
5
  SHA512:
6
- metadata.gz: 80d293f42ba494f35559df9f09a914cd59d60036be5e95ce83e2c906d07eafeacd3c78e17bb814797931984a58ecc78e3538923fd7dbb46b8f58e96bca90aebc
7
- data.tar.gz: 2e5e1d55dbd04928f20a282115a8afe217e1cfb93175c610b1c585393f6cbefa8e9a6db412bbf976753da0053952b11e9ef213ff97abdd0a899a72462f019391
6
+ metadata.gz: 5aa51d99ae99ae7aeb65287030b91a30eb16665ae8f582b2625e6816771c09d166129c854a99877db4aff1882d8620699ef6f1e3f3ca9022d552dbb27678ba8e
7
+ data.tar.gz: b4b7714fd9163a4178116e04ba38e693dcae73de65132a38cc9ecbe512ab2bcc9f2257e2ac1cc6190ba318680020599b9cec98ce855f10c0f048d1d00d651129
@@ -8,6 +8,7 @@ module Av
8
8
  attr_accessor :command_name
9
9
  attr_accessor :input_params
10
10
  attr_accessor :output_params
11
+ attr_accessor :output_format
11
12
  attr_accessor :audio_filters
12
13
  attr_accessor :video_filters
13
14
  attr_accessor :default_params
@@ -27,6 +28,10 @@ module Av
27
28
  end
28
29
 
29
30
  def add_destination dest
31
+ # infer format from extension unless format has already been set
32
+ if @output_format.nil?
33
+ output_format File.extname(dest)
34
+ end
30
35
  @destination = dest
31
36
  end
32
37
 
@@ -114,19 +119,20 @@ module Av
114
119
  end
115
120
 
116
121
  def output_format format
117
- case format
118
- when 'jpg', 'jpeg', 'png', 'gif' # Images
122
+ @output_format = format
123
+ case format.to_sym
124
+ when :jpg, :jpeg, :png, :gif # Images
119
125
  add_output_param 'f', 'image2'
120
126
  add_output_param 'vframes', '1'
121
- when 'webm' # WebM
127
+ when :webm # WebM
122
128
  add_output_param 'f', 'webm'
123
129
  add_output_param 'acodec', 'libvorbis'
124
130
  add_output_param 'vcodec', 'libvpx'
125
- when 'ogv' # Ogg Theora
131
+ when :ogv # Ogg Theora
126
132
  add_output_param 'f', 'ogg'
127
133
  add_output_param 'acodec', 'libvorbis'
128
134
  add_output_param 'vcodec', 'libtheora'
129
- when 'mp4'
135
+ when :mp4
130
136
  add_output_param 'acodec', 'aac'
131
137
  add_output_param 'strict', 'experimental'
132
138
  end
@@ -1,3 +1,3 @@
1
1
  module Av
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -18,6 +18,7 @@ describe Av do
18
18
  before do
19
19
  subject.add_source source
20
20
  subject.add_destination destination
21
+ subject.output_format :mp4
21
22
  subject.run
22
23
  end
23
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: av
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Abdel-Wahab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-10 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler