#16 Full Screen resolution switch

open
nobody
None
5
2004-07-26
2004-07-26
No

Hi!

First of all: great gui and great player! Thanks for it!
Another reason that made me migrate to Linux.

I just began using and tweaking my Linux (Debian), and
watching my favourite movies. I have an old projector,
and I managed to set up TwinView (I have a GeForce).
However, my projector is only able to display 800x600
resolution, but my monitor is at 1280x960. Now, I have
to manually switch the desktop resolution to 800x600 to
see the full screen on the projector. How about adding
an option to kplayer, like:
"[x] When going fullscreen, switch to resolution:
[__800x600__][v]
[etc.]
"

Most media players on Windows (sorry, I just recently
left that world) provides this option. And it's useful not
only for a setup like mine, but also for other cases.

What do you think?

--
Greetings,
Balázs

Discussion

  • kiriuja

    kiriuja - 2004-07-27

    Logged In: YES
    user_id=137121

    Good suggestion. I will have to read some fine manuals to see if
    this is possible. The main concern is that even when KPlayer goes
    full screen, it does not take over the whole desktop. Not sure if
    this is the case on Windows, sorry. :-)

    You can switch to other programs, and they of course will be
    affected by the change in resolution. Potentially you can even
    have more than one program running in full screen mode. What if
    both of them decide to switch resolution back and forth?

    Of course the option needs to be off by default, but even so we
    need to be very careful.

    Also, have you thought about making your system dual head instead
    of displaying the same thing on the monitor and the projector?
    This means having two X screen on the same video card, one for
    the monitor and the other for the projector. For GeForce the
    NVidia guys have the instructions on how to do that in the README
    ftp://download.nvidia.com/XFree86/Linux-x86/1.0-6106/README.txt
    Appendix R is the one you'd need.

    --
    K

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-07-27

    Logged In: YES
    user_id=796701

    Yes, the option must be disabled by default, it is done like
    that in other programs. Actually, even on Windows, players
    don't take over the desktop AFAIK. All they do, is when the
    player goes fullscreen (Ctrl+F in kplayer), they switch the
    screen resolution, and when they come back to normal mode
    (or lose the "focus") they switch back.

    Of course, care needs to be taken, but it shouldn't be your
    concern to think just about every possibility. Remember:
    nothing can prevent the programmer from the stupidity of
    the end user :)
    Anyway, the user who wants to watch a film full-screen AND
    even in a different resolution, surely has his reasons (mostly
    like my case). I doubt he would use two full-screen apps at
    the same time.
    Right now, I switch the resolution from the KDE control
    center, then start the movie. The other apps I run beside
    (browser, a few terminals, etc.) don't seem to be disturbed
    by the change.

    I already read those docs you mentioned, they are
    in /usr/share/doc/nvidia-glx for me. I'm just very new to
    Linux in general, and I like to experiment. Right now, I'll try
    dual-screen, then make different serverlayouts for twinview,
    no-twinview, dual-screen. I'll see which one is the best.
    Man, how many docs I read in the past week... %)

    --
    Greetings,
    Balzs

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-08-30

    Logged In: YES
    user_id=796701

    I think "xrandr" could be the right program to switch
    resolutions under X. What do you think?

    --
    Greetings,
    Balzs

     
  • kiriuja

    kiriuja - 2004-09-01

    Logged In: YES
    user_id=137121

    It seems there is a -vm option that you can use to switch video modes with MPlayer. It is used along with -screenw, -screenh, -bpp and -refreshrate options to choose the video mode. Other related options are -adapter and -nograbpointer.

    Did you try any of that? Please let me know. As usual, you should put those options on the Advanced page either in Settings/Configure KPlayer dialog to make them global or in File/Properties if you want them to apply to only one file.

    If that does not work, you can write a simple shell script and include the xrandr commands in it.

    Otherwise you will probably have to wait for a really long time for this to get implemented. There are just too many higher priority things on the TODO list.

    So please do let me know what you come up with so I can include it in a HOWTO for people to use.

    Thanks!

    --
    K

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-11-02

    Logged In: YES
    user_id=796701

    Oh my, haven't followed things here, sorry for that :(
    Damn school started, and I don't even have time to watch
    movies... :)

    Anyway, I tried -vm and the others, but I get really weird
    results. My default resolution is 1280*960, 32 bpp, 85 Hz. If I
    give the option:
    -vm -screenw 800 -screenh 600 -bpp 32 -refreshrate 85
    I get a 800*600 resolution on my monitor, but KDE keeps
    thinking that he is in 1280*960, so I get a larger desktop
    than my monitor, which results that I only see a portion of
    my desktop (a 800*600 part of 1280*960). I guess mplayer
    doesn't set the resolution correctly. I had issues like this
    before (not with mplayer), and I think it is because KDE and
    X maintains their resolutions separately somehow. Or
    anyway, somewhere the resolution is not stored centrally,
    which makes these weird things.

    xrandr sets the resolution correctly, so the only option now
    is to set the resolution with that, or from KDE control center.

    I know you have a lot of things to do, but what if I "hack"
    into the kplayer code, and see if I can come up with
    something, and if it's useful, will you accept it? I know C++
    quite well (at least, I thought so... :), but I haven't
    programmed KDE before, only the Redmond OS. I don't
    guarantee that I'll have anything usable soon, as f*ckin
    school is eating up all my time (I really hate it now...), but I'll
    try.

    --
    Greetings,
    Balzs

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-11-04

    Logged In: YES
    user_id=796701

    Well, I looked after things, and I found that even KDE itself
    uses the randr extension inside the Control Center to switch
    resolution modes. Look here for details:
    http://lxr.kde.org/source/kdebase/kcontrol/randr/

    So we have two options:
    1. Use the randr X11 extension directly, by including
    <X11/extensions/Xrandr.h> and adjust screen resolutions
    using it's functions and structures.
    2. Use the command line utility "xrandr" to adjust screen
    resolution, by parsing it's output and then calling it with the
    appropriate mode.

    Number 2. seems more easily doable, as xrandr produces a
    rather simple output, and using it to set a new resolution is
    easy. It's output looks like this (by calling xrandr without any
    parameters):
    *0 1280 x 960 ( 433mm x 325mm ) *85 60
    1 1152 x 864 ( 433mm x 325mm ) 75
    2 1024 x 768 ( 433mm x 325mm ) 85 75 70 60
    ...

    And setting new resolutions can be done like this:
    xrandr -s <index> (ex. xrandr -s 2)
    or
    xrandr -s <width>x<height> (ex. xrandr -s 1024x768)

    What do you think, which one would be better?

    --
    Greetings,
    Balzs

     
  • kiriuja

    kiriuja - 2004-11-05

    Logged In: YES
    user_id=137121

    Hi, good job on the research. I think we should do something
    very similar to what the KControl module does, for better
    compatibility. If that means using the X11 API extension
    directly, that's fine, but we need to make sure nothing bad
    happens if the extension is not installed or not loaded.

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-11-05

    Logged In: YES
    user_id=796701

    The control center module does that like this:
    (http://lxr.kde.org/source/kdebase/kcontrol/randr/randr.cpp#L548)
    551 // Check extension
    552 Status s = XRRQueryExtension(qt_xdisplay(),
    &m_eventBase, &m_errorBase);
    553 if (!s) {
    554 m_errorCode = QString("%1, base
    %1").arg(s).arg(m_errorBase);
    555 m_valid = false;
    556 return;
    557 }

    And later it checks m_valid, and if it's false, then it sais the
    following:
    (http://lxr.kde.org/source/kdebase/kcontrol/randr/krandrmodule.cpp#L77)
    81 if (!isValid()) {
    82 QVBoxLayout *topLayout = new
    QVBoxLayout(this);
    83 topLayout->addWidget(new
    QLabel(i18n("<qt>Your X server does not support resizing
    and rotating the display. Please update to version 4.3 or
    greater. You need the X Resize And Rotate extension
    (RANDR) version 1.1 or greater to use this feature.</qt>"),
    this));
    84 kdWarning() << "Error: " << errorCode() <<
    endl;
    85 return;
    86 }

    So I think it is fairly easy to check whether the extension is
    available or not. If not, then the player simply won't switch
    resolutions, and it is also a good idea to disable the check
    box in the config settings, and probably write a small
    message, just like above.

    Anyway, most people have X version >4.3 nowadays, so the
    randr extension shouldn't really be a problem. But it's best to
    be safe.

    --
    Greetings,
    Balzs

     
  • kiriuja

    kiriuja - 2004-11-07

    Logged In: YES
    user_id=137121

    Yes, I agree that it is best to be safe. It is also the right
    thing to do.

    I was thinking more about it, and it occurred to me that it
    may be a good idea to write a patch for MPlayer itself that
    would make its -vm option use the xrandr extension when the
    video output is X11 based (and when the file has a video
    stream of course).

    This way not only KPlayer, but any program that is based on
    MPlayer, as well as MPlayer itself, would behave better when
    changing resolution under KDE (and maybe GNOME also).

    What do you think?

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-11-07

    Logged In: YES
    user_id=796701

    The problem with -vm is that it is applied when the movie is
    started, not when switching to fullscreen. This results in a
    bit unexpected or clumsy behaviour, because:
    Most people who will make use of this automatic resolution
    switch (like me), will use this feature (almost always) for
    *full screen* movie playing (mostly in a TwinView or dual
    head setup). So the switch HAS to be applied when
    switching to full screen, *not* when starting movie playing.
    That's why I thought it should be implemented in kplayer,
    because adding additional switches to mplayer, like "change
    resolution, BUT only when going full screen, THEN switch
    back" would be unacceptable.
    You're right, that mplayer itself should be patched TOO to
    use xrandr, but that still wouldn't allow to switch resolutions
    ONLY when going fullscreen (that's how it is done in most
    media players under wingdows).

    --
    Greetings,
    Balzs

     
  • kiriuja

    kiriuja - 2004-11-07

    Logged In: YES
    user_id=137121

    Well, in that case it would be a new option like -fsvm rather
    than an enhancement for -vm.

    Why do you think it would be unacceptable? I would think
    there are many people who would be interested in an option
    like that...

    I think as long as it is properly implemented, the new option
    should be just fine.

     
  • OROSZI Balázs

    OROSZI Balázs - 2004-11-12

    Logged In: YES
    user_id=796701

    I wanted to post earlier, but SF was down again... :(

    Well, I'll try to get in contact with the mplayer guys then, or
    look into the mplayer source to see how does it change
    resolutions, but I don't know when will that happen. I hope it
    will this weekend.

    Why I thought the feature wouldn't get accepted, is because
    it doesn't sound too "much" to deserve a completely new flag
    (-fsvm), but who knows. We'll see.
    BTW, what does -vm stand for? (Doesn't mean anything
    related to resolutions for me...)

    Anyways, whether the option will get accepted or not, it
    would be nice if kplayer had a resolution selector in the
    options dialog (possibly under the video tab), which contains
    the available resolutions (queried with xrandr), and then
    kplayer would pass -fsvm automatically. It's really only a GUI
    candy, but it would still be nice.

    Anyway, I think this feature can be considered very low
    priority. I will look after things and report if I come up with
    something.

    --
    Greetings,
    Balzs

     
  • kiriuja

    kiriuja - 2004-11-13

    Logged In: YES
    user_id=137121

    I guess -vm stands for "video mode". So then -fsvm would be
    "full screen video mode".

    MPlayer code is no piece of cake, but can be figured out
    eventually. I submitted a few patches already myself, and in
    general the attitute has been positive. It takes time and
    polish for a patch to get accepted, but it will be better in the
    long run than implementing this in KPlayer.

    You could start by changing the -vm option to use the xrandr
    extension under X, submit that and see what the reaction is.
    Then you could add the -fsvm option. Or do both in one go,
    shouldn't be very difficult I think. Like I said in my opinion the
    new option will be useful for many people, so if the patch is
    good it should be accepted. Let me know if/when you want
    me to look at the patch and test it.

    Once it is in MPlayer we can of course add GUI for it in
    KPlayer, that's very easy.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks