ffencoderd::Encoder Class Reference

List of all members.

Public Class Methods

ffencoderd::Encoder new (hash params)

Public Object Methods

string getStats ()
int getNumberOfProcesses ()
int add_running_process ()
int end_process (hash data, scalar proctime)
void encode_video (hash process_data)
void DESTROY ()

Public Functions

array getArguments (hash parameters_list, hash process_data)
string _guid ()

Private Object Methods

private void _encode_video (hash process_data, scalar guid)


Detailed Description

This class wraps the usage of ffencoderd, uses Profiles class and the user defined parameters to generate a command line with ffmpeg and execute it.

Member Function Documentation

ffencoderd::Encoder ffencoderd::Encoder::new ( hash  params  ) 

Create Encoder instance, defines settings used by all encoding sessions

Parameters:
hash $params A hash with the following keys
  • videoDir Path to folder where videos are
  • outputDir Path to folder where to save encoded files
  • maxProcesses Max. number of concurrent encoding sessions
  • profilesFile Absolute path to the xml profiles file
  • ffmpeg Path to ffmpeg binary (default /bin/ffmpeg)
  • ffmpegOutput Path to file where to save ffmpeg output (default /dev/null)

string ffencoderd::Encoder::getStats (  ) 

Get shared mem stats

Returns:
string encoder usage statistics in a string with semicolon to separate the three values given (running procs;overall procs;total processing time)

int ffencoderd::Encoder::getNumberOfProcesses (  ) 

Get the number of running encoding sessions

Returns:
int Number of running encoding processes

int ffencoderd::Encoder::add_running_process (  ) 

Adds a running session to the shared mem stats (internal use)

Returns:
int 1 if success 0 if fail

int ffencoderd::Encoder::end_process ( hash  data,
scalar  proctime 
)

Remove an encoding session from the shared mem stats (internal use)

Parameters:
hash $data A hash with process data, the following keys may be setted
  • id User defined identifier
  • source Unique identifier for this process
  • description A brief description of this process
  • size The resource size in pixels, normally represented by a string wxh (ex. 320x240)
  • format A string representing the format used to encode this resource, as for ffmpeg
  • filename The original name of this resource in servers filesystem
int $proctime Conversion running time in number of seconds
Returns:
boolean 1 if success 0 if fail

void ffencoderd::Encoder::encode_video ( hash  process_data  ) 

Start a new thread to work in the encoding session

Parameters:
hash process_data Encoding session definition has the following keys
  • id User defined scalar as identifier of this resource
  • file File name as in the server's fs
  • profile Profile to use for this conversion
  • parameters An array with hash elements nested, these elements contain only one key which has to correspond to a profile parameter name so its value is setted

void ffencoderd::Encoder::DESTROY (  ) 

Destroy shared memory

array ffencoderd::Encoder::getArguments ( hash  parameters_list,
hash  process_data 
)

Returns arguments for the command line call depending on user defined arguments and the ones from the profile

Parameters:
hash $parameters_list Array with the profiles defined parameters
hash $process_data Array with user defined parameters
Returns:
array List of validated parameters to be used in the command line call

string ffencoderd::Encoder::_guid (  ) 

Create a unique identifier backportable problem

Returns:
string Unique identifier

private void ffencoderd::Encoder::_encode_video ( hash  process_data,
scalar  guid 
)

Parse encoding definition and start encoding with ffmpeg

Parameters:
hash $process_data With the following keys
  • id User defined scalar as identifier of this resource
  • file File name as in the server's fs
  • profile Profile to use for this conversion
  • parameters An array with hash elements nested, these elements contain only one key which has to correspond to a profile parameter name so its value is setted
String $guid Session identifier


The documentation for this class was generated from the following file:

Generated on Mon May 12 16:23:47 2008 for ffencoderd framework API by  doxygen 1.5.5