Commit Graph

1563 Commits

Author SHA1 Message Date
Marton Balint 2296078397 avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number
Their usefulness is questionable, very few decoders set them, and their type
should have been int64_t. A replacement field can be added later if a valid use
case is found.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:37:50 +01:00
Marton Balint 6b6f7db819 avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.

Also deprecate the old 32 bit frame_number attribute.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-13 00:36:46 +01:00
Anton Khirnov d1b9a3ddb4 lavfi: add a new filtergraph parsing API
Callers currently have two ways of adding filters to a graph - they can
either
- create, initialize, and link them manually
- use one of the avfilter_graph_parse*() functions, which take a
  (typically end-user-written) string, split it into individual filter
  definitions+options, then create filters, apply options, initialize
  filters, and finally link them - all based on information from this
  string.

A major problem with the second approach is that it performs many
actions as a single atomic unit, leaving the caller no space to
intervene in between. Such intervention would be useful e.g. to
- modify filter options;
- supply hardware device contexts;
both of which typically must be done before the filter is initialized.

Callers who need such intervention are then forced to invent their own
filtergraph parsing, which is clearly suboptimal.

This commit aims to address this problem by adding a new modular
filtergraph parsing API. It adds a new  avfilter_graph_segment_parse()
function to parse a string filtergraph description into an intermediate
tree-like representation (AVFilterGraphSegment and its children).

This intermediate form may then be applied step by step using further
new avfilter_graph_segment*() functions, with user intervention possible
between each step.
2023-02-12 10:28:06 +01:00
James Almer 5bad485603 Bump major versions of all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
Leo Izen 719a93f4e4 avutil/{color_utils, csp}: merge color_utils into csp and expose API
libavutil/color_utils contains some avpriv_ symbols that map
enum AVTransferCharacteristic values to gamma-curve approximations and
to the actual transfer functions to invert them (i.e. -> linear).

There's two issues with this:
(1) avpriv is evil and should be avoided whenever possible
(2) libavutil/csp.h exposes a public API for handling color that
    already handles primaries and matricies

I don't see any reason this API has to be private, so this commit takes
the functionality from avutil/color_utils and merges it into avutil/csp
with an exposed av_ API rather than the previous avpriv_ API.

Every reference to the previous API has been updated to point to the
new one. color_utils.h has been deleted as well. This should not break
any applications as it only contained avpriv_ symbols in the first
place, so nothing in that header could be referenced by other
applications.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:35:14 +01:00
Andreas Rheinhardt 868a31b42d avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket*
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
Anton Khirnov d02340b9e3 lavc/decode: allow using AV_CODEC_FLAG_COPY_OPAQUE for decoding
Use it to propagate AVPacket.opaque[_ref] to corresponding AVFrame
fields. This is a more convenient alternative to reordered_opaque.
2023-02-04 13:14:20 +01:00
Anton Khirnov a1a80f2e64 lavc/encode: pass through frame durations to encoded packets
The generic code can only handle the no-delay case. Encoders with delay
need to be handled individually, which will be done in the following
commits.
2023-01-29 09:23:15 +01:00
Anton Khirnov 5c0348f3d6 lavc: add a codec flag for propagating opaque from frames to packets
This is intended to be a more convenient replacement for
reordered_opaque.

Add support for it in the two encoders that offer
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE: libx264 and libx265. Other
encoders will be supported in future commits.
2023-01-29 09:18:14 +01:00
Jan Ekström 002d0ec740 avutil: introduce AVAmbientViewingEnvironment side data
This enables exposing H.274 Ambient Viewing Environment
metadata in the framework.
2023-01-13 21:26:13 +02:00
Timo Rothenpieler 7a8d78f7e3 lavc: add new unsafe_output hwaccel_flag 2022-12-10 00:52:33 +01:00
Lynne e97368eba5
lavu: bump minor and add APIchanges entry for lavu/tx DCT 2022-11-24 15:58:36 +01:00
James Almer 26cb36f357 Revert "lavc: deprecate avcodec_dct, av_fft, av_dct, av_rdft and av_mdct"
There are sill many users of these APIs within libav*, so this commit
introduced too many deprecation warnings, making compilation too noisy and
potentially hiding legit warnings.
Once the remaining users are ported, this can be reapplied.

