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

Page 469

Advertising
background image

7.14 Command Line

463

7.14

Command Line

#!/usr/bin/python -u

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

##

##

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

##

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

##

##

File:

$Workfile$

##

$Revision$

##

##

Last Update: $DateUTC$

##

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

##

import flixengine2

import time,sys,os

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

#failure. usage checksc(funcname,sc)

def checksc(func, sc):

if (sc != flixengine2.ON2_OK):

print "%s failed: sc= %d" % (func,sc)

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

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

if (sc == flixengine2.ON2_NET_ERROR): str = "rpcerr";

else: str = "flixerrno";

res = flixengine2.Flix2_Errno(flix)

print " Flix2_Errno: sc:%d %s:%d syserrno:%d\n" %\

(res[0],str,res[1],res[2])

raise Exception(func)

def print_encoder_status():

print "\nEncoder Status"

res = flixengine2.Flix2_GetEncoderState(flix)

print " Flix2_GetEncoderState: %d" % res[1]

res = flixengine2.Flix2_Errno(flix)

print " Flix2_Errno: sc:%d flixerrno:%d syserrno:%d\n" %\

(res[0],res[1],res[2])

print "Flix Engine client library v%s" % flixengine2.Flix2_Version()

print "%s\n" % flixengine2.Flix2_Copyright()

if (len(sys.argv) < 3):

print "usage: cli_encode.py <infile> <outfile>\n\n"\

"NOTE cli_encode.py 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"

raise Exception()

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

flixptr = flixengine2.new_flix2handlep()

sc = flixengine2.Flix2_CreateEx(flixptr, "localhost", timeout_s)

# retrieve the actual flix handle for use in the remaining API calls

flix = flixengine2.flix2handlep_value(flixptr);\

checksc(’flixengine2.Flix2_CreateEx’,sc)

print "Input File

: %s" % sys.argv[1]

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

Advertising