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

1496 Commits

Author SHA1 Message Date
Dudemanguy
fa89082f2e sub: avoid unneeded calls to is_animated
4e5d996c3a added this as part of a series
of patches written to avoid wasteful sub redraws when playing a still
image with subs. The is_animated special case was specifically for ASS
subtitles that have animations/effects and would need repeated redraws
in the still image case. This check was done unconditionally for all ASS
subtitles, but for very big ASS subtitles, this text parsing can get a
bit expensive.

Because this function call is only ever needed for the weird edge case
of ASS subtitles over a still image, some additional logic can be added
to avoid calling is_animated in the vast majority of cases. The animated
field in demux_packet can be changed to a tristate instead where -1
indicates "unknown" (the default state). In update_subtitle, we can look
at the current state of the video tracks and decide whether or not it is
neccesary to perform is_animated and pass that knowledge to sd_ass
before any subtitle packets are decoded and thus save us from doing this
potentially expensive call.
2024-06-04 12:29:13 +00:00
sfan5
54c755b08d various: add missing checks for directory streams
All of this code opens a stream and expects to read stuff from a file.
But streams can also be directories and that has to be handled.
2024-05-15 22:45:18 +02:00
Kacper Michajłow
aa3cf6d57b command: add dolby-vision-profile and dolby-vision-level to track-list 2024-05-10 01:26:30 +02:00
Kacper Michajłow
c83c273400 demux_mkv: inject AV_PKT_DATA_DOVI_CONF to demuxed packets 2024-05-10 01:26:30 +02:00
Kacper Michajłow
a094971ce8 demux_mkv: demux Block Additional Mappings
Parse Dolby Vision configuration.
2024-05-10 01:26:30 +02:00
Kacper Michajłow
d6803c4518 demux_edl: make protocol comparison case insensitive
Else nested edl protocol causes infinite recursion, when loading.

Found by OSS-Fuzz.
2024-05-08 18:52:40 +02:00
Kacper Michajłow
b647201795 osdep/dirent: add implementation for Windows SDK build 2024-05-06 22:01:17 +02:00
Kacper Michajłow
fffe723fc4 various: move strings.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow
18ef834ef4 various: move unistd.h inclusion to common.h 2024-05-06 22:01:17 +02:00
Kacper Michajłow
22ed5d0d3a demux_mkv: fix image detection
If blocks were already demuxed we would skip them and ask for new ones.
For files with few blocks it would return EOF without actually checking
the content.

Also make demux limit higher. In practice it doesn't matter, because if
it is image, video track will have only 1 block. And if it is not image
it will break on 2nd video block.

Fixes: #13975
2024-05-05 14:28:02 +02:00
Aman Karmani
abe8f3f9df demux: keep track of ts information per stream type
Signed-off-by: Aman Karmani <aman@tmm1.net>
2024-05-05 14:11:47 +02:00
Kacper Michajłow
e42e0f2e2a demux_mkv: make V_QUICKTIME codec detection generic
This allows playing files with any fourcc that is supported by mpv.
2024-05-05 13:53:43 +02:00
Kacper Michajłow
b68c742b27 demux/packet: add support for ITU T.35 metadata in Matroska 2024-04-29 01:37:02 +02:00
MartinEesmaa
4f828676fd demux: support VVC Matroska demux
This allows to demux Versatile Video Codec with Matroska container to play.
2024-04-29 01:35:31 +02:00
Florian Albrechtskirchinger
56b3bcaaf2 demux: also read "CUESHEET" tag from stream metadata
Read embedded cue sheets from stream-level metadata, in addition to
format-level metadata.

Fixes missing chapters in opus files with "CUESHEET" tags.
2024-04-19 03:10:48 +02:00
Guido Cella
d0aeca5918 demux_lavf: pass jpg filenames to ffmpeg for probing
Fixes #13192, fixes #13431. See the comment for details.
2024-04-18 16:48:25 +02:00
Kacper Michajłow
a569c3ce0c player/command: add track-list/N/decoder 2024-04-18 01:20:32 +02:00
Kacper Michajłow
b2836bbaf1 demux_mkv: print chapter timestamp with constant length 2024-04-16 19:51:22 +02:00
Kacper Michajłow
ab3b1744b9 demux_mkv: add BCP 47 language tags support
Section 12 of Matroska Media Container Format Specifications says:

If a BCP 47 Language Element and an ISO 639-2 Language Element are used
within the same Parent Element, then the ISO 639-2 Language Element MUST
be ignored and precedence given to the BCP 47 Language Element.

