rmov 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.
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Quicktime::Exporter do
4
+ it "should raise error when saving with no settings" do
5
+ lambda { Quicktime::Exporter.new(nil).save_settings('foo') }.should raise_error(Quicktime::Error)
6
+ end
7
+
8
+ it "should raise error when atempting to load no file" do
9
+ lambda { Quicktime::Exporter.new(nil).load_settings('foo/bar/baz') }.should raise_error(Quicktime::Error)
10
+ end
11
+
12
+ describe "loaded settings.st" do
13
+ before(:each) do
14
+ @load_path = File.dirname(__FILE__) + '/../fixtures/settings.st'
15
+ @exporter = Quicktime::Exporter.new(nil)
16
+ @exporter.load_settings(@load_path)
17
+ end
18
+
19
+ it "should be able to save settings to file" do
20
+ save_path = File.dirname(__FILE__) + '/../output/saved_settings.st'
21
+ @exporter.save_settings(save_path)
22
+ File.size(save_path).should == File.size(@load_path)
23
+ end
24
+
25
+ it "should complain when attempting to save to an invalid file" do
26
+ lambda { @exporter.save_settings('foo/bar/baz') }.should raise_error(Quicktime::Error)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,147 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Quicktime::Movie do
4
+ it "should raise an exception when attempting to open a nonexisting file" do
5
+ lambda { Quicktime::Movie.open('foo.mov') }.should raise_error(Quicktime::Error)
6
+ end
7
+
8
+ it "should raise an exception when attempting to open a non movie file" do
9
+ lambda { Quicktime::Movie.open(__FILE__) }.should raise_error(Quicktime::Error)
10
+ end
11
+
12
+ describe "example.mov" do
13
+ before(:each) do
14
+ @movie = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
15
+ end
16
+
17
+ it "duration should be 3.1 seconds" do
18
+ @movie.duration.should == 3.1
19
+ end
20
+
21
+ it "bounds should be a hash of top, left, bottom, and right points" do
22
+ @movie.bounds.should == { :top => 0, :left => 0, :bottom => 50, :right => 60 }
23
+ end
24
+
25
+ it "width should be 60" do
26
+ @movie.width.should == 60
27
+ end
28
+
29
+ it "height should be 50" do
30
+ @movie.height.should == 50
31
+ end
32
+
33
+ it "should have 2 tracks" do
34
+ @movie.tracks.map { |t| t.class }.should == [Quicktime::Track, Quicktime::Track]
35
+ @movie.tracks.map { |t| t.id }.should == [1, 2]
36
+ end
37
+
38
+ it "should be able to export into separate file" do
39
+ path = File.dirname(__FILE__) + '/../output/exported_example.mov'
40
+ File.delete(path) rescue nil
41
+
42
+ progress = 0
43
+ @movie.export(path) { |p| progress = p }
44
+ progress.should == 1.0
45
+
46
+ exported_movie = Quicktime::Movie.open(path)
47
+ exported_movie.duration.should == @movie.duration
48
+ exported_movie.tracks.size == @movie.tracks.size
49
+ end
50
+
51
+ it "should have one audio track" do
52
+ @movie.audio_tracks.should have(1).record
53
+ end
54
+
55
+ it "should have one video track" do
56
+ @movie.video_tracks.should have(1).record
57
+ end
58
+
59
+ it "composite should add another movie's tracks at a given location" do
60
+ m2 = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
61
+ @movie.composite_movie(m2, 2)
62
+ @movie.duration.should == 5.1
63
+ end
64
+
65
+ it "insert should insert another movie's tracks at a given location" do
66
+ m2 = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
67
+ @movie.insert_movie(m2, 2)
68
+ @movie.duration.should == 6.2
69
+ end
70
+
71
+ it "append_movie should insert movie at the end" do
72
+ m2 = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
73
+ @movie.append_movie(m2)
74
+ @movie.duration.should == 6.2
75
+ end
76
+
77
+ it "delete_section should remove a section from a movie" do
78
+ @movie.delete_section(1, 0.6)
79
+ @movie.duration.should == 2.5
80
+ end
81
+
82
+ it "clone_section should make a new movie from given section and leave existing movie intact" do
83
+ mov = @movie.clone_section(1, 0.6)
84
+ mov.duration.should == 0.6
85
+ @movie.duration.should == 3.1
86
+ end
87
+
88
+ it "clip_section should make a new movie from given section and remove it form existing movie" do
89
+ mov = @movie.clip_section(1, 0.6)
90
+ mov.duration.should == 0.6
91
+ @movie.duration.should == 2.5
92
+ end
93
+
94
+ it "should have an exporter with this movie" do
95
+ exporter = @movie.exporter
96
+ exporter.should be_kind_of(Quicktime::Exporter)
97
+ exporter.movie.should == @movie
98
+ end
99
+
100
+ it "should say when movie has changed" do
101
+ @movie.should_not be_changed
102
+ @movie.delete_section(1, 0.6)
103
+ @movie.should be_changed
104
+ end
105
+
106
+ it "should be able to clear changed status" do
107
+ @movie.delete_section(1, 0.6)
108
+ @movie.clear_changed_status
109
+ @movie.should_not be_changed
110
+ end
111
+
112
+ it "flatten should save movie into file" do
113
+ path = File.dirname(__FILE__) + '/../output/flattened_example.mov'
114
+ File.delete(path) rescue nil
115
+ @movie.flatten(path)
116
+ mov = Quicktime::Movie.open(path)
117
+ mov.duration.should == 3.1
118
+ end
119
+
120
+ it "export_pict should output a pict file at a given duration" do
121
+ path = File.dirname(__FILE__) + '/../output/example.pct'
122
+ File.delete(path) rescue nil
123
+ @movie.export_pict(path, 1.2)
124
+ end
125
+ end
126
+
127
+ describe "empty movie" do
128
+ before(:each) do
129
+ @movie = Quicktime::Movie.empty
130
+ end
131
+
132
+ it "should have 0 duration" do
133
+ @movie.duration.should == 0
134
+ end
135
+
136
+ it "should be able to append an existing movie" do
137
+ m2 = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
138
+ @movie.append_movie(m2)
139
+ @movie.duration.should == 3.1
140
+ end
141
+
142
+ it "should raise MovieAlreadyLoaded exception when attempting to load it again" do
143
+ lambda { @movie.load_empty }.should raise_error(Quicktime::Error)
144
+ lambda { @movie.load_from_file('example.mov') }.should raise_error(Quicktime::Error)
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Quicktime::Track do
4
+ describe "example.mov" do
5
+ before(:each) do
6
+ @movie = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
7
+ @track = @movie.video_tracks.first
8
+ end
9
+
10
+ it "duration should be 3.1 seconds" do
11
+ @track.duration.should == 3.1
12
+ end
13
+
14
+ it "frame count should be 31" do
15
+ @track.frame_count.should == 31
16
+ end
17
+
18
+ it "frame rate should be 10" do
19
+ @track.frame_rate.should == 10
20
+ end
21
+
22
+ it "should be able to delete a track" do
23
+ @track.delete
24
+ @movie.video_tracks.should == []
25
+ end
26
+
27
+ it "should be able to add a track" do
28
+ @track.delete
29
+ @movie.video_tracks.should == []
30
+ end
31
+
32
+ it "should be able to disable and enable a track" do
33
+ @track.should be_enabled
34
+ @track.disable
35
+ @track.should_not be_enabled
36
+ @track.enable
37
+ @track.should be_enabled
38
+ end
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require File.dirname(__FILE__) + '/../lib/rmov'
4
+
5
+ Spec::Runner.configure do |config|
6
+ config.mock_with :mocha
7
+ end
@@ -0,0 +1,7 @@
1
+ desc "Builds the rmov_ext extension"
2
+ task :setup do
3
+ Dir.chdir('ext') do
4
+ ruby 'extconf.rb'
5
+ system 'make'
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec/rake/spectask'
2
+
3
+ spec_files = Rake::FileList["spec/**/*_spec.rb"]
4
+
5
+ desc "Run specs"
6
+ Spec::Rake::SpecTask.new do |t|
7
+ t.spec_files = spec_files
8
+ t.spec_opts = ["-c"]
9
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rmov
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Bates
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-02 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Ruby wrapper for the QuickTime C API.
17
+ email: ryan (at) railscasts (dot) com
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - CHANGELOG
24
+ - ext/exporter.c
25
+ - ext/extconf.rb
26
+ - ext/movie.c
27
+ - ext/rmov_ext.c
28
+ - ext/rmov_ext.h
29
+ - ext/track.c
30
+ - lib/quicktime/exporter.rb
31
+ - lib/quicktime/movie.rb
32
+ - lib/quicktime/track.rb
33
+ - lib/rmov.rb
34
+ - LICENSE
35
+ - README
36
+ - tasks/setup.rake
37
+ - tasks/spec.rake
38
+ - TODO
39
+ files:
40
+ - CHANGELOG
41
+ - ext/exporter.c
42
+ - ext/extconf.rb
43
+ - ext/movie.c
44
+ - ext/rmov_ext.c
45
+ - ext/rmov_ext.h
46
+ - ext/track.c
47
+ - lib/quicktime/exporter.rb
48
+ - lib/quicktime/movie.rb
49
+ - lib/quicktime/track.rb
50
+ - lib/rmov.rb
51
+ - LICENSE
52
+ - Rakefile
53
+ - README
54
+ - spec/fixtures/settings.st
55
+ - spec/output/example.pct
56
+ - spec/output/saved_settings.st
57
+ - spec/quicktime/exporter_spec.rb
58
+ - spec/quicktime/movie_spec.rb
59
+ - spec/quicktime/track_spec.rb
60
+ - spec/spec.opts
61
+ - spec/spec_helper.rb
62
+ - tasks/setup.rake
63
+ - tasks/spec.rake
64
+ - TODO
65
+ - Manifest
66
+ - rmov.gemspec
67
+ has_rdoc: true
68
+ homepage: http://github.com/ryanb/rmov
69
+ post_install_message:
70
+ rdoc_options:
71
+ - --line-numbers
72
+ - --inline-source
73
+ - --title
74
+ - Rmov
75
+ - --main
76
+ - README
77
+ require_paths:
78
+ - lib
79
+ - ext
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "="
89
+ - !ruby/object:Gem::Version
90
+ version: "1.2"
91
+ version:
92
+ requirements: []
93
+
94
+ rubyforge_project: rmov
95
+ rubygems_version: 1.2.0
96
+ signing_key:
97
+ specification_version: 2
98
+ summary: Ruby wrapper for the QuickTime C API.
99
+ test_files: []
100
+