From 761a895d1f8ac3c20710a884560bc77f3789d3af Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 27 Aug 2004 16:24:22 +0000 Subject: minor cleanups git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@155 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/polyplib-def.h | 10 ++++++++-- polyp/polyplib-introspect.c | 3 ++- polyp/polyplib-introspect.h | 18 ++++++++++-------- polyp/polyplib-stream.c | 2 -- polyp/protocol-native.c | 2 ++ polyp/tagstruct.c | 2 +- 6 files changed, 23 insertions(+), 14 deletions(-) (limited to 'polyp') diff --git a/polyp/polyplib-def.h b/polyp/polyplib-def.h index 02f5e526..6c3cd825 100644 --- a/polyp/polyplib-def.h +++ b/polyp/polyplib-def.h @@ -129,10 +129,16 @@ enum pa_subscription_event_type { /** Return one if an event type t matches an event mask bitfield */ #define pa_subscription_match_flags(m, t) (!!((m) & (1 << ((t) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK)))) -/** A structure for latency info. See pa_stream_get_latency(). */ +/** A structure for latency info. See pa_stream_get_latency(). The + * total latency a sample that is written with pa_stream_write() takes + * to be played is buffer_usec+sink_usec. The buffer to which + * buffer_usec relates may be manipulated freely (with + * pa_stream_write()'s delta argument, pa_stream_flush() and friends), + * the playback buffer sink_usec relates to is a FIFO which cannot be + * flushed or manipulated in any way. */ struct pa_latency_info { pa_usec_t buffer_usec; /**< Time in usecs the current buffer takes to play */ - pa_usec_t sink_usec; /**< Time in usecs a sample takes to be played on the sink. The total latency is buffer_usec+sink_usec. */ + pa_usec_t sink_usec; /**< Time in usecs a sample takes to be played on the sink. */ int playing; /**< Non-zero when the stream is currently playing */ int queue_length; /**< Queue size in bytes. */ }; diff --git a/polyp/polyplib-introspect.c b/polyp/polyplib-introspect.c index 63422383..e650fb9f 100644 --- a/polyp/polyplib-introspect.c +++ b/polyp/polyplib-introspect.c @@ -400,7 +400,8 @@ static void context_get_sink_input_info_callback(struct pa_pdispatch *pd, uint32 pa_tagstruct_getu32(t, &i.sink) < 0 || pa_tagstruct_get_sample_spec(t, &i.sample_spec) < 0 || pa_tagstruct_getu32(t, &i.volume) < 0 || - pa_tagstruct_getu32(t, &i.latency) < 0) { + pa_tagstruct_getu32(t, &i.buffer_usec) < 0 || + pa_tagstruct_getu32(t, &i.sink_usec) < 0) { pa_context_fail(o->context, PA_ERROR_PROTOCOL); goto finish; } diff --git a/polyp/polyplib-introspect.h b/polyp/polyplib-introspect.h index 0c305184..fc7aa123 100644 --- a/polyp/polyplib-introspect.h +++ b/polyp/polyplib-introspect.h @@ -93,15 +93,17 @@ struct pa_client_info { struct pa_operation* pa_context_get_client_info(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_client_info*i, int is_last, void *userdata), void *userdata); struct pa_operation* pa_context_get_client_info_list(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_client_info*i, int is_last, void *userdata), void *userdata); +/** Stores information about sink inputs */ struct pa_sink_input_info { - uint32_t index; - const char *name; - uint32_t owner_module; - uint32_t client; - uint32_t sink; - struct pa_sample_spec sample_spec; - pa_volume_t volume; - pa_usec_t latency; + uint32_t index; /**< Name of this index */ + const char *name; /**< Name of the sink input */ + uint32_t owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module */ + uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */ + uint32_t sink; /**< Index of the connected sink */ + struct pa_sample_spec sample_spec; /**< The sample specification of the sink input */ + pa_volume_t volume; /**< The volume of this sink input */ + pa_usec_t buffer_usec; /**< Latency due to buffering in sink input, see pa_latency_info for details */ + pa_usec_t sink_usec; /**< Latency of the sink device, see pa_latency_info for details */ }; struct pa_operation* pa_context_get_sink_input_info(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_sink_input_info*i, int is_last, void *userdata), void *userdata); diff --git a/polyp/polyplib-stream.c b/polyp/polyplib-stream.c index f45e1e7c..220e4a14 100644 --- a/polyp/polyplib-stream.c +++ b/polyp/polyplib-stream.c @@ -168,8 +168,6 @@ void pa_command_request(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, s->requested_bytes += bytes; - fprintf(stderr, "total req: %u (%u)\n", s->requested_bytes, bytes); - if (s->requested_bytes && s->write_callback) s->write_callback(s, s->requested_bytes, s->write_userdata); diff --git a/polyp/protocol-native.c b/polyp/protocol-native.c index 7b7dfef6..213568a0 100644 --- a/polyp/protocol-native.c +++ b/polyp/protocol-native.c @@ -1022,6 +1022,7 @@ static void sink_input_fill_tagstruct(struct pa_tagstruct *t, struct pa_sink_inp pa_tagstruct_put_sample_spec(t, &s->sample_spec); pa_tagstruct_putu32(t, s->volume); pa_tagstruct_putu32(t, pa_sink_input_get_latency(s)); + pa_tagstruct_putu32(t, pa_sink_get_latency(s->sink)); } static void source_output_fill_tagstruct(struct pa_tagstruct *t, struct pa_source_output *s) { @@ -1363,6 +1364,7 @@ static void command_flush_or_trigger_playback_stream(struct pa_pdispatch *pd, ui pa_sink_notify(s->sink_input->sink); pa_pstream_send_simple_ack(c->pstream, tag); + request_bytes(s); } /*** pstream callbacks ***/ diff --git a/polyp/tagstruct.c b/polyp/tagstruct.c index 9578a9eb..742f6b9c 100644 --- a/polyp/tagstruct.c +++ b/polyp/tagstruct.c @@ -95,7 +95,7 @@ void pa_tagstruct_puts(struct pa_tagstruct*t, const char *s) { l = strlen(s)+2; extend(t, l); t->data[t->length] = TAG_STRING; - strcpy(t->data+t->length+1, s); + strcpy((char*) (t->data+t->length+1), s); t->length += l; } -- cgit