99#include <locale.h>
1010#include <string>
1111#include <vector>
12+ #include <vdr/plugin.h>
1213
1314#include "player.h"
1415#include "config.h"
@@ -49,6 +50,7 @@ xcb_connection_t *Connect = NULL;
4950xcb_window_t VideoWindow = 0 ;
5051xcb_pixmap_t pixmap = XCB_NONE ;
5152xcb_cursor_t cursor = XCB_NONE ;
53+ int is_softhddevice = 0 ;
5254
5355#ifdef __cplusplus
5456extern "C"
@@ -70,6 +72,26 @@ static inline void check_error(int status)
7072 }
7173}
7274
75+ void set_deinterlace (mpv_handle * h )
76+ {
77+ if (strstr (MpvPluginConfig -> HwDec .c_str (),"vaapi" ))
78+ {
79+ check_error (mpv_set_option_string (h , "vf" , "vavpp=deint=auto" ));
80+ }
81+ else if (strstr (MpvPluginConfig -> HwDec .c_str (),"vdpau" ))
82+ {
83+ check_error (mpv_set_option_string (h , "vf" , "vdpaupp=deint=yes:deint-mode=temporal-spatial" ));
84+ }
85+ else if (strstr (MpvPluginConfig -> HwDec .c_str (),"cuda" ))
86+ {
87+ check_error (mpv_set_option_string (h , "vd-lavc-o" , "deint=adaptive" ));
88+ }
89+ else
90+ {
91+ check_error (mpv_set_option_string (h , "deinterlace" , "yes" ));
92+ }
93+ }
94+
7395void * cMpvPlayer ::XEventThread (void * handle )
7496{
7597 XEvent event ;
@@ -88,25 +110,30 @@ void *cMpvPlayer::XEventThread(void *handle)
88110 XWindowEvent (Dpy , VideoWindow , KeyPressMask |ButtonPressMask |StructureNotifyMask |SubstructureNotifyMask , & event );
89111 switch (event .type ) {
90112 case ButtonPress :
91- if (event .xbutton .button == 1 ) {
92- Time difftime = event .xbutton .time - clicktime ;
93- if (difftime < 500 ) {
94- check_error (mpv_set_option_string (Player -> hMpv , "fullscreen" , toggle ? "yes" : "no" ));
95- toggle = !toggle ;
113+ if (is_softhddevice ) {
114+ if (event .xbutton .button == 1 ) {
115+ Time difftime = event .xbutton .time - clicktime ;
116+ if (difftime < 500 ) {
117+ check_error (mpv_set_option_string (Player -> hMpv , "fullscreen" , toggle ? "yes" : "no" ));
118+ toggle = !toggle ;
119+ }
120+ clicktime = event .xbutton .time ;
96121 }
97- clicktime = event .xbutton .time ;
98- }
99- else if (event .xbutton .button == 2 ) {
100- FeedKeyPress ("XKeySym" , "Ok" , 0 , 0 , NULL );
101- }
102- else if (event .xbutton .button == 3 ) {
103- FeedKeyPress ("XKeySym" , "Menu" , 0 , 0 , NULL );
104- }
105- if (event .xbutton .button == 4 ) {
106- FeedKeyPress ("XKeySym" , "Volume+" , 0 , 0 , NULL );
107- }
108- if (event .xbutton .button == 5 ) {
109- FeedKeyPress ("XKeySym" , "Volume-" , 0 , 0 , NULL );
122+ else if (event .xbutton .button == 2 ) {
123+ FeedKeyPress ("XKeySym" , "Ok" , 0 , 0 , NULL );
124+ }
125+ else if (event .xbutton .button == 3 ) {
126+ FeedKeyPress ("XKeySym" , "Menu" , 0 , 0 , NULL );
127+ }
128+ if (event .xbutton .button == 4 ) {
129+ FeedKeyPress ("XKeySym" , "Volume+" , 0 , 0 , NULL );
130+ }
131+ if (event .xbutton .button == 5 ) {
132+ FeedKeyPress ("XKeySym" , "Volume-" , 0 , 0 , NULL );
133+ }
134+ } else {
135+ check_error (mpv_set_option_string (Player -> hMpv , "fullscreen" , toggle ? "yes" : "no" ));
136+ toggle = !toggle ;
110137 }
111138 break ;
112139 case ButtonRelease :
@@ -194,6 +221,7 @@ void *cMpvPlayer::ObserverThread(void *handle)
194221 case MPV_EVENT_PLAYBACK_RESTART :
195222 Player -> ChangeFrameRate (Player -> CurrentFps ()); // switching directly after the fps event causes black screen
196223 Player -> PlayerIdle = 0 ;
224+ if (MpvPluginConfig -> UseDeinterlace && !Player -> Image ()) set_deinterlace (Player -> hMpv );
197225 break ;
198226
199227 case MPV_EVENT_LOG_MESSAGE :
@@ -517,6 +545,7 @@ void cMpvPlayer::PlayerStart()
517545 PlayerIdle = 0 ;
518546 PlayerSpeed = 1 ;
519547 PlayerDiscNav = 0 ;
548+ isImage = 0 ;
520549
521550 SwitchOsdToMpv ();
522551
@@ -542,6 +571,7 @@ void cMpvPlayer::PlayerStart()
542571 check_error (mpv_set_option_string (hMpv , "vo" , MpvPluginConfig -> VideoOut .c_str ()));
543572 check_error (mpv_set_option_string (hMpv , "hwdec" , MpvPluginConfig -> HwDec .c_str ()));
544573 check_error (mpv_set_option_string (hMpv , "gpu-context" , MpvPluginConfig -> GpuCtx .c_str ()));
574+ check_error (mpv_set_option_string (hMpv , "hwdec-codecs" , "all" ));
545575#ifdef USE_DRM
546576 if (!strcmp (MpvPluginConfig -> GpuCtx .c_str (),"drm" ) || !strcmp (MpvPluginConfig -> VideoOut .c_str (),"drm" ))
547577 {
@@ -567,30 +597,7 @@ void cMpvPlayer::PlayerStart()
567597 }
568598 if (MpvPluginConfig -> UseDeinterlace )
569599 {
570- if (strstr (MpvPluginConfig -> HwDec .c_str (),"vaapi" ))
571- {
572- check_error (mpv_set_option_string (hMpv , "hwdec-codecs" , "all" ));
573- check_error (mpv_set_option_string (hMpv , "vf" , "vavpp=deint=auto" ));
574- }
575- else if (strstr (MpvPluginConfig -> HwDec .c_str (),"vdpau" ))
576- {
577- check_error (mpv_set_option_string (hMpv , "hwdec-codecs" , "all" ));
578- check_error (mpv_set_option_string (hMpv , "vf" , "vdpaupp=deint=yes:deint-mode=temporal-spatial" ));
579- }
580- else if (strstr (MpvPluginConfig -> HwDec .c_str (),"cuda" ))
581- {
582- check_error (mpv_set_option_string (hMpv , "hwdec-codecs" , "all" ));
583- check_error (mpv_set_option_string (hMpv , "vd-lavc-o" , "deint=adaptive" ));
584- }
585- else if (strstr (MpvPluginConfig -> HwDec .c_str (),"nvdec" ))
586- {
587- check_error (mpv_set_option_string (hMpv , "hwdec-codecs" , "all" ));
588- check_error (mpv_set_option_string (hMpv , "deinterlace" , "yes" ));
589- }
590- else
591- {
592- check_error (mpv_set_option_string (hMpv , "deinterlace" , "yes" ));
593- }
600+ set_deinterlace (hMpv );
594601 }
595602 check_error (mpv_set_option_string (hMpv , "audio-device" , MpvPluginConfig -> AudioOut .c_str ()));
596603 check_error (mpv_set_option_string (hMpv , "slang" , MpvPluginConfig -> Languages .c_str ()));
@@ -681,6 +688,10 @@ void cMpvPlayer::PlayerStart()
681688 pthread_create (& XEventThreadHandle , NULL , XEventThread , this );
682689 RemoteStart ();
683690 }
691+ if (cPluginManager ::GetPlugin ("softhddevice" ))
692+ {
693+ is_softhddevice = 1 ;
694+ }
684695}
685696
686697void cMpvPlayer ::HandlePropertyChange (mpv_event * event )
@@ -820,6 +831,11 @@ void cMpvPlayer::HandleTracksChange()
820831 TrackLanguage = Node .u .list -> values [i ].u .list -> values [j ].u .string ;
821832 if (strcmp (Node .u .list -> values [i ].u .list -> keys [j ], "title" ) == 0 )
822833 TrackTitle = Node .u .list -> values [i ].u .list -> values [j ].u .string ;
834+ if (strcmp (Node .u .list -> values [i ].u .list -> keys [j ], "image" ) == 0 )
835+ {
836+ isImage = Node .u .list -> values [i ].u .list -> values [j ].u .flag ;
837+ if (isImage ) check_error (mpv_set_option_string (hMpv , "deinterlace" , "no" ));
838+ }
823839 }
824840 if (TrackType == "audio" )
825841 {
0 commit comments