From 3f2e04955c8cb74910afd459083bff8375350b9c Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Sun, 31 May 2026 18:00:55 +0530 Subject: [PATCH] feat: add --mute option to disable audio playback for videos --- src/gsplash.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gsplash.c b/src/gsplash.c index af2c2ae..41d9e34 100644 --- a/src/gsplash.c +++ b/src/gsplash.c @@ -95,6 +95,7 @@ static void compute_dest_rect(int src_w, int src_h, int out_w, int out_h, int main(int argc, char* argv[]) { RenderMode render_mode = RENDER_CENTER; + bool muted = false; int arg_index = 1; #ifndef GSPLASH_VERSION @@ -115,6 +116,9 @@ int main(int argc, char* argv[]) { } render_mode = parse_render_mode(argv[arg_index + 1]); arg_index += 2; + } else if (strcmp(argv[arg_index], "--mute") == 0) { + muted = true; + arg_index++; } else if (strcmp(argv[arg_index], "--version") == 0 || strcmp(argv[arg_index], "-v") == 0) { printf("gsplash version %s\n", GSPLASH_VERSION); @@ -128,6 +132,7 @@ int main(int argc, char* argv[]) { printf( " -m, --mode=MODE Set render mode: stretch, center (default), " "crop\n"); + printf(" --mute Mute video audio\n"); printf(" -h, --help Show this help message\n"); return 0; } else { @@ -193,7 +198,7 @@ int main(int argc, char* argv[]) { if (has_video_extension(image_path)) { if (init_video_player(&video_player, renderer, image_path)) { video_active = true; - if (video_player.audio_stream_index >= 0) { + if (!muted && video_player.audio_stream_index >= 0) { if (init_audio_player(&audio_player, image_path)) { audio_active = true; log_info("Audio stream loaded and initialized"); @@ -226,7 +231,7 @@ int main(int argc, char* argv[]) { } if (!texture && init_video_player(&video_player, renderer, image_path)) { video_active = true; - if (video_player.audio_stream_index >= 0) { + if (!muted && video_player.audio_stream_index >= 0) { if (init_audio_player(&audio_player, image_path)) { audio_active = true; log_info("Audio stream loaded and initialized");