diff options
| author | Lennart Poettering <lennart@poettering.net> | 2009-08-28 23:24:09 +0200 | 
|---|---|---|
| committer | Lennart Poettering <lennart@poettering.net> | 2009-08-28 23:24:09 +0200 | 
| commit | 84eb6614eb3a4c72d9c529948aff8ffd4c534e19 (patch) | |
| tree | 09c9f2816138a117133a9c2627a07f233b60620b /src | |
| parent | 300384ce0aa79bd86cdafa88848c6e944c0353b5 (diff) | |
core: move 'flags' field into 'pa_sink_input_new_data' structure so that hooks can access it
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/module-combine.c | 3 | ||||
| -rw-r--r-- | src/modules/module-ladspa-sink.c | 2 | ||||
| -rw-r--r-- | src/modules/module-loopback.c | 5 | ||||
| -rw-r--r-- | src/modules/module-remap-sink.c | 3 | ||||
| -rw-r--r-- | src/modules/module-sine.c | 2 | ||||
| -rw-r--r-- | src/modules/rtp/module-rtp-recv.c | 3 | ||||
| -rw-r--r-- | src/modules/rtp/module-rtp-send.c | 3 | ||||
| -rw-r--r-- | src/pulsecore/play-memblockq.c | 2 | ||||
| -rw-r--r-- | src/pulsecore/protocol-esound.c | 4 | ||||
| -rw-r--r-- | src/pulsecore/protocol-http.c | 2 | ||||
| -rw-r--r-- | src/pulsecore/protocol-native.c | 6 | ||||
| -rw-r--r-- | src/pulsecore/protocol-simple.c | 4 | ||||
| -rw-r--r-- | src/pulsecore/sink-input.c | 21 | ||||
| -rw-r--r-- | src/pulsecore/sink-input.h | 5 | ||||
| -rw-r--r-- | src/pulsecore/sound-file-stream.c | 2 | ||||
| -rw-r--r-- | src/pulsecore/source-output.c | 21 | ||||
| -rw-r--r-- | src/pulsecore/source-output.h | 5 | 
17 files changed, 50 insertions, 43 deletions
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 4a57ce2d..a186c899 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -844,8 +844,9 @@ static int output_create_sink_input(struct output *o) {      pa_sink_input_new_data_set_channel_map(&data, &o->userdata->sink->channel_map);      data.module = o->userdata->module;      data.resample_method = o->userdata->resample_method; +    data.flags = PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND; -    pa_sink_input_new(&o->sink_input, o->userdata->core, &data, PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND); +    pa_sink_input_new(&o->sink_input, o->userdata->core, &data);      pa_sink_input_new_data_done(&data); diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index aa28f7fd..933fb182 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -812,7 +812,7 @@ int pa__init(pa_module*m) {      pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);      pa_sink_input_new_data_set_channel_map(&sink_input_data, &map); -    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, 0); +    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);      pa_sink_input_new_data_done(&sink_input_data);      if (!u->sink_input) diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index 6e4f66d5..29c3ddab 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -676,8 +676,9 @@ int pa__init(pa_module *m) {      pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "abstract");      pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);      pa_sink_input_new_data_set_channel_map(&sink_input_data, &map); +    sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE; -    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, PA_SINK_INPUT_VARIABLE_RATE); +    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);      pa_sink_input_new_data_done(&sink_input_data);      if (!u->sink_input) @@ -709,7 +710,7 @@ int pa__init(pa_module *m) {      pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);      pa_sink_input_new_data_set_channel_map(&sink_input_data, &map); -    pa_source_output_new(&u->source_output, m->core, &source_output_data, 0); +    pa_source_output_new(&u->source_output, m->core, &source_output_data);      pa_source_output_new_data_done(&source_output_data);      if (!u->source_output) diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c index becff55c..6cfd0d15 100644 --- a/src/modules/module-remap-sink.c +++ b/src/modules/module-remap-sink.c @@ -406,8 +406,9 @@ int pa__init(pa_module*m) {      pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");      pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);      pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map); +    sink_input_data.flags = (remix ? 0 : PA_SINK_INPUT_NO_REMIX); -    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, (remix ? 0 : PA_SINK_INPUT_NO_REMIX)); +    pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);      pa_sink_input_new_data_done(&sink_input_data);      if (!u->sink_input) diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c index 0be1d722..69b20028 100644 --- a/src/modules/module-sine.c +++ b/src/modules/module-sine.c @@ -163,7 +163,7 @@ int pa__init(pa_module*m) {      pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);      pa_sink_input_new_data_set_sample_spec(&data, &ss); -    pa_sink_input_new(&u->sink_input, m->core, &data, 0); +    pa_sink_input_new(&u->sink_input, m->core, &data);      pa_sink_input_new_data_done(&data);      if (!u->sink_input) diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c index c195c045..1a05f57d 100644 --- a/src/modules/rtp/module-rtp-recv.c +++ b/src/modules/rtp/module-rtp-recv.c @@ -501,8 +501,9 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in      pa_proplist_setf(data.proplist, "rtp.payload", "%u", (unsigned) sdp_info->payload);      data.module = u->module;      pa_sink_input_new_data_set_sample_spec(&data, &sdp_info->sample_spec); +    data.flags = PA_SINK_INPUT_VARIABLE_RATE; -    pa_sink_input_new(&s->sink_input, u->module->core, &data, PA_SINK_INPUT_VARIABLE_RATE); +    pa_sink_input_new(&s->sink_input, u->module->core, &data);      pa_sink_input_new_data_done(&data);      if (!s->sink_input) { diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c index f147364d..8e1cfe36 100644 --- a/src/modules/rtp/module-rtp-send.c +++ b/src/modules/rtp/module-rtp-send.c @@ -330,8 +330,9 @@ int pa__init(pa_module*m) {      data.source = s;      pa_source_output_new_data_set_sample_spec(&data, &ss);      pa_source_output_new_data_set_channel_map(&data, &cm); +    data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; -    pa_source_output_new(&o, m->core, &data, PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND); +    pa_source_output_new(&o, m->core, &data);      pa_source_output_new_data_done(&data);      if (!o) { diff --git a/src/pulsecore/play-memblockq.c b/src/pulsecore/play-memblockq.c index b0d76993..f528c496 100644 --- a/src/pulsecore/play-memblockq.c +++ b/src/pulsecore/play-memblockq.c @@ -199,7 +199,7 @@ pa_sink_input* pa_memblockq_sink_input_new(      pa_sink_input_new_data_set_volume(&data, volume);      pa_proplist_update(data.proplist, PA_UPDATE_REPLACE, p); -    pa_sink_input_new(&u->sink_input, sink->core, &data, 0); +    pa_sink_input_new(&u->sink_input, sink->core, &data);      pa_sink_input_new_data_done(&data);      if (!u->sink_input) diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index cfbaee6f..480af6d5 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -429,7 +429,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void      sdata.sink = sink;      pa_sink_input_new_data_set_sample_spec(&sdata, &ss); -    pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata, 0); +    pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata);      pa_sink_input_new_data_done(&sdata);      CHECK_VALIDITY(c->sink_input, "Failed to create sink input."); @@ -525,7 +525,7 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi      sdata.source = source;      pa_source_output_new_data_set_sample_spec(&sdata, &ss); -    pa_source_output_new(&c->source_output, c->protocol->core, &sdata, 0); +    pa_source_output_new(&c->source_output, c->protocol->core, &sdata);      pa_source_output_new_data_done(&sdata);      CHECK_VALIDITY(c->source_output, "Failed to create source output."); diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c index 5220cc91..c09e5348 100644 --- a/src/pulsecore/protocol-http.c +++ b/src/pulsecore/protocol-http.c @@ -533,7 +533,7 @@ static void handle_listen_prefix(struct connection *c, const char *source_name)      pa_source_output_new_data_set_sample_spec(&data, &ss);      pa_source_output_new_data_set_channel_map(&data, &cm); -    pa_source_output_new(&c->source_output, c->protocol->core, &data, 0); +    pa_source_output_new(&c->source_output, c->protocol->core, &data);      pa_source_output_new_data_done(&data);      if (!c->source_output) { diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 956767ad..4bf5b3f9 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -648,8 +648,9 @@ static record_stream* record_stream_new(      pa_source_output_new_data_set_channel_map(&data, map);      if (peak_detect)          data.resample_method = PA_RESAMPLER_PEAKS; +    data.flags = flags; -    *ret = -pa_source_output_new(&source_output, c->protocol->core, &data, flags); +    *ret = -pa_source_output_new(&source_output, c->protocol->core, &data);      pa_source_output_new_data_done(&data); @@ -1050,8 +1051,9 @@ static playback_stream* playback_stream_new(      if (muted_set)          pa_sink_input_new_data_set_muted(&data, muted);      data.sync_base = ssync ? ssync->sink_input : NULL; +    data.flags = flags; -    *ret = -pa_sink_input_new(&sink_input, c->protocol->core, &data, flags); +    *ret = -pa_sink_input_new(&sink_input, c->protocol->core, &data);      pa_sink_input_new_data_done(&data); diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c index 488d7572..d66db4b7 100644 --- a/src/pulsecore/protocol-simple.c +++ b/src/pulsecore/protocol-simple.c @@ -541,7 +541,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp          pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist);          pa_sink_input_new_data_set_sample_spec(&data, &o->sample_spec); -        pa_sink_input_new(&c->sink_input, p->core, &data, 0); +        pa_sink_input_new(&c->sink_input, p->core, &data);          pa_sink_input_new_data_done(&data);          if (!c->sink_input) { @@ -593,7 +593,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp          pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist);          pa_source_output_new_data_set_sample_spec(&data, &o->sample_spec); -        pa_source_output_new(&c->source_output, p->core, &data, 0); +        pa_source_output_new(&c->source_output, p->core, &data);          pa_source_output_new_data_done(&data);          if (!c->source_output) { diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 484421bb..d3e7a45c 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -134,8 +134,7 @@ static void reset_callbacks(pa_sink_input *i) {  int pa_sink_input_new(          pa_sink_input **_i,          pa_core *core, -        pa_sink_input_new_data *data, -        pa_sink_input_flags_t flags) { +        pa_sink_input_new_data *data) {      pa_sink_input *i;      pa_resampler *resampler = NULL; @@ -198,15 +197,15 @@ int pa_sink_input_new(      if (!data->muted_is_set)          data->muted = FALSE; -    if (flags & PA_SINK_INPUT_FIX_FORMAT) +    if (data->flags & PA_SINK_INPUT_FIX_FORMAT)          data->sample_spec.format = data->sink->sample_spec.format; -    if (flags & PA_SINK_INPUT_FIX_RATE) +    if (data->flags & PA_SINK_INPUT_FIX_RATE)          data->sample_spec.rate = data->sink->sample_spec.rate;      original_cm = data->channel_map; -    if (flags & PA_SINK_INPUT_FIX_CHANNELS) { +    if (data->flags & PA_SINK_INPUT_FIX_CHANNELS) {          data->sample_spec.channels = data->sink->sample_spec.channels;          data->channel_map = data->sink->channel_map;      } @@ -225,7 +224,7 @@ int pa_sink_input_new(      if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], data)) < 0)          return r; -    if ((flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) && +    if ((data->flags & PA_SINK_INPUT_NO_CREATE_ON_SUSPEND) &&          pa_sink_get_state(data->sink) == PA_SINK_SUSPENDED) {          pa_log_warn("Failed to create sink input: sink is suspended.");          return -PA_ERR_BADSTATE; @@ -236,7 +235,7 @@ int pa_sink_input_new(          return -PA_ERR_TOOLARGE;      } -    if ((flags & PA_SINK_INPUT_VARIABLE_RATE) || +    if ((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ||          !pa_sample_spec_equal(&data->sample_spec, &data->sink->sample_spec) ||          !pa_channel_map_equal(&data->channel_map, &data->sink->channel_map)) { @@ -245,9 +244,9 @@ int pa_sink_input_new(                        &data->sample_spec, &data->channel_map,                        &data->sink->sample_spec, &data->sink->channel_map,                        data->resample_method, -                      ((flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | -                      ((flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | -                      (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) | +                      ((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | +                      ((data->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | +                      (core->disable_remixing || (data->flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |                        (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {              pa_log_warn("Unsupported resampling operation.");              return -PA_ERR_NOTSUPPORTED; @@ -260,7 +259,7 @@ int pa_sink_input_new(      i->core = core;      i->state = PA_SINK_INPUT_INIT; -    i->flags = flags; +    i->flags = data->flags;      i->proplist = pa_proplist_copy(data->proplist);      i->driver = pa_xstrdup(pa_path_get_filename(data->driver));      i->module = data->module; diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 06e9e4f2..59eabe36 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -256,6 +256,8 @@ typedef struct pa_sink_input_send_event_hook_data {  } pa_sink_input_send_event_hook_data;  typedef struct pa_sink_input_new_data { +    pa_sink_input_flags_t flags; +      pa_proplist *proplist;      const char *driver; @@ -298,8 +300,7 @@ void pa_sink_input_new_data_done(pa_sink_input_new_data *data);  int pa_sink_input_new(          pa_sink_input **i,          pa_core *core, -        pa_sink_input_new_data *data, -        pa_sink_input_flags_t flags); +        pa_sink_input_new_data *data);  void pa_sink_input_put(pa_sink_input *i);  void pa_sink_input_unlink(pa_sink_input* i); diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c index c4b4d1a5..16de4923 100644 --- a/src/pulsecore/sound-file-stream.c +++ b/src/pulsecore/sound-file-stream.c @@ -311,7 +311,7 @@ int pa_play_file(      pa_proplist_sets(data.proplist, PA_PROP_MEDIA_FILENAME, fname);      pa_sndfile_init_proplist(u->sndfile, data.proplist); -    pa_sink_input_new(&u->sink_input, sink->core, &data, 0); +    pa_sink_input_new(&u->sink_input, sink->core, &data);      pa_sink_input_new_data_done(&data);      if (!u->sink_input) diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 43733400..1509807b 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -101,8 +101,7 @@ static void reset_callbacks(pa_source_output *o) {  int pa_source_output_new(          pa_source_output**_o,          pa_core *core, -        pa_source_output_new_data *data, -        pa_source_output_flags_t flags) { +        pa_source_output_new_data *data) {      pa_source_output *o;      pa_resampler *resampler = NULL; @@ -146,13 +145,13 @@ int pa_source_output_new(      pa_return_val_if_fail(pa_channel_map_valid(&data->channel_map), -PA_ERR_INVALID);      pa_return_val_if_fail(pa_channel_map_compatible(&data->channel_map, &data->sample_spec), -PA_ERR_INVALID); -    if (flags & PA_SOURCE_OUTPUT_FIX_FORMAT) +    if (data->flags & PA_SOURCE_OUTPUT_FIX_FORMAT)          data->sample_spec.format = data->source->sample_spec.format; -    if (flags & PA_SOURCE_OUTPUT_FIX_RATE) +    if (data->flags & PA_SOURCE_OUTPUT_FIX_RATE)          data->sample_spec.rate = data->source->sample_spec.rate; -    if (flags & PA_SOURCE_OUTPUT_FIX_CHANNELS) { +    if (data->flags & PA_SOURCE_OUTPUT_FIX_CHANNELS) {          data->sample_spec.channels = data->source->sample_spec.channels;          data->channel_map = data->source->channel_map;      } @@ -168,7 +167,7 @@ int pa_source_output_new(      if ((r = pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], data)) < 0)          return r; -    if ((flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) && +    if ((data->flags & PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND) &&          pa_source_get_state(data->source) == PA_SOURCE_SUSPENDED) {          pa_log("Failed to create source output: source is suspended.");          return -PA_ERR_BADSTATE; @@ -179,7 +178,7 @@ int pa_source_output_new(          return -PA_ERR_TOOLARGE;      } -    if ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) || +    if ((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ||          !pa_sample_spec_equal(&data->sample_spec, &data->source->sample_spec) ||          !pa_channel_map_equal(&data->channel_map, &data->source->channel_map)) { @@ -188,9 +187,9 @@ int pa_source_output_new(                        &data->source->sample_spec, &data->source->channel_map,                        &data->sample_spec, &data->channel_map,                        data->resample_method, -                      ((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | -                      ((flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | -                      (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) | +                      ((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) | +                      ((data->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) | +                      (core->disable_remixing || (data->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |                        (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {              pa_log_warn("Unsupported resampling operation.");              return -PA_ERR_NOTSUPPORTED; @@ -203,7 +202,7 @@ int pa_source_output_new(      o->core = core;      o->state = PA_SOURCE_OUTPUT_INIT; -    o->flags = flags; +    o->flags = data->flags;      o->proplist = pa_proplist_copy(data->proplist);      o->driver = pa_xstrdup(pa_path_get_filename(data->driver));      o->module = data->module; diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index aca9ddf2..273b78fc 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -201,6 +201,8 @@ typedef struct pa_source_output_send_event_hook_data {  } pa_source_output_send_event_hook_data;  typedef struct pa_source_output_new_data { +    pa_source_output_flags_t flags; +      pa_proplist *proplist;      pa_sink_input *direct_on_input; @@ -231,8 +233,7 @@ void pa_source_output_new_data_done(pa_source_output_new_data *data);  int pa_source_output_new(          pa_source_output**o,          pa_core *core, -        pa_source_output_new_data *data, -        pa_source_output_flags_t flags); +        pa_source_output_new_data *data);  void pa_source_output_put(pa_source_output *o);  void pa_source_output_unlink(pa_source_output*o);  | 
