Gtk2-Ex-MPlayerEmbed

 view release on metacpan or  search on metacpan

lib/Gtk2/Ex/MPlayerEmbed.pm  view on Meta::CPAN

# $Id: MPlayerEmbed.pm,v 1.7 2006/01/02 19:44:41 jodrell Exp $
# Copyright (c) 2005 Gavin Brown. All rights reserved. This program is free
# software; you can redistribute it and/or modify it under the same terms as
# Perl itself.
package Gtk2::Ex::MPlayerEmbed;
use constant {
	PAUSE		=> 'pause',
	RESUME		=> 'pause', # 'pause' is really a toggle
	CLOSE		=> 'quit',
};
use Carp;
use FileHandle;
use Gtk2;
use vars qw($VERSION $STATE_ENUM_PKG);
use strict;

our $VERSION = '0.02';


BEGIN {
	our $STATE_ENUM_PKG = sprintf('%s::PlayingState', __PACKAGE__);
	Glib::Type->register_enum(
		$STATE_ENUM_PKG,
		'stopped', 'playing', 'paused'
	);
}

*new = \&Glib::Object::new;

=pod

=head1 NAME

Gtk2::Ex::MPlayerEmbed - a widget to embed the MPlayer media player into GTK+ applications

=head1 SYNOPSIS

	use Gtk2::Ex::MPlayerEmbed;

	my $window = Gtk2::Window->new;

	my $embed = Gtk2::MPlayerEmbed->new;

	$window->add($embed);

	$window->show_all;

	$embed->play("movie.mpg");

	Gtk2->main;

=head1 DESCRIPTION

Gtk2::Ex::MPlayerEmbed allows you to embed a video player into your
applications. It uses the XEMBED system to allow the I<mplayer> program
to insert its window into your application.

=head1 OBJECT HIERARCHY

  Glib::Object
  +----Gtk2::Object
       +----Gtk2::Widget
            +----Gtk2::Container
                 +----Gtk2::Socket
                      +----Gtk2::Ex::MPlayerEmbed

=head1 PROPERTIES

The following properties are accessible through the standard Glib C<get()> and C<set()> methods:

=over


=item C<mplayer_path>

This is the path to the I<mplayer> program. This is C</usr/bin/mplayer> by default.

=item C<args>

This is a string containing the command line arguments passed to I<mplayer> (no
default).

=item C<loaded>

This is a B<boolean> value that indicates whether the I<mplayer> program is
currently running.

=item C<state>

This is an B<enumeration> (described by C<Gtk2::Ex::MPlayerEmbed::PlayingState>)
that indicates the state of the player. C<state> may be one of: C<stopped>,
C<playing>, C<paused>. It is C<stopped> at startup.

=back

=cut

Glib::Type->register(
	Gtk2::Socket::,
	__PACKAGE__,
	properties => [
		Glib::ParamSpec->string(
			'mplayer_path',
			'MPlayer Path',
			'Path to the MPlayer program',
			'/usr/bin/mplayer',
			[qw/readable writable/],
		),

		Glib::ParamSpec->string(
			'args',
			'MPlayer Arguments',
			'The arguments supplied to the mplayer command',
			'',
			[qw/readable writable/],



( run in 0.536 second using v1.01-cache-2.11-cpan-71847e10f99 )