rmov 0.1.1 → 0.1.2

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,13 @@
1
+ 0.1.2 (October 3rd, 2008)
2
+
3
+ * movie.poster_time and movie.poster_time=(seconds) for getting and setting a movie's poster time
4
+
5
+ * track.offset and track.offset=(seconds) for getting and setting a track's offset time from the start of a movie
6
+
7
+ * track.volume and track.volume=(vol) for getting and setting a track's volume
8
+
9
+ * QuickTime settings dialog comes into the forground properly
10
+
1
11
  0.1.1 (October 3rd, 2008)
2
12
 
3
13
  * RubyGems 1.3 compatibility (updated Echoe)
data/Manifest CHANGED
@@ -10,8 +10,9 @@ lib/quicktime/movie.rb
10
10
  lib/quicktime/track.rb
11
11
  lib/rmov.rb
12
12
  LICENSE
13
+ Manifest
13
14
  Rakefile
14
- README
15
+ README.rdoc
15
16
  spec/fixtures/settings.st
16
17
  spec/output/example.pct
17
18
  spec/output/saved_settings.st
@@ -23,4 +24,3 @@ spec/spec_helper.rb
23
24
  tasks/setup.rake
24
25
  tasks/spec.rake
25
26
  TODO
26
- Manifest
@@ -27,7 +27,7 @@ Use this gem to open QuickTime movies and edit them to your liking.
27
27
 
28
28
  # make a new movie out of a section of movie 1
29
29
  # this will delete 5 seconds out of the movie at 2 seconds in
30
- movie3 = movie1.clip_section(movie1, 2, 5)
30
+ movie3 = movie1.clip_section(2, 5)
31
31
 
32
32
  # You can insert that part back into the movie at 8 seconds in
33
33
  movie1.insert_movie(movie3, 8)
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('rmov', '0.1.1') do |p|
5
+ Echoe.new('rmov', '0.1.2') do |p|
6
6
  p.summary = "Ruby wrapper for the QuickTime C API."
7
7
  p.description = "Ruby wrapper for the QuickTime C API."
8
8
  p.url = "http://github.com/ryanb/rmov"
data/TODO CHANGED
@@ -1,19 +1,15 @@
1
1
  Fixes
2
2
  - check if movie/track really exists each time we call it
3
- - add rdocs
4
- - fill README
5
3
 
6
4
  Features
7
- - export a single frame as pict
8
5
  - resize movie
9
- - export image sequence
10
- - import image sequence
11
- - import other file formats (mpeg, aiff, mp3, etc.)
12
6
  - get movie metadata (album, author, artist, etc.)
13
7
  - set movie metadata
14
- - programatically adjust export settings (framerate, codec, etc.)
15
-
16
- Possible
17
8
  - add text track to movie
18
9
  - add chapters to movie
19
- - time remapping
10
+
11
+ Possible
12
+ - time remapping
13
+ - programatically adjust export settings (framerate, codec, etc.)
14
+ - export image sequence
15
+ - import image sequence
data/ext/exporter.c CHANGED
@@ -91,11 +91,9 @@ static VALUE exporter_open_settings_dialog(VALUE obj)
91
91
  ComponentInstance component = exporter_component(obj);
92
92
 
93
93
  // Bring this process to the front
94
- if (!IsProcessVisible(&current_process)) {
95
- err = TransformProcessType(&current_process, kProcessTransformToForegroundApplication);
96
- if (err != noErr) {
97
- rb_raise(eQuicktime, "Error %d occurred while brining this application to the forground.", err);
98
- }
94
+ err = TransformProcessType(&current_process, kProcessTransformToForegroundApplication);
95
+ if (err != noErr) {
96
+ rb_raise(eQuicktime, "Error %d occurred while brining this application to the forground.", err);
99
97
  }
100
98
  SetFrontProcess(&current_process);
101
99
 
data/ext/movie.c CHANGED
@@ -392,6 +392,27 @@ static VALUE movie_export_pict(VALUE obj, VALUE filepath, VALUE frame_time)
392
392
  return Qnil;
393
393
  }
394
394
 
395
+ /*
396
+ call-seq: poster_time() -> seconds
397
+
398
+ Returns the poster time of the movie (in seconds).
399
+ */
400
+ static VALUE movie_get_poster_time(VALUE obj)
401
+ {
402
+ return rb_float_new((double)GetMoviePosterTime(MOVIE(obj))/GetMovieTimeScale(MOVIE(obj)));
403
+ }
404
+
405
+ /*
406
+ call-seq: poster_time=(seconds)
407
+
408
+ Sets the poster_time of the movie (in seconds).
409
+ */
410
+ static VALUE movie_set_poster_time(VALUE obj, VALUE seconds)
411
+ {
412
+ SetMoviePosterTime(MOVIE(obj), MOVIE_TIME(obj, seconds));
413
+ return Qnil;
414
+ }
415
+
395
416
  void Init_quicktime_movie()
