When it comes to music, there’s a callback function named Mix_HookMusicFinished, that you pass a function to, and that function will be called when the music playback has halted. I’m not sure that a music playback is specified as halted when it has finished playing though. It might be that the music playback is only specified as halted whenever the user halts it manually.
If it doesn’t work the way you intented, there also a function named Mix_PlayingMusic that returns 1 as long as a music playback is occuring.
When it comes to sounds, there’s a callback function named Mix_ChannelFinished which you can use for this purpose, that you pass the channel that you want to check and it will return true when that channel has stopped playing.