当前位置: 首页>>代码示例>>C++>>正文


C++ xmms_xform_metadata_set_int函数代码示例

本文整理汇总了C++中xmms_xform_metadata_set_int函数的典型用法代码示例。如果您正苦于以下问题:C++ xmms_xform_metadata_set_int函数的具体用法?C++ xmms_xform_metadata_set_int怎么用?C++ xmms_xform_metadata_set_int使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xmms_xform_metadata_set_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handle_partofset_field

static void
handle_partofset_field (xmms_xform_t *xform, xmms_id3v2_header_t *head,
                        const gchar *key, gchar *buf, gsize len)
{
	const gchar *enc;
	gchar *nval;
	gsize clen;

	enc = binary_to_enc (buf[0]);
	nval = convert_id3_text (enc, &buf[1], len - 1, &clen);
	if (nval) {
		gint partofset, totalset;

		parse_number_slash_number (nval, &partofset, &totalset);
		if (partofset > 0) {
			const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PARTOFSET;
			xmms_xform_metadata_set_int (xform, metakey, partofset);
		}
		if (totalset > 0) {
			const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALSET;
			xmms_xform_metadata_set_int (xform, metakey, totalset);
		}
		g_free (nval);
	}
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:25,代码来源:id3.c

示例2: handle_comment

/* note that "key" is NOT NUL-terminated here,
 * but "value" is.
 */
static void
handle_comment (xmms_xform_t *xform,
                const gchar *key, gint key_len, const gchar *value)
{
	gchar buf[8];
	gint i;

	for (i = 0; i < G_N_ELEMENTS (properties); i++) {
		if ((!g_ascii_strncasecmp (key, "MUSICBRAINZ_ALBUMARTISTID", key_len)) &&
		    (!g_ascii_strcasecmp (value, MUSICBRAINZ_VA_ID))) {
			const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_COMPILATION;
			xmms_xform_metadata_set_int (xform, metakey, 1);
		} else if (!g_ascii_strncasecmp (key, properties[i].vname, key_len)) {
			if (properties[i].type == INTEGER) {
				gint tmp = strtol (value, NULL, 10);
				xmms_xform_metadata_set_int (xform,
				                             properties[i].xname, tmp);
			} else if (properties[i].type == RPGAIN) {
				g_snprintf (buf, sizeof (buf), "%f",
				            pow (10.0, g_strtod (value, NULL) / 20));

				/** @todo this should probably be a int instead? */
				xmms_xform_metadata_set_str (xform,
				                             properties[i].xname, buf);
			} else {
				xmms_xform_metadata_set_str (xform,
				                             properties[i].xname, value);
			}
		}
	}
}
开发者ID:dreamerc,项目名称:xmms2,代码行数:34,代码来源:flac.c

示例3: handle_tracknr_field

static void
handle_tracknr_field (xmms_xform_t *xform, xmms_id3v2_header_t *head,
                      const gchar *key, gchar *buf, gsize len)
{
	const gchar *enc;
	gchar *nval;
	gsize clen;

	enc = binary_to_enc (buf[0]);
	nval = convert_id3_text (enc, &buf[1], len - 1, &clen);
	if (nval) {
		gint tracknr, tracktotal;

		parse_number_slash_number (nval, &tracknr, &tracktotal);
		if (tracknr > 0) {
			const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR;
			xmms_xform_metadata_set_int (xform, metakey, tracknr);
		}
		if (tracktotal > 0) {
			const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALTRACKS;
			xmms_xform_metadata_set_int (xform, metakey, tracktotal);
		}

		g_free (nval);
	}
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:26,代码来源:id3.c

示例4: xmms_wave_get_media_info

static void
xmms_wave_get_media_info (xmms_xform_t *xform)
{
	xmms_wave_data_t *data;
	gdouble playtime;
	guint samples_total, bitrate;
	gint filesize;
	const gchar *metakey;

	g_return_if_fail (xform);

	data = xmms_xform_private_data_get (xform);
	g_return_if_fail (data);

	samples_total = data->bytes_total / (data->bits_per_sample / 8);
	playtime = (gdouble) samples_total / data->samplerate / data->channels;

	metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_SIZE;
	if (xmms_xform_metadata_get_int (xform, metakey, &filesize)) {
		metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_DURATION;
		xmms_xform_metadata_set_int (xform, metakey, playtime * 1000);
	}

	bitrate = data->bits_per_sample * data->samplerate / data->channels;
	metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_BITRATE;
	xmms_xform_metadata_set_int (xform, metakey, bitrate);
}
开发者ID:Reilithion,项目名称:xmms2-reilithion,代码行数:27,代码来源:wave.c

示例5: outdata_type_metadata_collect

static void
outdata_type_metadata_collect (xmms_xform_t *xform)
{
	gint val;
	const char *mime;
	xmms_stream_type_t *type;

	type = xform->out_type;
	mime = xmms_stream_type_get_str (type, XMMS_STREAM_TYPE_MIMETYPE);
	if (strcmp (mime, "audio/pcm") != 0) {
		return;
	}

	val = xmms_stream_type_get_int (type, XMMS_STREAM_TYPE_FMT_FORMAT);
	if (val != -1) {
		const gchar *name = xmms_sample_name_get ((xmms_sample_format_t) val);
		xmms_xform_metadata_set_str (xform,
		                             XMMS_MEDIALIB_ENTRY_PROPERTY_SAMPLE_FMT,
		                             name);
	}

	val = xmms_stream_type_get_int (type, XMMS_STREAM_TYPE_FMT_SAMPLERATE);
	if (val != -1) {
		xmms_xform_metadata_set_int (xform,
		                             XMMS_MEDIALIB_ENTRY_PROPERTY_SAMPLERATE,
		                             val);
	}

	val = xmms_stream_type_get_int (type, XMMS_STREAM_TYPE_FMT_CHANNELS);
	if (val != -1) {
		xmms_xform_metadata_set_int (xform,
		                             XMMS_MEDIALIB_ENTRY_PROPERTY_CHANNELS,
		                             val);
	}
}
开发者ID:mantaraya36,项目名称:xmms2-mantaraya36,代码行数:35,代码来源:xform.c

示例6: xmms_mpc_cache_streaminfo

static void
xmms_mpc_cache_streaminfo (xmms_xform_t *xform)
{
    xmms_mpc_data_t *data;
    gint bitrate, duration, filesize;
    gchar buf[8];
    const gchar *metakey;

    g_return_if_fail (xform);

    data = xmms_xform_private_data_get (xform);
    g_return_if_fail (data);

    XMMS_DBG ("stream version = %d", data->info.stream_version);

    metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_SIZE;
    if (xmms_xform_metadata_get_int (xform, metakey, &filesize)) {
        duration = mpc_streaminfo_get_length (&data->info) * 1000;
        metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_DURATION;
        xmms_xform_metadata_set_int (xform, metakey, duration);
    }

    bitrate = (data->info.bitrate) ? data->info.bitrate :
              data->info.average_bitrate;

    metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_BITRATE;
    xmms_xform_metadata_set_int (xform, metakey, bitrate);

    if (data->info.gain_album) {
        g_snprintf (buf, sizeof (buf), "%f",
                    xmms_mpc_normalize_gain ((gdouble) data->info.gain_album));
        metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_GAIN_ALBUM;
        xmms_xform_metadata_set_str (xform, metakey, buf);
    }

    if (data->info.gain_title) {
        g_snprintf (buf, sizeof (buf), "%f",
                    xmms_mpc_normalize_gain ((gdouble) data->info.gain_title));
        metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_GAIN_TRACK;
        xmms_xform_metadata_set_str (xform, metakey, buf);
    }

    if (data->info.peak_album) {
        g_snprintf (buf, sizeof (buf), "%f",
                    xmms_mpc_normalize_peak ((gdouble) data->info.peak_album));
        metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PEAK_ALBUM;
        xmms_xform_metadata_set_str (xform, metakey, buf);
    }

    if (data->info.peak_title) {
        g_snprintf (buf, sizeof (buf), "%f",
                    xmms_mpc_normalize_peak ((gdouble) data->info.peak_title));
        metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PEAK_TRACK;
        xmms_xform_metadata_set_str (xform, metakey, buf);
    }
}
开发者ID:kfihihc,项目名称:xmms2-devel,代码行数:56,代码来源:musepack.c

示例7: 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;
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:57,代码来源:samba.c

示例8: xmms_asf_handle_tag_old_tracknr

static gboolean
xmms_asf_handle_tag_old_tracknr (xmms_xform_t *xform, const gchar *key,
                                 const gchar *value, gsize length)
{
    gint ivalue;

    /* WM/TrackNumber overrides WM/Track value as specified in the Microsoft
     * documentation at http://msdn2.microsoft.com/en-us/library/aa392014.aspx
     * so lets check if something else has set the tracknr property before us.
     */
    if (xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR, &ivalue)) {
        return FALSE;
    }

    /* Ok, nothing set, lets handle "WM/Track" as "WM/TrackNumber" */
    if (!xmms_xform_metadata_mapper_match (xform, "WM/TrackNumber", value, length)) {
        return FALSE;
    }

    /* Last quirk, WM/Track is 0-indexed, need to fix that */
    xmms_xform_metadata_get_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR, &ivalue);
    xmms_xform_metadata_set_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR, ivalue + 1);

    return TRUE;
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:25,代码来源:asf.c

