Skip to content

Commit

Permalink
Add a 720p50 handing option, and some 2160p changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
original-birdman committed Feb 3, 2017
1 parent 6124221 commit 14acf90
Showing 1 changed file with 64 additions and 9 deletions.
73 changes: 64 additions & 9 deletions autoresolution/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,33 @@
videoresolution_dictionary = {}
resolutionlabel = None

resolutions = (('sd_i_50', (_("SD 25/50HZ Interlace Mode"))), ('sd_i_60', (_("SD 30/60HZ Interlace Mode"))), \
('sd_p_24', (_("SD 24HZ Progressive mode"))), \
('sd_p_50', (_("SD 25/50HZ Progressive Mode"))), ('sd_p_60', (_("SD 30/60HZ Progressive Mode"))), \
('hd_i', (_("HD Interlace Mode"))), ('hd_p', (_("HD Progressive Mode"))), \
('p720_24', (_("Enable 720p24 Mode"))), ('p1080_24', (_("Enable 1080p24 Mode"))), \
('p1080_25', (_("Enable 1080p25 Mode"))), ('p1080_30', (_("Enable 1080p30 Mode"))))
# Added p720_50
resolutions = ( \
('sd_i_50', _("SD 25/50HZ Interlace Mode")), \
('sd_i_60', _("SD 30/60HZ Interlace Mode")), \
('sd_p_24', _("SD 24HZ Progressive mode")), \
('sd_p_50', _("SD 25/50HZ Progressive Mode")), \
('sd_p_60', _("SD 30/60HZ Progressive Mode")), \
('hd_i', _("HD Interlace Mode")), \
('hd_p', _("HD Progressive Mode")), \
('p720_24', _("Enable 720p24 Mode")), \
('p720_50', _("Enable 720p50 Mode")), \
('p1080_24', _("Enable 1080p24 Mode")), \
('p1080_25', _("Enable 1080p25 Mode")), \
('p1080_30', _("Enable 1080p30 Mode")), \
)

# from OpenPLi
have_2160p = config.av.videorate.get("2160p", False)

if have_2160p:
resolutions += (
('uhd_i', _("UHD Interlace Mode")),
('uhd_p', _("UHD Progressive Mode")),
('p2160_24', _("Enable 2160p24 Mode")),
('p2160_25', _("Enable 2160p25 Mode")),
('p2160_30', _("Enable 2160p30 Mode")), # Trailing , is NEEDED!
)

config.plugins.autoresolution = ConfigSubsection()
config.plugins.autoresolution.enable = ConfigYesNo(default = False)
Expand Down Expand Up @@ -175,7 +196,31 @@ def defaultModeChanged(self, configEntry):
if self.extra_mode1080p60:
default_choices.append('1080p60')
for mode in resolutions:
choices = default_choices + preferedmodes
# from OpenPLi
if have_2160p:
if mode[0].startswith('p2160'):
choices = ['2160p24', '2160p25', '2160p30'] + preferedmodes
elif mode[0].startswith('p1080_24'):
choices = ['1080p24', '2160p24'] + preferedmodes
elif mode[0].startswith('p1080'):
choices = ['1080p24', '1080p25', '1080p30'] + preferedmodes
elif mode[0] == 'p720_24':
choices = ['720p24', '1080p24', '2160p24'] + preferedmodes
# Added p720_50
elif mode[0] == 'p720_50':
choices = ['720p', '1080p25', '2160p25'] + preferedmodes
else:
choices = default_choices + preferedmodes
else:
if mode[0].startswith('p1080'):
choices = ['1080p24', '1080p25', '1080p30'] + preferedmodes
elif mode[0] == 'p720_24':
choices = ['720p24', '1080p24'] + preferedmodes
# Added p720_50
elif mode[0] == 'p720_50':
choices = ['720p', '1080p25'] + preferedmodes
else:
choices = default_choices + preferedmodes
config.plugins.autoresolution.videoresolution[mode[0]] = ConfigSelection(default = default[0], choices = choices)
config.plugins.autoresolution.videoresolution[mode[0]].addNotifier(self.modeConfigChanged, initial_call = False, immediate_feedback = False)
videoresolution_dictionary[mode[0]] = (config.plugins.autoresolution.videoresolution[mode[0]])
Expand Down Expand Up @@ -227,13 +272,23 @@ def determineContent(self):
progressive = info and info.getInfo(iServiceInformation.sProgressive)

prog = progressive == 1 and 'p' or 'i'

if frate in ('24'): # always 1080p24 content ???
# from OpenPLi
if have_2160p and (height >= 2100 or width >= 3200): # 2160 content
if frate in ('24', '25', '30') and prog == 'p':
new_mode = 'p2160_%s' % frate
elif frate in ('50', '60') and prog == 'p':
new_mode = 'uhd_p'
else:
new_mode = 'uhd_i' # 2160i content - senseless ???
elif frate in ('24'): # always 1080p24 content ???
new_mode = 'p1080_24'
elif (height >= 900 or width >= 1600) and frate in ('24', '25', '30') and prog == 'p': # 1080p content
new_mode = 'p1080_%s' % frate
elif (height > 576 or width > 720) and frate == '24' and prog == 'p': # 720p24 detection
new_mode = 'p720_24'
# Added p720_50
elif (height > 576 or width > 720) and frate == '50' and prog == 'p': # 720p50 detection
new_mode = 'p720_50'
elif (height <= 576) and (width <= 720) and frate in ('25', '50'):
new_mode = 'sd_%s_50' % prog
elif (height <= 480) and (width <= 720) and frate in ('24', '30', '60'):
Expand Down

0 comments on commit 14acf90

Please sign in to comment.