0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
Commit Graph

1759 Commits

Author SHA1 Message Date
wm4
f64de3ea66 player: don't leave buffering during underflow
Don't leave the buffering state while the demuxer is still marked as
having underflowed. It's unclear why this hasn't been done before - with
the logic being complicated as it is, maybe there was a reason for this.

This is actually still not very reliable, but should be better than what
was before: on stream switching decoders can read packets all while the
demuxer is executing a refresh seek, which creates the underrun
situation - but nothing really totally guarantees that the underrun
state remains stable when the demuxer is back at the current demuxer
position. Anyway, it's an improvement.

The rest of the touched condition is not changed, just moved around for
cosmetic reasons.
2016-10-21 17:11:26 +02:00
Aman Gupta
8b00d82b79 player: guard against MPSEEK_RELATIVE when current pts is unknown
in very rare circumstances, doing a relative seek like +1s will end up
doing an absolute seek to 00:01. this guards against that possibility.

so far i've only ever seen this issue when using --ad=lavc:ac3_at and
doing several relative seeks in quick succession. this is likely either
a bug in the audiotoolbox decoder in ffmpeg, or simply due to inherent
latency in that hardware decoder which causes brief periods of time
where the current audio pts is unknown.
2016-10-21 17:11:26 +02:00
Aman Gupta
7cd32ec29e audio: force pts_reset only when pts jumps forward more than 5s
i've seen several mpegts samples where pts jumps backwards and repeats
itself. this usually happens on live tv streams from cable providers,
particularly when the stream switches from one advertisement to another.
2016-10-21 17:11:26 +02:00
Aman Gupta
183af9d72e player: speed up audio/video re-sync when there is a huge delay
when there is a huge delay between audio/video sync, it can take a
really long time to converge back. this speeds up the resync time by
increasing the max_change allowed per iteration.

Signed-off-by: wm4 <wm4@nowhere>
2016-10-21 17:11:26 +02:00
Ricardo Constantino
a6da4faac5
osc: fix crash after reaching a certain position in limited lists
Don't try to display more items than there are in the chapter/playlist.
Fixes #3691
2016-10-20 19:07:35 +01:00
Ricardo Constantino
912d668ea8
osc: use the same characters as track list for playlist/chapter
Had only tested with luajit which supports the \xHH syntax added
in Lua 5.2.

The arrow is troublesome to use since the ideal way to use it, as
the OSD code uses it, needs \alpha&H00<arrow>\r to work, which
does not in OSC's way of showing messages.
2016-10-17 19:00:17 +01:00
Ricardo Constantino
8956229ee4
osc: fix chapter/playlist listing if empty 2016-10-15 13:58:52 +01:00
Ricardo Constantino
992bdc9411
osc: show playlist/chapter list on prev/next instead of osd 2016-10-15 12:27:04 +01:00
Ricardo Constantino
5d3657e092
osc: fix listing of chapters and playlist
Fixes regression since 05c398f.

Add helper functions for limiting potentially huge lists of
playlists and chapters and use them.
2016-10-15 12:27:04 +01:00
Ricardo Constantino
06065dc5ef
osc: fix display of chapters and playlist scaling
Compensate \fs when using non-default scale(fullscreen|windowed).
2016-10-15 12:27:04 +01:00
Ricardo Constantino
2a99e7ae12
osc: add user-alterable margin for top/bottombar 2016-10-15 12:24:01 +01:00
Ricardo Constantino
b99dc17f8e
osc: add right-click behavior to playlist and chapter buttons 2016-10-15 12:24:01 +01:00
Ricardo Constantino
8bb57c0387
osc: change default layout to bottombar
Change a few other defaults accordingly:
- seekbarstyle=bar looks better with bottombar.
- Bigger scalewindowed and scalefullscreen make bottom/topbar more readable.
2016-10-15 12:24:01 +01:00
Ricardo Constantino
13259f35c8
ytdl_hook: Add title to playlist items if available 2016-10-15 01:33:27 +01:00
Ricardo Constantino
65c75112a7 osc: move tooltip to inside seekbar for top/bottombar
Tooltip border is user-alterable
2016-10-07 00:31:49 +01:00
Ricardo Constantino
e41dbc3019 osc: change seekbar background's alpha scaling
This avoids a full transparent seekbar with only boxalpha=115.

