+ p = inc->buffer + inc->samples_in_buffer * inc->bytes_per_sample;
+ for (i = 0; i < space_left; i++) {
+ memcpy(p, inc->current_levels, inc->bytes_per_sample);
+ p += inc->bytes_per_sample;
+ inc->samples_in_buffer++;
+ count--;
+ }
+
+ if (inc->samples_in_buffer == samples_per_chunk)
+ send_buffer(in);
+ }
+}
+
+/* Set the channel level depending on the identifier and parsed value. */
+static void process_bit(struct context *inc, char *identifier, unsigned int bit)
+{
+ GSList *l;
+ struct vcd_channel *vcd_ch;
+ unsigned int j;
+
+ for (j = 0, l = inc->channels; j < inc->channelcount && l; j++, l = l->next) {
+ vcd_ch = l->data;
+ if (g_strcmp0(identifier, vcd_ch->identifier) == 0) {
+ /* Found our channel. */
+ size_t byte_idx = (j / 8);
+ size_t bit_idx = j - 8 * byte_idx;
+ if (bit)
+ inc->current_levels[byte_idx] |= (uint8_t)1 << bit_idx;
+ else
+ inc->current_levels[byte_idx] &= ~((uint8_t)1 << bit_idx);
+ break;
+ }