Video::Xine - xine movie player interface
use Video::Xine; use Video::Xine::Stream; use Video::Xine::Driver::Audio; use Video::Xine::Driver::Video qw/:constants/; use Video::Xine::Util qw/make_x11_fs_visual/; # Create and initialize the Xine object my $xine = Video::Xine->new( config_file => "$ENV{'HOME'}/.xine/config", ); # Get an X11 visual for X11::FullScreen and load a video driver my $display = X11::FullScreen->new(':0.0'); $display->show(); my $fs_visual = make_x11_fs_visual($display); my $video_driver = Video::Xine::Driver::Video->new($xine,"auto", XINE_VISUAL_TYPE_X11, $fs_visual); # Load an audio driver my $audio_driver = Video::Xine::Driver::Audio->new($xine, "auto"); # Create a new stream my $stream = $xine->stream_new($audio_driver, $video_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); }
A perl interface to xine, the Linux movie player. More properly, an interface to libxine, the development library. Requires installation of libxine. It has been tested up to xine version 1.2.2.
Video::Xine by itself does not provide a user interface or windowing system. Instead, you must set up the window using your own windowing code, and pass the window information to Video::Xine. The "X11::FullScreen" module provides a simple interface for doing this with X.
See the provided 'bin/xine_play' file for a very simple movie player that uses Video::Xine and X11::FullScreen to play movies.
Constructor. Takes optional named argument 'config_file'.
Example:
my $xine = Video::Xine->new( config_file => "$ENV{'HOME'}/xine/config" )
Returns the version of the xine library to which we're linked. Static method.
my $version = Video::Xine->get_version(); # returns something like '1.1.8'
Video::Xine->check_version(1, 2, 1) or die "Too low!\n";
Checks the provided major, minor, and point release numbers against the current Xine version and makes sure they're compatible.
set_param($param, $value);
Sets an engine parameter.
Xine engine parameter constants:
XINE_ENGINE_PARAM_VERBOSITY
Possible values are XINE_VERBOSITY_NONE, XINE_VERBOSITY_LOG, and XINE_VERBOSITY_DEBUG, which are exported by default.
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.
$audio_port
$video_port
See Video::Xine::Stream for stream methods.
Returns the error code for the last error. See the Xine documentation for their meaning. Xine error codes are:
XINE_ERROR_NONE
XINE_ERROR_NO_INPUT_PLUGIN
XINE_ERROR_NO_DEMUX_PLUGIN
XINE_ERROR_DEMUX_FAILED
XINE_ERROR_MALFORMED_URL
XINE_ERROR_INPUT_FAILED
This module lists X11::FullScreen as a requirement, since that's currently the only way of showing video with it. Technically, it's possible to use it with other windowing systems, or even to use it without X to find out metadata about AV files.
Xine (http://www.xine-project.org/home)
Stephen Nelson <stephenenelson@mac.com>
Joern Reder
Copyright (C) 2005-2013 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.
To install Video::Xine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Video::Xine
CPAN shell
perl -MCPAN -e shell install Video::Xine
For more information on module installation, please visit the detailed CPAN module installation guide.