Fixes: #8144
2024-04-16 19:51:22 +02:00
Kacper Michajłow
e720159f72 player/command: add video-codec-info and audio-codec-info
Adds support for extracting codec profile. Old properties are redirected
to new one and removed from docs. Likely will stay like that forever as
there is no reason to remove them.

As a effect of unification of properties between audio and video,
video-codec will now print codec (format) descriptive name, not decoder
long name as it were before. In practice this change fixes what docs
says. If you really need decoder name, use the `track-list/N/decoder-desc`.
2024-04-15 19:34:40 +02:00
Kacper Michajłow
367d02e971 demux_mkv: don't warn if yaw/pitch projection is set to 0
This case will work fine, even if those are explicitly set.
2024-04-14 18:11:37 +02:00
Kacper Michajłow
7bffdf3c70 demux_mkv: remove not needed v_projection_pose_roll_set 2024-04-14 18:11:37 +02:00
ls-2037
f729bd9e05 demux_mkv: corrected direction of ProjectionPoseRoll rotation
See: ietf-wg-cellar/matroska-specification#822
Fixes: #13830
2024-04-14 18:01:34 +02:00
Guido Cella
8d85627aad demux: fix seek ranges of images
When a video-reconfig occurs with an image, the cache is not used
because find_cache_seek_range() checks if the start time was
initialized, but for images it stays at MP_NOPTS_VALUE. This makes
rotating large network images slow because they are re-downloaded on
every rotation.

Fix this by setting the timestamps of image cache ranges by altering a
condition.
2024-04-03 14:47:07 +02:00
valadaptive
acff22cb3b demux_mkv: support V_FFV1 tag
FFmpeg encodes FFV1 with the V_MS/VFW/FOURCC tag, but GStreamer's
matroskamux uses the V_FFV1 tag, so we need to recognize it.
2024-03-25 15:56:17 +01:00
nanahi
a3489c8a0f demux/cache: fix -Wtype-limits warnings
warning: comparison of unsigned expression >= 0 is always true
warning: comparison is always false due to limited range of data type
2024-03-19 08:58:18 +01:00
Dudemanguy
ccafd40ccc demux: add a format-name property
It can be useful to know the underlying format of any entry in the
track list. Only applicable to the lavf demuxer.
2024-03-17 14:59:40 +00:00
Dudemanguy
1a649afbad demux_lavf: always find stream info for avif files
avif files will commonly be probed as "mov,mp4,m4a,3gp,3g2,mj2" by
ffmpeg, but demux_lavf currently has some logic to skip
avformat_find_stream_info for these kinds of files. It was introduced in
6f8c953042. Presumably, the optimization
of mentioned in that commit is still valid however for avif we
specifically need to do the avformat_find_stream_info call. Without it,
several codec proprieties like width, height, etc. are unavailable. So
just check the extension type and disable the skipinfo optimization.
2024-03-02 16:32:11 +00:00
David Vaughan
da753196af player: change insert_next to insert_at
Change the `playlist_insert_next` function to `playlist_insert_at` (ie,
insert at the location of an entry, rather than after it, and rename to
be clearer that it doesn't have anything to do with the
currently-playing entry).

Also, replace calls to `playlist_add` with calls to
`playlist_insert_at`, since the former has become redundant.
2024-02-26 02:03:21 +00:00
nanahi
84015959cc osdep/io: move I/O utility functions to misc/io_utils
The purpose of osdep/io is to provide a wrapper for POSIX I/O functions
on Windows. The last 2 functions are utility functions which don't serve
this purpose.
Move them to a separate file.
2024-02-23 21:35:57 +01:00
Kacper Michajłow
f413e38e42 demux_mkv: don't return null bstr with size specified
Such bstr object are not valid. Also reject empty blocks.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Kacper Michajłow
5e54a871c5 demux_mkv: error if needed compression settings were not found
Mode 3 is header stripping and we need ContentCompSettings to
reconstruct the data.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Kacper Michajłow
4419e5c41b demux_mkv: fix memory leak on invalid blocks
It is possible to have data with empty block that contains additions. In
which case the block would not be added and the additions would leak.