This reverts commit 76d0038579.
2022-11-06 12:15:56 -03:00
Lynne 76d0038579
lavc: deprecate avcodec_dct, av_fft, av_dct, av_rdft and av_mdct
Replaced by lavu/tx. Dedicated code soon to be removed, replaced with
a simple wrapper code.
2022-11-06 14:39:42 +01:00
Marvin Scholz 9dad237928 avutil/dict: Add av_dict_iterate
This is a more explicit iteration API rather than using the "magic"
av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX) which is not really
trivial to grasp what it does when casually reading through code.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-11-06 08:26:48 +01:00
James Almer 6228ba141d avutil/channel_layout: add a 7.1(top) channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-03 19:39:45 -03:00
James Almer 83e918de71 avutil/channel_layout: add a cube channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2022-10-30 16:18:30 -03:00
Leo Izen 479747645f avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats
Add an AV_PIX_FMT_NE macro for RGB32FBE/RGB32FLE and also one for
RGBA32FBE/RGBA32FLE for packed 32-bit float RGB samples, and also
packed 32-bit float RGBA samples, respectively.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2022-10-11 16:31:15 -03:00
Lynne bd3e552549
lavu: bump minor and add APIChanges entry for RISC-V's RVBbasic 2022-10-05 08:31:15 +02:00
Andreas Rheinhardt d09776d486 avformat/avio: Schedule AVIODirContext to become an opaque type
Users can't make anything with its content.
Making it opaque might allow us to avoid one level of indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-03 23:21:57 +02:00
Anton Khirnov 5c94b6694a lavu: add an APIchanges entry for RISC-V CPU flags
Forgotten in 0c0a3deb18.
2022-10-02 11:59:34 +02:00
Anton Khirnov 8bafe8a418 doc/APIchanges: mention the addition of AV_PIX_FMT_RGB[A]F*
lavu minor bump was apparently forgotten for those, so mention them in
the block adding av_chroma_location*(), which was the next lavu minor
bump.
2022-10-02 11:59:25 +02:00
Andreas Rheinhardt a02a0e8db4 avcodec/avcodec: Deprecate lavc chroma pos API functions
avcodec_enum_to_chroma_pos() and avcodec_chroma_pos_to_enum()
deal with enum AVChromaLocation which is defined in lavu.
These functions are therefore replaced by
av_chroma_location_enum_to_pos() and av_chroma_location_pos_to_enum().
This commit provides the necessary deprecations. Also already make
these functions wrappers around the corresponding lavu functions
as not doing so would force one to disable deprecation warnings.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-26 03:02:49 +02:00
Andreas Rheinhardt 8be6552aa4 avutil/pixdesc: Add av_chroma_location_(enum_to_pos|pos_to_enum)
They are intended as replacements for avcodec_enum_to_chroma_pos()
and avcodec_chroma_pos_to_enum().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-26 03:02:25 +02:00
Andreas Rheinhardt cf856d8957 avcodec/avcodec: Move AV_ER_* and FF_COMPLIANCE_* to defs.h
They are also frequently used in libavformat.
This change does not cause any breakage as avcodec.h
includes defs.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-26 02:51:46 +02:00
Philip Langdale d75c4693fe lavu/pixfmt: Add P012, Y212, XV30, and XV36 formats
These are the formats we want/need to use when dealing with the Intel
VAAPI decoder for 12bit 4:2:0, 12bit 4:2:2, 10bit 4:4:4 and 12bit 4:4:4
respectively.

As with the already supported Y210 and YUVX (XVUY) formats, they are
based on formats Microsoft picked as their preferred 4:2:2 and 4:4:4
video formats, and Intel ran with it.

