lib: media: wait preparse end before release

This is a quick fix for #25296 actually reverting the commit
a708c988, replacing the Hold/Release
lifecycle used there by an ad-hoc Hold/Release which actually defer the
actual release by blocking instead of releasing in the preparser thread.

Indeed, libvlc_media is holding the instance used to create it, though
it only needs it for preparsing. If the last reference of the media is
hold by the preparser, libvlc_media will be released by the preparser
thread and the libvlc_instance potentially released from there too.
Since killing the libvlc_instance will join the preparser thread, it
cannot be done from the preparser thread, or would lead to the failure
detailed in #25296. Written differently, only the final client should
make use of Hold/Release, directly through the adequate function or
indirectly through the creation of new objects.

In addition, a708c988 cannot just be
reverted as it was fixing cases where the libvlc_media_t object were
released before preparsing is finished, and the libvlc application
cannot just wait for the preparsing event to arrive since it must still
typically unlock the event manager and manage subitems.

Ideally, the libvlc_media would just not have a strong reference to the
libvlc instance, which would allow detaching the libvlc state from the
libvlccore state, but it cannot be done just yet, since the preparsing
API must be splitted from libvlc_media first.

Fix #25296
19 jobs for !36 with libvlc/ticket25296/1 in 70 minutes and 50 seconds (queued for 3 seconds)
latest merge request