NAME
fame_init - initialize the fame library
SYNOPSIS
#include <fame.h>
fame_context_t * fame_init(fame_context_t *context, fame_parameters_t *parameters, unsigned char *buffer, unsigned int size);
);
DESCRIPTION
The fame_init() call is used to open and initialize the fame library.
context is the context handle previously returned by fame_open
parameters is a fame_parameters_t structure as specified in fame.h:
typedef struct _fame_parameters_ {
int width; /* width of the video sequence */
int height; /* height of the video sequence */
char const *coding; /* coding sequence */
int quality; /* video quality */
int slices_per_frame; /* number of slices per frame */
unsigned int frames_per_sequence; /* number of frames per sequence */
int frame_rate_num; /* numerator of frames per second */
int frame_rate_den; /* denominator of frames per second */
unsigned int shape_quality; /* binary shape quality */
unsigned int search_range; /* motion estimation search range */
unsigned char verbose; /* verbosity */
} fame_parameters_t;
width and height specify the size of each frames of the video sequence.
Both must be multiple of 16. width and height must be less than
4096x4096
coding is a string of I, P or B characters representing the sequence of
frames the encoder must produce. I frames are intra-coded frames
(similar to JPEG), whereas P and B frames are motion compressed,
respectively predicted from past reference (I or P) frame, or
bidirectionally predicted from past and future reference frame.
quality is a percentage, which controls compression versus quality.
slices_per_frame is the number of frame slices per frame. More slices
provide better error recovery. There must be at least one slice per
frame, and at most height / 16
frames_per_sequence is the maximum number of frames contained in a
video sequence.
frame_rate_num/frame_rate_den specify the number of frames per second
for playback.
shape_quality is percentage determing the average binary shape accuracy
in video with arbitrary shape.
search_range specifies the motion estimation search range in pixel
unit. Small search ranges work best with slow motion videos, whereas
larger search ranges are rather for fast motion videos.
verbose when set to 1 outputs information on copyright, modules used
and current frame on standard error.
buffer is the buffer where encoded data will be written to. It must be
large enough to contain a few frames.
size specifies the length of the buffer.
RETURN VALUE
fame_init return a new context, or NULL if an error occurred.
BUGS
buffer must be large enough to contain encoded data. There is no
checking of buffer overflow as this would be too slow. Encoding of B
frame is not yet supported.
SEE ALSO
fame_encode_frame(3), fame_close(3)