Found by fuzzing.
2024-02-15 16:43:37 +00:00
Dudemanguy
4e5d996c3a player/sub: attempt to detect animated subtitles
The previous commits optimized sub redrawing on still images/terminal so
mpv wouldn't redraw so much. There is a gap though. It only assumes
static subtitles. Since ASS can be animated, those types of subtitles
will always need redraws so we need to build in specific detection for
this. We need to build a whitelist of events in ASS that are considered
animations and then flag the packet. Additionally, there's a bunch of
annoying bookkeeping that has to be done since packets can be dropped on
seeks and so on.
2024-02-15 16:43:11 +00:00
Dudemanguy
8f043de961 player/sub: avoid wasteful subtitle redraws
This only affects two special cases: printing subtitles to the terminal
and printing subtitles on a still picture. Previously, mpv was very dumb
here and spammed this logic on every single loop. For terminal
subtitles, this isn't as big of a deal, but for the image case this is
pretty bad. The entire VO constantly redrew even when there was no need
to which can be very expensive depending on user settings.

Instead, let's rework sub_read_packets so that it also tells us whether
or not the subtitle packets update in some way in addition to telling us
whether or not to read more. Since we cache all packets thanks to the
previous commit, we can leverage this information to make a guess
whether or not the current subtitle packet is supposed to be visible on
the screen. Because the redraw now only happens when it is needed, the
mp_set_timeout_hack can be removed.
2024-02-15 16:43:11 +00:00
nanahi
71598ca07e various: replace dead links in comments
Replace various dead links with live replacements or archives.
Less friction for anyone who wants to look up these references.
2024-02-11 04:01:24 +00:00
Guido Cella
a039cfce00 demux: clarify the meaning of still_image
Clarify that ffmpeg sets AV_DISPOSITION_STILL_IMAGE for sparse videos
like https://s3.amazonaws.com/tmm1/music-choice.ts, not for images.
2024-02-11 04:01:04 +00:00
1nsane000
6c65537c90 demux_mkv: add tags for A_MPEG/L1(mp1) audio 2024-02-10 12:38:59 +01:00
Kacper Michajłow
399a96db5b demux_mkv: set only image flag and ignore still_image
Also check if stream is already image to avoid probing.
2024-02-08 22:21:08 +00:00
Kacper Michajłow
9254231175 demux_mkv: increase probing size for still image
Some files, especially with quite a few audio tracks have video blocks
further away, which made them false detected as still images.

Fixes: 26a5146
2024-02-08 22:21:08 +00:00
Guido Cella
b8c6070f01 demux_mf: detect webp
This lets you play mf://*.webp. It is not necessary to play webp
normally because they are already detected by demux_lavf.
2024-02-06 18:08:53 +01:00
Guido Cella
addf4ad023 Revert "demux: put type2format into codec_tags with helper functions"
This reverts commit be0a979a0b.

The list of images codecs is no longer used by demux_mkv.c because
26a51464b6 made it check the number of blocks instead to not misdetect
animations in image codecs, so move it back to demux_mf.c since it is
its only user, so it is easier to understand how it is used, keeping the
jxl addition from e9d0a31dfe.
2024-02-06 18:08:53 +01:00
Guido Cella
b2bc3c239c demux_mf: explain why a printf format is unsupported 2024-02-02 11:39:47 +01:00
Guido Cella
f935dafa24 demux_mf: remove code repetition 2024-02-02 11:39:47 +01:00
Dudemanguy
26a51464b6 demux_mkv: detect images by reading blocks and timecodes
4709a94aec along with some related commits
added a way to detect image codecs embedded into mkv streams that
weren't tagged with attached picture (arguably a broken file anyways,
but maybe not the worst thing to workaround). Unfortunately, this has
some false positives particularly with mjpeg playback. So, as usual,
revert and rewrite. Instead, we can probe the file and count blocks in
the stream. If the video stream has only 1 block and 1 timecode, then
assume it's a still image.
2024-02-01 22:12:22 +00:00
Dudemanguy
289b3a432e Revert "demux_mkv: check if the video codec is an image"
This reverts commit 4709a94aec.
2024-02-01 22:12:22 +00:00
Kacper Michajłow
475f76dc6d csputils: replace more primitives with pl_
We can go deeper, but need to stop somewhere to not reimplement vo_gpu
using libplacebo...
2024-01-22 14:54:55 +00:00
Kacper Michajłow
66e451f4e6 csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
Guido Cella
5f7ce41371 demux_lavf: detect ico as images 2024-01-19 23:56:21 +00:00
llyyr
bd5d8e41ac demux_lavf: remove fix_editlists hack for mp4
Remove this "hack" from 2017 which disabled `advanced_editlist` while
demuxing mov/mp4. See: b7b12c36af as well
as b86a2316df

At present, advanced edit list support seems to be mature enough that it
doesn't need to be disabled by us and disabling it seems to break more
files based on testing with `elist` files in FFmpeg's FATE suite.
2024-01-11 08:44:18 +01:00