Commit Graph

105 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 0c6e5f321b avformat/avformat: Avoid including codec.h, frame.h
AVCodec is only ever used as an incomplete type (i.e. via a pointer
to an AVCodec) in avformat.h and it is not really part of the core
of avformat.h or libavformat; almost none of our internal users
make use of it (and none make use of hwcontext.h, which is implicitly
included). So switch to use struct AVCodec, but continue to include
codec.h for external users for compatibility.

Also, do the same for AVFrame and frame.h, which is implicitly included
by codec.h (via lavu/hwcontext.h).

Also, remove an unnecessary inclusion of <time.h>.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-07 00:30:08 +02:00
Andreas Rheinhardt 59c9dc82f4 avformat/avformat: Move AVOutputFormat internals out of public header
This commit does for AVOutputFormat what commit
20f9727018 did for AVCodec:
It adds a new type FFOutputFormat, moves all the internals
of AVOutputFormat to it and adds a now reduced AVOutputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for muxers (it is still a mess due to lavd).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
Peter Ross 23758380d0 avcodec: WBMP (Wireless Application Protocol Bitmap) image format
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Peter Ross <pross@xvid.org>
2022-08-07 19:18:18 +10:00
Paul B Mahol 307ab7fe8a avcodec: add Radiance HDR image format support 2022-07-16 21:43:54 +02:00
Marton Balint b54f3e32fa avformat/img2enc: use unmatched filename for an invalid or missing sequence pattern
Also warn the user that for single images -update should be used, for sequences
a proper pattern should be specified.

Fixes ticket #9748.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-07 20:23:06 +02:00
Marton Balint 3f2de562c3 avformat/img2enc: fix first image check
Start image number was hardcoded to 1 for the first image check.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-07-07 20:23:06 +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
Vignesh Venkatasubramanian dd99d34d67 avformat/img2: Add support for AVIF mux in image2
Add support for AVIF muxing in the image2 muxer.

Tested with this example:
ffmpeg -lavfi testsrc=duration=1:size=320x320 -g 1 -flags global_header -c:v libaom-av1 -f image2 img-%2d.avif

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2022-05-19 14:22:52 +05:30
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 ee50cc18b3 avcodec/vbnenc: add VBN encoder
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
Marton Balint 466441a0d2 avformat/img2enc: do not ignore IO errors
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Anton Khirnov c0e46ad9a9 lavf/img2enc: avoid a useless copy of the url
img2enc keeps a private (and possibly truncated) copy of the url that is
never modified. Just use AVFormatContext.url instead.
2021-12-07 11:16:14 +01:00
Andreas Rheinhardt 12a88f806f avformat/img2enc: Don't use sizeof(AVPacket)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:56:12 +02:00
Andreas Rheinhardt 2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +02: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
Paul B Mahol 67c8c863c7 avcodec: add initial exr image encoder 2021-02-18 13:00:40 +01:00
Paul B Mahol 85bdf18917 avcodec: add PFM image encoder 2021-02-02 14:29:33 +01:00
Andreas Rheinhardt 3362330741 ffplay, avcodec, avformat: Don't initialize before av_packet_ref()
It already initializes the packet.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-28 04:17:20 +01:00
Marton Balint 3ffe3b1db0 avformat/img2enc: add support for specifying protocol options
v2: simplified example

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-18 23:51:17 +01:00
Marton Balint c371463915 avformat: remove avio_flush() calls from the end of write_packet functions
Removing explicit avio_flush() calls helps us to buffer more data and avoid
flushing the IO context too often which causes reduced IO throughput for
non-streamed file output.

The user can control flushing behaviour at the end of every packet using the
-flush_packets option, the default typically means to flush unless a
non-streamed file output is used.

Therefore this change should have no adverse effect on streaming, even if it is
assumed that a new packet has a clean buffer so small seekbacks within the
output buffer work even when the IO context is not seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-07 21:51:45 +01:00
Marton Balint d111a41f9d avformat/img2enc: fix writing multiple streams in write_muxed_file
Maybe we should just reject multiple streams for the image2 muxer instead?

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint beb7f93b23 avformat/img2enc: minor simplification
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 57df8839e1 avformat/img2enc: cleanup IO contexts on error
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 43d5ddb4b5 avformat/img2enc: reindent after last commit
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint 04e36fc4e1 avformat/img2enc: factorize piped write_packet
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Marton Balint b693b06b22 avformat/img2enc: factorize writing fully muxed file
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 11:23:55 +01:00
Lou Logan d92f06eb66 avformat/img2enc: mention -frames:v in error message
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Kieran O Leary <kieran.o.leary@gmail.com>
2019-01-22 10:59:10 -09: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
Steven Liu f3e34072aa avformat/img2enc: add frame_pts option for make output filename
fix ticket id: #1452
when use frame_pts option, the output image name can be set with PTS
of current frame.

Signed-off-by: Steven Liu <lq@onvideo.cn>
2017-11-13 10:52:01 +08:00
Gyan Doshi 3524c92950 lavf/img2enc: remove redundant option 'updatefirst'
'updatefirst' is an undocumented option redundant to older option 'update'. Since it doesn't serve as a shorthand, this patch removes it.
2017-11-01 14:44:08 -08:00
James Almer 89a2472ec5 avformat/img2enc: remove av_dup_packet() call
It's unnecessary after a call to av_packet_ref().

Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-25 23:44:53 -03:00
James Almer a447b75de8 avformat: replace all uses of av_copy_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-25 21:26:38 -03:00
Paras Chadha df475db9a2 Add FITS Muxer
Signed-off-by: Paras Chadha <paraschadha18@gmail.com>
2017-08-30 12:13:02 +02:00
Michael Niedermayer 2b09a3ad19 Revert "img2 encoder: allow %t in filename, based on patch from Yuval Adam"
breaks API

Found-by: jamrial
This reverts commit 1a956c64c8.
2016-11-01 23:03:24 +01:00
rogerdpack 1a956c64c8 img2 encoder: allow %t in filename, based on patch from Yuval Adam
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-01 22:29:23 +01:00
Michael Niedermayer 1fb8f6b75c avformat/img2enc: Use AV_FRAME_FILENAME_FLAGS_MULTIPLE, support tee:
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-04 23:22:54 +02:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Michael Niedermayer b4018544fb avformat/img2enc: remove unused variable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-14 21:30:53 +01:00
Marton Balint 35890aaa65 avformat/img2enc: disable atomic file creation by default
Currently it is broken when explicitly using the file protocol, it uses an
insecure temporary file name, and in commit b4431c80 disabling the option by
default was already considered. Also it is not very consistent to have such an
option for one particular muxer.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:34:16 +01:00
Marton Balint 0250fc2146 avformat/img2enc: return error if image rename fails
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:34:16 +01:00
Derek Buitenhuis bc9a5965c8 Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks.

* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
  lavf: allow custom IO for all files

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-10 14:42:41 +00:00
Derek Buitenhuis 21f9468402 avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT
Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-27 16:36:46 +00:00
Anton Khirnov 9f61abc811 lavf: allow custom IO for all files
Some (de)muxers open additional files beyond the main IO context.
Currently, they call avio_open() directly, which prevents the caller
from using custom IO for such streams.

This commit adds callbacks to AVFormatContext that default to
avio_open2()/avio_close(), but can be overridden by the caller. All
muxers and demuxers using AVIO are switched to using those callbacks
instead of calling avio_open()/avio_close() directly.

(de)muxers that use the URLProtocol layer directly instead of AVIO
remain unconverted for now. This should be fixed in later commits.
2016-01-24 16:45:32 +01:00
Clément Bœsch b4431c80ef lavf/img2enc: add atomic_writing option
This behaviour change caused a regression on our side recently, we might
want to disable the option by default.
2015-12-21 11:19:51 +01:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00