No change with default values.
2016-10-07 00:31:48 +01:00
Ricardo Constantino
7022a24542 osc: align text vertically in top/bottombar
Close #2093
2016-10-07 00:24:12 +01:00
Maurycy Skier
e9c43258b8 ytdl_hook: add chapters by parsing video's description 2016-10-06 21:18:43 +01:00
wm4
d7e587acc9 options: handle --audio-device changes like the other options
Don't require special property code for handling updates, and simply use
the UPDATE_AUDIO flag instead. Also make runtime changes to
--audio-client-name take effect.
2016-10-05 16:45:04 +02:00
wm4
6fb12a5fda audio: move some fallback handling to common AO reload function
Now a reload requested by an AO behaves in exactly the same way as
changing an AO-related options (like --audio-channels or
--audio-exclusive). This is good for testing and uniform behavior. (You
could go as far as saying it's a necessity, because the spotty and
obscure AO reload behavior is hard to reproduce and thus hard to test at
all.)
2016-10-05 16:42:43 +02:00
wm4
3825dc63b2 command: flush and uninitialize audio output first on option changes
This affects changing audio configuration options. Explicitly flush and
uninitialize the audio output first before doing the rest. This should
ensure all state attached to the audio output is discarded and not used
during the reconfiguration.

Also add a comment to the reinit_audio_filters() call. It doesn't
necessarily restore the audio chain fully, but makes sure a seek is
issued if the amnount of buffered audio discarded was huge enough to
cause "problems".
2016-10-05 16:06:37 +02:00
wm4
75cab315ea command: include deprecated/aliased options in property bridge
If we really want client API users to use mpv_set_property() instead of
mpv_set_option(), then compatibility handling of deprecated options
should be included. Otherwise, there's the danger that client API users
either break too early (and without a warning), or mpv_set_option() will
continue to have a reason to exist.
2016-10-04 13:23:11 +02:00
wm4
abbc8fc84a player: fix previous commit
...
2016-10-03 17:16:02 +02:00
Philip Sequeira
ff531b71e3 command: allow absolute seeks relative to end of stream
"seek -10 absolute" will seek to 10 seconds before the end. This more or less
matches the --start option and negative seeks were otherwise useless (they just
clipped to 0).
2016-10-02 18:01:52 +02:00
wm4
3a5cbf3907 audio: fix late audio start
Regression since commit bbcd0b6a. This code is just cursed, because it's
a fragile state machine with no proper tests, and which could be done in
a much simpler way. Without doubt this change will cause a regression in
some ridiculous corner case as well.

Fixes #3610 (the cause of it, not the behavior it resulted in).
2016-10-02 13:47:25 +02:00
wm4
39fc5e1deb player: make --stop-screensaver runtime-changeable
Move the screensaver enable/disable determination to a central place,
and call it if the stop-screensaver property is changed.

Also, do not stop the screensaver when in idle mode (i.e. no file is
loaded).

Fixes #3615.
2016-10-02 12:33:34 +02:00
wm4
b81ae52f50 player: enable reading from stdin after loading input.conf
Someone requested this.
2016-09-29 16:26:54 +02:00
Ricardo Constantino
6487ba4864 ytdl_hook: Set aspect ratio for anamorphic video 2016-09-28 21:16:40 +02:00
James Ross-Gowan
b712095d89 win32: make --priority runtime-settable
I'm not sure if this option affects anything or if it's a placebo,
especially since the VO thread is now registered with MMCSS. Still, I
think --priority=high may have helped back when I used mplayer2 on a
netbook. It's also possible that encoding-mode users would want to set
--priority=idle.

