beautypg.com

Google Flix Engine Linux Reference Manual User Manual

Page 467

background image

7.13 CGI

461

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

}

echo "\r\n\r\nFlix CGI Process Sample - PHP\n";

# output the function calls

echo "


process_sample.php version 1.8
\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
";

include ($flixphp);

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

echo str_replace("\n","
",Flix2_Copyright()) . "

";

$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("’$outdir’",’$outdir’); $file=__FILE__;

echo "

****************************************
\n".

"WARNING: $t[0] MUST exist and be writeable by flixd.\n".

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

" value defined in ’$file’.
\n";

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

if($g) {

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

}

echo "****************************************

\n";

}

echo "";

echo "

\n";

echo "

\n";

echo "

";

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

Flix Function Calls
Function NameReturn Value
Flix2_CreateEx()