本文整理汇总了C++中xmms_log_error函数的典型用法代码示例。如果您正苦于以下问题:C++ xmms_log_error函数的具体用法?C++ xmms_log_error怎么用?C++ xmms_log_error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmms_log_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xmms_ipc_register_signal
static void
xmms_ipc_register_signal (xmms_ipc_client_t *client,
xmms_ipc_msg_t *msg, xmmsv_t *arguments)
{
xmmsv_t *arg;
gint32 signalid;
int r;
if (!arguments || !xmmsv_list_get (arguments, 0, &arg)) {
xmms_log_error ("No signalid in this msg?!");
return;
}
r = xmmsv_get_int (arg, &signalid);
if (!r) {
xmms_log_error ("Cannot extract signal id from value");
return;
}
if (signalid < 0 || signalid >= XMMS_IPC_SIGNAL_END) {
xmms_log_error ("Bad signal id (%d)", signalid);
return;
}
g_mutex_lock (client->lock);
client->pendingsignals[signalid] = xmms_ipc_msg_get_cookie (msg);
g_mutex_unlock (client->lock);
}
示例2: xmms_faad_read_some
static gint
xmms_faad_read_some (xmms_xform_t *xform, xmms_error_t *err)
{
xmms_faad_data_t *data;
NeAACDecFrameInfo frameInfo;
gpointer sample_buffer;
guint bytes_read = 0;
g_return_val_if_fail (xform, -1);
data = xmms_xform_private_data_get (xform);
g_return_val_if_fail (data, -1);
while (data->outbuf->len == 0) {
gboolean need_read;
/* MP4 demuxer always gives full packets so we need different handling */
if (data->filetype == FAAD_TYPE_MP4)
need_read = (data->buffer_length == 0);
else
need_read = (data->buffer_length < data->buffer_size);
if (need_read) {
bytes_read = xmms_xform_read (xform,
(gchar *) data->buffer + data->buffer_length,
data->buffer_size - data->buffer_length,
err);
if (bytes_read <= 0 && data->buffer_length == 0) {
XMMS_DBG ("EOF");
return 0;
}
data->buffer_length += bytes_read;
}
sample_buffer = NeAACDecDecode (data->decoder, &frameInfo, data->buffer,
data->buffer_length);
g_memmove (data->buffer, data->buffer + frameInfo.bytesconsumed,
data->buffer_length - frameInfo.bytesconsumed);
data->buffer_length -= frameInfo.bytesconsumed;
bytes_read = frameInfo.samples * xmms_sample_size_get (data->sampleformat);
if (bytes_read > 0 && frameInfo.error == 0) {
if (data->samplerate != frameInfo.samplerate ||
data->channels != frameInfo.channels) {
/* We should inform output to change parameters somehow */
xmms_log_error ("Output format changed in the middle of a read!");
data->samplerate = frameInfo.samplerate;
data->channels = frameInfo.channels;
}
g_string_append_len (data->outbuf, sample_buffer, bytes_read);
} else if (frameInfo.error > 0) {
xmms_log_error ("ERROR %d in faad decoding: %s", frameInfo.error,
NeAACDecGetErrorMessage (frameInfo.error));
return -1;
}
}
return data->outbuf->len;
}
示例3: xmms_ipc_register_broadcast
static void
xmms_ipc_register_broadcast (xmms_ipc_client_t *client,
xmms_ipc_msg_t *msg, xmmsv_t *arguments)
{
xmmsv_t *arg;
gint32 broadcastid;
int r;
if (!arguments || !xmmsv_list_get (arguments, 0, &arg)) {
xmms_log_error ("No broadcastid in this msg?!");
return;
}
r = xmmsv_get_int (arg, &broadcastid);
if (!r) {
xmms_log_error ("Cannot extract broadcast id from value");
return;
}
if (broadcastid < 0 || broadcastid >= XMMS_IPC_SIGNAL_END) {
xmms_log_error ("Bad broadcast id (%d)", broadcastid);
return;
}
g_mutex_lock (client->lock);
client->broadcasts[broadcastid] =
g_list_append (client->broadcasts[broadcastid],
GUINT_TO_POINTER (xmms_ipc_msg_get_cookie (msg)));
g_mutex_unlock (client->lock);
}
示例4: xmms_magic_add
gboolean
xmms_magic_add (const gchar *desc, const gchar *mime, ...)
{
GNode *tree, *node = NULL;
va_list ap;
gchar *s;
gpointer *root_props;
gboolean ret = TRUE;
g_return_val_if_fail (desc, FALSE);
g_return_val_if_fail (mime, FALSE);
/* now process the magic specs in the argument list */
va_start (ap, mime);
s = va_arg (ap, gchar *);
if (!s) { /* no magic specs passed -> failure */
va_end (ap);
return FALSE;
}
/* root node stores the description and the mimetype */
root_props = g_new0 (gpointer, 2);
root_props[0] = g_strdup (desc);
root_props[1] = g_strdup (mime);
tree = g_node_new (root_props);
do {
if (!*s) {
ret = FALSE;
xmms_log_error ("invalid magic spec: '%s'", s);
break;
}
s = g_strdup (s); /* we need our own copy */
node = xmms_magic_add_node (tree, s, node);
if (!node) {
xmms_log_error ("invalid magic spec: '%s'", s);
ret = FALSE;
g_free (s);
break;
}
g_free (s);
} while ((s = va_arg (ap, gchar *)));
va_end (ap);
/* only add this tree to the list if all spec chunks are valid */
if (ret) {
magic_list =
g_list_insert_sorted (magic_list, tree,
(GCompareFunc) cb_sort_magic_list);
} else {
xmms_magic_tree_free (tree);
}
return ret;
}
示例5: xmms_samba_init
/*
* Member functions
*/
static gboolean
xmms_samba_init (xmms_xform_t *xform)
{
xmms_samba_data_t *data;
const gchar *url;
const gchar *metakey;
struct stat st;
gint fd, err;
g_return_val_if_fail (xform, FALSE);
url = xmms_xform_indata_get_str (xform, XMMS_STREAM_TYPE_URL);
g_return_val_if_fail (url, FALSE);
G_LOCK (mutex);
err = smbc_stat (url, &st);
G_UNLOCK (mutex);
if (err < 0) {
xmms_log_error ("%s", strerror (errno));
return FALSE;
}
if (!S_ISREG (st.st_mode)) {
xmms_log_error ("%s is not a regular file.", url);
return FALSE;
}
G_LOCK (mutex);
fd = smbc_open (url, O_RDONLY | O_NONBLOCK, 0);
G_UNLOCK (mutex);
if (fd == -1) {
xmms_log_error ("%s", strerror (errno));
return FALSE;
}
data = g_new0 (xmms_samba_data_t, 1);
data->fd = fd;
xmms_xform_private_data_set (xform, data);
xmms_xform_outdata_type_add (xform, XMMS_STREAM_TYPE_MIMETYPE,
"application/octet-stream",
XMMS_STREAM_TYPE_END);
metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_SIZE;
xmms_xform_metadata_set_int (xform, metakey, st.st_size);
metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_LMOD;
xmms_xform_metadata_set_int (xform, metakey, st.st_mtime);
return TRUE;
}
示例6: xmms_samba_plugin_setup
static gboolean
xmms_samba_plugin_setup (xmms_xform_plugin_t *xform_plugin)
{
xmms_xform_methods_t methods;
gint err;
XMMS_XFORM_METHODS_INIT (methods);
methods.init = xmms_samba_init;
methods.destroy = xmms_samba_destroy;
methods.read = xmms_samba_read;
methods.seek = xmms_samba_seek;
methods.browse = xmms_samba_browse;
xmms_xform_plugin_methods_set (xform_plugin, &methods);
xmms_xform_plugin_indata_add (xform_plugin, XMMS_STREAM_TYPE_MIMETYPE,
"application/x-url", XMMS_STREAM_TYPE_URL,
"smb://*", XMMS_STREAM_TYPE_END);
G_LOCK (mutex);
if (smbc_set_context (NULL) == NULL) {
/* This should really be cleaned up when the program closes.
* However, given that we have no means of doing so, we're
* just going to forget that we ever created it and let the OS
* clean up after us.
*/
SMBCCTX *ctx = smbc_new_context ();
if (ctx == NULL) {
xmms_log_error ("Failed to create SMBCCTX.", NULL);
return FALSE;
}
if (smbc_init_context (ctx) == NULL) {
xmms_log_error ("Failed to init SMBCCTX.", NULL);
smbc_free_context (ctx, 1);
return FALSE;
}
smbc_setOptionUseKerberos (ctx, TRUE);
smbc_setOptionFallbackAfterKerberos (ctx, TRUE);
smbc_set_context (ctx);
}
err = smbc_init (xmms_samba_auth_fn, 0);
G_UNLOCK (mutex);
if (err < 0) {
xmms_log_error ("%s", strerror (errno));
return FALSE;
}
return TRUE;
}
示例7: xmms_output_new
/**
* Allocate a new #xmms_output_t
*/
xmms_output_t *
xmms_output_new (xmms_output_plugin_t *plugin, xmms_playlist_t *playlist, xmms_medialib_t *medialib)
{
xmms_output_t *output;
xmms_config_property_t *prop;
gint size;
g_return_val_if_fail (playlist, NULL);
XMMS_DBG ("Trying to open output");
output = xmms_object_new (xmms_output_t, xmms_output_destroy);
xmms_object_ref (playlist);
output->playlist = playlist;
xmms_object_ref (medialib);
output->medialib = medialib;
g_mutex_init (&output->status_mutex);
g_mutex_init (&output->playtime_mutex);
prop = xmms_config_property_register ("output.buffersize", "32768", NULL, NULL);
size = xmms_config_property_get_int (prop);
XMMS_DBG ("Using buffersize %d", size);
g_mutex_init (&output->filler_mutex);
output->filler_state = FILLER_STOP;
g_cond_init (&output->filler_state_cond);
output->filler_buffer = xmms_ringbuf_new (size);
output->filler_thread = g_thread_new ("x2 out filler", xmms_output_filler, output);
xmms_config_property_register ("output.flush_on_pause", "1", NULL, NULL);
xmms_playback_register_ipc_commands (XMMS_OBJECT (output));
output->status = XMMS_PLAYBACK_STATUS_STOP;
if (plugin) {
if (!set_plugin (output, plugin)) {
xmms_log_error ("Could not initialize output plugin");
}
} else {
xmms_log_error ("initalized output without a plugin, please fix!");
}
return output;
}
示例8: xmms_samba_plugin_setup
static gboolean
xmms_samba_plugin_setup (xmms_xform_plugin_t *xform_plugin)
{
xmms_xform_methods_t methods;
gint err;
XMMS_XFORM_METHODS_INIT (methods);
methods.init = xmms_samba_init;
methods.destroy = xmms_samba_destroy;
methods.read = xmms_samba_read;
methods.seek = xmms_samba_seek;
methods.browse = xmms_samba_browse;
xmms_xform_plugin_methods_set (xform_plugin, &methods);
xmms_xform_plugin_indata_add (xform_plugin, XMMS_STREAM_TYPE_MIMETYPE,
"application/x-url", XMMS_STREAM_TYPE_URL,
"smb://*", XMMS_STREAM_TYPE_END);
g_static_mutex_lock (&mutex);
err = smbc_init (xmms_samba_auth_fn, 0);
g_static_mutex_unlock (&mutex);
if (err < 0) {
xmms_log_error ("%s", strerror (errno));
return FALSE;
}
return TRUE;
}
示例9: open_cd
/*
* Private stuff
*/
static CdIo_t *
open_cd (xmms_xform_t *xform)
{
CdIo_t *cdio;
xmms_config_property_t *val;
const gchar *device;
const gchar *accessmode;
cdio_log_set_handler (log_handler);
val = xmms_xform_config_lookup (xform, "device");
device = xmms_config_property_get_string (val);
val = xmms_xform_config_lookup (xform, "accessmode");
accessmode = xmms_config_property_get_string (val);
XMMS_DBG ("Trying to open device '%s', using '%s' access mode.",
device, accessmode);
if (g_ascii_strcasecmp (accessmode, "default") == 0) {
cdio = cdio_open (device, DRIVER_UNKNOWN);
} else {
cdio = cdio_open_am (device, DRIVER_UNKNOWN, accessmode);
}
if (!cdio) {
xmms_log_error ("Failed to open device '%s'.", device);
} else {
cdio_set_speed (cdio, 1);
xmms_log_info ("Opened device '%s'.", device);
}
return cdio;
}
示例10: xmms_metadata_mapper_init
GHashTable *
xmms_metadata_mapper_init (const xmms_xform_metadata_basic_mapping_t *basic_mappings, gint basic_count,
const xmms_xform_metadata_mapping_t *mappings, gint count)
{
GHashTable *default_mapper, *result;
gint i;
result = g_hash_table_new (xmms_strcase_hash, xmms_strcase_equal);
default_mapper = xmms_metadata_mapper_get_default ();
/* Initialize default mappers */
for (i = 0; i < basic_count; i++) {
const xmms_xform_metadata_mapping_t *mapping;
mapping = g_hash_table_lookup (default_mapper, basic_mappings[i].to);
if (mapping == NULL) {
xmms_log_error ("No default metadata mapper for '%s'", basic_mappings[i].to);
continue;
}
g_hash_table_insert (result, (gpointer) basic_mappings[i].from, (gpointer) mapping);
}
for (i = 0; i < count; i++) {
g_hash_table_insert (result, (gpointer) mappings[i].key, (gpointer) &mappings[i]);
}
g_hash_table_unref (default_mapper);
return result;
}
示例11: xmms_cdda_seek
static gint64
xmms_cdda_seek (xmms_xform_t *xform, gint64 samples,
xmms_xform_seek_mode_t whence, xmms_error_t *err)
{
xmms_cdda_data_t *data;
lsn_t new_lsn;
g_return_val_if_fail (xform, -1);
data = xmms_xform_private_data_get (xform);
g_return_val_if_fail (data, FALSE);
/* Magic number 42... really should think of a better way to do this but
* it seemed that the lsn is off by about 42 everytime...
*/
new_lsn = samples / 441.0 * CDIO_CD_FRAMES_PER_SEC / 100 + 42;
if ((data->first_lsn + new_lsn) > data->last_lsn) {
xmms_log_error ("Trying to seek past the end of track.");
return -1;
}
data->current_lsn = data->first_lsn + new_lsn;
return samples;
}
示例12: xmms_ipc_handle_cmd_value
static void
xmms_ipc_handle_cmd_value (xmms_ipc_msg_t *msg, xmmsv_t *val)
{
if (xmms_ipc_msg_put_value (msg, val) == (uint32_t) -1) {
xmms_log_error ("Failed to serialize the return value into the IPC message!");
}
}
示例13: xmms_faad_get_framesize
static gint
xmms_faad_get_framesize (xmms_xform_t *xform) {
xmms_faad_data_t *data;
const guchar *tmpbuf;
gsize tmpbuflen;
guchar *copy;
mp4AudioSpecificConfig mp4ASC;
g_return_val_if_fail (xform, 0);
data = xmms_xform_private_data_get (xform);
g_return_val_if_fail (data, 0);
if (data->filetype != FAAD_TYPE_MP4) {
return 0;
}
if (!xmms_xform_auxdata_get_bin (xform, "decoder_config", &tmpbuf,
&tmpbuflen)) {
xmms_log_error ("ERROR: Cannot get AAC decoder config, but filetype is FAAD_TYPE_MP4!");
return 0;
}
copy = g_memdup (tmpbuf, tmpbuflen);
if ((signed char)NeAACDecAudioSpecificConfig (copy, tmpbuflen, &mp4ASC) < 0) {
/* FIXME: That function ^^^ returns char. How can it signal errors when
* char is unsigned?!
*/
g_free (copy);
XMMS_DBG ("ERROR: Could not get mp4ASC!");
return 0;
}
g_free (copy);
return ((mp4ASC.frameLengthFlag == 1) ? 960 : 1024)
* ((mp4ASC.sbr_present_flag == 1) ? 2 : 1);
}
示例14: get_disc_ids
static gboolean
get_disc_ids (const gchar *device, gchar **disc_id,
gchar **cddb_id, track_t *tracks)
{
DiscId *disc = discid_new ();
g_return_val_if_fail (disc, FALSE);
if (discid_read_sparse (disc, device, 0) == 0) {
xmms_log_error ("Could not read disc: %s", discid_get_error_msg (disc));
discid_free (disc);
return FALSE;
}
*disc_id = g_strdup (discid_get_id (disc));
if (tracks) {
*tracks = discid_get_last_track_num (disc);
}
if (cddb_id) {
*cddb_id = g_strdup (discid_get_freedb_id (disc));
}
discid_free (disc);
return TRUE;
}
示例15: update_effect_properties
static void
update_effect_properties (xmms_object_t *object, xmmsv_t *data,
gpointer userdata)
{
gint effect_no = GPOINTER_TO_INT (userdata);
const gchar *name;
xmms_config_property_t *cfg;
xmms_xform_plugin_t *xform_plugin;
xmms_plugin_t *plugin;
gchar key[64];
name = xmms_config_property_get_string ((xmms_config_property_t *) object);
if (name[0]) {
plugin = xmms_plugin_find (XMMS_PLUGIN_TYPE_XFORM, name);
if (!plugin) {
xmms_log_error ("Couldn't find any effect named '%s'", name);
} else {
xform_plugin = (xmms_xform_plugin_t *) plugin;
xmms_xform_plugin_config_property_register (xform_plugin, "enabled",
"1", NULL, NULL);
xmms_object_unref (plugin);
}
/* setup new effect.order.n */
g_snprintf (key, sizeof (key), "effect.order.%i", effect_no + 1);
cfg = xmms_config_lookup (key);
if (!cfg) {
xmms_config_property_register (key, "", update_effect_properties,
GINT_TO_POINTER (effect_no + 1));
}
}
}