Command line, 12 command line – Google Flix Engine Linux Reference Manual User Manual

Page 425

Advertising
background image

7.12 Command Line

419

7.12

Command Line

#!/usr/bin/env php

<?php

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

##

##

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

##

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

##

##

File:

$Workfile$

##

$Revision$

##

##

Last Update: $DateUTC$

##

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

##

#checks the return value of an API function printing error information on

#failure. usage checksc(funcname,sc)

function checksc($func, $sc) {

global $flix;

if ($sc != ON2_OK) {

echo "$func failed: sc= $sc\n";

##if sc == ON2_NET_ERROR Flix2_Errno will return the specific rpc error

##encountered as flixerrno along with the client lib’s errno value

$res = Flix2_Errno($flix);

printf(" Flix2_Errno: sc:%d %s:%d syserrno:%d\n",

$res[0],($sc==ON2_NET_ERROR)?"rpcerr":"flixerrno",$res[1],$res[2]);

die;

}

}

function print_encoder_status() {

global $flix;

echo "\nEncoder Status\n";

$res = Flix2_GetEncoderState($flix);

echo " Flix2_GetEncoderState: $res[1]\n";

$res = Flix2_Errno($flix);

printf(" Flix2_Errno: sc:%d flixerrno:%d syserrno:%d\n",

$res[0],$res[1],$res[2]);

}

# Load the FlixEngine module

$flixphp = ’flixengine2.php’;

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

# If this include fails you may need to edit you include_path variable in

# your php.ini file.

# See the accompanying Flix Linux Engine documentation for further details.

# 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")."/..");

include ($flixphp);

printf("Flix Engine client library v%s\n",Flix2_Version());

printf("%s\n\n",Flix2_Copyright());

if (count($argv) < 3) {

die("usage: cli_encode.php <infile> <outfile>\n\n".

"NOTE cli_encode.php uses libflixengine2.so which is a client\n".

"NOTE side rpc library. All paths must be accessible to the\n".

"NOTE server side, i.e., flixd, thus relative paths will most\n".

"NOTE likely give undesired results. The same can be said\n".

"NOTE for clients running on different machines.\n");

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

Advertising