Commit Graph

134 Commits

Author SHA1 Message Date
Ricardo Constantino ffe89415fe osc: add mouse mid-button as alias to shift+left button 2019-09-21 15:30:20 +02:00
wm4 530b203e5d osc: add feature to bottombar to not cover the video
Normally I use the OSC like this: not at all, but have a key binding
that does "cycle osc" to show it. And in that case, I don't really want
it to overlap the damn video.

I could use the zoom/pan options to move the video out of the way, but
this is also sort of annoying. Likewise, you could write a script or so
which does this automatically if the OSC appears, but that's still
annoying, and computing values for these options such that the video is
moved correctly is tricky.

So I added a bunch of options that set explicit video borders (previous
commit), and a option for the OSC to use them (this commit).

Disabled by default, since I'm afraid this is too awkward and
unpolished, especially with OSC default settings.

I'm also using "osc-visibility=always". Effectively, making the OSC
appear will box the video, and making it disappear (by unloading
osc.lua) will restore the video back to normal.
2019-09-19 20:37:05 +02:00
Jan Janssen 94c414bd1c osc: improve look of seekranges 2019-09-02 01:11:04 +03:00
fatalis 8479449d14 osc: fix accidentally skipping files when seeking with slider
When seeking near the end of the file and the next file loads, seeking
continues on the next file at the same position and then immediately
the file after that. This patch stops slider seeking when a new file is
loaded, which is the standard behavior of many other players.
2018-06-04 00:14:59 +03:00
Ricardo Constantino 3a76bfdccc
osc: leave only demuxer cache duration and limit its refresh rate
Sorta requested in #5390
2018-01-14 12:57:37 +00:00
dudemanguy c809b73db6
osc: add seekbarkeyframes as a user option 2018-01-03 15:35:39 +00:00
Ricardo Constantino 97816bbef0
osc: check if demuxer cache has not reached eof
Avoids flickering stream cache status while filling the demuxer cache.
2018-01-02 14:28:32 +00:00
Ricardo Constantino b51f6c59b9 osc: hide cache if not forced for local files
Also hide cache if 'cache-used' is 0 (usually means video fits
entirely within demuxer-cache-duration or stream cache is disabled).
2017-12-26 19:11:52 +01:00
pavelxdd 5f8402e3ec osc: make seek ranges rendering optional
This commit adds a new osc setting `seekranges` to control
the seek ranges visibility.
2017-12-26 01:18:26 +01:00
wm4 62cf960ef0 osc: show demuxer cache buffered amount in bytes
Same as previous commit, but for the OSC.

(A bit of a waste to request demuxer-cache-state at least twice per
frame, but the OSC queries so many properties it probably doesn't matter
anymore.)
2017-12-23 00:32:59 +01:00
Niklas Haas ba1943ac00 msg: reinterpret a bunch of message levels
I've decided that MP_TRACE means “noisy spam per frame”, whereas
MP_DBG just means “more verbose debugging messages than MSGL_V”.
Basically, MSGL_DBG shouldn't create spam per frame like it currently
does, and MSGL_V should make sense to the end-user and provide mostly
additional informational output.

MP_DBG is basically what I want to make the new default for --log-file,
so the cut-off point for MP_DBG is if we probably want to know if for
debugging purposes but the user most likely doesn't care about on the
terminal.

Also, the debug callbacks for libass and ffmpeg got bumped in their
verbosity levels slightly, because being external components they're a
bit less relevant to mpv debugging, and a bit too over-eager in what
they consider to be relevant information.

I exclusively used the "try it on my machine and remove messages from
MSGL_* until it does what I want it to" approach of refactoring, so
YMMV.
2017-12-15 22:28:47 -08:00
wm4 36630585f6 osc: make cycling visibility an input.conf key binding
As builtin script, it should not register global key bindings, and add
them to input.conf instead. This is similar to what stats.lua does.
2017-11-03 14:41:18 +01:00
ChrisK2 89513d26a2 osc: render seek ranges a bit less ugly 2017-11-02 22:00:12 +01:00
wm4 1d9057cb9a osc: render seek ranges
Pretty fucking ugly, but I'm not a UI designer.

Of course only does something with --demuxer-seekable-cache.
2017-11-02 20:03:53 +01:00
Avi Halachmi (:avih) 365b1d4f3d osc: fix rare stack overflow when changing visibility mode
Under some conditions, hide_osc() was calling render(), which then called
hide_osc() again, and so forth, until the stack overflows.

Tracking the exact conditions where this happens (and then managing them
to prevent it) is an excercise in futility.

