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

994 Commits

Author SHA1 Message Date
Mohammad AlSaleh
d470766000 sub: add --sub-stretch-durations option
Stretch a subtitle duration so it ends when the next one starts.
 Should help with subtitles which erroneously have zero durations.

 I found such a subrip substitles stream in the wild.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2023-11-07 20:46:40 +00:00
Dudemanguy
cf69fa03ca vo: replace max swapchain depth magic number 2023-11-07 00:52:46 +00:00
Kacper Michajłow
174df99ffa ALL: use new mp_thread abstraction 2023-11-05 17:36:17 +00:00
Dudemanguy
90170c1100 options: add UPDATE_SUB_HARD flag to sub-ass-override
The other options that have to do with ass styles also uses this flag.
It's needed since we have to destroy the ass objects and reinit them.
It's a bit incomplete since it will technically only properly work when
paused (while playing, the current subtitle gets discarded). That fix is
in the next commit.
2023-11-05 15:45:43 +00:00
Dudemanguy
250429dac6 m_option: don't try to remove all filter matches
Probably should have actually tested the filter changes but I didn't.
This was the wrong spot anyway since labels are unique. Something like
this should have been done further down when finding it by content. On
second thought, having multiple filters with the same content does have
a usecase (e.g. stacking multiple rotations) so removing all of them at
once probably isn't great. There's no practical usecase for having
duplicates in a string list, so we'll leave that change alone.

Fixes #12791.
2023-11-01 10:37:52 -05:00
Dudemanguy
b56e63e2a9 m_option: drop support for -del for list options
5f74ed5828 deprecated this many years ago.
The utility is questionable at best given that -remove exists and is
more natural to use. Free up some code and drop it.
2023-10-30 16:47:44 +00:00
Dudemanguy
d72c86f95c m_option: remove all matches when using -remove
When using -remove with list options, it previously only removed the
first match. Technically, it is possible for there to be more than entry
with the same name. They should all be removed. key/value lists
specifically only allow unique keys so we don't need to do anything
there.
2023-10-30 16:47:44 +00:00
Dudemanguy
991e2a599c options: make --screenshot-directory/--watch-later-directory aliases
By popular demand I guess.
2023-10-30 16:46:32 +00:00
Dudemanguy
b9c42755a7 javascript: use --js-memory-report option instead of MPV_LEAK_REPORT
The MPV_LEAK_REPORT environment variable was previously read in order to
determine whether or not to enable memory reporting for javascript
scripts. This is kind of weird and deviates from the norm of exposing an
option to the user. So let's just add --js-memory-report and disable it
by default instead.
2023-10-26 16:49:56 +00:00
Dudemanguy
2783d5a51a options: rename --play-dir to --play-direction
--play-dir sounds like it has something to do with directories so change
it. The play_dir variable is used a bunch everywhere internally so
whatever just leave it alone instead of renaming that.
2023-10-25 16:16:37 +00:00
Dudemanguy
36de0d784f options: rename --watch-later-directory to --watch-later-dir
Same logic as the previous commit.
2023-10-25 16:16:37 +00:00
Dudemanguy
1370ecfc1b options: rename --screenshot-directory to --screenshot-dir
Less characters is better? Other options use -dir for directory so
consistency I guess.
2023-10-25 16:16:37 +00:00
Dudemanguy
b626f3ba83 options: rename --sub-ass-force-style to --sub-ass-style-overrides
This option has exactly the same semantics are other mpv options that
override a particular thing with something from the user. So instead of
the "force-style" name, use "-overrides" which is more consistent.
The plural form is used since it's a list option.
2023-10-25 16:16:37 +00:00
Dudemanguy
9924102c66 options: rename --override-display-fps to --display-fps-override
Other similar options are in the form of --foo-override not
--override-foo. The display-fps one was backwards so flip it around the
other way for consistency reasons.
2023-10-25 16:16:37 +00:00
Kacper Michajłow
1805681aab m_option: initialize m_option_value union properly
C standard says that `= {0}` activates and initializes first member of
union. We expect whole union to be zeroed, it is used as default value.

Initialize union with one zeroed default instance to ensure proper init.