P12 and Y212 are simply an extension of 10 bit formats to say 12 bits
will be used, with 4 unused bits instead of 6.

XV30, and XV36, as exotic as they sound, are variants of Y410 and Y412
where the alpha channel is left formally undefined. We prefer these
over the alpha versions because the hardware cannot actually do
anything with the alpha channel and respecting it is just overhead.

Y412/XV46 is a normal looking packed 4 channel format where each
channel is 16bits wide but only the 12msb are used (like P012).

Y410/XV30 packs three 10bit channels in 32bits with 2bits of alpha,
like A/X2RGB10 style formats. This annoying layout forced me to define
the BE version as a bitstream format. It seems like our pixdesc
infrastructure can handle the LE version being byte-defined, but not
when it's reversed. If there's a better way to handle this, please
let me know. Our existing X2 formats all have the 2 bits at the MSB
end, but this format places them at the LSB end and that seems to be
the root of the problem.
2022-09-03 16:19:40 -07:00
Andreas Rheinhardt dea9744560 avutil/file: Properly deprecate av_tempfile()
It has been deprecated in b4f59beeb4,
but the attribute_deprecated was not set and there was no entry
in APIchanges. This commit adds these and schedules it for removal.
Given that the reason behind the deprecation is exactly the same
as in av_fopen_utf8(), reuse its FF_API_AV_FOPEN_UTF8.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:42:40 +02:00
Philip Langdale cc5a5c9860 lavu/pixfmt: Introduce VUYX format
This is the alphaless version of VUYA that I introduced recently. After
further discussion and noting that the Intel vaapi driver explicitly
lists XYUV as a support format for encoding and decoding 8bit 444
content, we decided to switch our usage and avoid the overhead of
having a declared alpha channel around.

Note that I am not removing VUYA, as this turned out to have another
use, which was to replace the need for v408enc/dec when dealing with
the format.

The vaapi switching will happen in the next change
2022-08-25 19:02:49 -07:00
Anton Khirnov 14726571dd lavf: deprecate av_stream_get_end_pts()
According to its documentation it returns "pts of the last muxed packet
+ its duration", but the value it actually returns right now is
(possibly guessed) dts after muxer-internal bitstream filtering (if
any).

This function was added for ffmpeg.c, but it is not used there anymore.
Since the value it returns is ill-defined and so inappropriate for any
serious use, deprecate it.
2022-08-22 11:35:43 +02:00
James Almer 0446282320 APIchanges: fix library version in the latest entry
Also add commit hash and date while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-19 23:01:10 -03:00
James Almer 352799dca8 The vuya pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-19 22:48:42 -03:00
Timo Rothenpieler 317f5252c0 doc/APIchanges: add missing rgbaf16 pixfmt entry 2022-08-16 12:31:03 +02:00
Haihao Xiang e0bbdbe0a6 lavu/hwcontext_qsv: add loader field to AVQSVDeviceContext
In oneVPL, a valid mfxLoader handle is needed when creating mfx session
for decoding, encoding and processing[1], so add loader field to
AVQSVDeviceContext. User should fill this field before calling
av_hwdevice_ctx_init() if using oneVPL

This is in preparation for oneVPL support

[1]https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher
2022-08-12 10:43:39 +08:00
Philip Langdale 6ab8a9d375 lavu/pixfmt: Add packed 4:4:4 format
The "AYUV" format is defined by Microsoft as their preferred format for
4:4:4 content, and so it is the format used by Intel VAAPI and QSV.

As Microsoft like to define their byte ordering in little-endian
fashion, the memory order is reversed, and so our pix_fmt, which
follows memory order, has a reversed name (VUYA).
2022-08-03 14:09:46 -07:00
Anton Khirnov e3838b856f lavc: add API for exporting reconstructed frames from encoders 2022-08-02 10:46:11 +02:00
Anton Khirnov eede1d2927 lavu/frame: allow calling av_frame_make_writable() on non-refcounted frames
This is an easy way to make a refcounted frame from a non-refcounted
one.
2022-08-02 10:44:37 +02:00
Niklas Haas e1a0f2df3d avcodec: add API for automatic handling of icc profiles
This functionally already exists, but as pointed out in #9672 and #9673,
requiring users to manually include filters is clumsy, error-prone and
hard to use together with tools like ffplay.

