rmov 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Manifest +0 -2
- data/Rakefile +2 -2
- data/ext/movie.c +6 -7
- data/ext/rmov_ext.h +3 -0
- data/lib/quicktime/movie.rb +19 -0
- data/rmov.gemspec +2 -4
- data/spec/quicktime/movie_spec.rb +7 -1
- metadata +1 -3
- data/spec/output/example.pct +0 -0
- data/spec/output/saved_settings.st +0 -0
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
0.1.4 (October 3rd, 2008)
|
2
|
+
|
3
|
+
* adding support for several export_image formats (PNG, JPEG, TIFF, TGA, BMP, PSD)
|
4
|
+
|
5
|
+
* adding movie.export_image as a generic way to export a frame to multiple formats
|
6
|
+
|
1
7
|
0.1.3 (October 3rd, 2008)
|
2
8
|
|
3
9
|
* some support for text tracks
|
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -2,13 +2,13 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('rmov', '0.1.
|
5
|
+
Echoe.new('rmov', '0.1.4') 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"
|
9
9
|
p.author = 'Ryan Bates'
|
10
10
|
p.email = "ryan (at) railscasts (dot) com"
|
11
|
-
p.ignore_pattern = ["script/*", "tmp/*", "output/*", "**/*.o", "**/*.bundle", "**/*.mov"]
|
11
|
+
p.ignore_pattern = ["script/*", "tmp/*", "spec/output/*", "**/*.o", "**/*.bundle", "**/*.mov"]
|
12
12
|
p.extensions = ["ext/extconf.rb"]
|
13
13
|
p.development_dependencies = []
|
14
14
|
end
|
data/ext/movie.c
CHANGED
@@ -346,13 +346,12 @@ static VALUE movie_flatten(VALUE obj, VALUE filepath)
|
|
346
346
|
}
|
347
347
|
|
348
348
|
/*
|
349
|
-
call-seq:
|
349
|
+
call-seq: export_image_type(filepath, time, ostype)
|
350
350
|
|
351
|
-
Exports
|
352
|
-
|
351
|
+
Exports an image as the given ostype. It is best to use export_image
|
352
|
+
instead if the ostype can be determined from the filepath extension.
|
353
353
|
*/
|
354
|
-
|
355
|
-
static VALUE movie_export_pict(VALUE obj, VALUE filepath, VALUE frame_time)
|
354
|
+
static VALUE movie_export_image_type(VALUE obj, VALUE filepath, VALUE frame_time, VALUE ostype_obj)
|
356
355
|
{
|
357
356
|
GraphicsImportComponent component;
|
358
357
|
PicHandle picture;
|
@@ -381,7 +380,7 @@ static VALUE movie_export_pict(VALUE obj, VALUE filepath, VALUE frame_time)
|
|
381
380
|
if (err != noErr)
|
382
381
|
rb_raise(eQuickTime, "Error %d occurred while setting graphics importer data handle for %s.", err, RSTRING(filepath)->ptr);
|
383
382
|
|
384
|
-
err = GraphicsImportExportImageFile(component,
|
383
|
+
err = GraphicsImportExportImageFile(component, OSTYPE(RSTRING(ostype_obj)->ptr), 0, &fs, smSystemScript);
|
385
384
|
if (err != noErr)
|
386
385
|
rb_raise(eQuickTime, "Error %d occurred while exporting pict to file %s.", err, RSTRING(filepath)->ptr);
|
387
386
|
|
@@ -450,7 +449,7 @@ void Init_quicktime_movie()
|
|
450
449
|
rb_define_method(cMovie, "changed?", movie_changed, 0);
|
451
450
|
rb_define_method(cMovie, "clear_changed_status", movie_clear_changed_status, 0);
|
452
451
|
rb_define_method(cMovie, "flatten", movie_flatten, 1);
|
453
|
-
rb_define_method(cMovie, "
|
452
|
+
rb_define_method(cMovie, "export_image_type", movie_export_image_type, 3);
|
454
453
|
rb_define_method(cMovie, "dispose", movie_dispose, 0);
|
455
454
|
rb_define_method(cMovie, "poster_time", movie_get_poster_time, 0);
|
456
455
|
rb_define_method(cMovie, "poster_time=", movie_set_poster_time, 1);
|
data/ext/rmov_ext.h
CHANGED
data/lib/quicktime/movie.rb
CHANGED
@@ -79,5 +79,24 @@ module QuickTime
|
|
79
79
|
track.new_text_media
|
80
80
|
track
|
81
81
|
end
|
82
|
+
|
83
|
+
# Exports a frame of the movie at the given time (in seconds) to the given file.
|
84
|
+
# The image format is automatically determined from the file extension. If this
|
85
|
+
# cannot be determined from the extension then you can use export_image_type to
|
86
|
+
# specify the ostype manually.
|
87
|
+
def export_image(filepath, seconds)
|
88
|
+
# TODO support more file types
|
89
|
+
type = case File.extname(filepath).downcase
|
90
|
+
when '.pct' then 'PICT'
|
91
|
+
when '.png' then 'PNGf'
|
92
|
+
when '.tif', '.tiff' then 'TIFF'
|
93
|
+
when '.jpg', '.jpeg' then 'JPEG'
|
94
|
+
when '.tga' then 'TPIC'
|
95
|
+
when '.bmp' then 'BMPf'
|
96
|
+
when '.psd' then '8BPS'
|
97
|
+
else raise QuickTime::Error, "Unable to guess ostype from file extension of #{filepath}"
|
98
|
+
end
|
99
|
+
export_image_type(filepath, seconds, type)
|
100
|
+
end
|
82
101
|
end
|
83
102
|
end
|
data/rmov.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rmov-0.1.
|
2
|
+
# Gem::Specification for Rmov-0.1.4
|
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.
|
8
|
+
version: 0.1.4
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Ryan Bates
|
@@ -56,8 +56,6 @@ files:
|
|
56
56
|
- Rakefile
|
57
57
|
- README.rdoc
|
58
58
|
- spec/fixtures/settings.st
|
59
|
-
- spec/output/example.pct
|
60
|
-
- spec/output/saved_settings.st
|
61
59
|
- spec/quicktime/exporter_spec.rb
|
62
60
|
- spec/quicktime/movie_spec.rb
|
63
61
|
- spec/quicktime/track_spec.rb
|
@@ -120,7 +120,13 @@ describe QuickTime::Movie do
|
|
120
120
|
it "export_pict should output a pict file at a given duration" do
|
121
121
|
path = File.dirname(__FILE__) + '/../output/example.pct'
|
122
122
|
File.delete(path) rescue nil
|
123
|
-
@movie.
|
123
|
+
@movie.export_image(path, 1.2)
|
124
|
+
end
|
125
|
+
|
126
|
+
it "export_png should output a png file at a given duration" do
|
127
|
+
path = File.dirname(__FILE__) + '/../output/example.png'
|
128
|
+
File.delete(path) rescue nil
|
129
|
+
@movie.export_image(path, 1.2)
|
124
130
|
end
|
125
131
|
|
126
132
|
it "should default poster time to 0" do
|
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bates
|
@@ -53,8 +53,6 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- README.rdoc
|
55
55
|
- spec/fixtures/settings.st
|
56
|
-
- spec/output/example.pct
|
57
|
-
- spec/output/saved_settings.st
|
58
56
|
- spec/quicktime/exporter_spec.rb
|
59
57
|
- spec/quicktime/movie_spec.rb
|
60
58
|
- spec/quicktime/track_spec.rb
|
data/spec/output/example.pct
DELETED
Binary file
|
Binary file
|