The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Video::Streamer - A HTTP video streamer and browser.

VERSION

Version 0.0.1

SYNOPSIS

    use WWW::Video::Streamer;

    my $wvs = WWW::Video::Streamer->new();

    #read the config if it exists
    if (-e './config.ini') {
            $wvs->config('./config.ini');
    }

    #invoke the CGI stiff
    $wvs->cgi;

METHODS

new

Initiates the object.

    my $wvs=WWW::Video::Streamer->new;

cgi

This handles a handles the CGI interface.

    $wvs->cgi;

config

This reads the config.

    if (-e './config.ini') {
            $wvs->config('./config.ini');
        if($wvs->{error}){
            print "Error!\n";
        }
    }

dir

This handles displaying directories.

mencoder

Takes the template and generates a proper string to run mencoder.

    my $mencoderstring=$wvs->mencoder($file);
    if(!$wvc->{error}){
        print "Error!\n";
    }

playable

This checks if the file is playable or not.

Currently this just checks if the mimetype matches /^video\//.

This will error if no file is specified.

    $playable=$wvc->playable($file);
    if($wvc->{error}){
        print "Error!\n";
    }else{
        if($playable){
            print "Playable.\n";
        }else{
            print "Not playable.\n";
        }
    }

stream

This streams the specified file to standard out.

    $wvc->stream($file);
    if(!$wvc->{error}){
        print "Error!\n";
    }

errorblank

This blanks the error storage and is only meant for internal usage.

It does the following.

    $self->{error}=undef;
    $self->{errorString}="";

ERROR CODES

1

Failed to read the config.

2

No file is defined.

3

File requested is not below the specified directory.

4

The file is below the specified directory, but is not a file or directory.

5

Opendir failed for the path.

6

Path does not exist.

7

Path is not defined.

8

Path is not a directory.

9

Failed to build mencoder string.

10

The requested file does not exist.

11

The video directory does not exist.

CONFIG FILE

The below is a example config file at the defaults.

    x=100
    y=100
    vb=120
    ab=40
    dir=/arc/video/
    mt=/usr/local/bin/mencoder {$file} -oac mp3lame -ovc lavc -of avi -lavcopts vbitrate={$vb} -lameopts cbr={$ab} {$size} -vf scale={$x}:{$y} -really-quiet -o -

ab

This is the default audio bit rate to use for the encoding.

dir

This is the base directory for video.

mt

This is the mencoder template that will be used.

{$ab}

This part of the template will be replaced with the audio bit rate.

{$file}

This part of template will be replaced with the file name.

{$vb}

This part of the template will be replaced with the video bit rate.

{$x}

This part of the template will be replaced with the video width.

{$y}

This part of the template will be replaced with the video heigth.

x

This is the default video width

y

This is the default video hieght.

DOT FILES

These are currently ignored by the dir function.

SECURITY

The file names passed to it are escaped when they are passed to mplayer.

Care should be taken to make sure that the config file is not writable by any untrusted users as changing the 'mt' variable can allow other things to be executed.

If none-numeric values for 'x', 'y', 'ab', or 'vb' are found when it goes to play it, the defaults are used.

USING

Copy 'bin/wvs.cgi' to your directory on your web server, enable CGI on that directory, and then if you want to override the defaults create 'config.ini' in hat directory.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-www-video-streamer at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Video-Streamer. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::Video::Streamer

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Zane C. Bowers, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.