Fixes #994 - moveoutput: new AudioOutputControl created from copyMoving an output to a partition is now done via MultipleOutputs::AddCopy(),using a new AudioOutputControl constructor. Tags and always_on settings willpersist when moving outputs between partitions.

This commit is contained in:
Stapper 2020-11-13 17:35:36 +01:00
parent 60d19b2380
commit ba5531f9dd
6 changed files with 35 additions and 3 deletions

2
NEWS
View File

@ -1,6 +1,8 @@
ver 0.22.4 (not yet released)
* decoder
- dsdiff: apply padding to odd-sized chunks
* output
- moveoutput: fix always_on and tag lost on move
ver 0.22.3 (2020/11/06)
* playlist

View File

@ -183,9 +183,8 @@ handle_moveoutput(Client &client, Request request, Response &response)
existing_output->ReplaceDummy(output->Steal(),
was_enabled);
else
/* add it to the output list */
dest_partition.outputs.Add(output->Steal(),
was_enabled);
/* copy the AudioOutputControl and add it to the output list */
dest_partition.outputs.AddCopy(output,was_enabled);
instance.EmitIdle(IDLE_OUTPUT);
return CommandResult::OK;

View File

@ -39,6 +39,17 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _out
{
}
AudioOutputControl::AudioOutputControl(AudioOutputControl *_output,
AudioOutputClient &_client) noexcept
:output(std::move(_output->Steal())),
name(output->GetName()),
client(_client),
thread(BIND_THIS_METHOD(Task))
{
tags =_output->tags;
always_on=_output->always_on;
}
AudioOutputControl::~AudioOutputControl() noexcept
{
StopThread();

View File

@ -245,6 +245,9 @@ public:
AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
AudioOutputClient &_client) noexcept;
AudioOutputControl(AudioOutputControl *_outputControl,
AudioOutputClient &_client) noexcept;
~AudioOutputControl() noexcept;
AudioOutputControl(const AudioOutputControl &) = delete;

View File

@ -140,6 +140,19 @@ MultipleOutputs::Add(std::unique_ptr<FilteredAudioOutput> output,
client.ApplyEnabled();
}
void
MultipleOutputs::AddCopy(AudioOutputControl *outputControl,
bool enable) noexcept
{
// TODO: this operation needs to be protected with a mutex
outputs.emplace_back(std::make_unique<AudioOutputControl>(outputControl,
client));
outputs.back()->LockSetEnabled(enable);
client.ApplyEnabled();
}
void
MultipleOutputs::EnableDisable()
{

View File

@ -128,6 +128,10 @@ public:
void Add(std::unique_ptr<FilteredAudioOutput> output,
bool enable) noexcept;
void AddCopy(AudioOutputControl *outputControl,
bool enable) noexcept;
void SetReplayGainMode(ReplayGainMode mode) noexcept;
/**