NAME
fame_register - register an object to the library
SYNOPSIS
#include <fame.h>
void fame_register(fame_context_t *context, char const *type, fame_object_t *object);
DESCRIPTION
fame_register() is used to register an object to the library and
associate a type with it. Upon initialisation with fame_init , libfame
looks for the fame_profile_t object associated with the "profile" type
and calls its ’init’ function. Then this object may get other objects
through fame_get_object , and so on. Thus, fame_register enables the
use of objects from the application inside the library, and can be used
to change or extend the default behaviour of the library.
context is the context handle previously returned by fame_open
type is a type identifier to be associated with the object for further
retrieval through fame_get_object.
object is the object to associate with type
BUILTIN OBJECTS
Currently the built-in objects and their default associations are:
fame_profile_t* "profile","profile/mpeg1"
MPEG-1 profile, uses "syntax/mpeg1", "encoder/mpeg" and "motion"
fame_profile_t* "profile/mpeg4","profile/mpeg4/simple"
MPEG-4 simple profile, uses "syntax/mpeg4", "encoder/mpeg" and "motion"
fame_profile_t* "profile/mpeg4/shape"
MPEG-4 shape profile, uses "syntax/mpeg4", "encoder/mpeg", "shape" and
"motion"
fame_syntax_t* "syntax","syntax/mpeg1"
MPEG-1 bitstream syntax
fame_syntax_t* "syntax/mpeg4"
MPEG-4 bitstream syntax
fame_encoder_t* "encoder","encoder/mpeg"
MPEG encoder
fame_motion_t* "motion","motion/none"
null motion estimation
fame_motion_t* "motion","motion/fourstep"
four step motion estimation
fame_motion_t* "motion","motion/pmvfast"
pmvfast motion estimation
fame_rate_t* "rate"
simple rate control
fame_shape_t* "shape"
shape coder
EXAMPLES
{
fame_object_t *object;
object = fame_get_object(fc, "profile/mpeg4/simple");
if(object) fame_register(fc, "profile", object);
}
will try to get the object associated with "profile/mpeg4/simple" and
register it for the "profile" type as well. This piece of code, called
just after fame_open and just before fame_init would effectively have
libfame produce MPEG-4 output instead of default MPEG-1.
int my_encode(fame_profile_t *profile, fame_yuv_t *yuv, unsigned char *shape)
{
printf("Hello world!");
}
{
fame_profile_t *my_profile;
my_profile = FAME_PROFILE(fame_get_object(fc, "profile"));
my_profile->encode = my_encode;
}
will overide the default profile ’encode’ function with this one
printing "Hello world!" :)
SEE ALSO
fame_open(3) fame_init(3) fame_unregister(3) fame_get_object(3)