Top | ![]() |
![]() |
![]() |
![]() |
enum | IpatchConverterLogType |
#define | IPATCH_CONVERTER_LOG_TYPE_MASK |
#define | IPATCH_CONVERTER_LOG_MSG_ALLOC |
enum | IpatchConverterCount |
enum | IpatchConverterFlags |
enum | IpatchConverterPriority |
struct | IpatchConverterInfo |
GObject ╰── IpatchConverter ├── IpatchConverterFileToSLI ├── IpatchConverterFileToSLISample ╰── IpatchConverterSF2VoiceCache
gboolean ipatch_convert_objects (GObject *input
,GObject *output
,GError **err
);
A convenience function for converting from one object to another. This function will only work for converters which take exactly one input and output object.
GObject * ipatch_convert_object_to_type (GObject *object
,GType type
,GError **err
);
A convenience function to convert an object to another object of a given type. This function will only work for converters which require 1 input and one or zero outputs. The output object is created as needed and returned.
IpatchList * ipatch_convert_object_to_type_multi (GObject *object
,GType type
,GError **err
);
A convenience function to convert an object to one or more objects of a given
type
. This function will work for converters which require 1
input and any number of outputs.
[skip]
GList * ipatch_convert_object_to_type_multi_list (GObject *object
,GType type
,GError **err
);
A convenience function to convert an object to one or more objects of a given
type
. This function will work for converters which require 1
input and any number of outputs.
[rename-to ipatch_convert_object_to_type_multi]
object |
Object to convert from |
|
type |
Type of object to convert to |
|
err |
Location to store error info or |
List of output objects or NULL
on error (in which
case err
may be set). Free the list with ipatch_glist_unref_free()
when finished using it.
[element-type GObject.Object][transfer full]
Since: 1.1.0
IpatchList * ipatch_convert_object_to_type_multi_set (GObject *object
,GType type
,GError **err
,const char *first_property_name
,...
);
A convenience function to convert an object to one or more objects of a given
type
. This function will work for converters which require 1
input and any number of outputs. Like ipatch_convert_object_to_type_multi()
but allows for properties of the converter to be assigned.
[skip]
object |
Object to convert from |
|
type |
Type of object to convert to |
|
err |
Location to store error info or |
|
first_property_name |
Name of first property to assign or |
[nullable] |
... |
First property value followed by property name/value pairs (as per
|
GList * ipatch_convert_object_to_type_multi_set_vlist (GObject *object
,GType type
,GError **err
,const char *first_property_name
,va_list args
);
A convenience function to convert an object to one or more objects of a given
type
. This function will work for converters which require 1
input and any number of outputs. Like ipatch_convert_object_to_type_multi()
but allows for properties of the converter to be assigned.
[skip]
object |
Object to convert from |
|
type |
Type of object to convert to |
|
err |
Location to store error info or |
|
first_property_name |
Name of first property to assign or |
[nullable] |
args |
First property value followed by property name/value pairs (as per
|
List of output objects or NULL
on error (in which
case err
may be set). Free the list with ipatch_glist_unref_free()
when finished using it.
[element-type GObject.Object][transfer full]
Since: 1.1.0
IpatchConverter * ipatch_create_converter (GType src_type
,GType dest_type
);
Create a converter object for converting an object of type src_type
to
dest_type
. A convenience function, since one could use
ipatch_find_converter()
and create an instance of the returned type.
See ipatch_find_converter()
for more details.
IpatchConverter * ipatch_create_converter_for_objects (GObject *input
,GObject *output
,GError **err
);
A convenience function for creating a converter for converting from one object to another. This function will only work for converters which take exactly one input and output object.
Since: 1.1.0
IpatchConverter * ipatch_create_converter_for_object_to_type (GObject *object
,GType dest_type
,GError **err
);
A convenience function to create a converter for converting an object to another object of a given type.
object |
Object to convert from |
|
dest_type |
Type of object to convert to |
|
err |
Location to store error info or |
The new converter object with a reference count
of 1 which the caller owns, or NULL
if there is no matching conversion
handler type.
[transfer full]
Since: 1.1.0
void ipatch_register_converter_map (GType conv_type
,guint8 flags
,guint8 priority
,GType src_type
,GType src_match
,gint8 src_count
,GType dest_type
,GType dest_match
,gint8 dest_count
);
Registers a IpatchConverter handler to convert objects of src_type
to dest_type
.
NOTE: Previous versions of this function combined flags and priority into a single param.
conv_type |
IpatchConverter derived GType of conversion handler |
|
flags |
IpatchConverterFlags, IPATCH_CONVERTER_SRC_DERIVED or
IPATCH_CONVERTER_DEST_DERIVED will match derived types of |
|
priority |
Converter map priority (number from 0 to 100, 0 will use the default). IpatchConverterPriority defines some common priorities. Used for overriding other converters for specific types. |
|
src_type |
Type for source object (GObject derived type or interface type). |
|
src_match |
The furthest parent type of |
|
src_count |
Required number of source items (can also be an IpatchConverterCount value) |
|
dest_type |
Type for destination object (GObject derived type or interface type). |
|
dest_match |
The furthest parent type of |
|
dest_count |
Required number of destination items (can also be an IpatchConverterCount value). This value can be 0 in the case where no objects should be supplied, but will be instead assigned after conversion. |
Since: 1.1.0
GType ipatch_find_converter (GType src_type
,GType dest_type
);
Lookup a conversion handler type for a given src_type
to dest_type
conversion. In some cases there may be multiple conversion handlers for
the given types, this function only returns the highest priority type.
To get a list of all available converters use ipatch_find_converters()
.
GType * ipatch_find_converters (GType src_type
,GType dest_type
,guint flags
);
Lookup conversion handler types matching search criteria.
src_type |
GObject derived source type (G_TYPE_NONE for wildcard) |
|
dest_type |
GObject derived destination type (G_TYPE_NONE for wildcard) |
|
flags |
IpatchConverterFlags to modify converter matching behavior (logically OR'd with registered converter flags) |
0 terminated array of IpatchConverter derived GTypes or NULL
if no matching converters. Array should be freed with g_free()
when finished using it.
[array zero-terminated=1][transfer full][nullable]
Since: 1.1.0
const IpatchConverterInfo * ipatch_lookup_converter_info (GType conv_type
,GType src_type
,GType dest_type
);
Lookup converter map info.
conv_type |
IpatchConverter derived GType to lookup info on (or 0 for wildcard, or G_TYPE_NONE - since 1.1.0) |
|
src_type |
Source type of conversion map to lookup (or 0 for default map, or G_TYPE_NONE - since 1.1.0) |
|
dest_type |
Destination type of conversion map (0 if |
const IpatchConverterInfo *
ipatch_get_converter_info (GType conv_type
);
Get converter info structure for a converter type.
Converter info structure or NULL
if no match.
The returned pointer is internal and should not be modified or freed.
[transfer none][nullable]
Since: 1.1.0
void ipatch_converter_add_input (IpatchConverter *converter
,GObject *object
);
Add an input object to a converter object.
void ipatch_converter_add_output (IpatchConverter *converter
,GObject *object
);
Add an output object to a converter object.
void ipatch_converter_add_inputs (IpatchConverter *converter
,GList *objects
);
Add a list of input objects to a converter object.
void ipatch_converter_add_outputs (IpatchConverter *converter
,GList *objects
);
Add a list of output objects to a converter object.
GObject *
ipatch_converter_get_input (IpatchConverter *converter
);
Get a single input object from a converter.
GObject *
ipatch_converter_get_output (IpatchConverter *converter
);
Get a single output object from a converter.
IpatchList *
ipatch_converter_get_inputs (IpatchConverter *converter
);
Get a list of input objects from a converter.
[skip]
GList *
ipatch_converter_get_inputs_list (IpatchConverter *converter
);
Get a list of input objects from a converter.
[rename-to ipatch_converter_get_inputs]
A newly created input
object list from a converter or NULL
if no input objects.
Free the list with ipatch_glist_unref_free()
when finished using it.
[element-type GObject.Object][transfer full]
Since: 1.1.0
IpatchList *
ipatch_converter_get_outputs (IpatchConverter *converter
);
Get a list of output objects from a converter.
[skip]
GList *
ipatch_converter_get_outputs_list (IpatchConverter *converter
);
Get a list of output objects from a converter.
[rename-to ipatch_converter_get_outputs]
A newly created output
object list from a converter or NULL
if no output objects.
Free the list with ipatch_glist_unref_free()
when finished using it.
[element-type GObject.Object][transfer full]
Since: 1.1.0
gboolean ipatch_converter_verify (IpatchConverter *converter
,char **failmsg
);
Verifies the settings of a converter object. This is automatically called before a conversion is done, so it doesn't usually need to be explicitly called.
void
ipatch_converter_init (IpatchConverter *converter
);
Allows a converter type to initialize its parameters based on its input and/or output objects. This function should be called after setting the input and output objects, but before setting object parameters or converting. Calling this function is not required, but certain converters will work more intuitively if it is (an example is an audio sample saver converter which could initialize the output sample file object format based on the input sample object format).
NOTE: Verification of converter parameters is not done by this routine so converter types implementing an init method are responsible for their own verification.
gboolean ipatch_converter_convert (IpatchConverter *converter
,GError **err
);
Runs the conversion method of a converter object. The converter
object's
conversion paramters are first verified before the conversion is run.
void
ipatch_converter_reset (IpatchConverter *converter
);
Reset a converter object so it can be re-used.
char *
ipatch_converter_get_notes (IpatchConverter *converter
);
Get notes about a conversion implementation. These notes could include things such as information about any loss of information in the conversion that may occur, etc.
void ipatch_converter_log (IpatchConverter *converter
,GObject *item
,int type
,char *msg
);
Logs an entry to a converter log. Usually only used by converter object handlers.
[skip]
converter |
Converter object |
|
item |
Item the log entry pertains to or |
[nullable] |
type |
IpatchConverterLogType and other flags |
|
msg |
Message of the log. If message is dynamically allocated then
the IPATCH_CONVERTER_LOG_MSG_ALLOC flag should be set in |
void ipatch_converter_log_printf (IpatchConverter *converter
,GObject *item
,int type
,const char *fmt
,...
);
Logs a printf style message to a converter log. Usually only used by converter object handlers. The IPATCH_CONVERTER_LOG_MSG_ALLOC flag is automatically set on the log entry, since it is dynamically allocated.
converter |
Converter object |
|
item |
Item the log entry pertains to or |
[nullable] |
type |
IpatchConverterLogType and other flags |
|
fmt |
Printf format style string |
|
... |
Arguments to |
gboolean ipatch_converter_log_next (IpatchConverter *converter
,gpointer *pos
,GObject **item
,int *type
,char **msg
);
Get the first or next log entry from a converter object.
converter |
Converter object |
|
pos |
Opaque current position in log, should be |
[out] |
item |
Location to store item of the log entry or |
[out][transfer none][optional] |
type |
Location to store the type parameter of the log entry or |
[out][optional] |
msg |
Location to store the message of the log entry or |
[out][transfer none] |
void ipatch_converter_set_link_funcs (IpatchConverter *converter
,IpatchConverterLinkLookupFunc *link_lookup
,IpatchConverterLinkNotifyFunc *link_notify
);
This function allows for object link interception by the user of
an IpatchConverter instance. The callback functions are used by
conversion processes which create objects linking other external
objects which need to be converted. For each link object needing
conversion link_lookup
will be called. If link_lookup
returns a valid
pointer it is used as the converted link object, if NULL
is returned then
the link will be converted and link_notify
will be called with the new
converted item. An example usage of this feature is
the IpatchPaste system, which does object conversions and substitutes
already converted objects (a conversion pool).
[skip]
void ipatch_converter_set_link_funcs_full (IpatchConverter *converter
,IpatchConverterLinkLookupFunc *link_lookup
,IpatchConverterLinkNotifyFunc *link_notify
,GDestroyNotify notify_func
,gpointer user_data
);
This function allows for object link interception by the user of
an IpatchConverter instance. The callback functions are used by
conversion processes which create objects linking other external
objects which need to be converted. For each link object needing
conversion link_lookup
will be called. If link_lookup
returns a valid
pointer it is used as the converted link object, if NULL
is returned then
the link will be converted and link_notify
will be called with the new
converted item. An example usage of this feature is
the IpatchPaste system, which does object conversions and substitutes
already converted objects (a conversion pool).
[rename-to ipatch_converter_set_link_funcs]
converter |
Converter object |
|
link_lookup |
Set the link lookup callback function. |
[scope notified][nullable] |
link_notify |
Set the link notify callback function. |
[scope notified][nullable] |
notify_func |
Callback which gets called when link functions are removed. |
[scope async][closure user_data][nullable] |
user_data |
User data passed to |
[nullable] |
Since: 1.1.0
struct IpatchConverterInfo { GType conv_type; GType src_type; GType src_match; GType dest_type; GType dest_match; guint8 flags; guint8 priority; gint8 src_count; gint8 dest_count; };
Registered object converter information.
Conversion handler type |
||
Source type of conversion handler |
||
Furthest source parent type to match (0 = exact match) |
||
Destination type of conversion handler |
||
Furthest dest parent type to match (0 = exact match) |
||
IpatchConverterFlags | priority (IpatchConverterPriority value or other integer value) |
||
Required source item count or IpatchConverterCount |
||
Required destination item count or IpatchConverterCount |