Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 2b154981 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

MPV: Try to create the MPV context if trying to play and the MPV context is not create

parent e29ec472
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!26MPV: Fix the MPV controls
Pipeline #2502 réussi
......@@ -7,6 +7,12 @@ using namespace std::string_literals;
if ((ptr) == nullptr) \
return
#define TRY_CREATE_MPV(ptr) \
if ((ptr) == nullptr) { \
logInfo() << "Asked to play MPV but context not created, try to create it"; \
reCreateMpvContext(); \
}
void
MpvContainer::mpvEventWakeUpCB(void *user) noexcept
{
......@@ -297,6 +303,7 @@ MpvContainer::printMpvError(int rc) const noexcept
void
MpvContainer::mpvPlay() noexcept
{
TRY_CREATE_MPV(mpv);
RETURN_IF_NULLPTR(mpv);
if (isPlaybackPaused)
mpvTogglePlayback();
......@@ -313,6 +320,7 @@ MpvContainer::mpvPause() noexcept
void
MpvContainer::mpvTogglePlayback() noexcept
{
TRY_CREATE_MPV(mpv);
RETURN_IF_NULLPTR(mpv);
logDebug() << "MPV: Toggling the playback";
asyncCommand(AsyncCmdType::TogglePlayback, { "cycle", "pause", "up", nullptr });
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter