one-k-rmov 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.2.7 (March 12, 2009)
2
+ * adds aspect_ratio to Track
3
+
4
+ 0.2.6 (March 12, 2009)
5
+ * adds display pixel dimensions
6
+
1
7
  0.2.5 (March 3, 2009)
2
8
 
3
9
  * adds pixel aspect ratio
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('rmov', '0.2.6') do |p|
5
+ Echoe.new('rmov', '0.2.7') do |p|
6
6
  p.summary = "Ruby wrapper for the QuickTime C API."
7
7
  p.description = "Ruby wrapper for the QuickTime C API. Updates by 1K include exposing some movie properties such as codec and audio channel descriptions"
8
8
  p.url = "http://github.com/one-k/rmov"
@@ -27,5 +27,15 @@ module QuickTime
27
27
  media_type == :text
28
28
  end
29
29
 
30
+ # returns numerical value for aspect ratio. eg. 1.33333 is 4x3
31
+ def aspect_ratio
32
+ pix_num, pix_den = pixel_aspect_ratio
33
+ encoded_size = encoded_pixel_dimensions
34
+ aspect = (encoded_size[:width].to_f / encoded_size[:height].to_f) * (pix_num.to_f / pix_den.to_f)
35
+ return :widescreen if aspect == (16.0/9.0)
36
+ return :fullframe if aspect == (4.0/3.0)
37
+ :other
38
+ end
39
+
30
40
  end
31
41
  end
data/rmov.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rmov}
5
- s.version = "0.2.6"
5
+ s.version = "0.2.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ryan Bates, with updates by 1K Studios, LLC"]
@@ -72,13 +72,18 @@ describe QuickTime::Track do
72
72
  @track.encoded_pixel_dimensions.should == {:width => 720, :height => 480}
73
73
  end
74
74
 
75
- it "has display pixel size of 720x480" do
75
+ it "has display pixel size of 853x480" do
76
76
  @track.display_pixel_dimensions.should == {:width => 853, :height => 480}
77
77
  end
78
-
78
+
79
79
  it "has aspect ratio of 1:0.84375" do
80
80
  @track.pixel_aspect_ratio.should == [100000, 84375]
81
81
  end
82
+
83
+ it "has aspect ratio" do
84
+ @track.aspect_ratio.should == :widescreen
85
+ end
86
+
82
87
  end
83
88
 
84
89
  describe "audio tracks" do
@@ -133,17 +138,41 @@ describe QuickTime::Track do
133
138
  track = @movie.video_tracks.first
134
139
  track.pixel_aspect_ratio.should == [1, 1]
135
140
  end
141
+
142
+ it "has aspect ratio" do
143
+ track = @movie.video_tracks.first
144
+ track.aspect_ratio.should == :other
145
+ end
146
+
136
147
  end
137
148
 
138
149
 
139
- describe "SD2v2.mov audio tracks" do
150
+ describe "SD2v2.mov" do
140
151
  before(:each) do
141
152
  @movie = QuickTime::Movie.open(File.dirname(__FILE__) + '/../fixtures/SD2v2.mov')
142
153
  end
143
154
 
144
- it "has video track aspect ratio of 100000:112500" do
145
- track = @movie.video_tracks.first
146
- track.pixel_aspect_ratio.should == [100000, 112500]
155
+ describe "video track" do
156
+ before(:each) do
157
+ @track = @movie.video_tracks.first
158
+ end
159
+
160
+ it "has video track aspect ratio of 100000:112500" do
161
+ @track.pixel_aspect_ratio.should == [100000, 112500]
162
+ end
163
+
164
+ it "has encoded pixel size" do
165
+ @track.encoded_pixel_dimensions.should == {:width => 720, :height => 480}
166
+ end
167
+
168
+ it "has display pixel size" do
169
+ @track.display_pixel_dimensions.should == {:width => 640, :height => 480}
170
+ end
171
+
172
+ it "has aspect ratio" do
173
+ @track.aspect_ratio.should == :fullframe
174
+ end
175
+
147
176
  end
148
177
 
149
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one-k-rmov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bates, with updates by 1K Studios, LLC