ytdl_hook: fix default track for single format
Only matters when configuring ytdl_hook with all_formats=yes.
Tracks are marked as default tracks based on what yt-dlp/youtube-dl returns in the field requested_formats.
The problem is that this field only exists when there is more then one requested format.
So ytdl-format=bestvideo+bestaudio would have that field, but ytdl-format=bestaudio would not, leading to no tracks being marked as default tracks.
The requested formats can also be found under requested_downloads, which exists regardless of the number of requested formats. However when there is more then one requested format, requested_downloads doesn't contain those formats directly and instead has a field requested_formats that is identical to the other requested_formats.
Therefore use requested_downloads as a fallback for when requested_formats doesn't exist.
So ytdl-format=bestvideo+bestaudio would apply, but ytdl-format=bestaudio would not.
Do you have a handy link that shows this? Random links I've tried work as expected for me with just bestaudio (i.e. they only play audio).
I should have probably mentioned somewhere that this only really makes a difference when using all_formats=yes of the ytdl_hook. Without that there is only one audio track and thus the default flag for the track doesn't change which track gets chosen.
mpv --no-config --script-opts=ytdl_hook-all_formats=yes --ytdl-format=251 'https://www.youtube.com/watch?v=bJbAFfMp52g'
mpv --no-config --script-opts=ytdl_hook-all_formats=yes --ytdl-format=140 'https://www.youtube.com/watch?v=bJbAFfMp52g'
Both end up playing the same audio track without this PR.