Commit Graph

25 Commits

Author SHA1 Message Date
Andreas Rheinhardt a24bccc238 avformat/mux: Add flag for "only default codecs allowed"
AVOutputFormat has default codecs for audio, video and subtitle
and often these are the only codecs of this type allowed.
So add a flag to AVOutputFormat so that this can be checked generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:57:19 +01:00
Andreas Rheinhardt f4167842c1 avformat/mux: Add flag for "not more than one stream of each type"
More exactly: Not more than one stream of each type for which
a default codec (i.e. AVOutputFormat.(audio|video|subtitle)_codec)
is set; for those types for which no such codec is set (or for
which no designated default codec in AVOutputFormat exists at all)
no streams are permitted.

Given that with this flag set the default codecs become more important,
they are now set explicitly to AV_CODEC_ID_NONE for "unset";
the earlier code relied on AV_CODEC_ID_NONE being equal to zero,
so that default static initialization set it accordingly;
but this is not how one is supposed to use an enum.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:57:19 +01:00
Andreas Rheinhardt b800327f4c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f4 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.

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

This is possible since 50f34172e0
(which removed the last usage of an internal field of AVInputFormat
in fftools).

(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03: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
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
Vittorio Giovara 2f271172b0 ilbc: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:33 -03:00
Andreas Rheinhardt a3e78deb0a avformat/ilbc: Use av_get_packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-06 22:49:26 +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
Michael Niedermayer 054ce5f786 avformat/ilbc: Add missing #if for muxer
Fixes: building without muxers
Fixes: 21594

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-07 17:01:58 +02:00
Andreas Rheinhardt ab502fab6a avformat/ilbc: Don't reimplement ff_raw_write_packet
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-03 17:51:18 +02:00
Andreas Rheinhardt 6a67d518d6 avformat: Remove unnecessary av_packet_unref()
Since bae8844e the packet will always be unreferenced when a demuxer
returns an error, so that a lot of calls to av_packet_unref() in lots of
demuxers are now redundant and can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-10 22:41:38 +01:00
Marton Balint 4bf90e095b avformat: remove avio_flush() calls from the end of write_header functions
To make it consistent with other muxers.

The user can still control the generic flushing behaviour after write_header
(same way as after packets) 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 the first 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
Carl Eugen Hoyos 4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +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
Hendrik Leppkes 7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
Luca Barbato ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Clément Bœsch 7308439158 lavf: Don't explicitly flush after each written packet in muxers
Since 596e5d4783, this is not necessary anymore. It also allows to
actually disable the flushing, improving write performance (but
possibly giving worse latency in real-time streaming).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:17:33 +03:00
Clément Bœsch 8de9bb6e5e lavf: remove some flushing in write_packet muxers callbacks.
Since 4f112a8e3, this is not necessary anymore. Also, it allows to
actually disable the flushing.
2013-04-14 21:16:53 +02:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Michael Niedermayer b5da7d4c1a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avformat: Drop pointless "format" from container long names
  swscale: bury one more piece of inline asm under HAVE_INLINE_ASM.
  wv: K&R formatting cosmetics
  configure: Add missing descriptions to help output
  h264_ps: declare array of colorspace strings on its own line.
  fate: amix: specify f32 sample format for comparison
  tiny_psnr: support 32-bit float samples
  eamad/eatgq/eatqi: call special EA IDCT directly
  eamad: remove use of MpegEncContext
  mpegvideo: remove unnecessary inclusions of faandct.h
  af_asyncts: avoid overflow in out_size with large delta values
  af_asyncts: add first_pts option

Conflicts:
	configure
	libavcodec/eamad.c
	libavcodec/h264_ps.c
	libavformat/crcenc.c
	libavformat/ffmdec.c
	libavformat/ffmenc.c
	libavformat/framecrcenc.c
	libavformat/md5enc.c
	libavformat/nutdec.c
	libavformat/rawenc.c
	libavformat/yuv4mpeg.c
	tests/tiny_psnr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-30 23:28:31 +02:00
Diego Biurrun 6774247a9d avformat: Drop pointless "format" from container long names 2012-07-30 13:59:06 +02:00
Michael Niedermayer cabbd271a5 Merge remote-tracking branch 'qatar/master'
* qatar/master: (24 commits)
  flvdec: remove incomplete, disabled seeking code
  mem: add support for _aligned_malloc() as found on Windows
  lavc: Extend the documentation for avcodec_init_packet
  flvdec: remove incomplete, disabled seeking code
  http: replace atoll() with strtoll()
  mpegts: remove unused/incomplete/broken seeking code
  af_amix: allow float planar sample format as input
  af_amix: use AVFloatDSPContext.vector_fmac_scalar()
  float_dsp: add x86-optimized functions for vector_fmac_scalar()
  float_dsp: Move vector_fmac_scalar() from libavcodec to libavutil
  lavr: Add x86-optimized function for flt to s32 conversion
  lavr: Add x86-optimized function for flt to s16 conversion
  lavr: Add x86-optimized functions for s32 to flt conversion
  lavr: Add x86-optimized functions for s32 to s16 conversion
  lavr: Add x86-optimized functions for s16 to flt conversion
  lavr: Add x86-optimized function for s16 to s32 conversion
  rtpenc: Support packetizing iLBC
  rtpdec: Add a depacketizer for iLBC
  Implement the iLBC storage file format
  mov: Support muxing/demuxing iLBC
  ...

Conflicts:
	Changelog
	configure
	libavcodec/avcodec.h
	libavcodec/dsputil.c
	libavcodec/version.h
	libavformat/movenc.c
	libavformat/mpegts.c
	libavformat/version.h
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-19 20:53:27 +02:00
Martin Storsjö a2b251a05e Implement the iLBC storage file format
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-18 22:01:02 +03:00