]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/source-output.c
move flat volume logic into the core. while doing so add n_volume_steps field to...
[pulseaudio] / src / pulsecore / source-output.c
index d4f0367e0360d88dda18c40fd36650fbbcc345e8..204e06ccc7531959c00d73a70a01f4e9331b07ce 100644 (file)
@@ -181,8 +181,6 @@ pa_source_output* pa_source_output_new(
             pa_log_warn("Unsupported resampling operation.");
             return NULL;
         }
-
-        data->resample_method = pa_resampler_get_method(resampler);
     }
 
     o = pa_msgobject_new(pa_source_output);
@@ -198,7 +196,9 @@ pa_source_output* pa_source_output_new(
     o->source = data->source;
     o->client = data->client;
 
-    o->resample_method = data->resample_method;
+
+    o->actual_resample_method = resampler ? pa_resampler_get_method(resampler) : PA_RESAMPLER_INVALID;
+    o->requested_resample_method = data->resample_method;
     o->sample_spec = data->sample_spec;
     o->channel_map = data->channel_map;
 
@@ -628,7 +628,7 @@ pa_bool_t pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t
 pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o) {
     pa_source_output_assert_ref(o);
 
-    return o->resample_method;
+    return o->actual_resample_method;
 }
 
 /* Called from main context */
@@ -685,15 +685,15 @@ int pa_source_output_start_move(pa_source_output *o) {
 
     origin = o->source;
 
-    pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0);
+    pa_idxset_remove_by_data(o->source->outputs, o, NULL);
 
     if (pa_source_output_get_state(o) == PA_SOURCE_OUTPUT_CORKED)
         pa_assert_se(origin->n_corked-- >= 1);
 
-    pa_idxset_remove_by_data(o->source->outputs, o, NULL);
-    o->source = NULL;
+    pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0);
 
-    pa_source_update_status(origin);
+    pa_source_update_status(o->source);
+    o->source = NULL;
 
     return 0;
 }
@@ -707,6 +707,9 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest) {
     pa_assert(!o->source);
     pa_source_assert_ref(dest);
 
+    if (!pa_source_output_may_move_to(o, dest))
+        return -1;
+
     o->source = dest;
     pa_idxset_put(o->source->outputs, o, NULL);
 
@@ -730,7 +733,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest) {
                       o->core->mempool,
                       &dest->sample_spec, &dest->channel_map,
                       &o->sample_spec, &o->channel_map,
-                      o->resample_method,
+                      o->requested_resample_method,
                       ((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
                       ((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
                       (o->core->disable_remixing || (o->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {