Skip to content

Commit eaadde8

Browse files
authored
Merge pull request #16 from ua0lnj/master
Added "-c gpuctx" option for GPU context. Now you must use "-c x11" i…
2 parents 84bcea7 + a2f3f6c commit eaadde8

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

README

+11-5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ Command line arguments
5757
The hwdec which are used by mpv, this is directly passed as hwdec
5858
to mpv. For latest mpv use -h gpu (also see -g parameter)
5959

60+
-c gpuctx
61+
mpv --gpu-context (Default: auto)
62+
The GPU context (auto, x11, drm, x11egl).
63+
64+
It is best to set "-v gpu -h auto".
65+
Set "-v gpu -h cuda -c x11" for use cuda with X11 and GLX. Latest mpv set X11 GLX deprecated, you need configure mpv with --enable-gl-x11.
66+
Set "-v gpu -h auto -c drm" for use drm output and hardware decoder without X11.
67+
Set "-v vdpau -h vdpau -c x11" for use vpdau with X11 and GLX.
68+
Set "-v vaapi -h vaapi -c x11" for use vaapi with X11 and GLX, GLX is slower in Intel than EGL.
69+
Set "-v gpu -h vaapi-copy" for use vaapi with X11 and EGL.
70+
6071
-d device
6172
optical disc device (Default: /dev/dvd)
6273
The device which is used for playback of optical media
@@ -90,11 +101,7 @@ Command line arguments
90101
-w
91102
windowed mode, not fullscreen
92103

93-
-g
94104
-g geometry
95-
normally mpv use EGL for hwdec=gpu and can not works with X11, if this parameter is set
96-
mpv use GLX for hwdec=gpu and can works with X11.
97-
Latest mpv set X11 GLX deprecated, you need configure mpv with --enable-gl-x11.
98105
You can set X11 geometry with this parameter [W[xH]][+-x+-y][/WS] or x:y.
99106
But size of OSD get from softhddevice geometry!!!
100107

@@ -195,4 +202,3 @@ SVDRP commands
195202
--------------
196203

197204
PLAY filename play given filename
198-

config.c

+7-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cMpvPluginConfig::cMpvPluginConfig()
3232
RefreshRate = 0;
3333
VideoOut = "vdpau";
3434
HwDec = "vdpau";
35-
UseGlx = 0;
35+
GpuCtx = "auto";
3636
AudioOut = "alsa:device=default";
3737
DiscDevice = "/dev/dvd";
3838
Languages = "deu,de,ger,eng,en";
@@ -72,7 +72,7 @@ int cMpvPluginConfig::ProcessArgs(int argc, char *const argv[])
7272

7373
for (;;)
7474
{
75-
switch (getopt(argc, argv, "a:v:h:d:b:l:x:rm:swg:"))
75+
switch (getopt(argc, argv, "a:v:h:c:d:b:l:x:rm:swg:"))
7676
{
7777
case 'a': // audio out
7878
AudioOut = optarg;
@@ -83,6 +83,9 @@ int cMpvPluginConfig::ProcessArgs(int argc, char *const argv[])
8383
case 'h': // hwdec-codecs
8484
HwDec = optarg;
8585
continue;
86+
case 'c': // gpu-context
87+
GpuCtx = optarg;
88+
continue;
8689
case 'd': // dvd-device
8790
DiscDevice = optarg;
8891
continue;
@@ -107,21 +110,15 @@ int cMpvPluginConfig::ProcessArgs(int argc, char *const argv[])
107110
case 'w':
108111
Windowed = 1;
109112
continue;
110-
case 'g': // glx with x11 and geometry
113+
case 'g':
111114
Geometry = optarg;
112-
UseGlx = 1;
113115
continue;
114116
case EOF:
115117
break;
116118
case ':':
117119
esyslog("[mpv]: missing argument for option '%c'\n", optopt);
118120
return 0;
119121
default:
120-
if (optopt == 'g') //glx with x11
121-
{
122-
UseGlx = 1;
123-
continue;
124-
}
125122
esyslog("[mpv]: unknown option '%c'\n", optopt);
126123
return 0;
127124
}
@@ -144,6 +141,7 @@ const char *cMpvPluginConfig::CommandLineHelp(void)
144141
" -a audio\tmpv --ao (Default: alsa:device=default)\n"
145142
" -v video\tmpv --vo (Default: vdpau)\n"
146143
" -h hwdec\tmpv --hwdec-codecs (Default: vdpau)\n"
144+
" -c gpuctx\tmpv --gpu-context (Default: auto)\n"
147145
" -d device\tmpv optical disc device (Default: /dev/dvd)\n"
148146
" -l languages\tlanguages for audio and subtitles (Default: deu,de,ger,eng,en)\n"
149147
" -b /dir\tbrowser root directory\n"
@@ -154,7 +152,6 @@ const char *cMpvPluginConfig::CommandLineHelp(void)
154152
#endif
155153
" -m text\ttext displayed in VDR main menu (Default: MPV)\n"
156154
" -s\t\tdon't load mpv LUA scripts\n"
157-
" -g\t\tuse GLX with X11\n"
158155
" -g geometry\t X11 geometry [W[xH]][+-x+-y][/WS] or x:y\n"
159156
;
160157
}

config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class cMpvPluginConfig
4848
int RefreshRate; // enable modeline switching
4949
string VideoOut; // video out device
5050
string HwDec; // hwdec codecs
51-
int UseGlx; // enable use GLX with X11, because mpv use EGL by default.
51+
string GpuCtx; // gpu context
5252
string AudioOut; // audio out device
5353
string DiscDevice; // optical disc device
5454
string Languages; // language string for audio and subtitle TODO move to Setup menu

mpv.c

+1-1
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.0.1"
22+
static const char *VERSION = "1.1.0"
2323
#ifdef GIT_REV
2424
"-GIT" GIT_REV
2525
#endif

player.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,7 @@ void cMpvPlayer::PlayerStart()
397397

398398
check_error(mpv_set_option_string(hMpv, "vo", MpvPluginConfig->VideoOut.c_str()));
399399
check_error(mpv_set_option_string(hMpv, "hwdec", MpvPluginConfig->HwDec.c_str()));
400-
if (MpvPluginConfig->UseGlx)
401-
{
402-
check_error(mpv_set_option_string(hMpv, "gpu-context", "x11"));
403-
}
400+
check_error(mpv_set_option_string(hMpv, "gpu-context", MpvPluginConfig->GpuCtx.c_str()));
404401
if (strcmp(MpvPluginConfig->Geometry.c_str(),""))
405402
{
406403
check_error(mpv_set_option_string(hMpv, "geometry", MpvPluginConfig->Geometry.c_str()));

0 commit comments

Comments
 (0)