396
417
  {
397
418
  VALUE mQuicktime;
@@ -415,4 +436,6 @@ void Init_quicktime_movie()
415
436
  rb_define_method(cMovie, "flatten", movie_flatten, 1);
416
437
  rb_define_method(cMovie, "export_pict", movie_export_pict, 2);
417
438
  rb_define_method(cMovie, "dispose", movie_dispose, 0);
439
+ rb_define_method(cMovie, "poster_time", movie_get_poster_time, 0);
440
+ rb_define_method(cMovie, "poster_time=", movie_set_poster_time, 1);
418
441
  }
data/ext/rmov_ext.h CHANGED
@@ -24,6 +24,7 @@ void Init_quicktime_track();
24
24
  #define RTRACK(obj) (Check_Type(obj, T_DATA), (struct RTrack*)DATA_PTR(obj))
25
25
  #define TRACK(obj) (RTRACK(obj)->track)
26
26
  #define TRACK_MEDIA(obj) (GetTrackMedia(TRACK(obj)))
27
+ #define TRACK_TIME(obj, seconds) (floor(NUM2DBL(seconds)*GetMediaTimeScale(TRACK_MEDIA(obj))))
27
28
 
28
29
  struct RTrack {
29
30
  Track track;
data/ext/track.c CHANGED
@@ -146,6 +146,49 @@ static VALUE track_enabled(VALUE obj, VALUE boolean)
146
146
  }
147
147
  }
148
148
 
149
+ /*
150
+ call-seq: volume() -> volume_float
151
+
152
+ Returns the volume of the audio from 0.0 to 1.0.
153
+ */
154
+ static VALUE track_get_volume(VALUE obj)
155
+ {
156
+ return rb_float_new((double)GetTrackVolume(TRACK(obj))/0x0100);
157
+ }
158
+
159
+ /*
160
+ call-seq: volume=(volume_float)
161
+
162
+ Sets the volume to the given value (0.0 to 1.0)
163
+ */
164
+ static VALUE track_set_volume(VALUE obj, VALUE volume_obj)
165
+ {
166
+ SetTrackVolume(TRACK(obj), (short)(0x0100*NUM2DBL(volume_obj)));
167
+ return Qnil;
168
+ }
169
+
170
+ /*
171
+ call-seq: offset() -> seconds
172
+
173
+ Returns the offset of the track from the beginning of the movie (in seconds).
174
+ */
175
+ static VALUE track_get_offset(VALUE obj)
176
+ {
177
+ return rb_float_new((double)GetTrackOffset(TRACK(obj))/GetMediaTimeScale(TRACK_MEDIA(obj)));
178
+ }
179
+
180
+ /*
181
+ call-seq: offset=(seconds)
182
+
183
+ Sets the offset of the track from the start of the movie (in seconds).
184
+ */
185
+ static VALUE track_set_offset(VALUE obj, VALUE seconds)
186
+ {
187
+ SetTrackOffset(TRACK(obj), TRACK_TIME(obj, seconds));
188
+ return Qnil;
189
+ }
190
+
191
+
149
192
  void Init_quicktime_track()
150
193
  {
151
194
  VALUE mQuicktime;
@@ -162,4 +205,8 @@ void Init_quicktime_track()
162
205
  rb_define_method(cTrack, "enabled?", track_enabled, 0);
163
206
  rb_define_method(cTrack, "enable", track_enable, 0);
164
207
  rb_define_method(cTrack, "disable", track_disable, 0);
208
+ rb_define_method(cTrack, "volume", track_get_volume, 0);
209
+ rb_define_method(cTrack, "volume=", track_set_volume, 1);
210
+ rb_define_method(cTrack, "offset", track_get_offset, 0);
211
+ rb_define_method(cTrack, "offset=", track_set_offset, 1);
165
212
  }
data/rmov.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
- # Gem::Specification for Rmov-0.1.1
2
+ # Gem::Specification for Rmov-0.1.2
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: rmov
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.1.1
8
+ version: 0.1.2
9
9
  platform: ruby
10
10
  authors:
11
11
  - Ryan Bates
@@ -35,7 +35,7 @@ extra_rdoc_files:
35
35
  - lib/quicktime/track.rb
36
36
  - lib/rmov.rb
37
37
  - LICENSE
38
- - README
38
+ - README.rdoc
39
39
  - tasks/setup.rake
40
40
  - tasks/spec.rake
41
41
  - TODO
@@ -52,8 +52,9 @@ files:
52
52
  - lib/quicktime/track.rb
53
53
  - lib/rmov.rb
54
54
  - LICENSE
55
+ - Manifest
55
56
  - Rakefile
56
- - README
57
+ - README.rdoc
57
58
  - spec/fixtures/settings.st
58
59
  - spec/output/example.pct
59
60
  - spec/output/saved_settings.st
@@ -65,7 +66,6 @@ files:
65
66
  - tasks/setup.rake
66
67
  - tasks/spec.rake