To streamline ICC profile support, add a new AVCodecContext flag to
globally enable reading and writing ICC profiles, automatically, for all
appropriate media types.

Note that this commit only includes the new API. The implementation is
split off to separate commits for readability.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-07-30 11:42:06 +02:00
Anton Khirnov 4397f9a5a0 lavu/frame: add a duration field to AVFrame
The only duration field currently present in AVFrame is pkt_duration,
which is semantically restricted to those frames that are output by
decoders.

Add a new field that stores the frame's duration without regard for how
that frame was produced. Deprecate pkt_duration.
2022-07-19 12:27:17 +02:00
Michael Niedermayer 3421476eb5 doc/APIchanges: Add 5.1 branch cutpoint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-13 00:04:15 +02:00
Michael Niedermayer 510cd7d11b doc/APIchanges: Fill in missing things
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 23:58:55 +02:00
Michael Niedermayer eafe641d13 doc/APIchanges: Extend hash which has become ambiguous
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-07-12 23:58:31 +02:00
Gyan Doshi 557a1a8af2 doc/APIchanges: add missing marker for release 5.0 2022-06-16 12:52:24 +05:30
Zane van Iperen 9874baf2cd doc/APIchanges: add missing uuid and csp entries
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-06-13 22:04:36 -03:00
Stefano Sabatini 7cae3d8b76 lavf/avio: add avio_vprintf()
This new function makes it possible to use avio_printf() functionality from
a function taking a variable list of arguments.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-13 22:42:55 +02:00
Martin Storsjö 4cdc14aa95 libavutil: Deprecate av_fopen_utf8, provide an avpriv version
Since every DLL can use an individual CRT on Windows, having
an exported function that opens a FILE* won't work if that
FILE* is going to be used from a different DLL (or from user
application code).

Internally within the libraries, the issue can be worked around
by duplicating the function in all libraries (this already happened
implicitly because the function resided in file_open.c) and renaming
the function to ff_fopen_utf8 (so that it doesn't end up exported from
the DLLs) and duplicating it in all libraries that use it.

This makes the avpriv_fopen_utf8 / ff_fopen_utf8 function work in
the exact same way as the existing avpriv_open / ff_open, with the
same setup as introduced in e743e7ae6e.

That mechanism doesn't work for external users, thus deprecate the
existing function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:52:26 +03:00
Anton Khirnov 6ccc3989d1 doc/APIchanges: update for the new channel layout API 2022-03-19 15:55:51 +01:00
Martin Storsjö 2d368392a5 Keep including the full version.h when headers are included externally
This avoids unnecessary churn and build breakage for users, by
making sure the whole version.h is included like it has been so far,
while keeping the benefit of not needing to rebuild most files in
the ffmpeg tree on minor/micro bumps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-19 00:01:57 +02:00
Martin Storsjö f3a0e2ee2b doc: Add an entry to APIchanges about changes to version.h and version_major.h
Also bump the minor versions of all libraries, to signify the
API change of splitting the version.h headers and adding the
new version_major.h header.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:46 +02:00
Wu Jianhua f629ea2e18 avutil/cpu: add AVX512 Icelake flag
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
Reviewed-by: Henrik Gramner <henrik@gramner.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-10 16:45:48 -03:00
Anton Khirnov a10f1aec1f avutil/fifo: Deprecate old FIFO API
Users should switch to the superior AVFifo API.

Unfortunately AVFifoBuffer fields cannot be marked as deprecated because
it would trigger a warning wherever fifo.h is #included, due to
inlined av_fifo_peek2().
2022-02-07 00:31:49 +01:00