Anyway, it was one of the last M_OPT_FIXED options, so fix that.
2016-09-28 21:47:30 +10:00
wm4
b6cbf74518 command: fix inverted condition in sub-reload command
Fixes #3586 (probably). Untested.
2016-09-26 20:12:59 +02:00
Ricardo Constantino
f0ab9f05f1 player: allow opts in pseudo-gui set by the user to override user's default
This should still allow user-set default options to override built-in
pseudo-gui while respecting user-set pseudo-gui options.

Pros:
- user option in default profile overrides built-in pseudo-gui's options
  Ex: screenshot-directory overrides built-in pseudo-gui's
- user can "fix" pseudo-gui if some option like "force-window=no" is set
  in default by setting "force-window=yes" in [pseudo-gui]
- `mpv --profile=pseudo-gui` will work as before

Cons:
- --show-profile=pseudo-gui won't display the built-in's options

Original idea from wm4.

Documentation edits mostly by wm4.

Signed-off-by: wm4 <wm4@nowhere>
2016-09-26 19:25:14 +02:00
wm4
dd339b200b video: trust demuxer framerate on invalid timestamps
If the PTS goes backwards (whether it's a timestamp reset or some other
problem) would just use 0 as frame duration. (At least until the logic
for detecting divergence with the timestamps gets active.)

Trust the demuxer framerate in these cases instead, if it's available. I
think this improves behavior slightly with some broken files.
2016-09-26 17:55:00 +02:00
wm4
a314b1013f scripting: don't attempt to load builtin scripts twice
During init it will first call mp_load_builtin_scripts(), and then again
via mp_load_scripts().

This was harmless (a second attempt won't load it again if the first one
was successful), but it's unnecessary, and also looks confusing if the
scripts failed to load the first time.
2016-09-26 16:49:35 +02:00
Ricardo Constantino
29d74ca2f5 osc: Fix scaling issues when toggling fullscreen
Fixes #3429
2016-09-25 16:10:48 +02:00
wm4
cad6fb038b lua: complain loudly if Lua state creation fails
This should normally happen only if memory allocation for the state
happens, which should be extremely rare. But with Luajit on OSX, it can
happen if the magic compiler flags required by Luajit were not passed to
mpv compilation. Print an error to reduce confusion.
2016-09-25 01:00:20 +02:00
wm4
88f10ec84f player: fix instant subtitle refresh on track switches
When switching a subtitle track, the subtitle wasn't necessarily
updated, especially when playback was paused.

Some awfully subtle and complex interactions here.

