Commit 44c242dd authored by Sébastien Blin's avatar Sébastien Blin

mediasettings: add hardware acceleration support

If a user want to only enable hardware decoding and disable
hardware decoding, they have to change the yml config for
the daemon.

Change-Id: I2335bfa27994218a9d9d221a3735d5b0c013acdc
parent e23740ac
......@@ -77,7 +77,7 @@ struct _MediaSettingsViewPrivate
QMetaObject::Connection audio_meter_connection;
/* hardware accel settings */
GtkWidget *checkbutton_hardware_decoding;
GtkWidget *checkbutton_hardware_acceleration;
details::CppImpl* cpp; ///< Non-UI and C++ only code
};
......@@ -111,8 +111,8 @@ CppImpl::CppImpl(MediaSettingsView& widget, lrc::api::AVModel& avModel)
, avModel_(&avModel)
{
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON(widgets->checkbutton_hardware_decoding),
avModel_->getDecodingAccelerated());
GTK_TOGGLE_BUTTON(widgets->checkbutton_hardware_acceleration),
avModel_->getHardwareAcceleration());
auto activeIdx = 0;
auto currentManager = avModel_->getAudioManager();
......@@ -314,12 +314,12 @@ media_settings_view_dispose(GObject *object)
}
static void
hardware_decoding_toggled(GtkToggleButton *toggle_button, MediaSettingsView *self)
hardware_acceleration_toggled(GtkToggleButton *toggle_button, MediaSettingsView *self)
{
g_return_if_fail(IS_MEDIA_SETTINGS_VIEW(self));
MediaSettingsViewPrivate *priv = MEDIA_SETTINGS_VIEW_GET_PRIVATE(self);
gboolean hardware_decoding = gtk_toggle_button_get_active(toggle_button);
priv->cpp->avModel_->setDecodingAccelerated(hardware_decoding);
gboolean hardware_acceleration = gtk_toggle_button_get_active(toggle_button);
priv->cpp->avModel_->setHardwareAcceleration(hardware_acceleration);
}
static void
......@@ -465,7 +465,7 @@ media_settings_view_class_init(MediaSettingsViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, combobox_channel);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, combobox_resolution);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, combobox_framerate);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, checkbutton_hardware_decoding);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, checkbutton_hardware_acceleration);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, levelbar_input);
}
......@@ -479,8 +479,8 @@ media_settings_view_new(lrc::api::AVModel& avModel)
);
// CppImpl ctor
g_signal_connect(priv->checkbutton_hardware_decoding, "toggled",
G_CALLBACK(hardware_decoding_toggled), self);
g_signal_connect(priv->checkbutton_hardware_acceleration, "toggled",
G_CALLBACK(hardware_acceleration_toggled), self);
g_signal_connect_swapped(priv->combobox_manager, "changed",
G_CALLBACK(set_audio_manager), self);
g_signal_connect_swapped(priv->combobox_ringtone, "changed",
......
......@@ -276,10 +276,10 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label_hardware_decoding">
<object class="GtkLabel" id="label_hardware_acceleration">
<property name="visible">True</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Enable hardware decoding:</property>
<property name="label" translatable="yes">Enable hardware acceleration:</property>
<property name="margin_left">10</property>
</object>
<packing>
......@@ -288,7 +288,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_hardware_decoding">
<object class="GtkCheckButton" id="checkbutton_hardware_acceleration">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment