Mediaportal window steals focus when showing TV (Freeview) (1 Viewer)

Neverwasowt

Portal Member
May 26, 2017
5
0
74
Home Country
United Kingdom United Kingdom
In summary, when I have MediaPortal 1.16 showing Freeview TV (UK) it steals focus from other windows from time to time.

This often (but not always) happens around the time a program changes or during adverts (sometimes several times during one "commercial break"). So my suspicion was that this is something to do with the TV-Anytime signals which are transmitted to enable "Accurate Recording" - but also, from the very little I understand of the specification, are possibly sent to do other things. I have, however, failed to find any reference to how (if at all) Media Portal deals with such signals.

Is there anyway I can stop MediaPortal doing this please?

And to state the obvious, it is a pain when - say - typing a document or email to find the last few keystrokes have done weird and wonderful things in MediaPortal.
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello and welcome to the forum :)

    Short answer:
    1. MediaPortal doesn't normally steal focus.
    2. MediaPortal doesn't do anything with TV-Anytime or accurate recording signals, so that can't be the cause.
    3. We need log files in order to check what's causing MediaPortal to steal focus.
     

    Neverwasowt

    Portal Member
    May 26, 2017
    5
    0
    74
    Home Country
    United Kingdom United Kingdom
    Many thanks.

    I attach log files (zipped manually as Watchdog’s Export gave an “Unhandled exception” error).

    But I am ashamed to say that I posted on the assumption that I’d missed a setting and without even looking at the log files. Having done so, the MediaPortal.log shows during a commercial break several entries on the lines of:


    [2017-05-27 14:18:50,431] [Log ] [29 ] [INFO ] - ViewModeSwitcher: Switching to viewmode: Zoom14to9
    [2017-05-27 14:18:50,438] [Log ] [29 ] [INFO ] - overlay: video WxH : 544x576
    [2017-05-27 14:18:50,439] [Log ] [29 ] [INFO ] - overlay: video AR : 544:576
    [2017-05-27 14:18:50,440] [Log ] [29 ] [INFO ] - overlay: screen WxH : 1264x711
    [2017-05-27 14:18:50,441] [Log ] [29 ] [INFO ] - overlay: AR type : Zoom14to9
    [2017-05-27 14:18:50,441] [Log ] [29 ] [INFO ] - overlay: PixelRatio : 1
    [2017-05-27 14:18:50,442] [Log ] [29 ] [INFO ] - overlay: src : (0,36)-(544,540)
    [2017-05-27 14:18:50,443] [Log ] [29 ] [INFO ] - overlay: dst : (254,0)-(1009,711)
    [2017-05-27 14:18:50,443] [Log ] [29 ] [INFO ] - TSReaderPlayer:Window (0,36)-(544,540) - (254,0)-(1009,711)
    [2017-05-27 14:18:50,444] [Log ] [29 ] [INFO ] - PlaneScene: Crop: top:4, bottom:4, left:4, right:4
    [2017-05-27 14:18:50,445] [Log ] [29 ] [INFO ] - PlaneScene: video WxH : 544x576
    [2017-05-27 14:18:50,445] [Log ] [29 ] [INFO ] - PlaneScene: screen WxH : 1264x711
    [2017-05-27 14:18:50,538] [Log ] [MPMain ] [INFO ] - Main: Activation request received
    [2017-05-27 14:18:50,541] [Log ] [MPMain ] [INFO ] - Main: Activation request received
    [2017-05-27 14:18:50,543] [Log ] [29 ] [INFO ] - Util: Successfully switched focus.​


    Is this a sign that the issue (or at least an issue) is the way the ViewModeSwitcher plugin deals with the wretched Freeview channels which use 544x576 and when they switch programs (incluyding adverts)? If so, should I prepare for a "3 pipe problem" (sadly now with only virtual pipes), study ViewMode Switcher - MediaPortal 1 - MediaPortal Wiki and change the settings?
     

    Neverwasowt

    Portal Member
    May 26, 2017
    5
    0
    74
    Home Country
    United Kingdom United Kingdom
    Sorry to reply to my own post but I think a solution quickly became clear: I disabled the ViewModeSwitcher plugin.

    In a little more detail, I don't recall enabling the plugin when I installed MP but then I just accepted the defaults on most things. (I also seemed to need to enable it in the configuration menu and then disable it but that may have been my misunderstanding of the interface.) And, while I can see the plugin offers a great deal of functionality, I don't need it for my viewing of Freeview on screens where overscan would be pointless.

    Thanks again for your help.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I should say...
    As far as I'm aware the ViewModeSwitcher plugin should not cause MP to steal focus. If it does, we'd consider it a bug.
     

    Neverwasowt

    Portal Member
    May 26, 2017
    5
    0
    74
    Home Country
    United Kingdom United Kingdom
    In the light of your comment I enabled the ViewModeSwitcher plugin with verbose logging. I attach logs which cover times when ISTM MP took focus - during commercial breaks at 09:52~09:55 (on Sky News) and 10:12~10:14 (on Spike).

    I have (I hope) also made my system specs available for all to view.

    But if there is other information that would help, or other tests I can do, I hope you or Owlsroost will just ask.
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    The ViewModeSwitcher plugin doesn't change the window focus - it just tells the MP player code that shape/cropping of the video window needs to change

    I suspect this line (highlighted in red) in MediaPortal.log might be a pointer to the culprit:

    [2017-05-28 10:12:17,679] [Log ] [23 ] [INFO ] - ViewModeSwitcher: Switching to viewmode: Normal
    [2017-05-28 10:12:17,680] [Log ] [23 ] [INFO ] - overlay: video WxH : 544x576
    [2017-05-28 10:12:17,680] [Log ] [23 ] [INFO ] - overlay: video AR : 544:576
    [2017-05-28 10:12:17,681] [Log ] [23 ] [INFO ] - overlay: screen WxH : 1264x711
    [2017-05-28 10:12:17,682] [Log ] [23 ] [INFO ] - overlay: AR type : Normal
    [2017-05-28 10:12:17,682] [Log ] [23 ] [INFO ] - overlay: PixelRatio : 1
    [2017-05-28 10:12:17,683] [Log ] [23 ] [INFO ] - overlay: src : (0,0)-(544,576)
    [2017-05-28 10:12:17,684] [Log ] [23 ] [INFO ] - overlay: dst : (296,0)-(968,711)
    [2017-05-28 10:12:17,684] [Log ] [23 ] [INFO ] - TSReaderPlayer:Window (0,0)-(544,576) - (296,0)-(968,711)
    [2017-05-28 10:12:17,685] [Log ] [23 ] [INFO ] - PlaneScene: Crop: top:4, bottom:4, left:4, right:4
    [2017-05-28 10:12:17,685] [Log ] [23 ] [INFO ] - PlaneScene: video WxH : 544x576
    [2017-05-28 10:12:17,686] [Log ] [23 ] [INFO ] - PlaneScene: screen WxH : 1264x711
    [2017-05-28 10:12:17,687] [Log ] [23 ] [INFO ] - Util: Successfully switched focus.
    [2017-05-28 10:12:17,703] [Log ] [MPMain ] [INFO ] - Main: Activation request received

    This is happening (as far as I can tell) due to this code at line 571 in Core\Player\\PlaneScene.cs:

    Code:
        public bool SetVideoWindow(Size videoSize)
        {
          ....
          ....
              if (GUIGraphicsContext.VideoRenderer != GUIGraphicsContext.VideoRendererType.madVR)
              {
                Util.Utils.SwitchFocus();
              }
          ....
          ....
        }

    ...which was added for MP 1.16 i.e. older versions of MP1 don't call SwitchFocus() (for EVR renderer) on every call to SetVideoWindow() - which gets called as a consequence of ViewModeSwitcher asking the player to change the shape of the video window.

    The Git comment for the commit that added this is:

    SHA-1: 3a08fa2a9619062c40aa234b66c8e99509b5c549

    * MP1-4781V2 : madVR V261. (added 45s reset timer for screensaver when MP is not focused)

    See MP1-4781V2 : madVR V261. (added 45s reset timer for screensaver when … · MediaPortal/MediaPortal-1@3a08fa2 · GitHub

    I think we have a bug introduced in MP 1.16
     

    Neverwasowt

    Portal Member
    May 26, 2017
    5
    0
    74
    Home Country
    United Kingdom United Kingdom
    @Owlsroost

    When I said that disabling ViewModeSwitcher was "a solution" I did not mean to imply that any fault lay with ViewModeSwitcher. I was taking an empirical approach - or if you insist an ignorant one ;) - at the same level as "turn it off and turn it on again".
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    @Owlsroost

    When I said that disabling ViewModeSwitcher was "a solution" I did not mean to imply that any fault lay with ViewModeSwitcher. I was taking an empirical approach - or if you insist an ignorant one ;) - at the same level as "turn it off and turn it on again".

    Don't worry - I know you didn't mean to imply it was ViewModeSwitcher's fault :)

    My post was mostly intended to provide info to other devs about what I'd worked out so far.

    @Sebastiii - any comments about why that 'SwitchFocus()' call was added to SetVideoWindow() method (see my earlier post)?
     

    Users who are viewing this thread

    Top Bottom