Page 1 of 1
How can I tell if Subtitles are switched on
Posted: Wed Oct 06, 2021 1:29 pm
by trevorjharris
Is there a way to tell if subtitles are switched on by reading a GPR?
Regards Trevor Harris
Re: How can I tell if Subtitles are switched on
Posted: Wed Oct 06, 2021 2:59 pm
by Alexey Kolesnikov
Hi Trevor,
Not GPR - PSR 17. Check help: Advanced -> PSR registers.
Re: How can I tell if Subtitles are switched on
Posted: Wed Oct 06, 2021 4:24 pm
by trevorjharris
I cannot see how I can check the psr value in the switch command. I assume that the three byte are zero if subtitles are turned off.
Re: How can I tell if Subtitles are switched on
Posted: Wed Oct 06, 2021 5:24 pm
by Alexey Kolesnikov
Sorry, I was wrong about PSR[17]. The current subtitles is in the PSR[2].
The code that checks if subtitles is on: (getPSR(2) & 0x80000000) != 0. This means that the leftmost bit is responsible for this.
Thus, to check that subtitles are on in a SWITCH you can use the Custom condition: PSR(2) < 2147483648L & PSR(2) > 0
Re: How can I tell if Subtitles are switched on
Posted: Fri Oct 08, 2021 8:51 pm
by trevorjharris
Hi
I tested PSR(2) and found it was set to 0x8fff0001 if subtitles are on and 0x0fff0001 if off. I could not get your test PSR(2) < 2147483648L & PSR(2) > 0 to work. I think it is because int is signed and so I found PSR(2) < 0 works.
I want to turn subtitles on from a popup. I tried manager.selectSubtitleState(true); but this did not work.
I also tried adding a second subtitle track but PowerDVD and my Blu-ray player did not detect the second subtitle.
Regards Trevor
Re: How can I tell if Subtitles are switched on
Posted: Sat Oct 09, 2021 7:19 am
by Alexey Kolesnikov
Hi
Frankly, I never worked with PSR[2]
Always worked via Java functions.
Just checked with debug log.
Subtitles are off by default - switching on:
Code: Select all
PSR[2] before on: 0x0FFF0001
selectSubtitleState(true)
PSR[2] after on: -0x7000FFFF
Now subtitles are on (subtitles stream 1 is on) - switching off:
Code: Select all
PSR[2] before off: -0x7000FFFF
selectSubtitleState(false)
PSR[2] after off: 0x0FFF0001
Now switching on (the same as in the p.1)
and than switching to track 2:
Code: Select all
PSR[2] before #2: -0x7000FFFF
selectSubtitleStream('Movie', 2, true, true)
PSR[2] after #2: -0x7000FFFE
PS: I suppose that "track 2 off" will be 0x0FFF0002