First off (and not so subtle), the subtitle decoder will read packets
only on explicit update_subtitles() calls, which, if video is active, is
called only when a new video frame is shown. (A simply video frame
redraw doesn't trigger this.) So call it explicitly. But only if
playback is "initialized", i.e. not when it does initial track selection
and decoder init, during which no packets should be read.

The second issue is that the demuxer thread simply will not read new
packets just because a track was switched, especially if playback is
paused. That's fine, but if a refresh seek is to be done, it really
should do this. So if there's either 1. a refresh seek requested, or 2.
a refresh seek ongoing, then read more packets.

Note that it's entirely possible that we overflow the packet queue with
this in unpredicated weird corner cases, but the queue limit will still
be enforced, so this shouldn't make the situation worse.
2016-09-24 19:57:19 +02:00
wm4
2361ec35aa lua: fix array detection
This was dumb and could return something like "{name=123}" as an array.

Also, fix the error message if a key is not a string. lua_typename()
takes a type directly, not a stack item.
2016-09-24 17:52:36 +02:00
wm4
68d2903cb1 command: some minor corrections to previous commit
The last commit was fine - just making some enhancements.

Rename the function to parse_node_chapters(), since it really has not
much to do with Lua.

Don't use len<0 as check whether it makes sense to set chapters, and
instead check for mpctx->demuxer (that includes the possibility to set
chapters e.g. within a preload hook, but after chapters are initialized
from the demuxer).

Return M_PROPERTY_ERROR instead of M_PROPERTY_OK if the mpv_node has the
wrong type.

It's ok if a chapter has no title, so change the checks accordingly.

Remove a Yoda condition.

Notify that chapter metadata might have changed with mp_notify() (the
chapter list itself is already taken care by generic code).

Fix leaking the metadata allocations of the new chapter list.
2016-09-24 17:51:23 +02:00
Maurycy Skier
e2e9a7faa8 command: make it possible to set chapters via lua plugins 2016-09-24 17:17:49 +02:00
wm4
1500c84226 player: fix intended pseudo-gui behavior
It's still supposed to be possible to customize the pseudo-gui section.
2016-09-23 22:35:54 +02:00
wm4
9eef41dec1 player: do not let pseudo-gui override user config settings
Seems like this confused users quite often.

Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now
has to be used to invoke pseudo GUI mode. The old way still works, and
still behaves in the old way.
2016-09-23 21:24:50 +02:00
wm4
f0fd663320 m_config, command: remove some minor code duplication
I would have been fine with this, but now I want to add another flag,
and the duplication would become more messy than having a strange
function for deduplication.
2016-09-23 21:04:20 +02:00
wm4
f4db6b8479 command: make most options observable
The property observation mechanism turns properties into integer IDs for
fast comparison. This means if two properties get the same ID, they will
receive the same notifications. Use this to make properties under
options/ receive notifications. The option-property bridge marks
top-level properties with the same name as the options.

This still might not work in cases the C code sets values on options
structs directly.
2016-09-23 20:49:08 +02:00
wm4
6f6c4a57ec command: fix potential UB
Pointed out by quilloss on github.
2016-09-23 15:21:59 +02:00
wm4
caa14e3d45 x11: fix external fullscreen update
On x11, you can change the fullscreen via the window manager and without
mpv's involvement. In these cases, the internal fullscreen flag has to
be updated.

The hack used for this didn't really work properly. Change it
accordingly. The important thing is that the shadow copy of the option
is updated. This is still not really ideal.

Fixes #3570.
2016-09-23 12:09:48 +02:00
wm4
075edc6fee player: make audio-channels etc. runtime settable
If one of the audio output format options is set, brually reinit the
audio chain.

Since the audio-channels property is still mapped to the deprecated
read-only property, "options/audio-channels" currently has to be used,
e.g. "cycle-values options/audio-channels 2 7.1".
2016-09-22 20:57:06 +02:00
wm4
2ac74977c5 command: add a load-script command
The intention is to give libmpv users as much flexibility to load
scripts as using mpv from CLI, but without restricting libmpv users from
having to decide everything on creation time, or having to go through
hacks like recreating the libmpv context to update state.
2016-09-22 20:57:06 +02:00
wm4
01e95468f9 player: remove some explicit options accesses when saving resume file
Basically, make use of all the new code.

Unfortunately, the new code and it's "compromise semantics" with the old
behavior before the options/properties merge bites back: this
vid/aid/sid, deinterlace, and video-aspect properties have neutral
default settings (such as "auto"), but return the current value during
playback, so we would unnecessarily force this value when playback is
resumed. So leave those as they are.

Also, the colormatrix options were removed a long time ago.
2016-09-22 20:57:06 +02:00
wm4
efbfc00741 command: fix missing update notifications in some cases 2016-09-22 20:57:06 +02:00
wm4
6fe83fdc33 player: some M_SETOPT_RUNTIME cleanups
Add this flag where needed. You shouldn't be able to set e.g. config-dir
in these situations.

Remove the mpctx->initialized check from the property/option bridge,
since it's in use strictly only after initialization. Likewise, the
apply-profile command doesn't need to check this.
2016-09-22 20:57:05 +02:00