Fixes: #12711
2023-10-23 20:33:51 +02:00
NRK
cf7453226d path: don't treat "hidden" files as extension
currently for a filename such as ".file" mpv incorrectly thinks of the
entire filename as being an extension. skip leading dots to avoid
treating "hidden/dot" files as extension.
2023-10-22 10:41:19 +02:00
NRK
d05ef7fdc4 various: sort some standard headers
since i was going to fix the include order of stdatomic, might as well
sort the surrouding includes in accordance with the project's coding
style.

some headers can sometime require specific include order. standard
library headers usually don't. but mpv might "hack into" the standard
headers (e.g pthreads) so that complicates things a bit more.

hopefully nothing breaks. if it does, the style guide is to blame.
2023-10-20 21:31:09 +02:00
NRK
2070331f64 osdep: remove atomic.h
replace it with <stdatomic.h> and replace the mp_atomic_* typedefs with
explicit _Atomic qualified types.

also add missing config.h includes on some files.
2023-10-20 21:31:09 +02:00
Kacper Michajłow
02d009bc5c player/command: truncate anything < 1e-4 in pretty printer
To avoid switching to scientific notation. Apparently it is "jarring"
for some users.

This preserves status quo from before 9dddfc4f where pretty printer were
truncated to 3 decimal places.
2023-10-18 11:34:52 +02:00
Kacper Michajłow
9dddfc4fcc player/command: change how floating point number are printed
Use "%.7g" to show 7 significant digits. Removes the trailing zeros, and
in general makes it more readable, than fixed 3 decimal digits.

For avsync use "%+.2g" to add plus sign, similar to display-sync
values.
2023-10-14 12:30:46 +02:00
Kacper Michajłow
4bbe961885 m_property: add read_sub_validate to check if should be processed
In many cases it makes sense to early exit instead of preparing all the
data only to return type or not implemented.
2023-10-14 12:30:46 +02:00
sfan5
df758880e2 path: don't override "cache" and "state" paths with configdir
This reverts commit 576e86bfa1 (functionally).

