/* Current selected samplerate. */
uint64_t samplerate;
+ gboolean samplerate_sent;
/* Number of channels. */
size_t num_channels;
{
struct context *inc;
struct sr_datafeed_packet packet;
+ struct sr_datafeed_meta meta;
+ struct sr_config *src;
+ uint64_t samplerate;
struct sr_datafeed_logic logic;
int rc;
if (!inc->datafeed_buf_fill)
return SR_OK;
+ if (inc->samplerate && !inc->samplerate_sent) {
+ packet.type = SR_DF_META;
+ packet.payload = &meta;
+ samplerate = inc->samplerate;
+ src = sr_config_new(SR_CONF_SAMPLERATE, g_variant_new_uint64(samplerate));
+ meta.config = g_slist_append(NULL, src);
+ sr_session_send(in->sdi, &packet);
+ g_slist_free(meta.config);
+ sr_config_free(src);
+ inc->samplerate_sent = TRUE;
+ }
+
memset(&packet, 0, sizeof(packet));
memset(&logic, 0, sizeof(logic));
packet.type = SR_DF_LOGIC;
static int process_buffer(struct sr_input *in, gboolean is_eof)
{
- struct sr_datafeed_packet packet;
- struct sr_datafeed_meta meta;
- struct sr_config *src;
struct context *inc;
gsize num_columns;
- uint64_t samplerate;
size_t max_columns, l;
int ret;
char *p, **lines, *line, **columns;
inc = in->priv;
if (!inc->started) {
std_session_send_df_header(in->sdi);
-
- if (inc->samplerate) {
- packet.type = SR_DF_META;
- packet.payload = &meta;
- samplerate = inc->samplerate;
- src = sr_config_new(SR_CONF_SAMPLERATE, g_variant_new_uint64(samplerate));
- meta.config = g_slist_append(NULL, src);
- sr_session_send(in->sdi, &packet);
- g_slist_free(meta.config);
- sr_config_free(src);
- }
-
inc->started = TRUE;
}