This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving movie export into separate Exporter class
- Loading branch information
Showing
10 changed files
with
86 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "rmov_ext.h" | ||
|
||
VALUE cExporter; | ||
|
||
static void exporter_free(struct RExporter *rExporter) | ||
{ | ||
} | ||
|
||
static void exporter_mark(struct RExporter *rExporter) | ||
{ | ||
} | ||
|
||
static VALUE exporter_new(VALUE klass) | ||
{ | ||
struct RExporter *rExporter; | ||
return Data_Make_Struct(klass, struct RExporter, exporter_mark, exporter_free, rExporter); | ||
} | ||
|
||
static VALUE exporter_export_to_file(VALUE obj, VALUE filepath) | ||
{ | ||
OSErr err; | ||
FSSpec fs; | ||
Movie movie = MOVIE(rb_iv_get(obj, "@movie")); | ||
|
||
if (rb_block_given_p()) | ||
SetMovieProgressProc(movie, (MovieProgressUPP)movie_progress_proc, rb_block_proc()); | ||
|
||
// Activate so QuickTime doesn't export a white frame | ||
SetMovieActive(movie, TRUE); | ||
|
||
// TODO add error handling | ||
err = NativePathNameToFSSpec(RSTRING(filepath)->ptr, &fs, 0); | ||
err = ConvertMovieToFile(movie, 0, &fs, 'MooV', 'TVOD', 0, 0, 0, 0); | ||
|
||
if (rb_block_given_p()) | ||
SetMovieProgressProc(movie, 0, 0); | ||
|
||
return Qnil; | ||
} | ||
|
||
void Init_quicktime_exporter() | ||
{ | ||
cExporter = rb_define_class_under(mQuicktime, "Exporter", rb_cObject); | ||
rb_define_alloc_func(cExporter, exporter_new); | ||
rb_define_method(cExporter, "export", exporter_export_to_file, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Quicktime | ||
# see ext/exporter.c for additional methods | ||
class Exporter | ||
attr_reader :movie | ||
|
||
def initialize(movie) | ||
@movie = movie | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
require 'quicktime/movie' | ||
require 'quicktime/track' | ||
require 'quicktime/exporter' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters