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


C++ xmms_xform_private_data_get函数代码示例

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


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

示例1: xmms_modplug_read

static gint
xmms_modplug_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len, xmms_error_t *err)
{
	xmms_modplug_data_t *data;

	data = xmms_xform_private_data_get (xform);

	return ModPlug_Read (data->mod, buf, len);
}
开发者ID:theefer,项目名称:xmms2,代码行数:9,代码来源:modplug.c

示例2: xmms_mpg123_read

static gint
xmms_mpg123_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
                  xmms_error_t *err)
{
	xmms_mpg123_data_t *data;
	int result = MPG123_OK;
	size_t read = 0;

	data = xmms_xform_private_data_get (xform);
	g_return_val_if_fail (data, -1);

	while (read == 0) {
		gint ret = 0;

		if (result == MPG123_NEED_MORE) {
			ret = xmms_xform_read (xform, data->buf, BUFSIZE, err);
			if (ret < 0) {
				return ret;
			} else if (ret == 0) {
				data->eof_found = TRUE;
			}
		}

		result = mpg123_decode (data->decoder, data->buf, (size_t) ret,
		                        buf, len, &read);

		if (result == MPG123_NEED_MORE && data->eof_found) {
			/* We need more data, but there's none available
			 * so libmpg123 apparently missed an EOF */
			result = MPG123_DONE;
			break;
		} else if (result != MPG123_OK && result != MPG123_NEED_MORE) {
			/* This is some uncommon result like EOF, handle outside
			 * the loop */
			break;
		}
	}

	if (result == MPG123_DONE) {
		/* This is just normal EOF reported from libmpg123 */
		XMMS_DBG ("Got EOF while decoding stream");
		return 0;
	} else if (result == MPG123_NEW_FORMAT) {
		/* FIXME: When we can handle format changes, modify this */
		xmms_error_set (err,
		                XMMS_ERROR_GENERIC,
		                "The output format changed, XMMS2 can't handle that");
		return -1;
	} else if (result == MPG123_ERR) {
		xmms_error_set (err,
		                XMMS_ERROR_GENERIC,
		                mpg123_strerror (data->decoder));
		return -1;
	}

	return (gint) read;
}
开发者ID:vdust,项目名称:xmms2-devel,代码行数:57,代码来源:mpg123.c

示例3: xmms_mpc_read

static gint
xmms_mpc_read (xmms_xform_t *xform, xmms_sample_t *buffer,
               gint len, xmms_error_t *err)
{
    MPC_SAMPLE_FORMAT internal[MPC_DECODER_BUFFER_LENGTH];
    xmms_mpc_data_t *data;
    mpc_uint32_t ret;
    guint size;

    data = xmms_xform_private_data_get (xform);

    size = MIN (data->buffer->len, len);

#ifdef HAVE_MPCDEC_OLD
    if (size <= 0) {
        ret = mpc_decoder_decode (&data->decoder, internal, NULL, NULL);
        if (ret == -1) {
            xmms_error_set (err, XMMS_ERROR_GENERIC, "Musepack decoder failed");
            return -1;
        }

        ret *= xmms_sample_size_get (XMMS_SAMPLE_FORMAT_FLOAT);
        ret *= data->info.channels;

        g_string_append_len (data->buffer, (gchar *) internal, ret);
    }
#else
    if (size <= 0) {
        mpc_frame_info frame;

        frame.buffer = internal;
        do {
            ret = mpc_demux_decode (data->demux, &frame);
        } while (frame.bits != -1 && frame.samples == 0);

        if (frame.bits == -1 && ret != MPC_STATUS_OK) {
            xmms_error_set (err, XMMS_ERROR_GENERIC, "Musepack decoder failed");
            return -1;
        }
        ret = frame.samples;

        ret *= xmms_sample_size_get (XMMS_SAMPLE_FORMAT_FLOAT);
        ret *= data->info.channels;

        g_string_append_len (data->buffer, (gchar *) internal, ret);
    }
#endif

    /* Update the current size of available data */
    size = MIN (data->buffer->len, len);

    memcpy (buffer, data->buffer->str, size);
    g_string_erase (data->buffer, 0, size);

    return size;
}
开发者ID:kfihihc,项目名称:xmms2-devel,代码行数:56,代码来源:musepack.c

示例4: 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

示例5: xmms_sndfile_destroy

static void
xmms_sndfile_destroy (xmms_xform_t *xform)
{
	g_return_if_fail (xform);

	xmms_sndfile_data_t *data = xmms_xform_private_data_get (xform);

	sf_close (data->sndfile);

	g_free (data);
}
开发者ID:mantaraya36,项目名称:xmms2-mantaraya36,代码行数:11,代码来源:sndfile.c

示例6: xmms_wavpack_destroy

static void
xmms_wavpack_destroy (xmms_xform_t *xform)
{
	xmms_wavpack_data_t *data;

	g_return_if_fail (xform);

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

	xmms_wavpack_free_data (data);
}
开发者ID:dsheeler,项目名称:xmms2,代码行数:12,代码来源:wavpack.c

