output/Control: pass rvalue reference to move constructor
This commit is contained in:
parent
5ad53a7554
commit
f0d66bf6a6
@ -186,7 +186,8 @@ handle_moveoutput(Client &client, Request request, Response &response)
|
||||
was_enabled);
|
||||
else
|
||||
/* copy the AudioOutputControl and add it to the output list */
|
||||
dest_partition.outputs.AddCopy(output,was_enabled);
|
||||
dest_partition.outputs.AddMoveFrom(std::move(*output),
|
||||
was_enabled);
|
||||
|
||||
instance.EmitIdle(IDLE_OUTPUT);
|
||||
return CommandResult::OK;
|
||||
|
@ -41,15 +41,15 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _out
|
||||
{
|
||||
}
|
||||
|
||||
AudioOutputControl::AudioOutputControl(AudioOutputControl *_output,
|
||||
AudioOutputControl::AudioOutputControl(AudioOutputControl &&src,
|
||||
AudioOutputClient &_client) noexcept
|
||||
:output(_output->Steal()),
|
||||
:output(src.Steal()),
|
||||
name(output->GetName()),
|
||||
client(_client),
|
||||
thread(BIND_THIS_METHOD(Task))
|
||||
{
|
||||
tags =_output->tags;
|
||||
always_on=_output->always_on;
|
||||
tags = src.tags;
|
||||
always_on = src.always_on;
|
||||
}
|
||||
|
||||
AudioOutputControl::~AudioOutputControl() noexcept
|
||||
|
@ -252,7 +252,11 @@ public:
|
||||
AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _output,
|
||||
AudioOutputClient &_client) noexcept;
|
||||
|
||||
AudioOutputControl(AudioOutputControl *_outputControl,
|
||||
/**
|
||||
* Move the contents of an existing instance, and convert that
|
||||
* existing instance to a "dummy" output.
|
||||
*/
|
||||
AudioOutputControl(AudioOutputControl &&src,
|
||||
AudioOutputClient &_client) noexcept;
|
||||
|
||||
~AudioOutputControl() noexcept;
|
||||
|
@ -143,11 +143,12 @@ MultipleOutputs::Add(std::unique_ptr<FilteredAudioOutput> output,
|
||||
}
|
||||
|
||||
void
|
||||
MultipleOutputs::AddCopy(AudioOutputControl *outputControl,
|
||||
bool enable) noexcept
|
||||
MultipleOutputs::AddMoveFrom(AudioOutputControl &&src,
|
||||
bool enable) noexcept
|
||||
{
|
||||
// TODO: this operation needs to be protected with a mutex
|
||||
outputs.push_back(std::make_unique<AudioOutputControl>(outputControl, client));
|
||||
outputs.push_back(std::make_unique<AudioOutputControl>(std::move(src),
|
||||
client));
|
||||
|
||||
outputs.back()->LockSetEnabled(enable);
|
||||
|
||||
|
@ -128,8 +128,8 @@ public:
|
||||
void Add(std::unique_ptr<FilteredAudioOutput> output,
|
||||
bool enable) noexcept;
|
||||
|
||||
void AddCopy(AudioOutputControl *outputControl,
|
||||
bool enable) noexcept;
|
||||
void AddMoveFrom(AudioOutputControl &&src,
|
||||
bool enable) noexcept;
|
||||
|
||||
|
||||
void SetReplayGainMode(ReplayGainMode mode) noexcept;
|
||||
|
Loading…
Reference in New Issue
Block a user