feat: add --mute option to disable audio playback for videos
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user