hey everyone
I need some help in determining if HDR playback is being used for my service addon.
So the basic problem goes like this: I like the TV frame generation to get smooth 60 fps when the source has lower fps. However for some reason during HD playback there is a cinema mode enabled (although it is greyed out in the TVs picture settings) and it appears I can only disable it using the TVs API.
So when playback on a HDR item in Kodi is started the fps smoothing on the TV is disabled until I issue a realcinema off command, then everything works as expected.
What I need help with is how to determine if HDR is really playing. Because my TV needs a whopping 20 secs to setup HDR/resolution etc until a pic is shown. Sending the realcinema code before the ~20s wont do anything.
So I really only want to send the command if I really use HDR (only 10% of use cases). But I am having trouble finding out how to access this information.
What I probably need is this VideoStreamDetail::getHDRType
But I am unable to find this info from python.
Can someone help? Many thanks in advance.
https://codedocs.xyz/xbmc/xbmc/group__py...Video.html
I have come up with this addon code:
I need some help in determining if HDR playback is being used for my service addon.
So the basic problem goes like this: I like the TV frame generation to get smooth 60 fps when the source has lower fps. However for some reason during HD playback there is a cinema mode enabled (although it is greyed out in the TVs picture settings) and it appears I can only disable it using the TVs API.
So when playback on a HDR item in Kodi is started the fps smoothing on the TV is disabled until I issue a realcinema off command, then everything works as expected.
What I need help with is how to determine if HDR is really playing. Because my TV needs a whopping 20 secs to setup HDR/resolution etc until a pic is shown. Sending the realcinema code before the ~20s wont do anything.
So I really only want to send the command if I really use HDR (only 10% of use cases). But I am having trouble finding out how to access this information.
What I probably need is this VideoStreamDetail::getHDRType
But I am unable to find this info from python.
Can someone help? Many thanks in advance.
https://codedocs.xyz/xbmc/xbmc/group__py...Video.html
I have come up with this addon code:
Code:
import xbmc, subprocess
import xbmcaddon
from threading import Timer
__addon__ = xbmcaddon.Addon()
__addon_id__ = __addon__.getAddonInfo('id')
__addonname__ = __addon__.getAddonInfo('name')
__icon__ = __addon__.getAddonInfo('icon')
__addonpath__ = __addon__.getAddonInfo('path')
__lang__ = __addon__.getLocalizedString
def switch_pic_mode(picmode, wait=False):
si = subprocess.STARTUPINFO()
si.dwFlags |= (subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW)
si.wShowWindow = subprocess.SW_HIDE
cmdline = r'C:\Tools\LG\LG_PicMode_direct2.cmd %s' % picmode
cw = r'C:\Tools\LG'
if wait:
subprocess.call(cmdline, cwd=cw, startupinfo=si)
else:
subprocess.Popen(cmdline, cwd=cw, startupinfo=si)
def switch_off_realcinema():
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'playback started, switching realcinema mode off NOW!')
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().isPlayingVideo()))
#xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().getVideoInfoTag()))
#xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().getVideoInfoTag().ToStreamDetailVideo()))
#xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().getVideoInfoTag().getHDRType()))
#xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().getVideoInfoTag().VideoStreamDetail().getHDRType()))
switch_pic_mode('realcinemaoff', False)
class PXPlayer(xbmc.Player):
def __init__ ( self ):
xbmc.Player.__init__( self )
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'init')
def onPlayBackStarted(self):
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'onPlayBackStarted')
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'xbmc.Player().isPlayingVideo() = ' + str(xbmc.Player().isPlayingVideo()))
#if xbmc.Player().isPlayingVideo()==1:
t = Timer(20.0, switch_off_realcinema)
t.start()
xbmc.log(__addonname__ + " playback started, switching realcinema mode off on timer", level=xbmc.LOGINFO)
#xbmc.executebuiltin('Notification(' + __addonname__ + ', ' + path.decode('utf-8') + ', 8000, ' + __icon__ + ')')
if __name__ == '__main__':
try:
p=PXPlayer()
monitor = xbmc.Monitor()
xbmc.log('>>>> ' + __addonname__ + ' <<<< ' + 'STARTUP mainloop', level=xbmc.LOGINFO)
while not monitor.abortRequested():
# Sleep/wait for abort for 1 seconds
xbmc.sleep(100) # process event notifications, check if aborted 10 times a second
except Exception as ex:
print('Exception in ' + __addonname__)
print(type(ex)) # the exception instance
print(ex)