Commit Graph

22 Commits

Author SHA1 Message Date
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