drop_block(bq, bq->blocks);
assert(bq->n_blocks == 0);
- bq->write_index = bq->read_index;
pa_memblockq_prebuf_force(bq);
}
pa_tagstruct *reply;
struct playback_stream *s;
struct timeval tv, now;
- uint64_t counter;
uint32_t idx;
assert(c && t);
if (pa_tagstruct_getu32(t, &idx) < 0 ||
pa_tagstruct_get_timeval(t, &tv) < 0 ||
- pa_tagstruct_getu64(t, &counter) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
return;
pa_tagstruct_put_timeval(reply, &tv);
pa_gettimeofday(&now);
pa_tagstruct_put_timeval(reply, &now);
- pa_tagstruct_putu64(reply, counter);
+ pa_tagstruct_puts64(reply, pa_memblockq_get_write_index(s->memblockq));
+ pa_tagstruct_puts64(reply, pa_memblockq_get_read_index(s->memblockq));
pa_pstream_send_tagstruct(c->pstream, reply);
}
pa_tagstruct *reply;
struct record_stream *s;
struct timeval tv, now;
- uint64_t counter;
uint32_t idx;
assert(c && t);
if (pa_tagstruct_getu32(t, &idx) < 0 ||
pa_tagstruct_get_timeval(t, &tv) < 0 ||
- pa_tagstruct_getu64(t, &counter) < 0 ||
!pa_tagstruct_eof(t)) {
protocol_error(c);
return;
pa_tagstruct_put_timeval(reply, &tv);
pa_gettimeofday(&now);
pa_tagstruct_put_timeval(reply, &now);
- pa_tagstruct_putu64(reply, counter);
+ pa_tagstruct_puts64(reply, pa_memblockq_get_write_index(s->memblockq));
+ pa_tagstruct_puts64(reply, pa_memblockq_get_read_index(s->memblockq));
pa_pstream_send_tagstruct(c->pstream, reply);
}
t->length += 9;
}
+void pa_tagstruct_puts64(pa_tagstruct*t, int64_t u) {
+ uint32_t tmp;
+ assert(t);
+ extend(t, 9);
+ t->data[t->length] = PA_TAG_S64;
+ tmp = htonl((uint32_t) ((uint64_t) u >> 32));
+ memcpy(t->data+t->length+1, &tmp, 4);
+ tmp = htonl((uint32_t) ((uint64_t) u));
+ memcpy(t->data+t->length+5, &tmp, 4);
+ t->length += 9;
+}
+
void pa_tagstruct_put_channel_map(pa_tagstruct *t, const pa_channel_map *map) {
unsigned i;
return -1;
memcpy(&tmp, t->data+t->rindex+1, 4);
- *u = (pa_usec_t) ntohl(tmp) << 32;
+ *u = (uint64_t) ntohl(tmp) << 32;
memcpy(&tmp, t->data+t->rindex+5, 4);
- *u |= (pa_usec_t) ntohl(tmp);
+ *u |= (uin64_t) ntohl(tmp);
+ t->rindex +=9;
+ return 0;
+}
+
+int pa_tagstruct_gets64(pa_tagstruct*t, int64_t *u) {
+ uint32_t tmp;
+ assert(t && u);
+
+ if (t->rindex+9 > t->length)
+ return -1;
+
+ if (t->data[t->rindex] != PA_TAG_S64)
+ return -1;
+
+ memcpy(&tmp, t->data+t->rindex+1, 4);
+ *u = (int64_t) ((uint64_t) ntohl(tmp) << 32);
+ memcpy(&tmp, t->data+t->rindex+5, 4);
+ *u |= (int64_t) ntohl(tmp);
t->rindex +=9;
return 0;
}
PA_TAG_U32 = 'L',
PA_TAG_U8 = 'B',
PA_TAG_U64 = 'R',
+ PA_TAG_S64 = 'r',
PA_TAG_SAMPLE_SPEC = 'a',
PA_TAG_ARBITRARY = 'x',
PA_TAG_BOOLEAN_TRUE = '1',
void pa_tagstruct_putu8(pa_tagstruct*t, uint8_t c);
void pa_tagstruct_putu32(pa_tagstruct*t, uint32_t i);
void pa_tagstruct_putu64(pa_tagstruct*t, uint64_t i);
+void pa_tagstruct_puts64(pa_tagstruct*t, int64_t i);
void pa_tagstruct_put_sample_spec(pa_tagstruct *t, const pa_sample_spec *ss);
void pa_tagstruct_put_arbitrary(pa_tagstruct*t, const void *p, size_t length);
void pa_tagstruct_put_boolean(pa_tagstruct*t, int b);
int pa_tagstruct_getu8(pa_tagstruct*t, uint8_t *c);
int pa_tagstruct_getu32(pa_tagstruct*t, uint32_t *i);
int pa_tagstruct_getu64(pa_tagstruct*t, uint64_t *i);
+int pa_tagstruct_gets64(pa_tagstruct*t, int64_t *i);
int pa_tagstruct_get_sample_spec(pa_tagstruct *t, pa_sample_spec *ss);
int pa_tagstruct_get_arbitrary(pa_tagstruct *t, const void **p, size_t length);
int pa_tagstruct_get_boolean(pa_tagstruct *t, int *b);