11 cgi, 1 flix2_sample.cgi – Google Flix Engine Linux Reference Manual User Manual

Page 384

Advertising
background image

378

Flix Engine Linux Page Documentation

7.11

CGI

This example consists of 2 parts:

flix2_sample.cgi

and

process_sample.cgi

.

flix2_sample.cgi

searches for

uploaded files to encode and allows the user to select one while giving the option to set values for most
of the engine’s functions. The engine options are separated into sections that map to the engine’s include
files.

To use this example navigate to

flix2_sample.cgi

in your web browser, select a file from the list, set any of

the desired options and click the encode button. The selected options are submitted to

process_sample.cgi

which runs the encode loop.

Default file locations used by the scripts:

Input

: /var/www/cgi-bin/flixmedia/in ($indir in

flix2_sample.cgi

)

Overlay

: /var/www/cgi-bin/flixmedia/overlay ($overlaydir in

flix2_sample.cgi

)

Output

: /var/www/cgi-bin/flixmedia/out ($outdir in

process_sample.cgi

)

7.11.1

flix2_sample.cgi

#!/usr/bin/perl -w

##==========================================================================

##

##

Copyright (c) On2 Technologies Inc. All Rights Reserved.

##

##--------------------------------------------------------------------------

##

##

File:

$Workfile$

##

$Revision$

##

##

Last Update: $DateUTC$

##

##--------------------------------------------------------------------------

##

#flix2_sample.cgi

#expose API functions available in the perl bindings

#submits a form to process_sample.cgi which makes calls to libflixengine2.so

#through the bindings

use CGI qw(:standard -no_xhtml);

use On2::flixengine2 ();

#ensure Flix Engine module existence prior to process

$| = 1; #auto flush

my $prefix

= "/var/www/cgi-bin/";

my $indir

= $prefix."flixmedia/in/";

#src file directory

my $overlaydir = $prefix."flixmedia/overlay/"; #overlay image file directory

print header;

print <<HTML_END;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en-US">

<head>

<title>Flix CGI Sample - Perl</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

function showall(show) {

var legend_list = document.getElementsByTagName(’legend’);

var i=0;

while(legend_list[i]) {

legend_list[i].parentNode.className=show?’expanded’:’collapsed’;

Generated on Tue Jul 20 17:39:03 2010 for Flix Engine Linux by Doxygen

Advertising