Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
adding movie.poster_time getter and setter
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Oct 3, 2008
1 parent d93cfcd commit 7163305
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
* track.offset and track.offset=(seconds) for getting and setting a track's offset time from the start of a movie.
* movie.poster_time and movie.poster_time=(seconds) for getting and setting a movie's poster time

* track.offset and track.offset=(seconds) for getting and setting a track's offset time from the start of a movie

* track.volume and track.volume=(vol) for getting and setting a track's volume

Expand Down
23 changes: 23 additions & 0 deletions ext/movie.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,27 @@ static VALUE movie_export_pict(VALUE obj, VALUE filepath, VALUE frame_time)
return Qnil;
}

/*
call-seq: poster_time() -> seconds
Returns the poster time of the movie (in seconds).
*/
static VALUE movie_get_poster_time(VALUE obj)
{
return rb_float_new((double)GetMoviePosterTime(MOVIE(obj))/GetMovieTimeScale(MOVIE(obj)));
}

/*
call-seq: poster_time=(seconds)
Sets the poster_time of the movie (in seconds).
*/
static VALUE movie_set_poster_time(VALUE obj, VALUE seconds)
{
SetMoviePosterTime(MOVIE(obj), MOVIE_TIME(obj, seconds));
return Qnil;
}

void Init_quicktime_movie()
{
VALUE mQuicktime;
Expand All @@ -415,4 +436,6 @@ void Init_quicktime_movie()
rb_define_method(cMovie, "flatten", movie_flatten, 1);
rb_define_method(cMovie, "export_pict", movie_export_pict, 2);
rb_define_method(cMovie, "dispose", movie_dispose, 0);
rb_define_method(cMovie, "poster_time", movie_get_poster_time, 0);
rb_define_method(cMovie, "poster_time=", movie_set_poster_time, 1);
}
9 changes: 9 additions & 0 deletions spec/quicktime/movie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@
File.delete(path) rescue nil
@movie.export_pict(path, 1.2)
end

it "should default poster time to 0" do
@movie.poster_time.should == 0
end

it "should be able to set poster time to 2.1 seconds in" do
@movie.poster_time = 2.1
@movie.poster_time.should == 2.1
end
end

describe "empty movie" do
Expand Down

0 comments on commit 7163305

Please sign in to comment.