libmimic 1.0.4
Typedefs | Enumerations | Functions

libmimic public API

The public API of the libmimic library. More...

Typedefs

typedef struct _MimCtx MimCtx

Enumerations

enum  MimicResEnum { MIMIC_RES_LOW, MIMIC_RES_HIGH }

Functions

MimCtxmimic_open ()
void mimic_close (MimCtx *ctx)
gboolean mimic_encoder_init (MimCtx *ctx, const MimicResEnum resolution)
gboolean mimic_decoder_init (MimCtx *ctx, const guchar *frame_buffer)
gboolean mimic_get_property (MimCtx *ctx, const gchar *name, gpointer data)
gboolean mimic_set_property (MimCtx *ctx, const gchar *name, gpointer data)
gboolean mimic_encode_frame (MimCtx *ctx, const guchar *input_buffer, guchar *output_buffer, gint *output_length, gboolean make_keyframe)
gboolean mimic_decode_frame (MimCtx *ctx, const guchar *input_buffer, guchar *output_buffer)

Detailed Description

The public API of the libmimic library.

libmimic provides the API required for encoding and decoding MIMIC v2.x-encoded content.


Typedef Documentation

typedef struct _MimCtx MimCtx

The mimic encoding/decoding context returned by mimic_open and used for all further API calls until mimic_close.


Enumeration Type Documentation

Enumerator:
MIMIC_RES_LOW 

160x120 resolution

MIMIC_RES_HIGH 

320x240 resolution


Function Documentation

MimCtx* mimic_open ( )

Creates a new instance and returns a pointer to the new context that can be used for either encoding or decoding by calling mimic_encoder_init or mimic_decoder_init.

mimic_close is called to free any resources associated with the context once done.

Returns:
a new mimic context
void mimic_close ( MimCtx ctx)

Frees any resources associated with the given context.

Parameters:
ctxthe mimic context to free
gboolean mimic_encoder_init ( MimCtx ctx,
const MimicResEnum  resolution 
)

Initialize the mimic encoder and prepare for encoding by initializing internal state and allocating resources as needed.

After initializing use mimic_get_property to determine the size of the output buffer needed for calls to mimic_encode_frame. Use mimic_set_property to set encoding quality.

Note that once a given context has been initialized for either encoding or decoding it is not possible to initialize it again.

Parameters:
ctxthe mimic context to initialize
resolutiona MimicResEnum used to specify the resolution
Returns:
#TRUE on success

References MIMIC_RES_HIGH, and MIMIC_RES_LOW.

gboolean mimic_decoder_init ( MimCtx ctx,
const guchar *  frame_buffer 
)

Initialize the mimic decoder. The frame passed in frame_buffer is used to determine the resolution so that the internal state can be prepared and resources allocated accordingly. Note that the frame passed has to be a keyframe.

After initializing use mimic_get_property to determine required buffer-size, resolution, quality, etc.

Note that once a given context has been initialized for either encoding or decoding it is not possible to initialize it again.

Parameters:
ctxthe mimic context to initialize
frame_bufferbuffer containing the first frame to decode
Returns:
#TRUE on success
gboolean mimic_get_property ( MimCtx ctx,
const gchar *  name,
gpointer  data 
)

Get a property from a given mimic context. The context has to be initialized.

Currently the following properties are defined:

  • "buffer_size"
    • Required output buffer size
  • "width"
    • Frame width
  • "height"
    • Frame height
  • "quality"
    • Encoder: Encoding quality used
    • Decoder: Decoding quality of the last known frame
Parameters:
ctxthe mimic context to retrieve the property from
nameof the property to retrieve the current value of
datapointer to the data that will receive the retrieved value
Returns:
#TRUE on success
gboolean mimic_set_property ( MimCtx ctx,
const gchar *  name,
gpointer  data 
)

Set a property in a given mimic context. The context has to be initialized.

Currently the following properties are defined:

  • "quality"
    • Encoding quality used by encoder.
Parameters:
ctxthe mimic context to set a property in
nameof the property to set to a new value
datapointer to the data that contains the new value
Returns:
#TRUE on success
gboolean mimic_encode_frame ( MimCtx ctx,
const guchar *  input_buffer,
guchar *  output_buffer,
gint *  output_length,
gboolean  make_keyframe 
)

Encode a MIMIC-encoded frame from RGB data.

Parameters:
ctxthe mimic context
input_bufferbuffer containing pixeldata in RGB 24-bpp packed pixel top-down format
output_bufferbuffer that will receive the MIMIC-encoded frame (use mimic_get_property to determine the required buffer size)
output_lengthpointer to an integer that receives the length of the encoded data written to output_buffer
make_keyframewhether the encoder should make this frame a keyframe
Returns:
#TRUE on success
gboolean mimic_decode_frame ( MimCtx ctx,
const guchar *  input_buffer,
guchar *  output_buffer 
)

Decode a MIMIC-encoded frame into RGB data.

Parameters:
ctxthe mimic context
input_bufferbuffer containing the MIMIC-encoded frame to decode
output_bufferbuffer that will receive the decoded frame in RGB 24-bpp packed pixel top-down format (use mimic_get_property to determine the required buffer size, as well as frame width and height)
Returns:
#TRUE on success