Right now, the --config-dir option silently causes all watch_later and cache
files to be written in the --config-dir as well. This is pretty uninitutive
and also not desirable in most cases so get rid of this.
libmpv users will have to set the corresponding options or env vars if they
want to keep the old behaviour.
2023-10-02 18:48:10 +02:00
DeadSix
f19ada7b58 win32: add option to change backdrop style 2023-09-27 14:02:08 +00:00
Dudemanguy
cc1a43f014 m_config_core: remove mp_read_option_raw
With the previous series of commits, all usage of this bad function has
been eliminated in mpv so we can just nuke it for good.
2023-09-22 14:20:38 +00:00
Dudemanguy
db12a2f224 cuda: move --cuda-device to cuda_opts group
Also change a ta_free to talloc_free for consistency reasons.
2023-09-22 14:20:38 +00:00
Dudemanguy
73ad9eef28 opengl/context_win: move opengl-dwmflush to wingl_opts group
Gets rid of yet another mp_read_option_raw call.
2023-09-22 14:20:38 +00:00
Dudemanguy
6d07c8bd36 options: rename some opt structs to *_opts instead of *_params
Purely cosmetic, but this weird inconsistency bothered me. There's
techincally vd_lacv_params and ad_lavc_params too, but encode is special
and maybe shouldn't exist so we'll just leave that alone.
2023-09-22 14:20:38 +00:00
Dudemanguy
8a7704ea89 stream_bluray: move --bluray-device to stream_bluray_opts
Similar to the previous commit. There's no reason for --bluray-device to
be in MPOpts. Make a specific subopt for stream_bluray and use that
instead so we can remove the mp_read_option_raw call.
2023-09-22 14:20:38 +00:00
Dudemanguy
6ea9ec9931 stream_cdda: move cdrom-device to cdda_params
There is zero reason for this to be an MPOpt. Because of how the
OPT_SUBSTRACT works, the option gets renamed to cdda-device instead, but
probably not a big deal since the old alias is still in place.
2023-09-22 14:20:38 +00:00
Dudemanguy
a703dc10c8 options: move some demux-specific opts to demux opts
These options are only ever accessed by the demuxer and have no need to
be in MPOpts. Move them to demux.c instead.
2023-09-22 14:20:38 +00:00
Kacper Michajłow
804eb80e78 win32: add --window-corners
Allows to set preference for window corners rounding for DWM.
2023-09-21 23:13:19 +00:00
Kacper Michajłow
ee24dd0419 win32: add an option to control window title bar state
Fixes: #11432
2023-09-21 23:13:19 +00:00
DeadSix
2c738ca54b win32: add an option to change window affinity 2023-09-21 22:14:28 +00:00
Dudemanguy
177fe48d79 options: remove --vf-defaults and --af-defaults
These were deprecated a long time ago and apparently didn't even work
with lavfi filters. Go ahead and remove them and additionally clean up
some code related to them. m_config_from_obj_desc_and_args becomes much
simpler now and a couple of arguments can be completely removed.
2023-09-21 16:06:29 +00:00
Dudemanguy
fb46666395 options: remove deprecated --record-file option
No wonder wm4 wanted to get rid of this. This option requires touching a
bunch of crap in the core player code. --stream-record works perfectly
fine and is a lot nicer so there's no need for this to exist anymore.
2023-09-21 16:06:29 +00:00
Dudemanguy
36ea5d7b5c options: remove a few options marked with .deprecation_message
A bit different from the OPT_REPLACED/OPT_REMOVED ones in that the
options still possibly do something but they have a deprecation
message. Most of these are old and have no real usage. The only
potentially controversial ones are the removal of --oaffset and
--ovoffset which were deprecated years ago and seemingly have no real
replacement. There's a cryptic message about --audio-delay but who
knows. The less encoding mode code we have, the better so just chuck
it.
2023-09-21 16:06:29 +00:00
Dudemanguy
969c19c9cb options: remove ancient option fallbacks/deprecation
We've got an ungodly amount of OPT_REPLACED and OPT_REMOVED sitting
around in the code. This is harmless, but the vast majority of these are
ancient. 26f4f18c06 is the last commit
that touched the majority of these and of course that only changed how
options were declared so all of this stuff was deprecated even before
that. No use in keeping these, so just delete them all. As an aside,
there was actually a cocoa_opts but it had only a single option which
was replaced by something else and empty otherwise. So that entire thing
was just simply removed. OPT_REPLACED/OPT_REMOVED declarations that were
added in 0.35 or later were kept as is.
2023-09-21 16:06:29 +00:00
Kacper Michajłow
20e584f60b options: make video-crop validation more strict 2023-09-20 19:08:19 +00:00
Kacper Michajłow
f5690e3c97 Revert "sub: add auto option to --sub-fix-timing"
This reverts commit b47a58516a.
2023-09-11 01:58:07 +00:00
Kacper Michajłow
fb6f92af7f m_option: return empty rect when no width/height is available 2023-09-08 02:27:08 +00:00
Kacper Michajłow
fef4481bfe m_option: make m_rect_apply center based
This makes it easier to apply crops without need to manually calc the
offset. I wanted for it to be top-left corner based, but maybe it was
not that good idea in retrospect.

Also rename scrw/scrh, since they don't refer to screen. It was copied
form m_geometry apply.
2023-09-08 02:27:08 +00:00
Dudemanguy
b47a58516a sub: add auto option to --sub-fix-timing
Third try is the charm? I stupidly missed that this option already
existed in my previous commits. Instead, add an auto value to it and
enable it by default for sd_lavc but not sd_ass. On my limited samples,
it seems to fix the gaps issue that can occur but without regressing
some duration timings for sub_lavc subtitles. Well hopefully anyway.
Fixes #12327.
2023-09-07 09:27:31 -05:00
llyyr
a862f4ff10 options: remove unnecessary clamping on video-pan-x/y
This makes panning impossible at zoom level below 0, because it scales
with 2^zoom. Allow using bigger values instead
2023-09-02 16:18:31 +00:00
Kacper Michajłow
f3f1a79fe3 vo: add --video-crop
Just cropping by VO that works with hwdec.

