1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

177 Commits

Author SHA1 Message Date
Anton Khirnov
08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt
0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Andreas Rheinhardt
ee485b4051 avformat/internal: Don't auto-include os_support.h
It includes various Windows-specific headers when compiling
for Windows and these sometimes cause issues: E.g. winbase.h
defines IGNORE, which clashes with a macro used in the Matroska
muxer (since 884653ee5b) and demuxer.

This header provides fallback defines for various stuff that is
mostly not used directly by (de)muxers at all:
mkdir, rename, rmdir, unlink, access, poll, pollfd, nfds_t,
closesocket, socklen_t, fstat, stat, lseek, SHUT_(RD|WR|RDWR)
and various POLL* constants.

Ergo fix this issue by not auto-including this header in lots
of places via an inclusion in internal.h and instead include
it everywhere where the above stuff is used (most of these
translation units already included os_support.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-02 10:36:11 +02:00
Leo Izen
e8a63b4763
avformat/jpegxl: remove jpegxl_probe, instead call avcodec/jpegxl_parse
This prevents code duplication in the source form by calling the parse
code that was moved to avcodec last commit. The code will be duplicated
in binary form for shared builds (it's not that large), but for source
code it will only exist in one location now.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-08-27 01:36:18 -04:00
Leo Izen
fa11c4c7fa
avformat/jpegxl_anim_dec: add animated JPEG XL demuxer
Animated JPEG XL files requires a separate demuxer than image2, because
the timebase information is set by the demuxer. Should the timebase of
an animated JPEG XL file be incompatible with the timebase set by the
image2pipe demuxer (usually 1/25 unless set otherwise), rescaling will
fail. Adding a separate demuxer for animated JPEG XL files allows the
timebase to be set correctly.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-06-05 12:15:05 -04:00
Wang Yaqiang
81bc7bc52e avformat/img2dec: fix unable to find svg format when the svg resources start with "<svg" or "<!--"
svg is xml, but <?xml is not required,
it can start with <svg and can have multiple empty lines,
or start with <!-- include some comments,
but must first line if start with <?xml.

Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-03-09 21:17:15 +01:00
Paul B Mahol
a26a2f38e1 avformat/img2dec: fix build 2022-07-16 22:40:44 +02:00
Paul B Mahol
307ab7fe8a avcodec: add Radiance HDR image format support 2022-07-16 21:43:54 +02:00
Paul B Mahol
ff1450e449 avcodec: add PHM decoder and encoder 2022-07-03 15:16:31 +02:00
Paul B Mahol
973fab5653 avcodec: add QOI decoder and demuxer and parser and encoder and muxer 2022-06-05 13:06:54 +02:00
Leo Izen
3ac23440ef avformat/image2: add Jpeg XL as image2 format
This commit adds support to libavformat for muxing
and demuxing Jpeg XL images as image2 streams.
2022-04-23 19:51:46 +02:00
Marton Balint
013d774e22 avcodec/vbndec: add VBN decoder
Add support for decoding Vizrt Binary Image (VBN) files.

LZW-compressed data is not supported yet.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Martin Storsjö
a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Peter Ross
cc5eb2e662 avformat/img2dec: increase probe score for GEM image fourcc variants
Signed-off-by: Peter Ross <pross@xvid.org>
2022-02-04 11:52:26 +11:00
Peter Ross
5903a4e321 avformat/img2dec: fix logic error in GEM Raster file probe
Use correct logic to express limits of the planes and pattern_size fields.

Fix ticket# 9605

Signed-off-by: Peter Ross <pross@xvid.org>
2022-02-04 11:52:26 +11:00
Andreas Rheinhardt
a0d7e41ad7 avformat/img2dec: Don't include disabled demuxers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-08 18:12:30 +01:00
Alex Xu (Hello71)
6fdd7fe0b8 avformat/img2dec: probe JFIF/Exif header
Due to reasons, mpv doesn't pass filename when probing. mpv also sets
default probescore threshold to 26. Since the current jpeg_probe
implementation returns 25 until EOI, it means that the whole image needs
to be probed to succeed. Worse, the whole image is not passed at once;
increasingly large buffers are tried before that. Adding it up together,
if many demuxers are enabled, moderately large JPEG files (few MB) can
take several seconds to open, despite taking less than 1 second to
actually decode.

Therefore, adjust the heuristic to be more optimistic if proper JFIF or
Exif segments are found. While not strictly required, the vast majority
of JPEG-ish files have one or the other or both.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-27 18:24:49 +01:00
Peter Ross
4ff8840697 avformat/img2dec: add GEM Raster image demuxer
Signed-off-by: Peter Ross <pross@xvid.org>
2021-10-08 20:37:36 +11:00
Andreas Rheinhardt
40bdd8cc05 avformat: Avoid allocation for AVStreamInternal
Do this by allocating AVStream together with the data that is
currently in AVStreamInternal; or rather: Put AVStream at the
beginning of a new structure called FFStream (which encompasses
more than just the internal fields and is a proper context in its own
right, hence the name) and remove AVStreamInternal altogether.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-17 13:22:25 +02:00
Andreas Rheinhardt
40ce7aec09 avformat/img2dec: Fix typo in AVClass name
Found-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 21:31:19 +02:00
Andreas Rheinhardt
f06bd04123 avformat/img2dec: Deduplicate AVClasses
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
Andreas Rheinhardt
c0a53884ee avformat/img2dec: Make ff_img2pipe_options static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-08 16:03:17 +02:00
James Almer
b9c5fdf602 avformat: move AVStream.{parser,need_parsing} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-07 09:27:21 -03:00
Andreas Rheinhardt
bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
Andreas Rheinhardt
ef6a9e5e31 avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Jan Ekström
5945288818 avformat/img2dec: set r_frame_rate in addition to avg_frame_rate
Apparently for various image sequences libavformat/utils.c can
calculate rather fancy r_frame_rate values, such as `186/1921`,
and since ffmpeg.c utilizes r_frame_rate for the filter chain
time base, this can quite deteriorate the output frame timing - even
though the user has requested the image sequence to be interpreted
at a specific, constant frame rate.
2021-04-11 13:53:05 +03:00
Andreas Rheinhardt
a46d781905 avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
These are auxiliary side-data functions, so they should have been
switched to size_t in d79e0fe65c,
but this has been forgotten.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 03:12:24 +01:00
Carl Eugen Hoyos
c0d0b1c4f6 lavf/img2dec: Autodetect pfm images. 2021-02-15 00:34:01 +01:00
Paul B Mahol
e28b6e0448 avformat/img2dec: improve xbm probing 2021-02-05 22:37:34 +01:00
Paul B Mahol
84d5df5446 avformat: add xbm_pipe demuxer 2021-02-05 15:36:19 +01:00
Carl Eugen Hoyos
2943c3debd lavf/img2dec: Increase score for very large jpeg images.
Avoids a conflict with the raw mjpeg demuxer.
2020-12-24 13:16:44 +01:00
Anton Khirnov
63c2e500d2 img2dec: export avg_frame_rate 2020-12-10 09:44:40 +01:00
Anton Khirnov
cea7c19cda lavf: move AVStream.*index_entries* to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header. Since there are some (semi-)public fields located after these,
even though this section is supposed to be private, keep some dummy
padding there until the next major bump to preserve ABI compatibility.
2020-10-28 14:59:28 +01:00
Carl Eugen Hoyos
bc43588a71 lavf/img2dec: Auto-detect Cintel scanner images. 2020-10-08 09:34:55 +02:00
Carl Eugen Hoyos
d263838958 lavf/img2dec: Auto-detect Kodak Photo CD image files. 2020-09-05 10:45:52 +02:00
Gautam Ramakrishnan
35adac6e92 libavformat/img2dec: Added pgx demuxer
This patch adds support to demux pgx file
format.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-07-03 23:28:26 +02:00
Andreas Rheinhardt
9fee37c56e avformat/img2dec: Avoid duplicating buffer when adding side-data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-28 12:03:28 +02:00
Andreas Rheinhardt
6a67d518d6 avformat: Remove unnecessary av_packet_unref()
Since bae8844e the packet will always be unreferenced when a demuxer
returns an error, so that a lot of calls to av_packet_unref() in lots of
demuxers are now redundant and can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-10 22:41:38 +01:00
Alexandre Heitor Schmidt
ae436cc5e4 avformat/img2dec: add option to provide metadata fields related to input path
libavformat/img2.h: New field export_path_metadata to
VideoDemuxData to only allow the use of the extra metadata
upon explicit user request, for security reasons.

libavformat/img2dec.c: Modify image2 demuxer to make available
two special metadata entries called lavf.image2dec.source_path
and lavf.image2dec.source_basename, which represents, respectively,
the complete path to the source image for the current frame and
the basename i.e. the file name related to the current frame.
These can then be used by filters like drawtext and others. The
metadata fields will only be available when explicitly enabled
with image2 option -export_path_metadata 1.

doc/demuxers.texi: Documented the new metadata fields available
for image2 and how to use them.

doc/filters.texi: Added an example on how to use the new metadata
fields with drawtext filter, in order to plot the input file path
to each output frame.

Usage example:

ffmpeg -f image2 -export_path_metadata 1 -pattern_type glob
 -framerate 18 -i '/path/to/input/files/*.jpg'
 -filter_complex drawtext="fontsize=40:fontcolor=white:
 fontfile=FreeSans.ttf:borderw=2:bordercolor=black:
 text='%{metadata\:lavf.image2dec.source_basename\:NA}':x=5:y=50"
 output.avi

Fixes #2874.

Signed-off-by: Alexandre Heitor Schmidt <alexandre.schmidt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-10 23:08:18 +01:00
Michael Niedermayer
bd3672ba75 avformat/img2dec: Fix probe_buffer leak in ff_img_read_header()
Fixes: memleak
Fixes: 15171/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5683881644130304

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-06-25 13:30:09 +02:00
Carl Eugen Hoyos
4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Carl Eugen Hoyos
3aa6208db9 lavf: Constify AVInputFormat pointer. 2019-03-20 18:52:38 +01:00
Carl Eugen Hoyos
6de396c216 lavf/img2: Move "loop" into common options.
While the image2pipe demuxer ignores the option - confusing users -
the autodetecting demuxers that are favoured over image2 act on it.
2019-02-10 18:56:46 +01:00
Carl Eugen Hoyos
826cc58deb lavf/img2dec: Split img2 and img2pipe options. 2019-02-10 17:56:01 +01:00
Paul B Mahol
eade85bbbd avformat: add gif pipe demuxer 2018-12-10 11:20:41 +01:00
Carl Eugen Hoyos
42b4351333 lavf/img2dec: Auto-detect xwd images. 2018-05-25 20:06:34 +02:00
Josh de Kock
e0f3228686 lavf/img2dec: use new iteration API
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Michael Niedermayer
a6cba06205 avformat/img2dec: fix infinite loop
Fixes: kira-poc

Found-by: Kira <kira_cxy@foxmail.com>
Change suggested by Kira
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-10 02:44:45 +01:00
Marton Balint
18ac642359 avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Carl Eugen Hoyos
a20f64bee2 lavf/img2dec: Auto-detect svg images. 2017-10-07 03:42:00 +02:00