mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 15:22:11 +02:00
clapper-app: Add command line option to set volume
This commit is contained in:
@@ -60,6 +60,8 @@ struct ClapperPluginData
|
||||
|
||||
struct ClapperAppOptions
|
||||
{
|
||||
gdouble volume;
|
||||
|
||||
gchar *video_filter;
|
||||
gchar *audio_filter;
|
||||
|
||||
@@ -264,7 +266,12 @@ _restore_settings_to_window (ClapperAppApplication *self, ClapperAppWindow *app_
|
||||
if (app_opts.audio_sink)
|
||||
clapper_player_set_audio_sink (player, clapper_app_utils_make_element (app_opts.audio_sink));
|
||||
|
||||
clapper_player_set_volume (player, PERCENTAGE_ROUND (g_settings_get_double (self->settings, "volume")));
|
||||
/* NOTE: Not using ternary operator to avoid accidental typecasting */
|
||||
if (app_opts.volume >= 0)
|
||||
clapper_player_set_volume (player, PERCENTAGE_ROUND (app_opts.volume));
|
||||
else
|
||||
clapper_player_set_volume (player, PERCENTAGE_ROUND (g_settings_get_double (self->settings, "volume")));
|
||||
|
||||
clapper_player_set_mute (player, g_settings_get_boolean (self->settings, "mute"));
|
||||
clapper_player_set_speed (player, PERCENTAGE_ROUND (g_settings_get_double (self->settings, "speed")));
|
||||
clapper_player_set_subtitles_enabled (player, g_settings_get_boolean (self->settings, "subtitles-enabled"));
|
||||
@@ -533,6 +540,8 @@ clapper_app_application_open (GApplication *app,
|
||||
static void
|
||||
clapper_app_application_init (ClapperAppApplication *self)
|
||||
{
|
||||
app_opts.volume = -1;
|
||||
|
||||
self->need_init_state = TRUE;
|
||||
}
|
||||
|
||||
@@ -544,6 +553,7 @@ clapper_app_application_constructed (GObject *object)
|
||||
guint i;
|
||||
|
||||
const GOptionEntry app_options[] = {
|
||||
{ "volume", 0, 0, G_OPTION_ARG_DOUBLE, &app_opts.volume, _("Audio volume to set (0 - 2.0 range)"), NULL },
|
||||
{ "video-filter", 0, 0, G_OPTION_ARG_STRING, &app_opts.video_filter, _("Video filter to use (\"none\" to disable)"), NULL },
|
||||
{ "audio-filter", 0, 0, G_OPTION_ARG_STRING, &app_opts.audio_filter, _("Audio filter to use (\"none\" to disable)"), NULL },
|
||||
{ "video-sink", 0, 0, G_OPTION_ARG_STRING, &app_opts.video_sink, _("Video sink to use"), NULL },
|
||||
|
Reference in New Issue
Block a user