67
68
  - TODO
68
- - Manifest
69
69
  - rmov.gemspec
70
70
  has_rdoc: true
71
71
  homepage: http://github.com/ryanb/rmov
@@ -76,7 +76,7 @@ rdoc_options:
76
76
  - --title
77
77
  - Rmov
78
78
  - --main
79
- - README
79
+ - README.rdoc
80
80
  require_paths:
81
81
  - lib
82
82
  - ext
Binary file
@@ -122,6 +122,15 @@ describe Quicktime::Movie do
122
122
  File.delete(path) rescue nil
123
123
  @movie.export_pict(path, 1.2)
124
124
  end
125
+
126
+ it "should default poster time to 0" do
127
+ @movie.poster_time.should == 0
128
+ end
129
+
130
+ it "should be able to set poster time to 2.1 seconds in" do
131
+ @movie.poster_time = 2.1
132
+ @movie.poster_time.should == 2.1
133
+ end
125
134
  end
126
135
 
127
136
  describe "empty movie" do
@@ -4,37 +4,66 @@ describe Quicktime::Track do
4
4
  describe "example.mov" do
5
5
  before(:each) do
6
6
  @movie = Quicktime::Movie.open(File.dirname(__FILE__) + '/../fixtures/example.mov')
7
- @track = @movie.video_tracks.first
8
7
  end
8
+
9
+ describe "example.mov video track" do
10
+ before(:each) do
11
+ @track = @movie.video_tracks.first
12
+ end
9
13
 
10
- it "duration should be 3.1 seconds" do
11
- @track.duration.should == 3.1
12
- end
14
+ it "duration should be 3.1 seconds" do
15
+ @track.duration.should == 3.1
16
+ end
13
17
 
14
- it "frame count should be 31" do
15
- @track.frame_count.should == 31
16
- end
18
+ it "frame count should be 31" do
19
+ @track.frame_count.should == 31
20
+ end
17
21
 
18
- it "frame rate should be 10" do
19
- @track.frame_rate.should == 10
20
- end
22
+ it "frame rate should be 10" do
23
+ @track.frame_rate.should == 10
24
+ end
21
25
 
22
- it "should be able to delete a track" do
23
- @track.delete
24
- @movie.video_tracks.should == []
25
- end
26
+ it "should be able to delete a track" do
27
+ @track.delete
28
+ @movie.video_tracks.should == []
29
+ end
26
30
 
27
- it "should be able to add a track" do
28
- @track.delete
29
- @movie.video_tracks.should == []
31
+ it "should be able to add a track" do
32
+ @track.delete
33
+ @movie.video_tracks.should == []
34
+ end
35
+
36
+ it "should be able to disable and enable a track" do
37
+ @track.should be_enabled
38
+ @track.disable
39
+ @track.should_not be_enabled
40
+ @track.enable
41
+ @track.should be_enabled
42
+ end
43
+
44
+ it "should have no offset" do
45
+ @track.offset.should == 0
46
+ end
47
+
48
+ it "should be able to offset by 2.5 seconds" do
49
+ @track.offset = 2.5
50
+ @track.offset.should == 2.5
51
+ end
30
52
  end
53
+
54
+ describe "example.mov audio track" do
55
+ before(:each) do
56
+ @track = @movie.audio_tracks.first
57
+ end
58
+
59
+ it "should have a volume of 1.0" do
60
+ @track.volume.should == 1.0
61
+ end
31
62
 
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
63
+ it "should be able to set volume to 0.5" do
64
+ @track.volume = 0.5
65
+ @track.volume.should == 0.5
66
+ end
38
67
  end
39
68
  end
40
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmov
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
  - Ryan Bates
@@ -32,7 +32,7 @@ extra_rdoc_files:
32
32
  - lib/quicktime/track.rb
33
33
  - lib/rmov.rb
34
34
  - LICENSE
35
- - README
35
+ - README.rdoc
36
36
  - tasks/setup.rake
37
37
  - tasks/spec.rake
38
38
  - TODO
@@ -49,8 +49,9 @@ files:
49
49
  - lib/quicktime/track.rb
50
50
  - lib/rmov.rb
51
51
  - LICENSE
52
+ - Manifest
52
53
  - Rakefile
53
- - README
54
+ - README.rdoc
54
55
  - spec/fixtures/settings.st
55
56
  - spec/output/example.pct
56
57
  - spec/output/saved_settings.st
@@ -62,7 +63,6 @@ files:
62
63
  - tasks/setup.rake
63
64
  - tasks/spec.rake
64
65
  - TODO
65
- - Manifest
66
66
  - rmov.gemspec
67
67
  has_rdoc: true
68
68
  homepage: http://github.com/ryanb/rmov
@@ -73,7 +73,7 @@ rdoc_options:
73
73
  - --title
74
74
  - Rmov
75
75
  - --main
76
- - README
76
+ - README.rdoc
77
77
  require_paths:
78
78
  - lib
79
79
  - ext