Migrate Player from pw-play to mpv
This commit is contained in:
17
pipewire.cpp
17
pipewire.cpp
@@ -128,10 +128,23 @@ Player::~Player()
|
||||
stop_all();
|
||||
}
|
||||
|
||||
void Player::play_file(const QString& file_path, const QString& target_node/* = "auto" */)
|
||||
void Player::play_file(const QString& file_path,
|
||||
const QString& target_sink/* = "auto" */, float speed/* = 1.0f */)
|
||||
{
|
||||
QString target = target_sink;
|
||||
if (target_sink != "auto") {
|
||||
target = "pipewire/" + target_sink;
|
||||
}
|
||||
|
||||
QStringList args;
|
||||
args << "--vo=null" << "--no-video"
|
||||
<< "--audio-pitch-correction=no"
|
||||
<< "--audio-device=" + target
|
||||
<< "--speed=" + QString::number(speed, 'f', 1)
|
||||
<< file_path;
|
||||
|
||||
auto process = std::make_unique<QProcess>();
|
||||
process->start("pw-play", { "--target", target_node, file_path });
|
||||
process->start("mpv", args);
|
||||
m_playing_processes.push_back(std::move(process));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ class Player
|
||||
public:
|
||||
~Player();
|
||||
|
||||
void play_file(const QString& file_path, const QString& target_node = "auto");
|
||||
void play_file(const QString& file_path,
|
||||
const QString& target_sink = "auto", float speed = 1.0f);
|
||||
void stop_all();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user