Fixes: #12222
2023-08-31 17:37:42 +00:00
Kacper Michajłow
21048291be m_option: add OPT_RECT
Parsed as WxH+X+Y to mp_rect. Allows also WxH without the offset.
2023-08-31 17:37:42 +00:00
Dudemanguy
9b9475e218 player: rename --sub-forced-only to --sub-forced-events-only
The old name is pretty bad and users mistakenly think it has something
to do with selecting forced subtitles (that would be
--subs-fallback-forced). Instead of giving it such a generic name, make
it clearer that this has to do specifically with forced sub events
which is only relevant for a small minority of subtitles.
2023-08-29 16:39:00 +00:00
Dudemanguy
4009e99b9c player: remove auto choice from sub-forced-only
First of all, this never worked. Or if it ever did, it was in some
select few scenarios. c9474dc9ed is what
originally added support for the auto choice. However, that commit
worked by propagating a value to a fake option used internally. This
shouldn't have ever worked because the underlying m_config_cache was
never updated so the value shouldn't have been preserved when accessed
in sd_lavc. And indeed with some testing, the value there is always 0
unsurprisingly.

This was later rewritten in ba7cc07106
along with a lot of other sub changes, but with that, it was still
mostly broken. The reason is because one of the key parts of having to
hit this logic (prefer_forced) required `--no-subs-with-matching-audio`
to be set. If the audio language matches the subtitle language (the
requirement also excludes forced subs), the option makes no subtitle
selection in the first place so pick->forced_only_def is not set to true
and nothing even happens. Another way around this would be to attempt to
change your OS language (like with the LANG environment variable) so
that the subtitle track gets selected but then audio_matches mistakenly
becomes false because it compares the OS language to the audio language
which then make preferred_forced 0, so nothing happens. I don't think
there's a scenario where pick->forced_only_def is actually set to true
(thus meaning `auto` is useless), but maybe someone could contrive
something very strange. Regardless, it's definitely not something even
remotely common.

fbe8f99194 changed track selection again
but didn't consider this particular case. The net result is that DVD/PGS
subs become equivalent to --sub-forced-only being yes, so this a change
in behavior and probably not a good one. Note that I wasn't able to
actually observe any difference in a PGS sample. It still displayed
subtitles fine but that sample probably didn't have the right flags to
hit the sub-forced-only logic.

Anyways, the auto feature is extremely questionable at best and in my
view, not actually worth it. It is meant to be used with
`--no-subs-with-matching-audio` to display forced pictures in subtitle
tracks that are not marked as forced, but that contradicts that
particular option's purpose and description in the manual (secretly
selecting a track under certain conditions even though it says not to).

Instead of trying to shove all this logic into select_default_track
which is already insanely complicated as it is, recognize that this is a
trivial lua script. If you absolutely want to turn --sub-forced-only on
under these certain conditions (DVD/PGS subtitles, matching audio and
subtitle languages, etc.), just look at the current-tracks property and
do your thing. The very, very niche behavior that this option tried to
accomplish basically never worked, no user even knows what this option
does, and well it's just not worth supporting in core mpv code. Drop
all this code for sanity's sake and change --sub-forced-only back to a
bool.
2023-08-29 16:39:00 +00:00
Dudemanguy
165f9e061f player: add always to --subs-fallback-forced
In general, forced tracks should only be shown if they match the
language of the audio. However some people do want them no matter what,
so add an always option to this so such tracks are always selected.
2023-08-28 18:43:46 +00:00
Dudemanguy
58ec0630f5 player: add --subs-match-os-language option
This is the replacement for the previous auto option for slang. It
behaves similar however it never overrides slang if that is set and will
instead try to pick the subtitle that matches the user's language if
appropriately flagged by the file.
2023-08-28 18:43:46 +00:00
Dudemanguy
53d032374d player: remove special auto option from alang/slang/vlang
This proved to be too problematic. Depending on the value of
--subs-with-matching-audio, you could either end up with cases where
--slang wasn't respected and users didn't get subtitles or alternatively
cases where subtitles were given and the user didn't ask for them.
Fundamentally, the OS language functionality doesn't really map well to
slang (and for alang/vlang it makes zero sense; not that anyone actually
used it). Instead of trying to shove it in an option where it doesn't
belong, we should split this off into something else. So for now, just
remove the special handling of "auto" and flip slang back to NULL.
2023-08-28 18:43:46 +00:00