Remove the osc directly - instead of going through the entire rendering
procedure just to end up rendering nothing.

Fixes #4900 .
2017-09-23 14:41:17 +03:00
James Ross-Gowan 7897f79217 input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.

To make it more confusing, the keycodes used on Windows were changed in
18a45a42d5 without a deprecation period or adequate communication to
users.

This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
2017-09-03 20:31:44 +10:00
James Ross-Gowan 957e9a37db input: use mnemonic names for mouse buttons
mpv's mouse button numbering is based on X11 button numbering, which
allows for an arbitrary number of buttons and includes mouse wheel input
as buttons 3-6. This button numbering was used throughout the codebase
and exposed in input.conf, and it was difficult to remember which
physical button each number actually referred to and which referred to
the scroll wheel.

In practice, PC mice only have between two and five buttons and one or
two scroll wheel axes, which are more or less in the same location and
have more or less the same function. This allows us to use names to
refer to the buttons instead of numbers, which makes input.conf syntax a
lot easier to remember. It also makes the syntax robust to changes in
mpv's underlying numbering. The old MOUSE_BTNx names are still
understood as deprecated aliases of the named buttons.

This changes both the input.conf syntax and the MP_MOUSE_BTNx symbols in
the codebase, since I think both would benefit from using names over
numbers, especially since some platforms don't use X11 button numbering
and handle different mouse buttons in different windowing system events.

This also makes the names shorter, since otherwise they would be pretty
long, and it removes the high-numbered MOUSE_BTNx_DBL names, since they
weren't used.

Names are the same as used in Qt:
https://doc.qt.io/qt-5/qt.html#MouseButton-enum
2017-09-03 20:31:44 +10:00
nodiscc 969c25d2f7 OSD message: "Drop files or URLs to play here."
Add "or URLs" to the default OSD message when mpv is launched without parameters.
Since this works flawlessly with youtube-dl integration, the fact that you can drop URLs directly to the window should be advertised more.
2017-05-31 12:56:14 +01:00
Ricardo Constantino 18703b55d8
osc: also add processing for axis_up/down events
Considered semantically equivalent with mouse_btn3/4.

This is a preemptive fix for upcoming changes to AXIS_* events.
2017-04-25 15:42:09 +01:00
Avi Halachmi (:avih) 150c988e88
osc: add user_opts.boxmaxchars for box layout title limit
The default of 80 is conservative to allow relatively wide fonts, but
with many common fonts a bigger number can be used without overflow.
2017-04-19 20:35:58 +01:00
Ricardo Constantino 05c8707a0b
osc: add volume icons to osd font and use them
Glyphs taken and based on U+1F507 to U+1F50A from Symbola, which
is available under public domain: http://users.teilar.gr/~g1951d/
2017-04-19 20:18:23 +01:00
Ricardo Constantino 9d6c208afa
osc: move volume left of fullscreen button 2017-04-19 20:18:23 +01:00
Ricardo Constantino fe937e866d
osc: bottom/topbar: add fullscreen button 2017-04-19 20:18:23 +01:00
Ricardo Constantino a477c864a4
osc: add volume button
Click to toggle mute, mouse wheel to change volume.
OSD is shown on volume change.
2017-04-19 20:18:23 +01:00
Ricardo Constantino 00ab5a15be
osc: support handling mouse wheel events 2017-04-19 20:18:23 +01:00
Ricardo Constantino e870b7ad66
osc: simplify checks in key handler
Use a helper function for these safety checks.
2017-04-19 20:18:23 +01:00
Ricardo Constantino 82bf4567f9
osc: fix last potential race condition on key events 2017-04-19 20:18:15 +01:00
wm4 4c516a064a osc: use "loop-playlist" instead of "loop" property 2017-04-11 12:44:41 +02:00
Ricardo Constantino 07ee7fb2c3
osc: escape ASS and strip newlines on title 2017-03-27 18:00:56 +01:00
Ricardo Constantino dc00ad537f
osc: make title configurable and use property expansion on it 2017-03-27 18:00:56 +01:00
Ricardo Constantino ebf61267f4
Revert "osc: make the title toggleable between media-title and filename"
This reverts commit 6573b73462.
2017-03-27 18:00:54 +01:00
Ricardo Constantino 6573b73462
osc: make the title toggleable between media-title and filename
Close #4221
2017-03-26 14:41:03 +01:00
Ricardo Constantino aae0833fc6
osc: fix PlayResX undefined warning when aspect is 0 2017-03-24 16:23:39 +00:00
Ricardo Constantino bc8710a98d
osc: bottom/topbar: don't clip title vertically 2017-03-24 16:16:12 +00:00
Ricardo Constantino aee08e3f51
osc: bottom/topbar: increase timecodes width a bit
Compensates for wider fonts like DejaVu Sans Mono.
Further compensate for the minus sign in the right timecode by 10px.