示例7: xmms_daap_destroy

static void
xmms_daap_destroy (xmms_xform_t *xform)
{
	xmms_daap_data_t *data;

	data = xmms_xform_private_data_get (xform);

	daap_conn_free (data->conn);

	g_free (data->host);
	g_free (data);
}
开发者ID:kfihihc,项目名称:xmms2-devel,代码行数:12,代码来源:daap_xform.c

示例8: xmms_nulstripper_destroy

static void
xmms_nulstripper_destroy (xmms_xform_t *xform)
{
	xmms_nulstripper_data_t *data;

	g_return_if_fail (xform);

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

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

示例9: xmms_wave_seek

static gint64
xmms_wave_seek (xmms_xform_t *xform, gint64 samples,
                xmms_xform_seek_mode_t whence, xmms_error_t *error)
{
	xmms_wave_data_t *data;
	gint64 offset;
	gint64 ret;

	g_return_val_if_fail (xform, -1);
	g_return_val_if_fail (samples >= 0, -1);
	g_return_val_if_fail (whence == XMMS_XFORM_SEEK_SET, -1);

	data = xmms_xform_private_data_get (xform);
	g_return_val_if_fail (data, -1);

	/* in mp3 mode, the samples argument actually indicates bytes..
	 * thus we've set up bits_per_sample to 8 and channels to 1 to get
	 * expected behaviour. */

	offset = data->header_size;
	offset += samples * (data->bits_per_sample / 8) * data->channels;

	if (offset < data->header_size) {
		xmms_error_set (error, XMMS_ERROR_INVAL,
		                "Trying to seek before start of stream");
		return -1;
	}

	if (offset > data->header_size + data->bytes_total) {
		xmms_error_set (error, XMMS_ERROR_INVAL,
		                "Trying to seek past end of stream");
		return -1;
	}

	ret = xmms_xform_seek (xform, offset, whence, error);

	if (ret == -1) {
		return -1;
	}

	if (ret != offset) {
		XMMS_DBG ("xmms_xform_seek didn't return expected offset "
		          "(%" G_GINT64_FORMAT " != %" G_GINT64_FORMAT ")",
		          ret, offset);
	}

	ret -= data->header_size;

	ret /= (data->bits_per_sample / 8) * data->channels;

	return ret;
}
开发者ID:Reilithion,项目名称:xmms2-reilithion,代码行数:52,代码来源:wave.c

示例10: xmms_vorbis_destroy

static void
xmms_vorbis_destroy (xmms_xform_t *xform)
{
	xmms_vorbis_data_t *data;

	g_return_if_fail (xform);

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

	ov_clear (&data->vorbisfile);
	g_free (data);
}
开发者ID:eggpi,项目名称:xmms2-guilherme,代码行数:13,代码来源:common.c

示例11: xmms_daap_destroy

static void
xmms_daap_destroy (xmms_xform_t *xform)
{
    xmms_daap_data_t *data;

    data = xmms_xform_private_data_get (xform);

    g_io_channel_shutdown (data->channel, TRUE, NULL);
    g_io_channel_unref (data->channel);

    g_free (data->host);
    g_free (data);
}
开发者ID:Reilithion,项目名称:xmms2-reilithion,代码行数:13,代码来源:daap_xform.c

示例12: xmms_opus_destroy

static void
xmms_opus_destroy (xmms_xform_t *xform)
{
	xmms_opus_data_t *data;

	g_return_if_fail (xform);

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

	op_free (data->opusfile);
	g_free (data);
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:13,代码来源:opus.c

示例13: xmms_modplug_seek

static gboolean
xmms_modplug_seek (xmms_xform_t *xform, guint samples)
{
	xmms_modplug_data_t *data;

	g_return_val_if_fail (xform, FALSE);

	data = xmms_xform_private_data_get (xform);

	ModPlug_Seek (data->mod, (int) ((gdouble)1000 * samples / 44100));

	return TRUE;
}
开发者ID:dreamerc,项目名称:xmms2,代码行数:13,代码来源:modplug.c

示例14: xmms_mid1_read

static gint
xmms_mid1_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len, xmms_error_t *err)
{
	xmms_mid1_data_t *data;
	data = xmms_xform_private_data_get (xform);

	if (data->pos + len > data->chunked_data->len)
		len = data->chunked_data->len - data->pos;

	memcpy (buf, &(data->chunked_data->str[data->pos]), len);
	data->pos += len;
	return len;
}
开发者ID:chrippa,项目名称:xmms2,代码行数:13,代码来源:mid1.c

示例15: xmms_icymetaint_destroy

static void
xmms_icymetaint_destroy (xmms_xform_t *xform)
{
	xmms_icymetaint_data_t *data;

	g_return_if_fail (xform);

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

	g_free (data->metabuffer);

	g_free (data);
}
开发者ID:mantaraya36,项目名称:xmms2-mantaraya36,代码行数:14,代码来源:icymetaint.c


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