core: liberalize 99a6a4 a bit

While flags should generally be initialized by passing them to
pa_{sink|source}_new() we make an exception for the volume related flags
which may be initilized afterwards, but before _put().
This commit is contained in:
Lennart Poettering 2009-05-08 02:16:10 +02:00
parent 8d9c26e3b6
commit 7f767e5fe6
2 changed files with 17 additions and 9 deletions

View file

@ -184,12 +184,6 @@ pa_sink* pa_sink_new(
return NULL;
}
if (!(flags & PA_SINK_HW_VOLUME_CTRL))
flags |= PA_SINK_DECIBEL_VOLUME;
if ((flags & PA_SINK_DECIBEL_VOLUME) && core->flat_volumes)
flags |= PA_SINK_FLAT_VOLUME;
s->parent.parent.free = sink_free;
s->parent.process_msg = pa_sink_process_msg;
@ -357,6 +351,16 @@ void pa_sink_put(pa_sink* s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
/* Generally, flags should be initialized via pa_sink_new(). As a
* special exception we allow volume related flags to be set
* between _new() and _put(). */
if (!(s->flags & PA_SINK_HW_VOLUME_CTRL))
s->flags |= PA_SINK_DECIBEL_VOLUME;
if ((s->flags & PA_SINK_DECIBEL_VOLUME) && s->core->flat_volumes)
s->flags |= PA_SINK_FLAT_VOLUME;
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;

View file

@ -174,9 +174,6 @@ pa_source* pa_source_new(
return NULL;
}
if (!(flags & PA_SOURCE_HW_VOLUME_CTRL))
flags |= PA_SOURCE_DECIBEL_VOLUME;
s->parent.parent.free = source_free;
s->parent.process_msg = pa_source_process_msg;
@ -311,6 +308,13 @@ void pa_source_put(pa_source *s) {
pa_assert(s->rtpoll);
pa_assert(s->thread_info.min_latency <= s->thread_info.max_latency);
/* Generally, flags should be initialized via pa_source_new(). As
* a special exception we allow volume related flags to be set
* between _new() and _put(). */
if (!(s->flags & PA_SOURCE_HW_VOLUME_CTRL))
s->flags |= PA_SOURCE_DECIBEL_VOLUME;
s->thread_info.soft_volume = s->soft_volume;
s->thread_info.soft_muted = s->muted;