示例9: xmms_sid_get_media_info

/**
 * @todo  Enable option to use STIL for media info and
 * timedatabase for song length.
 */
static void
xmms_sid_get_media_info (xmms_xform_t *xform)
{
	xmms_sid_data_t *data;
	const gchar *md5sum;
	const gchar *metakey;
	char artist[32];
	char title[32];
	gint err;

	data = xmms_xform_private_data_get (xform);
	g_return_if_fail (data);

	err = sidplay_wrapper_songinfo (data->wrapper, artist, title);
	if (err > 0) {
		metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TITLE;
		xmms_xform_metadata_set_str (xform, metakey, title);

		metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_ARTIST;
		xmms_xform_metadata_set_str (xform, metakey, artist);
	}

	metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_SUBTUNES;
	xmms_xform_metadata_set_int (xform, metakey,
	                             sidplay_wrapper_subtunes (data->wrapper));

	md5sum = sidplay_wrapper_md5 (data->wrapper);
	xmms_xform_metadata_set_str (xform, "HVSCfingerprint", md5sum);

	xmms_sid_get_songlength (xform);

}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:36,代码来源:sid.c

示例10: xmms_speex_read_metadata

static void
xmms_speex_read_metadata (xmms_xform_t *xform, xmms_speex_data_t *data)
{
	xmms_xform_metadata_set_int (xform,
	                             XMMS_MEDIALIB_ENTRY_PROPERTY_BITRATE,
	                             data->speexheader->bitrate);
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:7,代码来源:speex.c

示例11: xmms_mp4_get_mediainfo

static void
xmms_mp4_get_mediainfo (xmms_xform_t *xform)
{
	xmms_mp4_data_t *data;
	const gchar *metakey;
	glong temp;
	gint i, num_items;

	g_return_if_fail (xform);

	data = xmms_xform_private_data_get (xform);
	g_return_if_fail (data);

	if ((temp = mp4ff_get_sample_rate (data->mp4ff, data->track)) > 0) {
		glong srate = temp;

		if ((temp = mp4ff_get_track_duration (data->mp4ff, data->track)) >= 0) {
			glong msec = ((gint64) temp) * 1000 / srate;

			metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_DURATION,
			xmms_xform_metadata_set_int (xform, metakey, msec);
		}
	}

	if ((temp = mp4ff_get_avg_bitrate (data->mp4ff, data->track)) >= 0) {
		metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_BITRATE;
		xmms_xform_metadata_set_int (xform, metakey, temp);
	}

	num_items = mp4ff_meta_get_num_items (data->mp4ff);
	for (i = 0; i < num_items; i++) {
		gchar *key, *value;
		guint length;

		length = mp4ff_meta_get_by_index (data->mp4ff, i, &key, &value);
		if (length > 0) {
			if (!xmms_xform_metadata_mapper_match (xform, key, value, length)) {
				/* iTunSMPB should be handled in xmms_mp4_gapless_try */
				if (0 != g_ascii_strcasecmp (key, "iTunSMPB")) {
					XMMS_DBG ("Unhandled tag '%s' = '%s'", key, value);
				}
			}
			g_free (key);
			g_free (value);
		}
	}
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:47,代码来源:mp4.c

示例12: xmms_apetag_handle_tag_track

static gboolean
xmms_apetag_handle_tag_track (xmms_xform_t *xform, const gchar *key,
                              const gchar *value, gsize length)
{
	gint tracknr, tracktotal;

	xmms_apetag_parse_number_slash_number (value, &tracknr, &tracktotal);
	if (tracknr > 0) {
		const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TRACKNR;
		xmms_xform_metadata_set_int (xform, metakey, tracknr);
	}
	if (tracktotal > 0) {
		const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALTRACKS;
		xmms_xform_metadata_set_int (xform, metakey, tracktotal);
	}

	return tracknr > 0;
}
开发者ID:dsheeler,项目名称:xmms2,代码行数:18,代码来源:apev2.c

示例13: xmms_apetag_handle_tag_disc

static gboolean
xmms_apetag_handle_tag_disc (xmms_xform_t *xform, const gchar *key,
                             const gchar *value, gsize length)
{
	gint partofset, totalset;

	xmms_apetag_parse_number_slash_number (value, &partofset, &totalset);
	if (partofset > 0) {
		const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_PARTOFSET;
		xmms_xform_metadata_set_int (xform, metakey, partofset);
	}
	if (totalset > 0) {
		const gchar *metakey = XMMS_MEDIALIB_ENTRY_PROPERTY_TOTALSET;
		xmms_xform_metadata_set_int (xform, metakey, totalset);
	}

	return partofset > 0;
}
开发者ID:dsheeler,项目名称:xmms2,代码行数:18,代码来源:apev2.c

示例14: xmms_asf_handle_tag_is_vbr

static gboolean
xmms_asf_handle_tag_is_vbr (xmms_xform_t *xform, const gchar *key,
                            const gchar *value, gsize length)
{
    if (strcasecmp ("true", value) == 0) {
        xmms_xform_metadata_set_int (xform, XMMS_MEDIALIB_ENTRY_PROPERTY_IS_VBR, 1);
        return TRUE;
    }
    return FALSE;
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:10,代码来源:asf.c

示例15: xmms_xform_metadata_parse_compilation

gboolean
xmms_xform_metadata_parse_compilation (xmms_xform_t *xform, const gchar *key,
                                       const gchar *value, gsize length)
{
	const gchar *musicbrainz_va_id = "89ad4ac3-39f7-470e-963a-56509c546377";
	gchar *endptr = NULL;
	gint number;

	if (strcasecmp (musicbrainz_va_id, value) == 0) {
		return xmms_xform_metadata_set_int (xform, key, 1);
	}

	number = strtol (value, &endptr, 10);
	if (endptr > value && *endptr == '\0' && number > 0) {
		return xmms_xform_metadata_set_int (xform, key, 1);
	}

	return FALSE;
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:19,代码来源:metadata.c


注:本文中的xmms_xform_metadata_set_int函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。