Google Flix Engine Linux Reference Manual User Manual

Page 467

Advertising
background image

7.13 CGI

461

flush(); if(ini_get("output_buffering")) ob_flush();

}

echo "\r\n\r\n<html><head><title>Flix CGI Process Sample - PHP</title></head><body>\n";

# output the function calls

echo "<hr><p>process_sample.php version 1.8<br>\n";

# Load the FlixEngine module

# add extension_dir/.. to ’include_path’ as this is often missing from php.ini

set_include_path(get_include_path().PATH_SEPARATOR.ini_get("extension_dir")."/..");

$flixphp = ’flixengine2.php’;

echo ’Loading flix: ’ . $flixphp . "\n<br>";

include ($flixphp);

echo "Flix Engine client library v" . Flix2_Version() . "<br>";

echo str_replace("\n","<br>",Flix2_Copyright()) . "</p>";

$rpchost = "localhost";

$prefix

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

$outdir

= $prefix."flixmedia/out/";

##verify outdir’s presence and accessibility

if ($rpchost == "localhost" && !(is_dir($outdir) && is_writeable($outdir))) {

$t=array("<i>’$outdir’</i>",’<tt>$outdir</tt>’); $file=__FILE__;

echo "<p>****************************************<br>\n".

"<b>WARNING</b>: $t[0] MUST exist and be writeable by <i>flixd</i>.\n".

"<br>Please make $t[0] accessible or modify the $t[1]".

" value defined in ’$file’.<br>\n";

$g=‘grep -m 1 -H -n ’^\$outdir’ $file‘;

if($g) {

print "The definition of $t[1] can be found here:<br>\n$g<br>\n";

}

echo "****************************************</p>\n";

}

echo "<table border=’1’ cellpadding=’5’>";

echo "<caption>Flix Function Calls</caption>\n";

echo "<tr><th>Function Name</th><th>Return Value</th></tr>\n";

echo "<tr><td>Flix2_CreateEx()</td>";

flush_output();

$flixptr= new_flix2handlep();

$sc = Flix2_CreateEx($flixptr, $rpchost, 0);

#extract the handle value returned from _Create. $flix will be used in

#every Flix API call that follows

$flix= flix2handlep_value($flixptr);

process_sc(’Flix2_CreateEx’,$sc);

foreach($_POST as $func=>$param) {

if(strlen($param)) {

if(!strcmp($func,"Flix2_SetOutputFile")) {

SimpleSet($func, $outdir.$param);

} else if(preg_match(’/^(?:a|v)codec:/’,$func)) {

init_codec($param);

} else if(preg_match(’/^(?:a|v)filter:/’,$param)) {

init_filter($func);

} else if(preg_match(’/^muxer:$/’,$func)) {

init_muxer($param);

} else if(strstr($func,"CodecSetParam")) {

$temp = explode(":",$func);

codec_interface($temp[0],$temp[1],$param);

} else if(strstr($func, "FilterSetParam")) {

$temp = explode(":",$func);

filter_interface($temp[0],$temp[1],$param);

} else if(strstr($func,"MuxerSetParam")) {

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

Advertising