/*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
*
* Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
*
#include "libsigrok.h"
#include "libsigrok-internal.h"
-/* Message logging helpers with driver-specific prefix string. */
-#define DRIVER_LOG_DOMAIN "input/wav: "
-#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
-#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+#define LOG_PREFIX "input/wav"
#define CHUNK_SIZE 4096
static int init(struct sr_input *in, const char *filename)
{
- struct sr_probe *probe;
+ struct sr_channel *ch;
struct context *ctx;
- char buf[40], probename[8];
+ char buf[40], channelname[8];
int i;
if (get_wav_header(filename, buf) != SR_OK)
}
for (i = 0; i < ctx->num_channels; i++) {
- snprintf(probename, 8, "CH%d", i + 1);
- if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, probename)))
+ snprintf(channelname, 8, "CH%d", i + 1);
+ if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, channelname)))
return SR_ERR;
- in->sdi->probes = g_slist_append(in->sdi->probes, probe);
+ in->sdi->channels = g_slist_append(in->sdi->channels, ch);
}
return SR_OK;
ctx = in->sdi->priv;
/* Send header packet to the session bus. */
- std_session_send_df_header(in->sdi, DRIVER_LOG_DOMAIN);
+ std_session_send_df_header(in->sdi, LOG_PREFIX);
packet.type = SR_DF_META;
packet.payload = &meta;
- src = sr_config_make(SR_CONF_SAMPLERATE, (const void *)&ctx->samplerate);
+ src = sr_config_new(SR_CONF_SAMPLERATE,
+ g_variant_new_uint64(ctx->samplerate));
meta.config = g_slist_append(NULL, src);
sr_session_send(in->sdi, &packet);
+ sr_config_free(src);
if ((fd = open(filename, O_RDONLY)) == -1)
return SR_ERR;
}
packet.type = SR_DF_ANALOG;
packet.payload = &analog;
- analog.probes = in->sdi->probes;
+ analog.channels = in->sdi->channels;
analog.num_samples = chunk_samples;
analog.mq = 0;
analog.unit = 0;