|
I've got some more questions for you...
1) when I try to do a set_preview_frame_nr after a read_dvd_toc, it appears that the title object isn't immediately valid - I'm guessing it takes time for the read_dvd_toc to execute, and my "execute when idle" code isn't waiting long-enough. I've also noticed that read_dvd_toc contains some callbacks that are executed by "get_post_callbacks->add", so I again guess that perhaps I need to somehow wait till the post_callbacks are executed - from a $self reference, how would I tell when the post_callbacks are finished ?
2) how do I programatically refresh/update the GUI so it shows the "tab" that is currently of interest?
(it seems to do this automatically for read_dvd_toc, but I can't see how.
Buzz.
On 12/27/06, buzz <davidbuzz@xxxxxxxxx> wrote:get_post_callbacks-
As you might have seen from the diff's I posted, I'd *kinda* figured out about 1/4 of that already... but it's good to get the gaps filled in, especially regarding how the
Title.pm works.
I'll add some more code to my .dvdripauto file, and see how I go... thanks for the tips.
Buzz.
On 12/27/06, Jörn Reder <joern@xxxxxx> wrote:
buzz wrote:
> *What I need help with is:* what code that I should be executing to make a > specific task occur (note: i'm not a Gtk or dvd::rip guru, by any stretch,
> but I do program perl for a living)
You find the correspondent code snippets resp. subroutines in the module files which cover building the GUI and connecting actions to buttons and stuff. For the main window these are located in this directory:
lib/Video/DVDRip/GUI/Project/
The module files are named by the corresponding tabs on the GUI, e.g.
ClipZoom.pm
To use this example, you will see that the "Grab frame" button is connected to this subroutine, located in the same file:
sub grab_preview_frame { ... }
You can call it within dvd::rip using this construct:
$self->get_context->get_object("clip_zoom")->grab_preview_frame();
$self is assumed to be an arbitrary dvd::rip GUI object - these are all
derived from a base class which provides the get_context() method. From where does this "clip_zoom" identifier come? Each GUI object registers itself to the central "Context" object, which all dvd::rip objects bound
to the GUI. In the constructor of Video::DVDRip::GUI::Project::ClipZoom - the new() subroutine - the corresponding code is $self->get_context->set_object( "clip_zoom" => $self ), so from here
comes the name "clip_zoom".
This subroutine doesn't get a parameter *which* frame to grab, because this is stored in the data object, which are present for each DVD title. The code for this very centric dvd::rip module is located here:
lib/Video/DVDRip/Title.pm
You get the currently selected title this way:
my $title = $self->get_context->get_object("title")
To set the preview frame number just use this: (take a look at the top
of Title.pm to see all the attributes covered by Video::DVDRip::Title)
$title->set_preview_frame_nr(500)
or to put it at the middle of the movie you can use this:
$title->set_preview_frame_nr(int($title->get_frames / 2))
So the complete example of setting the preview frame number and start grabbing would look like this:
my $context = $self->get_context; my $title = $context->get_object("title"); my $clip_zoom = $context->get_object("clip_zoom");
$title->set_preview_frame_nr(500);
$clip_zoom->grab_preview_frame();
Have fun,
Joern
-- .''`. Jörn Reder <joern@xxxxxx
> : :' : http://www.exit1.org/
http://www.zyn.de/ `. `' `- Debian GNU/Linux -- The power of freedom
|