Skip to content

Add audio support and mute option for video playback - #4

Open
sortedcord wants to merge 3 commits into
masterfrom
feat-audio
Open

Add audio support and mute option for video playback#4
sortedcord wants to merge 3 commits into
masterfrom
feat-audio

Conversation

@sortedcord

Copy link
Copy Markdown
Owner

This pull request adds audio playback support for video splash screens in gsplash, allowing video files with audio streams to play sound unless the new --mute flag is provided. It introduces a new AudioPlayer implementation using FFmpeg and SDL2, updates the build system and main program logic to manage audio, and exposes audio-related command-line options.

Audio playback support for video splash screens:

  • Added a new src/audio.c implementation and src/audio.h interface, providing the AudioPlayer struct and functions for initializing, decoding, and cleaning up audio streams using FFmpeg and SDL2 audio subsystems.
  • Updated the Makefile to link against libswresample and include src/audio.c in the build.

Integration with main program:

  • Modified src/gsplash.c to initialize SDL audio, detect video audio streams, and manage an AudioPlayer instance alongside video playback. Audio playback is started automatically unless the new --mute flag is set.
  • Added --mute command-line argument to suppress audio playback and updated the help message accordingly.

Video/audio stream detection:

  • Extended VideoPlayer in src/video.h and src/video.c to track both video and audio stream indices, allowing the main program to determine when audio playback is possible.

Other improvements:

  • Cleaned up and clarified event handling and resource management in the main loop, including pausing audio when the splash window is hidden and ensuring proper cleanup.
  • Update the interactive tests to include video background testing

These changes collectively enable synchronized audio/video splash screens in gsplash, with robust handling and user control over audio playback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant