Gapless as a seamless transition between 2 audio media, this MR is not about cross-fading (not planned for VLC 4.0).
If gapless is enabled and possible, the vlc_player_t will load a new input_thread_t, in gapless mode, near the end of the current input_thread_t.
This input_thead_t in gapless mode will act as a normal input_thread_t except that it will be halted at the end of the buffering, waiting for a signal from the player to resume. The gapless preparation can be cancelled (if the user stop/seek/etc...).
The audio output is also modified to handle gapless. If an aout stream is notified to have a next stream playing (input_thread_t in gapless mode), it won't drain and stop at the end of the current stream.
I fixed the points discussed during the last VLC tech meeting https://code.videolan.org/videolan/vlc/-/wikis/Meetingreports/2020-10-04-VLC-Tech-Meeting-via-videoconf#gapless
- Gapless is only enabled if the input can be paced (Use it only for file-based access: file, smb, nfs...)
- Gapless is only enabled when playing only one audio ES (that drive the block == master)
- It can only work if the reported input time and length are correct