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

Page 381

Advertising
background image

7.10 Command Line

375

7.10

Command Line

#!/usr/bin/perl -w

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

##

##

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

##

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

##

##

File:

$Workfile$

##

$Revision$

##

##

Last Update: $DateUTC$

##

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

##

use On2::flixengine2;

use File::Spec::Functions;

package On2::flixengine2; #use flixengine2’s namespace

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

#failure. usage checksc(funcname,sc)

sub checksc($$)

{

my $sc = $_[1];

if ($sc != $ON2_OK) {

my $esc;

select STDERR;

print "$_[0] 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

@_ = Flix2_Errno($flix); $esc= shift;

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

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

exit 1;

}

}

sub print_encoder_status()

{

print "\nEncoder Status\n";

my $state = Flix2_GetEncoderState($flix);

print " Flix2_GetEncoderState: $state\n";

my ($sc,@err) = Flix2_Errno($flix);

printf(" Flix2_Errno: sc:%d flixerrno:%d syserrno:%d\n",$sc,$err[0],$err[1]);

}

my $rpchost = "localhost";

my $timeout_s = 0; #rpc timeout in seconds, 0=use default (25s)

print "Flix Engine client library v".Flix2_Version()."\n";

print Flix2_Copyright()."\n\n";

die "usage: ./cli_encode.pl <infile> <outfile>\n\n".

"NOTE cli_encode.pl 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" if @ARGV < 2;

#create a new flix2handle ptr

my $flixptr = new_flix2handlep();

## contact flixd on rpchost w/timeout of timeout_s.

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

Advertising