Closes #3952
2017-03-24 16:16:11 +00:00
Ricardo Constantino 03b2710dc8
osc: refactor cache status display
This removes the twitch of the right-aligned cache status.
2017-03-24 16:16:10 +00:00
Ricardo Constantino bcb2db078c
osc: refactor osc message scaling
Will still hide playlist items with long enough filenames and osd-font-size
but not as soon.

osc messages should now preserve their scaling with fullscreen toggling and
cycling through audio-only files and files with video.

Closes #4081, #4083, #4102
2017-03-24 16:16:07 +00:00
Akemi 55fb4cb3f6 osc: fix window dragging with showwindowed=no
initialise OSC with a zero mouse area so mp_input_test_dragging returns
a proper value.

Fixes #1819
2017-02-27 23:55:30 +01:00
Ricardo Constantino bbf01346ff
osc: allow playlist buttons when looping
Closes #4092
2017-02-01 13:26:38 +00:00
Ricardo Constantino 9831d3ada6
osc: box: clip with ellipsis after too much stretching 2017-01-31 18:54:40 +00:00
Ricardo Constantino ee000f2133
osc: bottom/topbar: clip title instead of stretching 2017-01-31 18:54:40 +00:00
Roland Hieber 194b26536b osc: fix crashes related to field eventresponder being nil
I'm still getting some crashes after issue #3210 was fixed in commit
5beb230690. It's hard to reproduce those
crashes, they happen maybe once a month, so I guess it could be a race
condition. But in any case, I don't see anything wrong in applying some
defensive programming here.

For reference, here is what was happening on 0.23.0-1 from Debian
testing:

  Playing: ytdl://usL5CeP_row
   (+) Video --vid=1 (*) (h264)
    (+) Audio --aid=1 --alang=und (*) (aac)
    [osc]
    [osc] stack traceback:
    [osc]	  @osc.lua:2074: in function 'process_event'
    [osc]	  @osc.lua:2246: in function 'cb'
    [osc]	  mp.defaults:107: in function 'fn'
    [osc]	  mp.defaults:60: in function 'handler'
    [osc]	  mp.defaults:339: in function 'handler'
    [osc]	  mp.defaults:448: in function 'call_event_handlers'
    [osc]	  mp.defaults:485: in function 'dispatch_events'
    [osc]	  mp.defaults:441: in function <mp.defaults:440>
    [osc]	  [C]: in ?
    [osc]	  [C]: in ?
    [osc] Lua error: @osc.lua:2074: attempt to index field 'eventresponder' (a nil value)

Note that the location is different from where issue #3210 happens.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
2017-01-25 07:58:45 +01:00
Ricardo Constantino 321dd794c8
osc: bottombar/topbar: make chapter markers slightly bigger
1px squares to 2px triangles and layout=box markers from 1px
squares to 2x1px rectangles.

While we're at it, wrap a few lines to 80col again.
2016-12-25 15:44:11 +00:00
pavelxdd f53b2952eb osc: replace length property with duration
Length property is deprecated and no longer works. This fixes
a bug when the total file duration wasn't visible if the
option to display milliseconds was activated.
2016-12-04 13:18:19 +01:00
Ricardo Constantino 796b48b2a3
osc: don't hide playlist buttons, just disable
Having empty space before the title in layout=*bar looks worse
than the floating buttons in layout=box.

Also disable both playlist buttons selectively according to the
current position.
2016-12-02 16:59:40 +00:00
Ricardo Constantino a7a919f93f
osc: topbar: use same styles as bottombar 2016-12-02 16:59:32 +00:00
Ricardo Constantino ebd9ce9fca
osc: fix use of deprecated idle property
Fixes regression since 7201fd7d
2016-11-22 21:00:04 +00:00
Ricardo Constantino b39a7fddb5
osc: fix possible race condition in right timecode 2016-11-21 18:20:53 +00:00
Ricardo Constantino adf65634d8
osc: add seekbarstyle=knob
Most code from @leiserfg in #2365.
Closes #2365

Cut guides to the center of the knob. This makes the knob
knob look more like IRL knob sliders.
2016-11-09 05:51:20 +00:00
Ricardo Constantino 5beb230690
osc: fix crashes when dragging seekbar across file changes
Fixes #3210
2016-11-08 21:18:53 +00:00