Skip to content

Commit 40d3ff1

Browse files
committed
Fix for vdr-2.7.1. Version 1.7.4.
1 parent c1be4c8 commit 40d3ff1

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

mpv.c

+21-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "menu_options.h"
2020
#include "mpv_service.h"
2121

22-
static const char *VERSION = "1.7.3"
22+
static const char *VERSION = "1.7.4"
2323
#ifdef GIT_REV
2424
"-GIT" GIT_REV
2525
#endif
@@ -76,7 +76,12 @@ void cMpvPlugin::PlayFile(string Filename, bool Shuffle)
7676
cControl::Launch(new cMpvControl(Filename.c_str(), Shuffle));
7777
else
7878
{
79+
#if APIVERSNUM < 20402
7980
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
81+
#else
82+
cMutexLock ControlMutexLock;
83+
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
84+
#endif
8085
if(control)
8186
control->PlayNew(Filename.c_str());
8287
}
@@ -109,11 +114,17 @@ cOsdObject *cMpvPlugin::MainMenuAction(void)
109114

110115
bool cMpvPlugin::Service(const char *id, void *data)
111116
{
117+
#if APIVERSNUM >= 20402
118+
cMutexLock ControlMutexLock;
119+
#endif
112120
if (strcmp(id, "Mpv_Seek") == 0)
113121
{
114122
Mpv_Seek *seekInfo = (Mpv_Seek *)data;
115-
123+
#if APIVERSNUM < 20402
116124
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
125+
#else
126+
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
127+
#endif
117128
if(control)
118129
{
119130
if(seekInfo->SeekRelative != 0)
@@ -130,7 +141,11 @@ bool cMpvPlugin::Service(const char *id, void *data)
130141
if (strcmp(id, "ScaleVideo") == 0)
131142
{
132143
Mpv_ScaleVideo *scaleVideo = (Mpv_ScaleVideo *)data;
144+
#if APIVERSNUM < 20402
133145
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
146+
#else
147+
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
148+
#endif
134149
if(control)
135150
{
136151
control->ScaleVideo(scaleVideo->x, scaleVideo->y, scaleVideo->width, scaleVideo->height);
@@ -140,7 +155,11 @@ bool cMpvPlugin::Service(const char *id, void *data)
140155
if (strcmp(id, "GrabImage") == 0)
141156
{
142157
Mpv_GrabImage *grabImage = (Mpv_GrabImage *)data;
158+
#if APIVERSNUM < 20402
143159
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(true));
160+
#else
161+
cMpvControl* control = dynamic_cast<cMpvControl*>(cControl::Control(ControlMutexLock, true));
162+
#endif
144163
if(control)
145164
{
146165
grabImage->image = control->GrabImage(&grabImage->size, &grabImage->width, &grabImage->height);

0 commit comments

Comments
 (0)