Commit Graph

29 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
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 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
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 56450a0ee4 avformat: Constify the API wrt AV(In|Out)putFormat
Also constify AVProbeData.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:08 -03:00
Gyan Doshi eac77f7cf0 rtpenc_mpegts: add AVClass to the muxer context 2021-04-01 09:34:58 +05:30
Gyan Doshi 8b2bde0494 avformat/rtpenc_mpegts: stop leaks
Fixes CID 1474460 & 1474461
2021-03-28 15:55:02 +05:30
Gyan Doshi 2c806aa2b4 avformat/rtpenc_mpegts: convey options for rtp muxer 2021-03-26 12:37:10 +05:30
Gyan Doshi 325bb04188 avformat/rtpenc_mpegts: relay streamid to mpegts muxer streams. 2021-03-26 12:35:37 +05:30
Gyan Doshi affe911c65 avformat/rtpenc_mpegts: convey options for mpeg-ts muxer
Fixes #5239
2021-03-26 12:34:27 +05:30
Gyan Doshi 75fd3e1519 avformat/rtp_mpegts: typedef MuxChain struct 2021-03-21 15:50:40 +05:30
James Almer fd23efb20b avformat/rtpenc_mpegts: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:19:36 -03:00
Steven Liu 0f79a71353 avformat/rtpenc_mpegts: removed unused check of avformat_free_context
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-12-02 00:08:21 +08:00
Moritz Barsnick 270f94e132 avformat/rtpenc_mpegts: copy metadata to mpegts sub-muxer
Fixes #7293.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-20 23:26:34 +02:00
Carl Eugen Hoyos 9461e4bc69 lavf: Constify AVOutputFormat pointer. 2019-03-20 18:38:48 +01:00
Pan Bian 5b4baf1506 libavformat/rtpenc_mpegts: check avformat_new_stream() return value
The function avformat_new_stream() returns a NULL pointer on failure.
However, in function rtp_mpegts_write_header(), its return value is not
validated before it is dereferenced. Check the return value against NULL
to avoid potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-28 01:18:22 +01: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 ebdae73125 Merge commit 'cf402d6fa88acd647cdff993429583bec8a34fdc'
* commit 'cf402d6fa88acd647cdff993429583bec8a34fdc':
  rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-10 11:17:37 +01:00
Michael Niedermayer 967afad03b Merge commit 'c83dd2d2a458075a58895c384372f57c1ec26276'
* commit 'c83dd2d2a458075a58895c384372f57c1ec26276':
  rtpenc_mpegts: Free the right ->pb in the error path in the init function

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-10 11:08:53 +01:00
Martin Storsjö cf402d6fa8 rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
By making sure we at each time only have one pointer set, either a
local variable or one in the context, we avoid potential double frees
in the cleanup routines. If chain->rtp_ctx is set, it is closed by
calling avformat_write_trailer, but that shouldn't be called unless
avformat_write_header succeeded.

This issue was pointed out by Andreas Cadhalpun.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 09:58:41 +02:00
Martin Storsjö c83dd2d2a4 rtpenc_mpegts: Free the right ->pb in the error path in the init function
This fixes a typo from 8e32b1f096.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 09:58:37 +02:00
Michael Niedermayer 7f03f75ce7 Merge commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a'
* commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a':
  libavformat: Use ffio_free_dyn_buf where applicable

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:48:50 +01:00
Martin Storsjö 8e32b1f096 libavformat: Use ffio_free_dyn_buf where applicable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:47 +02:00
Michael Niedermayer a701a9cff4 Merge commit 'fc308b30bb24e623fed042ec78b10803b2362a18'
* commit 'fc308b30bb24e623fed042ec78b10803b2362a18':
  rtpenc_mpegts: Call write_trailer for the mpegts muxer even if no output buffer exists

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-20 00:42:07 +01:00
Martin Storsjö fc308b30bb rtpenc_mpegts: Call write_trailer for the mpegts muxer even if no output buffer exists
Since the mpegts muxer now can handle being called with a NULL
AVIOContext, we don't need to try to allocate one before calling
write_trailer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-19 23:14:45 +02:00
Michael Niedermayer 7ef515cda5 Merge commit '8a70ef94b9c377293b3dfa7d92cdc81a4fe1543a'
* commit '8a70ef94b9c377293b3dfa7d92cdc81a4fe1543a':
  libavformat: Add a muxer wrapping mpegts encoding into RTP

Conflicts:
	Changelog
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 02:49:36 +01:00
Martin Storsjö 8a70ef94b9 libavformat: Add a muxer wrapping mpegts encoding into RTP
Since this structurally is quite different from normal RTP
(multiple streams are muxed into one single mpegts stream,
which is packetized into one single RTP session), it is kept
as a separate muxer.

Since this structurally also behaves differently than normal
RTP, all of the other muxers that do chained RTP muxing
(rtsp, sap, mp4) would need to be updated similarly to handle
this - in particular, creating one single rtp_mpegts muxer
for the whole presentation instead of one rtp muxer per stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-18 23:12:33 +02:00