Top | ![]() |
![]() |
![]() |
![]() |
extern const guint | bt_major_version |
extern const guint | bt_micro_version |
extern const guint | bt_minor_version |
#define | G_OBJECT_REF_COUNT_FMT |
enum | BtExperimentFlags |
#define BT_IS_GVALUE(v) (G_VALUE_TYPE(v)!=G_TYPE_INVALID)
checks if the supplied gvalue is initialized (not all fields zero).
#define BT_IS_STRING(a) (a && *a)
Checks if the supplied string pointer is not NULL
and contains not just '\0'
guint
bt_cpu_load_get_current (void
);
Determines the current CPU load. Run this from a timeout handler (with e.g. a 1 second interval).
void bt_init (gint *argc
,gchar **argv[]
);
Initializes the Buzztrax Core library.
This function will terminate your program if it was unable to initialize
the core for some reason. If you want your program to fall back,
use bt_init_check()
instead.
WARNING: This function does not work in the same way as corresponding
functions in other glib-style libraries, such as gtk_init()
. In
particular, unknown command line options cause this function to
abort program execution.
void
bt_init_add_option_groups (GOptionContext * const ctx
);
Adds all option groups to the main context the core library will pull in.
gboolean bt_init_check (gint *argc
,gchar **argv[]
,GError **err
);
Initializes the Buzztrax core library.
This function will return FALSE
if Buzztrax core could not be initialized
for some reason. If you want your program to fail fatally,
use bt_init()
instead.
GOptionGroup *
bt_init_get_option_group (void
);
Returns a GOptionGroup with libbtcore's argument specifications. The group is set up to use standard GOption callbacks, so when using this group in combination with GOption parsing methods, all argument parsing and initialization is automated.
This function is useful if you want to integrate libbtcore with other
libraries that use GOption (see g_option_context_add_group()
).
[skip]
void
bt_deinit (void
);
It is normally not needed to call this function in a normal application as the resources will automatically be freed when the program terminates. This function is therefore mostly used by testsuites and other memory profiling tools.
void
bt_setup_for_local_install ();
Checks if for all env-vars are set for the location we run from. If not makes the neccesary adjustments.
Note: This must be called before initializing any other library.
#define return_if_disposed() if(self->priv->dispose_has_run) return
Checks self->priv->dispose_has_run
and
if TRUE
returns.
This macro is handy to use at the start of all class routines
such as GObjectClass.get_property()
, GObjectClass.set_property()
,
GObjectClass.dispose()
.
#define return_val_if_disposed(a) if(self->priv->dispose_has_run) return(a)
Checks self->priv->dispose_has_run
and
if TRUE
returns with the supplied arg a
.
This macro is handy to use at the start of e.g. idle handlers.
#define safe_string(a) ((gchar *)(a)?(gchar *)(a):"")
Pass the supplied string through or return an empty string when it is NULL
.
#define G_OBJECT_REF_COUNT(obj) ((obj)?((G_OBJECT(obj))->ref_count):0)
Read the objects reference counter. Implemented as a macro, so don't use
expressions for obj
.
#define G_OBJECT_LOG_REF_COUNT(o)
Logs an object pointer together with its refcount value and the floating flag. Use with G_OBJECT_REF_COUNT_FMT.
GType
bt_g_type_get_base_type (const GType type
);
Call g_type_parent()
as long as it returns a parent.
guint bt_g_object_idle_add (GObject *obj
,gint pri
,GSourceFunc func
);
A g_idle_add_full()
variant, that passes obj
as user_data and detaches the
handler when obj
gets destroyed.
gulong bt_g_signal_connect_object (gpointer instance
,const gchar *detailed_signal
,GCallback c_handler
,gpointer data
,GConnectFlags connect_flags
);
Like g_signal_connect_object()
, but checks first if the handler is already
connected.
#define g_object_try_ref(obj)
If the supplied object is not NULL
then reference it via
g_object_ref()
.
#define g_object_try_unref(obj)
If the supplied object is not NULL
then release the reference via
g_object_unref()
.
#define g_object_try_weak_ref(obj)
If the supplied object is not NULL
then reference it via
g_object_add_weak_pointer()
.
#define g_object_try_weak_unref(obj)
If the supplied object is not NULL
then release the reference via
g_object_remove_weak_pointer()
.
gboolean bt_bin_activate_tee_chain (GstBin *bin
,GstElement *tee
,GList *elements
,gboolean is_playing
);
Add the elements
to the bin
and link them. Handle pad blocking in playing
mode.
Return: TRUE
for success
gboolean bt_bin_deactivate_tee_chain (GstBin *bin
,GstElement *tee
,GList *elements
,gboolean is_playing
);
Add the elements
to the bin
and link them. Handle pad blocking in playing
mode.
Return: TRUE
for success
GstClockTime bt_gst_analyzer_get_waittime (GstElement *analyzer
,const GstStructure *structure
,gboolean endtime_is_running_time
);
Get the time to wait for audio corresponding to the analyzed data to be rendered.
GList *
bt_gst_check_core_elements (void
);
Check if all core elements exist.
GList *
bt_gst_check_elements (GList *list
);
Check if the given elements exist.
const gchar * bt_gst_debug_pad_link_return (GstPadLinkReturn link_res
,GstPad *src_pad
,GstPad *sink_pad
);
Format a nice debug message from failed pad links.
GstPadTemplate * bt_gst_element_factory_get_pad_template (GstElementFactory *factory
,const gchar *name
);
Lookup a pad template by name.
gboolean bt_gst_element_factory_can_sink_media_type (GstElementFactory *factory
,const gchar *name
);
Check if the sink pads of the given factory
are compatible with the given
name
. The name
can e.g. be "audio/x-raw".
GList *
bt_gst_registry_get_element_factories_matching_all_categories
(const gchar *class_filter
);
Iterates over all available elements and filters by categories given in
class_filter
.
list of element
factories, use gst_plugin_feature_list_free()
after use.
[element-type Gst.PluginFeature][transfer full]
Since: 0.6
gboolean bt_gst_try_element (GstElementFactory *factory
,const gchar *format
);
Create an instance of the element and try to set it to GST_STATE_READY
.
gdouble bt_gst_level_message_get_aggregated_field (const GstStructure *structure
,const gchar *field_name
,gdouble default_value
);
Aggregate the levels per channel and return the averaged level.
#define BT_GST_LOG_MESSAGE_ERROR(msg, err_msg, err_desc)
Helper to logs the message to the debug log. If description
is
given, it is set to the error detail (free after use).
#define BT_GST_LOG_MESSAGE_WARNING(msg, warn_msg, warn_desc)
Helper to logs the message to the debug log. If description
is
given, it is set to the error detail (free after use).
gboolean bt_gst_log_message_error (GstDebugCategory *cat
,const gchar *file
,const gchar *func
,const int line
,GstMessage *msg
,gchar **err_msg
,gchar **err_desc
);
Low level helper that logs the message to the debug log. If description
is
given, it is set to the error detail (free after use).
Use the BT_GST_LOG_MESSAGE_ERROR()
macro instead.
gboolean bt_gst_log_message_warning (GstDebugCategory *cat
,const gchar *file
,const gchar *func
,const int line
,GstMessage *msg
,gchar **warn_msg
,gchar **warn_desc
);
Low level helper that logs the message to the debug log. If description
is
given, it is set to the error detail (free after use).
Use the BT_GST_LOG_MESSAGE_WARNING()
macro instead.
const gchar *
bt_str_format_double (const gdouble val
);
Convenience methods, that formats a value to be serialized as a string.
const gchar * bt_str_format_enum (GType enum_type
,gint value
);
Convenience methods, that formats a value to be serialized as a string.
const gchar *
bt_str_format_long (const glong val
);
Convenience methods, that formats a value to be serialized as a string.
const gchar *
bt_str_format_uchar (const guchar val
);
Convenience methods, that formats a value to be serialized as a string.
const gchar *
bt_str_format_ulong (const gulong val
);
Convenience methods, that formats a value to be serialized as a string.
gint bt_str_parse_enum (GType enum_type
,const gchar *str
);
Convenience methods, that parses a enum value nick and to get the corresponding integer value.
gchar *
bt_str_format_gvalue (GValue * const gvalue
);
Returns the string representation of the given gvalue
. Free it when done.
gboolean bt_str_parse_gvalue (GValue * const gvalue
,const gchar * const svalue
);
Stores the supplied value into the given gvalue
.
void
bt_experiments_init (gchar **flags
);
Parses the experiemnts. The coe can later use bt_experiments_check_active()
to check the flags.
gboolean
bt_experiments_check_active (BtExperimentFlags experiments
);
Check if the experimental code should run.
#define G_OBJECT_REF_COUNT_FMT "p,ref_ct=%d,floating=%d"
Printf format string for G_OBJECT_LOG_REF_COUNT.