Re: Was: Video in window NOW: window Black



On Sun, 09 Apr 2006 13:15:49 -0400
Josà Luis Regalado <djdaga gmail com> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Josà Luis Regalado escribiÃ:

    use Gtk2 -init;
    use Gtk2::Ex::MPlayerEmbed;

NOW WORK, but the window is black. I not see the video.

some advice?.
Thanks.

Hi, I've yet to get Ex::MPlayerEmbed to work for me.
It just dosn't show up on the screen.
I have been able to do it manually, but it is a bit clunky.

In the script below, the init.mpg is just a blank mpg I have
and it is used to start mplayer in slave mode. Since I don't
want to include it in this email, I just made the init the same as the 
mpg to be played.

Like I said, this is only an experimental script, which I have
not done much work on, so don't expect it to work right, except to
play the mpg. There may be useless code statements in it.

I've yet to find a way to get any of the key bindings to work in Gtk2
embedded windows. 
Anyways......  here it is

#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2;
use Gtk2 '-init';

my $mpg = shift;

my $pid;  #global for killing  on exit
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Embed test');
$window ->signal_connect( 'destroy' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(600,600);

my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);

my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);
$hbox->set_border_width(2);

$vbox->pack_end (Gtk2::HSeparator->new, FALSE, FALSE, 0);

my $vbox1 = Gtk2::VBox->new( FALSE, 6 );
$vbox1->set_size_request(600,500);
$vbox->pack_end($vbox1,FALSE,FALSE,0);
$vbox1->set_border_width(2);

my $button = Gtk2::Button->new_from_stock('gtk-quit');
$hbox->pack_end( $button, FALSE, FALSE, 0 );
$button->signal_connect( clicked => \&delete_event );

my $button1 = Gtk2::Button->new('Mplayer');
$hbox->pack_end( $button1, FALSE, FALSE, 0 );
$button1->signal_connect( clicked => \&do_mplayer );

$window->show_all();
Gtk2->main;
#####################################
sub delete_event {
kill 9, $pid;
Gtk2->main_quit;
return FALSE;
}  

##########################################
sub do_mplayer{

    my $gdkwindow = $window->window;
    print "gdkwin->$gdkwindow\n";    

    my $gdkwindow1 = $vbox1->window;
    print "gdkvbox->$gdkwindow1\n";    
    my $xid = $gdkwindow1->XWINDOW;
    print "xid->$xid\n";
    my $url ='';

my @options = (  '-slave','-loop 0', '-zoom',
                 "-x 600", "-y 450",
                  '-really-quiet',
                   "-wid $xid",
               );

my $init = $mpg;
my  $pid = open(MP, "| mplayer @options $init >/dev/null 2>&1 "); 
syswrite(MP, "loadfile $mpg\n");


}
__END__

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]