Squash  0.7.0
Data Structures | Functions
SquashContext

Library context. More...

Data Structures

struct  SquashContext
 Context for all Squash operations. More...
 

Functions

SquashCodec * squash_context_get_codec (SquashContext *context, const char *codec)
 Retrieve a SquashCodec from a SquashContext. More...
 
SquashCodec * squash_get_codec (const char *codec)
 Retrieve a SquashCodec. More...
 
SquashCodec * squash_context_get_codec_from_extension (SquashContext *context, const char *extension)
 Retrieve a codec from a context based on an extension. More...
 
SquashCodec * squash_get_codec_from_extension (const char *extension)
 Retrieve a codec based on an extension. More...
 
SquashPlugin * squash_context_get_plugin (SquashContext *context, const char *plugin)
 Retrieve a SquashPlugin from a SquashContext. More...
 
SquashPlugin * squash_get_plugin (const char *plugin)
 Retrieve a SquashPlugin. More...
 
void squash_context_foreach_plugin (SquashContext *context, SquashPluginForeachFunc func, void *data)
 Execute a callback for every loaded plugin. More...
 
void squash_context_foreach_codec (SquashContext *context, SquashCodecForeachFunc func, void *data)
 Execute a callback for every loaded codec. More...
 
void squash_foreach_plugin (SquashPluginForeachFunc func, void *data)
 Execute a callback for every loaded plugin in the default context. More...
 
void squash_foreach_codec (SquashCodecForeachFunc func, void *data)
 Execute a callback for every loaded codec in the default context. More...
 
SquashContext * squash_context_get_default (void)
 Retrieve the default SquashContext. More...
 

Detailed Description

Library context.

SquashContext is a singleton which is created the first time squash_context_get_default is invoked. You generally need not deal with the SquashContext directly as Squash provides numerous wrapper functions which you can use instead.

Function Documentation

void squash_context_foreach_codec ( SquashContext *  context,
SquashCodecForeachFunc  func,
void *  data 
)

Execute a callback for every loaded codec.

Note
If you have multiple plugins which supply a single codec, the callback will only be invoked for the highest-priority codec. If you would like to invoke a callback even when a higher priority codec exists, you can use squash_context_foreach_plugin to iterate through all the plugins and squashl squash_plugin_foreach_codec on each SquashPlugin.
Parameters
contextThe context to use
funcThe callback to execute
dataData to pass to the callback

Definition at line 564 of file context.c.

void squash_context_foreach_plugin ( SquashContext *  context,
SquashPluginForeachFunc  func,
void *  data 
)

Execute a callback for every loaded plugin.

Parameters
contextThe context to use
funcThe callback to execute
dataData to pass to the callback

Definition at line 525 of file context.c.

SquashCodec* squash_context_get_codec ( SquashContext *  context,
const char *  codec 
)

Retrieve a SquashCodec from a SquashContext.

Parameters
contextThe context to use.
codecName of the codec to retrieve.
Returns
The SquashCodec, or NULL on failure. This is owned by Squash and must never be freed or unreffed.

Definition at line 114 of file context.c.

SquashCodec* squash_context_get_codec_from_extension ( SquashContext *  context,
const char *  extension 
)

Retrieve a codec from a context based on an extension.

Parameters
contextThe context
extensionThe extension
Returns
A ref SquashCodec or NULL on failure

Definition at line 161 of file context.c.

SquashContext* squash_context_get_default ( void  )

Retrieve the default SquashContext.

If this is the first time squashling this function, a new SquashContext will be created and Squash will attempt to scan the plugin directories for information.

Returns
The SquashContext. Note that this is owned by Squash and must never be freed or unreffed.

Definition at line 638 of file context.c.

SquashPlugin* squash_context_get_plugin ( SquashContext *  context,
const char *  plugin 
)

Retrieve a SquashPlugin from a SquashContext.

Parameters
contextThe context to use.
pluginName of the plugin to retrieve.
Returns
The SquashPlugin. This is owned by Squash and must never be freed or unreffed.

Definition at line 190 of file context.c.

void squash_foreach_codec ( SquashCodecForeachFunc  func,
void *  data 
)

Execute a callback for every loaded codec in the default context.

Note
If you have multiple plugins which supply a single codec, the callback will only be invoked for the highest-priority codec. If you would like to invoke a callback even when a higher priority codec exists, you can use squash_foreach_plugin to iterate through all the plugins and squashl squash_plugin_foreach_codec on each SquashPlugin.
Parameters
funcThe callback to execute
dataData to pass to the callback

Definition at line 597 of file context.c.

void squash_foreach_plugin ( SquashPluginForeachFunc  func,
void *  data 
)

Execute a callback for every loaded plugin in the default context.

Parameters
funcThe callback to execute
dataData to pass to the callback

Definition at line 578 of file context.c.

SquashCodec* squash_get_codec ( const char *  codec)

Retrieve a SquashCodec.

Parameters
codecName of the codec to retrieve.
Returns
The SquashCodec. This is owned by Squash and must never be freed or unreffed.

Definition at line 149 of file context.c.

SquashCodec* squash_get_codec_from_extension ( const char *  extension)

Retrieve a codec based on an extension.

Parameters
extensionThe extension
Returns
A ref SquashCodec or NULL on failure

Definition at line 177 of file context.c.

SquashPlugin* squash_get_plugin ( const char *  plugin)

Retrieve a SquashPlugin.

Parameters
plugin- Name of the plugin to retrieve.
Returns
The SquashPlugin. This is owned by Squash and must never be freed or unreffed.

Definition at line 209 of file context.c.