summaryrefslogtreecommitdiffstats
path: root/demux
Commit message (Collapse)AuthorAgeFilesLines
* demux/packet: add support for ITU T.35 metadata in MatroskaKacper Michajłow5 days2-3/+56
|
* demux: support VVC Matroska demuxMartinEesmaa5 days2-0/+2
| | | | This allows to demux Versatile Video Codec with Matroska container to play.
* demux: also read "CUESHEET" tag from stream metadataFlorian Albrechtskirchinger2024-04-191-12/+19
| | | | | | | Read embedded cue sheets from stream-level metadata, in addition to format-level metadata. Fixes missing chapters in opus files with "CUESHEET" tags.
* demux_lavf: pass jpg filenames to ffmpeg for probingGuido Cella2024-04-181-4/+10
| | | | Fixes #13192, fixes #13431. See the comment for details.
* player/command: add track-list/N/decoderKacper Michajłow2024-04-181-0/+6
|
* demux_mkv: print chapter timestamp with constant lengthKacper Michajłow2024-04-161-2/+2
|
* demux_mkv: add BCP 47 language tags supportKacper Michajłow2024-04-161-1/+4
| | | | | | | | | | 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
* player/command: add video-codec-info and audio-codec-infoKacper Michajłow2024-04-151-0/+6
| | | | | | | | | | | 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`.
* demux_mkv: don't warn if yaw/pitch projection is set to 0Kacper Michajłow2024-04-141-2/+20
| | | | This case will work fine, even if those are explicitly set.
* demux_mkv: remove not needed v_projection_pose_roll_setKacper Michajłow2024-04-141-3/+1
|
* demux_mkv: corrected direction of ProjectionPoseRoll rotationls-20372024-04-141-1/+1
| | | | | See: ietf-wg-cellar/matroska-specification#822 Fixes: #13830
* demux: fix seek ranges of imagesGuido Cella2024-04-031-1/+1
| | | | | | | | | | | 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.
* demux_mkv: support V_FFV1 tagvaladaptive2024-03-251-0/+1
| | | | | 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.
* demux/cache: fix -Wtype-limits warningsnanahi2024-03-191-5/+2
| | | | | warning: comparison of unsigned expression >= 0 is always true warning: comparison is always false due to limited range of data type
* demux: add a format-name propertyDudemanguy2024-03-172-4/+8
| | | | | It can be useful to know the underlying format of any entry in the track list. Only applicable to the lavf demuxer.
* demux_lavf: always find stream info for avif filesDudemanguy2024-03-021-0/+4
| | | | | | | | | | | 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 6f8c953042a7a964686e5923f5c61025ef6b842e. 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.
* player: change insert_next to insert_atDavid Vaughan2024-02-262-5/+5
| | | | | | | | | | 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.
* osdep/io: move I/O utility functions to misc/io_utilsnanahi2024-02-231-0/+1
| | | | | | | 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.
* demux_mkv: don't return null bstr with size specifiedKacper Michajłow2024-02-151-0/+6
| | | | | | Such bstr object are not valid. Also reject empty blocks. Found by fuzzing.
* demux_mkv: error if needed compression settings were not foundKacper Michajłow2024-02-151-0/+4
| | | | | | | Mode 3 is header stripping and we need ContentCompSettings to reconstruct the data. Found by fuzzing.
* demux_mkv: fix memory leak on invalid blocksKacper Michajłow2024-02-151-4/+6
| | | | | | | 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.
* player/sub: attempt to detect animated subtitlesDudemanguy2024-02-151-0/+3
| | | | | | | | | | | 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.
* player/sub: avoid wasteful subtitle redrawsDudemanguy2024-02-151-0/+3
| | | | | | | | | | | | | | | | | 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.
* various: replace dead links in commentsnanahi2024-02-111-2/+2
| | | | | Replace various dead links with live replacements or archives. Less friction for anyone who wants to look up these references.
* demux: clarify the meaning of still_imageGuido Cella2024-02-112-2/+2
| | | | | Clarify that ffmpeg sets AV_DISPOSITION_STILL_IMAGE for sparse videos like https://s3.amazonaws.com/tmm1/music-choice.ts, not for images.
* demux_mkv: add tags for A_MPEG/L1(mp1) audio1nsane0002024-02-101-1/+2
|
* demux_mkv: set only image flag and ignore still_imageKacper Michajłow2024-02-081-4/+2
| | | | Also check if stream is already image to avoid probing.
* demux_mkv: increase probing size for still imageKacper Michajłow2024-02-081-1/+1
| | | | | | | Some files, especially with quite a few audio tracks have video blocks further away, which made them false detected as still images. Fixes: 26a5146
* demux_mf: detect webpGuido Cella2024-02-061-0/+1
| | | | | This lets you play mf://*.webp. It is not necessary to play webp normally because they are already detected by demux_lavf.
* Revert "demux: put type2format into codec_tags with helper functions"Guido Cella2024-02-063-69/+62
| | | | | | | | | | This reverts commit be0a979a0b17b49f8535ee2542cca7df4c35b04d. 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.
* demux_mf: explain why a printf format is unsupportedGuido Cella2024-02-021-1/+3
|
* demux_mf: remove code repetitionGuido Cella2024-02-021-5/+1
|
* demux_mkv: detect images by reading blocks and timecodesDudemanguy2024-02-011-0/+36
| | | | | | | | | | | 4709a94aec5b16534b1d6b0d6738caeaf692e9c9 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.
* Revert "demux_mkv: check if the video codec is an image"Dudemanguy2024-02-013-16/+0
| | | | This reverts commit 4709a94aec5b16534b1d6b0d6738caeaf692e9c9.
* csputils: replace more primitives with pl_Kacper Michajłow2024-01-221-1/+1
| | | | | We can go deeper, but need to stop somewhere to not reimplement vo_gpu using libplacebo...
* csputils: replace mp_colorspace with pl_color_spaceKacper Michajłow2024-01-222-11/+15
|
* demux_lavf: detect ico as imagesGuido Cella2024-01-191-0/+1
|
* demux_lavf: remove `fix_editlists` hack for mp4llyyr2024-01-111-8/+1
| | | | | | | | | | Remove this "hack" from 2017 which disabled `advanced_editlist` while demuxing mov/mp4. See: b7b12c36af96af14b8371d16c5a7f98a7a17915f as well as b86a2316df260de70012fb05dbddf06118b00611 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.
* demux_mkv: add HDMV Text subtitles to subtitle codec listDudemanguy2023-12-161-0/+1
| | | | | Such subtitles will not actually work since FFmpeg doesn't yet have a decoder for them, but this prevents some error message spam at least.
* demux_mkv: check that subtitle type is set before accessing itDudemanguy2023-12-161-1/+1
| | | | | | | | Fixes crashes in case of unknown subtitle track being found, as the original ARIB caption logic added in 0da0acdae8e729eecfb2498ac11cb86a7fe3360d did not attempt to take into mention tracks with unknown type. Fixes #13106
* demux/codec_tags: add jxl/jpegxl extension mapping to image codecsLeo Izen2023-12-141-0/+1
| | | | | | Add .jxl as a file extension that maps to an image codec. Note that this will include animated JXL files, but .gif is also on that list so they are not different in that regard.
* demux: add missing NULL checkKacper Michajłow2023-11-181-0/+1
| | | | It is assigned to NULL above is !stream.
* demux_playlist: simplify ini parsingDudemanguy2023-11-141-7/+8
| | | | | | | | | | | | | | In acac614032529997e0a8d89d35a8613b505e04fb, I sort of cargoculted what I had to do for m3u, but it's actually not needed. bstr_split_tok unexpectedly doesn't modify the original string. So the line_dup business in the ini parsing is not needed. Remove it. The part in parse_ref_init isn't wrong but naming the variable "line_dup" instead of "value" is stupid so adjust that. And finally, you can actually force a codepage in mpv (add "+" before the codepage) which will cause every line to be allocated memory including the header lines even though those are obviously valid utf8 that should never need conversion. This wasn't taken into account so add an extra pl_free_line in a couple of places to make sure they are freed.
* demux: always update the cache on initDudemanguy2023-11-121-1/+1
| | | | | | | | | | | | | cd59ea8afab6381951a3ae19a43e422906d02164 removed an arbitrary start offset added to the timer. However, it turns out that demux secretly depends on this. When updating cache to actually read bytes from the stream, there's a diff >= MP_TIME_S_TO_NS(1) check to make it only update once every second. With the old MP_START_TIME macro, the initial time value would always be at least 1e10, so this would also be true. Since we don't have that offset anymore, now the initial time is less than that so it is not updated and properties like file-size are 0. Just be sure to always update if the last_speed_query is 0 (i.e. we just started the player). Fixes #12869.
* demux/lavf: don't use deprecated side dataKacper Michajłow2023-11-091-5/+26
| | | | | | | Fixes rotation metadata no longer works. See: https://github.com/FFmpeg/FFmpeg/commit/5432d2aacad5fa7420fe2d9369ed061d521e92d6 Fixes: #12836
* ALL: use pl_hdr_metadata and nuke sig_peakKacper Michajłow2023-11-051-3/+0
| | | | | | | | This commit replaces all uses of sig_peak and maps all HDR metadata. Form notable changes mixed usage of maxCLL and max_luma is resolved and not always max_luma is used which makes vo_gpu and vo_gpu_next behave the same way.
* demux_mkv: parse mastering metadataKacper Michajłow2023-11-051-5/+47
|
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-052-101/+98
|
* demux: make hysteresis-secs respect cache-secsNRK2023-10-301-1/+3
| | | | | | | | | | | | currently hysteresis-secs only works when the demuxer-max-bytes fills up. but it's possible for the cache-secs/demuxer-readahead-secs to be reached first. in those cases, hysteresis-secs doesn't work and keeps buffering non-stop. but the goal of this option was to save power by avoiding non-stop buffering so go ahead and make it respect cache-secs as well. additionally remove some redundant repetition from the docs.
* demux: cosmeticsNRK2023-10-301-6/+5
| | | | | - brace goes to next line for multi-line conditional - sort standard headers some more
* various: remove trailing whitespaceGuido Cella2023-10-301-4/+4
|
* options: rename --fps to --container-fps-overrideDudemanguy2023-10-251-1/+1
| | | | | | This better reflects what it actually does. As a bonus, script writers won't be misled into thinking that fps displays the actual video or display fps.
* demux_mkv: check if the video codec is an imageDudemanguy2023-10-233-0/+16
| | | | | | Add a simple helper to codec_tags to check if the codec name matches one of the images. If so, then we set still_image and image in the stream as true (slightly different semanatics).
* demux: put type2format into codec_tags with helper functionsDudemanguy2023-10-233-61/+68
| | | | | | | | | demux_mf has a big const struct which is essentially a nice list handy list of codecs that are considered images. This is generally useful for all demuxers (demux_mkv could use this), so instead of making yet another list, lift it out and put it in a common place. Some things slightly changed so it matches the very similiar mimetype mapping struct below it. demux_mf calls a helper mapping function instead.
* Revert "demux_mkv: PAR should be calculated after applying crop"Kacper Michajłow2023-10-211-10/+7
| | | | | | | | | | | Matroska spec says that DisplayWidth and DisplayHeight should be applied after cropping, but this doesn't adhere to the real files which does not follow this rule. Revert the change and we can re-evaluate if someone complains with spec compliant files. See: https://datatracker.ietf.org/doc/draft-ietf-cellar-matroska/ This reverts commit f8db02b59db08f1013dfb9411bd04c6a80dc72ff.
* demux_mkv: don't set codec crop rect when there is no cropDudemanguy2023-10-211-14/+16
| | | | | | | | | | | | Unfortunately there are files out there with broken tags where the width/height doesn't match the actual width/height of the file. That means the cropping logic which normally should be a no-op resulting in (0, 0, w, h) ends up being a crop which is probably not wanted by the user. Workaround this by simply keeping the entire crop rect as 0 when there is no container cropping. All zeros is internally treated the same as (0, 0, w, h) and avoids bad container data messing up the width or height of the window. Also simplify the logic a bit and get rid of some superflorous bools that had no real use. Fixes #12680.
* various: sort some standard headersNRK2023-10-201-5/+5
| | | | | | | | | | | | 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.
* osdep: remove atomic.hNRK2023-10-201-1/+1
| | | | | | | 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.
* demux_mkv: PAR should be calculated after applying cropKacper Michajłow2023-10-201-10/+10
| | | | DisplayWidth/DisplayHeight applies to the video frame after cropping (PixelCrop* Elements).
* demux/lavf: move tags instead of copyingClaude Heiland-Allen2023-10-181-5/+5
| | | | | | | | | | | Use mp_tags_move_from_av_dictionary() in place of mp_tags_copy_from_av_dictionary(). This ensures that when lavf appends metadata that occurs later in the stream, it starts from empty each time. Fixes: <https://github.com/mpv-player/mpv/issues/12559>
* demux: convert cache updates to nanosecondsDudemanguy2023-10-161-6/+6
| | | | As a bonus, we can remove the awkward and horribly named MP_SECOND_US.
* demux_playlist: use --metacode-codepage when parsing playlist filesDudemanguy2023-10-071-22/+63
| | | | | | | | | | | | It's 2023 and people don't use UTF-8 for their m3u, ini, etc. files. Well mpv already has the tools in place to try and guess other codepages, so we might as well use it I guess. This change is pretty awkward since we have to read line-by-line but mp_iconv_to_utf8 may sometimes allocate memory. So sometimes the bstr needs to be freed and sometimes not for every line. Also we need to make another copy of the line on the stack since splitting by tokens and such will mess up the original line which may possibly be allocated memory. The ugliness is mostly hidden in pl_free_line, but it's still weird. Fixes #10911.
* demux: change the default of metadata-codepage to autoDudemanguy2023-10-071-1/+1
| | | | | | | There's really no reason not to do this especially since sub-codepage already defaults to auto. Also change logging in charset_conv since telling us that the data is UTF-8 if the passed codepage value is "auto" or "utf-8" is really not useful information (that's the expectation).
* demux_cue: deprecate --demuxer-cue-codepage for --metadata-codepageDudemanguy2023-10-071-15/+6
| | | | | | | | | What are cue sheets not metadata or something? No reason this needs to be a separate option so just deprecate it. This does mean that the default value changes from "auto" to "utf-8" for this obscure fringe case. I really hope people don't use non-UTF-8 cuesheets, but the next commit will change the default of --metadata-codepage to "auto" so there's no actual change in behavior to users.
* codec_tags: map some more image mimetypesDudemanguy2023-10-021-0/+7
| | | | This only had jpeg and png in it strangely enough. Fixes #11592.
* demux: move parent_stream_info before the gotoDudemanguy2023-10-011-9/+9
| | | | | | Previously if the demuxer didn't exist, then it could jump down and try to free sinfo.filename before it was ever set thus segfaulting. Just always set the struct unconditionally so we're always sure to free it.
* Revert "demux: constify a struct member"Dudemanguy2023-10-011-2/+3
| | | | | | | | | | Some demuxers actually close the stream right after they are finished opening like cue. Since the stream->url is no longer copied with this commit, that means it gets thrown away after the stream closes. This leads to a use after free. We still need to allocate stream->url so fix this another way. This reverts commit 3e85df3b2d89d6a27806d677b6b8a99055cb1fcc.
* demux: fix erroneous cond