Skip to content

Commit

Permalink
Merge pull request #44 from ua0lnj/master
Browse files Browse the repository at this point in the history
Fix for vdr-2.7.1. Version 1.7.4.
  • Loading branch information
ua0lnj authored Sep 23, 2024
2 parents ee525d9 + 40d3ff1 commit 82e51ab
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions mpv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "menu_options.h"
#include "mpv_service.h"

static const char *VERSION = "1.7.3"
static const char *VERSION = "1.7.4"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif
Expand Down Expand Up @@ -76,7 +76,12 @@ void cMpvPlugin::PlayFile(string Filename, bool Shuffle)
cControl::Launch(new cMpvControl(Filename.c_str(), Shuffle));
else
{
#if APIVERSNUM < 20402
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
#else
cMutexLock ControlMutexLock;
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
#endif
if(control)
control->PlayNew(Filename.c_str());
}
Expand Down Expand Up @@ -109,11 +114,17 @@ cOsdObject *cMpvPlugin::MainMenuAction(void)

bool cMpvPlugin::Service(const char *id, void *data)
{
#if APIVERSNUM >= 20402
cMutexLock ControlMutexLock;
#endif
if (strcmp(id, "Mpv_Seek") == 0)
{
Mpv_Seek *seekInfo = (Mpv_Seek *)data;

#if APIVERSNUM < 20402
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
#else
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
#endif
if(control)
{
if(seekInfo->SeekRelative != 0)
Expand All @@ -130,7 +141,11 @@ bool cMpvPlugin::Service(const char *id, void *data)
if (strcmp(id, "ScaleVideo") == 0)
{
Mpv_ScaleVideo *scaleVideo = (Mpv_ScaleVideo *)data;
#if APIVERSNUM < 20402
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
#else
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
#endif
if(control)
{
control->ScaleVideo(scaleVideo->x, scaleVideo->y, scaleVideo->width, scaleVideo->height);
Expand All @@ -140,7 +155,11 @@ bool cMpvPlugin::Service(const char *id, void *data)
if (strcmp(id, "GrabImage") == 0)
{
Mpv_GrabImage *grabImage = (Mpv_GrabImage *)data;
#if APIVERSNUM < 20402
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
#else
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
#endif
if(control)
{
grabImage->image = control->GrabImage(&grabImage->size, &grabImage->width, &grabImage->height);
Expand Down

0 comments on commit 82e51ab

Please sign in to comment.