Frame server api, 43 frame server api, 1 detailed description – Google Flix Engine Linux Reference Manual User Manual

Page 191: 2 example usage

Advertising
background image

5.43 Frame Server API

185

5.43

Frame Server API

5.43.1

Detailed Description

Flix Engine Frame Server API.

The Frame Server API allows an application to provide the engine with raw audio and video frames
rather than entire files. This service is only available via the core Flix Engine library (libflixengine2_-
core.so

). It is not available through the daemon (flixd) / rpc client library (libflixengine2.so) pair or the

language extensions that are built to interface with libflixengine2.so.

5.43.2

Example Usage

//initialize the library, create a handle to the engine and set our outfile

Flix2_Init();

Flix2_Create(&flix);

Flix2_SetOutputFile(flix,"frameserver-out.flv");

//enable the frame server

Flix2_SetFrameServer(flix,on2true);

//setup our video input, [email protected], bgra

Flix2_SetVideoProperties(flix,VideoFormatBGRA,320,240,320*4,2997,1000);
//setup our audio input, 2ch/16bitsps/44.1kHz

Flix2_SetAudioProperties(flix,2,16,44100);

//encode audio/video using the library’s default encoding parameters

Flix2_EncodeFrame(flix, FrameTypeVideo, on2false,

vidframe, 320*240*4, 0);

Flix2_EncodeFrame(flix, FrameTypeAudio, on2false,

audframe, audframesiz, 0);

...

Flix2_EncodeFrame(flix, FrameTypeVideo, on2false,

vidframe, 320*240*4, 300300);

Flix2_EncodeFrame(flix, FrameTypeAudio, on2false,

audframe, audframesiz, 0);

...

//set eos on both inputs

Flix2_EncodeFrame(flix, FrameTypeVideo, on2true,

NULL, 0, 303303);

Flix2_EncodeFrame(flix, FrameTypeAudio, on2true,

NULL, 0, 0);

//finish encoding any queued frames

do {

Flix2_IsEncoderRunning(flix,&b);

} while(b);

//cleanup

Flix2_Destroy(flix);

Flix2_Deinit();

Attention:

The Frame Server API does not currently support resampling of the input audio.

Note:

As the Frame Server API deals with raw video and audio, which use a large amount of storage, no
sample is distributed with the Flix Engine. If you are interested in using the Frame Server API and
require a sample please contact

support

.

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

Advertising