NAME
Video::Xine - Perl interface to libxine
SYNOPSIS
use Video::Xine;
# Create and initialize the Xine object
my $xine = Video::Xine->new(
config_file => "$ENV{'HOME'}/.xine/config",
);
# Load a video driver
my $video_driver = Video::Xine::Driver::Video->new($xine,"auto",1,$x11_visual);
# Create a new stream (put your video driver under $DRIVER)
my $stream = $xine->stream_new(undef,$DRIVER);
# Open a file on the stream
$stream->open('file://my/movie/file.avi')
or die "Couldn't open stream: ", $stream->get_error();
# Get the current position (0 .. 65535), position in time, and length
# of stream in milliseconds
my ($pos, $pos_time, $length_time) = $stream->get_pos_length();
# Start the stream playing
$stream->play()
or die "Couldn't play stream: ", $xine->get_error();
# Play the stream to the end
while ( $xine->get_status() == XINE_STATUS_PLAY ) {
sleep(1);
}
DESCRIPTION
A perl interface to Xine, the Linux movie player. More properly, an interface to libxine, the development library. Requires installation of libxine.
Xine by itself does not provide a user interface, and neither does this interface. Instead, you must set up the window using your own windowing code, and pass the window information to Xine.
METHODS
new()
Constructor. Takes named argument 'config_file'.
set_param()
set_param($param, $value);
Sets an engine parameter. Currently, this is only useful for setting the Xine logging level.
stream_new()
stream_new($audio_port, $video_port)
Creates a new stream. The $audio_port
and $video_port
options are optional and default to automatically-selected drivers. A convenience method around Xine::Stream::new.
STREAM METHODS
These are methods which can be used on the Video::Xine::Stream class and object.
new()
new($xine, $audio_port, $video_port)
Creates a new Stream object. The $audio_port
and $video_port
options are optional and default to automatically-selected drivers.
get_video_port()
Returns the video port, also known as the video driver.
open()
open($mrl)
Opens the stream to an MRL, which is a URL-like construction used by Xine to locate media files. See the xine documentation for details.
play()
play($start_pos, $start_time)
Starts playing the stream at a specific position or specific time. Both $start_pos
and $start_time
are optional and default to 0.
stop()
Stops the stream.
close()
Close the stream. You can re-use the same stream again and again.
get_pos_length()
($pos_pct, $pos_time, $length_time) = $s->get_pos_length();
Gets position / length information. $pos_pct
is a value between 1 and 65535 indicating how far we've proceeded through the stream. $pos_time
gives how far we've proceeded through the stream in milliseconds, and $length_time
gives the total length of the stream in milliseconds.
get_status()
Returns the play status of the stream.
XINE_STATUS_STOP
Indicates that the stream is stopped.
XINE_STATUS_PLAY
Indicates that the stream is playing.
get_error()
Returns the last error message.
set_param()
$s->set_param($param, $value)
Sets a parameter on the stream. $param
should be a xine parameter constant. See xine.h for details.
get_param()
$s->get_param($param)
Returns a parameter from the stream. $param
should be a xine parameter constant.
SEE ALSO
AUTHOR
Stephen Nelson, <stephen@cpan.org>
SPECIAL THANKS TO
Joern Reder
COPYRIGHT AND LICENSE
Copyright (C) 2005-2007 by Stephen Nelson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.