summaryrefslogtreecommitdiffstats
path: root/player/osd.c
Commit message (Collapse)AuthorAgeFilesLines
* command: improve A-B loop behaviorwm42014-11-181-1/+1
| | | | | | If the B point is set, then loop back to A. Also, update the OSD bar if necessary.
* command: implement A-B loopswm42014-11-181-7/+17
| | | | | | | | | | | | | Probably needs to be polished a bit more. Also, might require a key binding that can set/clear the loop points in a more intuitive way. For now, something like this can be put into input.conf to use it: ctrl+y set ab-loop-a ${time-pos} # set A ctrl+x set ab-loop-b ${time-pos} # set B ctrl+c set ab-loop-a no # clear (mostly) Fixes #1241.
* player: make the osd-msg prefix work for playlist_next/prevwm42014-11-111-0/+6
| | | | | If input.conf e.g. contains "n osd-msg playlist_next", then pressing the n key will switch to the next file, and display the filename on OSD.
* osd: properly wakeup when the OSD function disappearswm42014-11-011-3/+10
| | | | Fixes #1236.
* player: update meaning of drop_frame_cntwm42014-11-011-3/+3
| | | | | Rename the variable, update comments, and update the documentation of the property which returns its value.
* player: change framedrop display in the status linewm42014-10-311-4/+5
| | | | | Hopefully less confusing, and hopefully doesn't exceed the terminal width in any situation.
* player: don't display zero duration for files with unknown durationwm42014-10-291-2/+5
| | | | | | On OSD/terminal, just don't display the duration if unavailable. Make the "length" property unavailable if duration is unavailable.
* player: show busy symbol on OSD if seeking takes too longwm42014-10-221-2/+7
| | | | Same as it's done on the terminal.
* player: fix OSD cyclingwm42014-10-141-0/+2
| | | | | | | OSD cycling attempted to remove the current message by setting an empty message with duration 0. Duration 0 tripped up a corner case causing no OSD to be displayed (until the next message was set), so exclude this explicitly.
* osd: don't let slow commands cut OSD messages shortwm42014-10-061-1/+8
| | | | Done for screenshot commands, requested by a user.
* player: remove central uninit_player() function and flags messwm42014-10-031-2/+1
| | | | | | | | | | | | | | Each subsystem (or similar thing) had an INITIALIZED_ flag assigned. The main use of this was that you could pass a bitmask of these flags to uninit_player(). Except in some situations where you wanted to uninitialize nearly everything, this wasn't really useful. Moreover, it was quite annoying that subsystems had most of the code in a specific file, but the uninit code in loadfile.c (because that's where uninit_player() was implemented). Simplify all this. Remove the flags; e.g. instead of testing for the INITIALIZED_AO flag, test whether mpctx->ao is set. Move uninit code to separate functions, e.g. uninit_audio_out().
* build: add -Wno-format-zero-lengthwm42014-09-261-1/+1
| | | | | | This warning makes absolutely no sense. Passing an empty string to printf-like functions is perfectly fine. In the OSD case, it just sets an empty message, practically clearing the OSD.
* player: do not wrongly clear OSD bar stops, reindentwm42014-09-251-30/+30
| | | | | | | | | | set_osd_bar_chapters() always cleared the OSD bar stops, even if the current bar was not the seek bar. Obviously it should leave the state of the bar alone in this case. Also change the function control flow so that we can drop one indentation level, and do the equivalent change for the other OSD bar functions.
* player: simplify OSD message handling codewm42014-09-251-101/+56
| | | | | | | | | | | Eliminate the remains of the OSD message stack. Another simplification comes from the fact that we do not need to care about time going backwards (we always use a monotonic time source, and wrapping time values are practically impossible). What this code was pretty trivial, and by now unnecessarily roundabout. Merge get_osd_msg() into update_osd_msg(), and add_osd_msg() into set_osd_msg_va().
* player: rate-limit OSD text updatewm42014-09-251-9/+13
| | | | | | | | | | | | | | | There's no need to update OSD messages and the terminal status if nobody is going to see it. Since the player doesn't block on video display anymore, this update happens to often and probably burns slightly more CPU than necessary. (OSD redrawing is handled separately, so it's just mostly useless text processing and such.) Change it so that it's updated only on every video frame or all 50ms (whatever comes first). For VO OSD, we could in theory try to lock to the OSD redraw heuristic or the display refresh rate, but that's more complicated and doesn't work for the terminal status.
* osd: fix --term-osd=nowm42014-09-221-1/+1
| | | | | | | It didn't actually disable it. I'm actually not sure what this option is useful for, but fixing it can't harm.
* command: simplify OSD property display codewm42014-09-211-8/+3
| | | | | | | | | | | | | | | | Probably not many user-visible changes. One notable change is that the terminal OSD code for OSD bar fallback handling is removed with no replacement. Instead, terminal OSD gets the same text message as normal OSD. For volume, this is ok, because the text message is reasonable. Other properties will look worse, but could be adjusted, and there are in fact no other such properties that would be useful in audio-only mode. The fallback message for seeking falls away as well, but that message was useless anyway - the terminal status line provides all information anyway. I believe the show_property_osd() code is now much easier to follow.
* player: rename "Late:" field to "SD:"wm42014-09-201-1/+1
| | | | | | | | | Follow up to previous commit. This is probably confusing from a user point of view, since this field shouldn't show up normally anymore. (Before this commit, it could show up sporadically when a slow operation was performed during playback, such as switching fullscreen.)
* player: allow overriding OSD message for all OSD levelswm42014-09-181-17/+26
| | | | | | | | | | | | | | | | | | Until now, you could override only level 3 with --osd-status-msg. Extend this, add add --osd-msg1 to --osd-msg3 (one for each OSD level). OSD level 0 always means disable OSD, so that isn't included. --osd-msg3 corresponds to --osd-status-msg, but they're not exactly the same. To allow more customization, --osd-msgN do not include the OSD symbol. The symbol can be manually added with "${osd-sym-cc}". We keep the "old" option for some short-term compatibility. --osd-msg1 should be particularly useful; for example you could do: --osd-msg1='${?pause==yes:${osd-sym-cc}}' to display a "paused" symbol when paused, and nothing during normal playback. (Although admittedly, the syntax is quite a bit of work.)
* command: add osd-sym-cc propertywm42014-09-181-11/+10
| | | | This allows you to reproduce the OSD symbol.
* player: better cache status on status linewm42014-08-271-3/+18
| | | | | | | | | | | | | | The cache percentage was useless. It showed how much of the total stream cache was in use, but since the cache size is something huge and unrelated to the bitrate or network speed, the information content of the percentage was rather low. Replace this with printing the duration of the demuxer-cached data, and the size of the stream cache in KB. I'm not completely sure about the formatting; suggestions are welcome. Note that it's not easy to know how much playback time the stream cache covers, so it's always in bytes.
* terminal: some cleanupswm42014-08-211-2/+3
| | | | In particular, remove all the stupid debug printfs from the win code.
* player: never print status messages before playback beginswm42014-08-181-1/+3
| | | | | | | | | | | | | | | | | | After a new file is loaded, playback never starts instantly. Rather, it takes some playloop iterations until initial audio and video have been decoded, and the outputs have been (lazily) initialized. This means you will get status line updates between the messages that inform of the initialized outputs. This is a bit annoying and clutters the terminal output needlessly. Fix this by never printing the status line before playback isn't fully initialized. Do this by reusing the --term-playing-msg code (which prints a message once playback is initialized). This also makes sure the status line _is_ shown during playback restart when doing seeks. It's possible that the change will make the output more confusing if for some reason is stuck forever initializing playback, but that seems like an obscure corner case that never happens, so forget about it.
* player: remove unneeded callwm42014-08-181-1/+1
| | | | | | | | print_status() is called at a later point anyway (and before sleeping), so this code has little effect. This code was added in commit a4f7a3df5, and I can't observe any problems with idle mode anymore. Now print_status() is called from a single place only, within osd.c.
* video: add VO framedropping modewm42014-08-151-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | This mostly uses the same idea as with vo_vdpau.c, but much simplified. On X11, it tries to get the display framerate with XF86VM, and limits the frequency of new video frames against it. Note that this is an old extension, and is confirmed not to work correctly with multi-monitor setups. But we're using it because it was already around (it is also used by vo_vdpau). This attempts to predict the next vsync event by using the time of the last frame and the display FPS. Even if that goes completely wrong, the results are still relatively good. On other systems, or if the X11 code doesn't return a display FPS, a framerate of 1000 is assumed. This is infinite for all practical purposes, and means that only frames which are definitely too late are dropped. This probably has worse results, but is still useful. "--framedrop=yes" is basically replaced with "--framedrop=decoder". The old framedropping mode is kept around, and should perhaps be improved. Dropping on the decoder level is still useful if decoding itself is too slow.
* player: remove cache status from video OSDwm42014-08-111-3/+0
|
* player: indicate on the status line whether a seek is activewm42014-08-081-1/+3
| | | | | | This is delayed by 300ms - before that, the status doesn't change. I feel like it would too annoying if the status line would "flicker" on normal seek by quickly showing and hiding the indicator.
* osd: properly handle OSD bar timeoutwm42014-07-211-4/+10
| | | | | This could just remain stuck on the screen, until the playloop happened to be run again.
* player: remove the last instances of pollingwm42014-07-181-7/+9
| | | | | | | | | | | | | | | | | Mouse cursor handling, --heartbeat-cmd, and OSD messages basically relied on polling. For this reason, the playloop always used a small timeout (not more than 500ms). Fix these cases, and raise the timeout to 100 seconds. There is no reason behind this number; for this specific purpose it's as close to infinity as any other number. On MS Windows, or if vo_sdl is used, the timeout remains very small. In these cases the GUI code doesn't do proper event handling in the first place, and fixing it requires much more effort. getch2_poll() still does polling, because as far as I'm aware no event- based way to detect this state change exists.
* command: change cache perentage to float, add cache-free and cache-usedAndrey Morozov2014-07-021-4/+4
|
* player: make the time display relative to start PTSTsukasa OMOTO2014-06-291-3/+2
| | | | | | This commit makes the playback start time always at time 0. Signed-off-by: wm4 <wm4@nowhere>
* player: show "neutral" position markers for OSD barswm42014-06-081-3/+8
| | | | This commit implements them for volume and some video properties.
* player: hack to fix --msgmodule --term-osd-barwm42014-04-131-1/+1
| | | | | | | | | Basically a cheap hack to fix that the --msgmodule prefix will cause an unwanted linebreak by making the line too long. Suggested by Hamuko in github issue #710. Fixes #710.
* options: handle escape sequences in e.g. --playing-msg differentlywm42014-02-201-2/+2
| | | | | | | | | | M_OPT_PARSE_ESCAPES was pretty stupid, and broke the (useful) assumption that string variables contain exactly the same value as set by the option. Simplify it, and move escape handling to the place where it's used. Escape handling itself is not terribly useful, but still allows useful things like multiline custom OSD with "\n".
* options: add --no-terminal switchwm42014-02-101-0/+6
| | | | | Mostly useful for internal reasons. This code will be enabled by default if mpv is started via the client API.
* sub: uglify OSD code path with lockingwm42014-01-181-18/+18
| | | | | | | | | | | | | | | Do two things: 1. add locking to struct osd_state 2. make struct osd_state opaque While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses lots of osd_state (and osd_object) members. To make sure everything is accessed synchronously, I prefer making osd_state opaque, even if it means adding pretty dumb accessors. All of this is meant to allow running VO in their own threads. Eventually, VOs will request OSD on their own, which means osd_state will be accessed from foreign threads.
* player: remove OSD message IDswm42014-01-171-14/+10
| | | | | | These were needed before the last commit, but now they don't do anything anymore. (They were used to decide whether to replace or stack the previous OSD message when a new one was displayed.)
* player: remove OSD stackwm42014-01-171-55/+15
| | | | | | | | | | | If certain OSD messages were displayed at the same time, the hidden messages were put on the stack, and displayed again once the higher priority messages disappeared. The idea was probably that lower priority messages could not hide higher priority ones, and also that the lower messages did not get lost. But in practice, this gives confusing results with OSD messages randomly reappearing for a brief time. Remove it.
* player: don't use OSD message stack for term OSD subswm42014-01-171-13/+16
| | | | | | | | Showing subtitles on terminal used the OSD message stack (which uses a stack to "pile up" messages that were displayed at the same time). This had a bunch of weird and annoying consequences. This accessed a certain osd_state field, which is a minor annoyance since I want to make that struct opaque. Implement this differently.
* msg: move special declarations to msg_control.hwm42014-01-161-0/+1
| | | | | While almost everything uses msg.h, the moved definitions are rarely needed by anything.
* player: handle the corner cases in --term-osd-bar correctlyJohannes Nixdorf2014-01-151-3/+3
| | | | With the old code and pos == width - 2 one character too many is drawn.
* player: use more than 1/100 resolution for --term-osd-barJohannes Nixdorf2014-01-151-1/+2
| | | | | If the terminal width is large enough the position marker jumps over several characters because currently pos only increases in 1/100th steps.
* player: add --term-osd-bar, which shows a status bar on the terminalwm42014-01-151-0/+29
| | | | | Feature request from github issue #451. Disabled by default, will probably stay this way.
* player: don't print status in --idle modewm42014-01-141-1/+1
| | | | Apparently this annoys certain users. Restores old behavior.
* player: redo terminal OSD and status line handlingwm42014-01-131-48/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The terminal OSD code includes the handling of the terminal status line, showing player OSD messages on the terminal, and showing subtitles on terminal (the latter two only if there is no video window, or if terminal OSD is forced). This didn't handle some corner cases correctly. For example, showing an OSD message on the terminal always cleared the previous line, even if the line was an important message (or even just the command prompt, if most other messages were silenced). Attempt to handle this correctly by keeping track of how many lines the terminal OSD currently consists of. Since there could be race conditions with other messages being printed, implement this in msg.c. Now msg.c expects that MSGL_STATUS messages rewrite the status line, so the caller is forced to use a single mp_msg() call to set the status line. Instead of littering print_status() all over the place, update the status only once per playloop iteration in update_osd_msg(). In audio- only mode, the status line might now be a little bit off, but it's perhaps ok. Print the status line only if it has changed, or if another message was printed. This might help with extremely slow terminals, although in audio+video mode, it'll still be updated very often (A-V sync display changes on every frame). Instead of hardcoding the terminal sequences, use terminfo/termcap to get the sequences. Remove the --term-osd-esc option, which allowed to override the hardcoded escapes - it's useless now. The fallback for terminals with no escape sequences for moving the cursor and clearing a line is removed. This somewhat breaks status line display on these terminals, including the MS Windows console: instead of querying the terminal size and clearing the line manually by padding the output with spaces, the line is simply not cleared. I don't expect this to be a problem on UNIX, and on MS Windows we could emulate escape sequences. Note that terminal OSD (other than the status line) was broken anyway on these terminals. In osd.c, the function get_term_width() is not used anymore, so remove it. To remind us that the MS Windows console apparently adds a line break when writint the last column, adjust screen_width in terminal- win.c accordingly.
* player: don't block terminal OSD while seekingwm42014-01-131-3/+6
| | | | | | | | Seeking usually show the status on OSD. In terminal OSD mode, no status is shown, because there is already a separate status line. Unfortunately, the mechanism for showing the status was still active, which forced showing no message while the code for showing seek status was active.
* player: always ise [statusline] for terminal OSDwm42014-01-051-3/+3
| | | | | | This was inconsistent: the actual statusline used [statusline] as message prefix, while other parts of the terminal OSD used [cplayer] (and MSGL_STATUS). This commit makes it consistent.
* player: add --secondary-sid for displaying a second subtitle streamwm42013-12-241-2/+2
| | | | | | | This is relatively hacky, but it's Christmas, so it's ok. This does two things: 1. allow selecting two subtitle tracks, and 2. include a hack that renders the second subtitle always as toptitle. See manpage additions how to use this.
* player: use separate msg prefix for statuslinewm42013-12-211-3/+3
| | | | | So the user can specifically mute or unmute the status line with --msglevel. Accidentally removed with commit 5e0c4ec3.
* Rename getch2....c/h to terminal....c/hwm42013-12-191-1/+1
| | | | | "getch2" really tells nothing about what the heck this code does. It'd be even worse when moving the rest of terminal handling code there.
* player: replace some overlooked mp_msgswm42013-12-191-6/+5
| | | | | There are still some using IDENTIFY, and some without context in configfiles.c.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-3/+3
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-2/+2
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Rename mp_core.h to core.hwm42013-12-171-1/+1
| | | | Get rid of the mp_ prefix.
* Move mpvcore/player/ to player/wm42013-12-171-0/+518