Add option to turn off playbin3

This commit is contained in:
Jonas Kvinge
2025-04-08 21:19:15 +02:00
parent b66c0f5573
commit 71287dd77e
8 changed files with 42 additions and 14 deletions

View File

@@ -46,6 +46,7 @@ using namespace Qt::Literals::StringLiterals;
EngineBase::EngineBase(QObject *parent)
: QObject(parent),
playbin3_enabled_(true),
exclusive_mode_(false),
volume_control_(true),
volume_(100),
@@ -156,6 +157,8 @@ void EngineBase::ReloadSettings() {
device_ = s.value(BackendSettings::kDevice);
}
playbin3_enabled_ = s.value(BackendSettings::kPlaybin3, true).toBool();
exclusive_mode_ = s.value(BackendSettings::kExclusiveMode, false).toBool();
volume_control_ = s.value(BackendSettings::kVolumeControl, true).toBool();

View File

@@ -176,6 +176,7 @@ class EngineBase : public QObject {
void Finished();
protected:
bool playbin3_enabled_;
bool exclusive_mode_;
bool volume_control_;
uint volume_;

View File

@@ -899,6 +899,7 @@ GstEnginePipelinePtr GstEngine::CreatePipeline() {
GstEnginePipelinePtr pipeline = GstEnginePipelinePtr(new GstEnginePipeline);
pipeline->set_output_device(output_, device_);
pipeline->set_playbin3_enabled(playbin3_enabled_);
pipeline->set_exclusive_mode(exclusive_mode_);
pipeline->set_volume_enabled(volume_control_);
pipeline->set_stereo_balancer_enabled(stereo_balancer_enabled_);

View File

@@ -103,6 +103,7 @@ GstEnginePipeline::GstEnginePipeline(QObject *parent)
id_(sId++),
playbin3_support_(false),
volume_full_range_support_(false),
playbin3_enabled_(true),
exclusive_mode_(false),
volume_enabled_(true),
fading_enabled_(false),
@@ -221,6 +222,10 @@ void GstEnginePipeline::set_output_device(const QString &output, const QVariant
}
void GstEnginePipeline::set_playbin3_enabled(const bool playbin3_enabled) {
playbin3_enabled_ = playbin3_enabled;
}
void GstEnginePipeline::set_exclusive_mode(const bool exclusive_mode) {
exclusive_mode_ = exclusive_mode;
}
@@ -450,7 +455,9 @@ bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_ur
end_offset_nanosec_ = end_offset_nanosec;
ebur128_loudness_normalizing_gain_db_ = ebur128_loudness_normalizing_gain_db;
pipeline_ = CreateElement(playbin3_support_ ? u"playbin3"_s : u"playbin"_s, u"pipeline"_s, nullptr, error);
const QString playbin_name = playbin3_support_ && playbin3_enabled_ ? u"playbin3"_s : u"playbin"_s;
qLog(Debug) << "Using" << playbin_name << "for pipeline";
pipeline_ = CreateElement(playbin_name, u"pipeline"_s, nullptr, error);
if (!pipeline_) return false;
pad_added_cb_id_ = CHECKED_GCONNECT(G_OBJECT(pipeline_), "pad-added", &PadAddedCallback, this);

View File

@@ -65,6 +65,7 @@ class GstEnginePipeline : public QObject {
// Call these setters before Init
void set_output_device(const QString &output, const QVariant &device);
void set_playbin3_enabled(const bool playbin3_enabled);
void set_exclusive_mode(const bool exclusive_mode);
void set_volume_enabled(const bool enabled);
void set_stereo_balancer_enabled(const bool enabled);
@@ -219,6 +220,8 @@ class GstEnginePipeline : public QObject {
bool playbin3_support_;
bool volume_full_range_support_;
bool playbin3_enabled_;
// General settings for the pipeline
QString output_;
QVariant device_;