Commit Graph

35 Commits

Author SHA1 Message Date
James Almer d6799ee0e4 avformat: remove deprecated FF_API_AVFORMAT_IO_CLOSE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer ab15c04dee avformat/avformat: add a function to return the name of stream groups
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-05 11:54:27 -03:00
James Almer 41e349c24a avformat/mov: add support for tile HEIF still images
Export each tile as its own stream, and the grid information as a Stream Group
of type TILE_GRID.
This also enables exporting other stream items like thumbnails, which may be
present in non tiled HEIF images too. For those, the primary stream will be
tagged with the default disposition.

Based on a patch by Swaraj Hota

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
James Almer 25a10677d1 avformat: add a Tile Grid stream group type
This will be used to support tiled image formats like HEIF.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-26 12:21:12 -03:00
Andreas Rheinhardt 71e1da4522 avformat/mux: Don't allocate priv_pts separately
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt ad9f644505 avformat/avformat: Avoid av_strdup(NULL)
It is not documented to be safe.
Also copy these lists in a more generic manner.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 569ad285a5 avformat/options: Only allocate AVCodecContext for demuxers
The muxer's AVCodecContext is currently used for exactly one thing:
To store a time base in it that has been derived via heuristics
in avformat_transfer_internal_stream_timing_info(); said time base
can then be read back via av_stream_get_codec_timebase().
But one does not need a whole AVCodecContext for that, a simple
AVRational is enough.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 76ef2b9337 avformat/avformat: Remove obsolete comment
Forgotten in 3f991325b5,
obsolete since 3749eede66.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
Andreas Rheinhardt 1d5ba34249 avformat/avformat: Remove dead check, write-only assignment
For muxers, the internal AVCodecContext is basically unused
except in avformat_transfer_internal_stream_timing_info()
(which sets time_base and ticks_per_frame) and
av_stream_get_codec_timebase() (a getter for time_base).
This makes ticks_per_frame write-only, so don't set it.

Also remove an always-false check for the AVCodecContext's
codec_tag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:18 +01:00
James Almer 9949c1dd78 avformat/avformat: fix group index range check in match_stream_specifier()
Fixes segfaults when trying to map a group index with a value equal to the
amount of groups in the file.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-30 17:23:20 -03:00
James Almer 89215237dd avformat: remove ff_remove_stream_group()
It's unused.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-20 00:17:59 -03:00
James Almer 556b596d1d avformat: introduce AVStreamGroup
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:18:05 -03:00
James Almer 5432d2aaca avformat/avformat: use the side data from AVStream.codecpar
Deprecate AVStream.side_data and its helpers in favor of the AVStream's
codecpar.coded_side_data.

This will considerably simplify the propagation of global side data to decoders
and from encoders. Instead of having to do it inside packets, it will be
available during init().
Global and frame specific side data will therefore be distinct.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-06 10:03:57 -03: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
Anton Khirnov 7d1d61cc5f lavc: deprecate AVCodecContext.ticks_per_frame
For encoding, this field is entirely redundant with
AVCodecContext.framerate.

For decoding, this field is entirely redundant with
AV_CODEC_PROP_FIELDS.
2023-05-15 10:56:18 +02:00
Anton Khirnov e930b834a9 lavf: use AV_CODEC_PROP_FIELDS where appropriate
H.264 and mpeg12 parsers need to be adjusted at the same time to stop
using the value of AVCodecContext.ticks_per_frame, because it is not set
correctly unless the codec has been opened. Previously this would result
in both the parser and lavf seeing the same incorrect value, which would
cancel out.
Updating lavf and not the parsers would result in correct value in lavf,
but the wrong one in parsers, which would break some tests.
2023-05-15 10:31:55 +02:00
Marton Balint 927042b409 avformat: deprecate AVFormatContext io_close callback
io_close2 should be used instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-02-16 01:18:45 +01:00
James Almer 5f9e848e68 avcodec: remove FF_API_AVCTX_TIMEBASE
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:08 +01: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
Pierre-Anthony Lemieux f2403d1530 avformat: refactor ff_stream_encode_params_copy() to stream_params_copy()
Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299726.html

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-12 18:54:19 +02:00
Andreas Rheinhardt 467f157fc6 avformat/utils: Move ff_format_io_close.* to options.c, avformat.c
These are not pure avio-functions, but auxiliary AVFormatContext
functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:19 +02:00
Andreas Rheinhardt 6aca6146d9 avformat/utils: Move ff_stream_side_data_copy to avformat.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:18 +02:00
Andreas Rheinhardt 60fa58b835 avformat/utils: Move avpriv_set_pts_info() to avformat.c
It is an essential auxiliary function for both demuxing and muxing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:16 +02:00
Andreas Rheinhardt fc2fc98c75 avformat/utils: Move ff_copy_whiteblacklists to avformat.c
This is an auxiliary function for AVFormatContexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:15 +02:00
Andreas Rheinhardt fd8a6f78c5 avformat/utils: Move ff_format_set_url to avformat.c
An auxiliary function for AVFormatContexts (mainly muxers,
but potentially (e.g. rtsp) also demuxers).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:10 +02:00
Andreas Rheinhardt 2831fa7aed avformat/utils: Move ff_is_intra_only to avformat.c
It is an auxiliary function only used by the generic
muxing and demuxing code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:49:09 +02:00
Andreas Rheinhardt 8e2f48ff78 avformat/utils: Move av_find_best_stream to avformat.c
It is not forbidden to call this with a muxer, so it is moved to
avformat.c and not demux_utils.c. ff_find_decoder(), which is used
by av_find_best_stream() is also moved as well, despite being even
more geared towards demuxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:56 +02:00
Andreas Rheinhardt e00d0ef46d avformat/utils: Move av_find_default_stream_index to avformat.c
While it is clearly written with demuxers in mind,
it is not forbidden to call it with muxers, hence avformat.c
and not demux_utils.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:56 +02:00
Andreas Rheinhardt 1c0912c26e avformat/utils: Move av_find_program_from_stream to avformat.c
It is potentially used with both demuxers and muxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:55 +02:00
Andreas Rheinhardt 9163faecd3 avformat/utils: Move guessing frame rate/SAR to avformat.c
It is not explicitly forbidden to call these functions with muxers
(although it is probably intended to be only called by demuxers;
av_guess_sample_aspect_ratio even says that "the stream aspect ratio
is set by the demuxer").

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:54 +02:00
Andreas Rheinhardt 682d42b41d avformat/utils: Move matching stream specificiers to avformat.c
It is not to call this with a muxer, so move it to avformat.c
and not demux_utils.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:54 +02:00
Andreas Rheinhardt 217f2bfb49 avformat/utils: Move internal stream timebase stuff to avformat.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:53 +02:00
Andreas Rheinhardt b516302cfe avformat/utils: Move adding AVProgram to avformat.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:52 +02:00
Andreas Rheinhardt 21f3dc0ad6 avformat/utils: Move av_stream_*_side_data API to avformat.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:51 +02:00
Andreas Rheinhardt 703318b350 avformat/utils: Move freeing AVFormatContext to a new file avformat.c
This file will contain the AVFormatContext-specific parts
that are used by both demuxers and muxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:46:49 +02:00