Commit Graph

83 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 03b04eef72 avformat: Enforce one-stream limit where appropriate
Several muxers (e.g. pcm muxers) did not check the number
of streams even though the individual streams were not
recoverable from the muxed files. This commit changes
this by using the FF_OFMT_MAX_ONE_OF_EACH flag
where appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:57:19 +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
Paul B Mahol 44c8f7df03 avformat/adtsenc: do not pass NULL to av_log() 2023-04-27 21:38:21 +02: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 7eed125dbb avcodec/mpeg4audio: Move ff_copy_pce_data() to a header of its own
It is only used by three of the thirty files that (potentially
indirectly) include mpeg4audio.h. Twenty of these files won't
have a put_bits.h inclusion any more after this patch.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-02 20:16:42 +02:00
maryam ebrahimzadeh 9ffa49496d avformat/adtsenc: return value check for init_get_bits in adts_decode_extradata
As the second argument for init_get_bits (buf) can be crafted, a return value check for this function call is necessary.
'buf' is  part of  'AVPacket pkt'.
replace init_get_bits with init_get_bits8.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-08-06 21:04:43 +02:00
Anton Khirnov 239b7d2e40 lavf/adtsenc: avoid avcodec.h dependency 2021-06-10 16:51:44 +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
Andreas Rheinhardt ef6a9e5e31 avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Gyan Doshi b06082d1d5 avformat/dtsenc: reindent 2021-04-27 09:21:43 +05:30
Gyan Doshi 45fc214ebf avformat/adtsenc: clarify option help
Also remove unnecessary unit as option does not accept any constants.
2021-04-27 09:18:41 +05:30
Chris Ribble c9fed043f1 libavformat/adtsenc: Increase ADTS_MAX_FRAME_BYTES from 8k to 16k
ADTS frames may contain up to 768 bytes per channel. With 16 channels,
this is 12k, which cannot fit into the maximum 8k buffer.

Signed-off-by: Chris Ribble <chris.ribble@resi.io>
2021-04-25 19:16:40 +02:00
James Almer e07126f54a avformat: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-10 20:26:36 -03:00
Marvin Scholz ff4cc8c654 adtsenc: Add ability to write MPEG2 ID
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-08-30 16:18:37 +02:00
Andreas Rheinhardt c3cd6b765b avcodec, avformat: Remove unnecessary initializations of side data size
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-22 12:20:37 +02:00
James Almer 35bbaa6652 avformat: use avpriv_mpeg4audio_get_config2()
Signed-off-by: James Almer <jamrial@gmail.com>
2019-09-27 10:37:11 -03:00
Gyan Doshi 96f94624e0 avformat/adtsenc: allow only AAC streams
The ADTS muxer will silently (attempt to) mux any audio stream passed to it.
Patch adds a codec check.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-14 09:57:51 -03:00
James Almer 02dba49dd3 avformat/adtsenc: add adts_init()
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-14 09:57:42 -03:00
James Almer 9ea06d48c2 Merge commit '831018b0bbe26a603802a9022472f714a59293be'
* commit '831018b0bbe26a603802a9022472f714a59293be':
  mpeg4audio: Make avpriv_copy_pce_data() inline

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 17:47:21 -03:00
James Almer 210388a197 avcodec/adtsenc: check packet side data for AAC extradata updates
This is in preparation for the following patch.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:28:00 -03:00
Anton Khirnov 831018b0bb mpeg4audio: Make avpriv_copy_pce_data() inline
The function currently accepts a PutBitContext and a GetBitContext,
which hardcodes their sizes into the lavc ABI. Since the function is
quite small and only called in a few places, the simplest solution is
making it inline, thus avoiding a runtime dependency completely.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-04-28 13:47:20 +02: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
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Michael Niedermayer a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Michael Niedermayer d902a3f4cb avformat/adtsenc: buf isnt changed in adts_decode_extradata(), make it const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-22 18:47:14 +02:00
Michael Niedermayer fca76dc61e Merge commit '13c90bc9a359e969cc2b7f7e8199b02a0e4c6ec9'
* commit '13c90bc9a359e969cc2b7f7e8199b02a0e4c6ec9':
  adts: Return more meaningful error codes

Conflicts:
	libavformat/adtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-21 21:56:33 +02:00
Nidhi Makhijani 13c90bc9a3 adts: Return more meaningful error codes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-21 04:25:48 -07:00
Dale Curtis 42f3bc4072 avformat/adtsenc: Optionally enable ID3 in ADTS.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 02:11:25 +02:00
Michael Niedermayer 95398aa949 Merge commit 'f792d3cbb8e8e35c54a9358a55dd596b7a40f228'
* commit 'f792d3cbb8e8e35c54a9358a55dd596b7a40f228':
  lavf: add the notimestamps flag to the muxers missing it

Conflicts:
	libavformat/adtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-18 17:28:10 +02:00
Anton Khirnov f792d3cbb8 lavf: add the notimestamps flag to the muxers missing it 2014-06-18 15:03:31 +02:00
James Almer c994b42830 lavf/adtsenc: Add support for APE tags
Should fix ticket #2269

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-23 16:13:23 +02: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 d1dad7c824 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpc8: return more meaningful error codes.
  mpc: return more meaningful error codes.
  wv,mpc8: don't return apetag data in packets.
  rtmp: do not warn about receiving metadata packets
  x86: h264dsp: Adjust YASM #ifdefs
  x86: yadif: Mark mmxext optimizations as such
  h264: convert loop filter strength dsp function to yasm.
  Improve descriptiveness of a number of codec and container long names

Conflicts:
	libavcodec/flvdec.c
	libavcodec/libopenjpegdec.c
	libavformat/apetag.c
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-31 22:41:00 +02:00
Diego Biurrun 0177b7d23a Improve descriptiveness of a number of codec and container long names 2012-07-30 20:46:55 +02:00
Michael Niedermayer f67309cabe Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegtsenc: Support LATM packetization for AAC
  adtsenc: Don't expose the muxer internals to the rest of lavf
  mpegtsenc: use AVFormatContext for AAC packetization
  mpegtsenc: use AVERROR() for return codes

Conflicts:
	libavformat/adts.h
	libavformat/mpegtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-03 02:56:52 +02:00
Jindrich Makovicka 485d3ea064 adtsenc: Don't expose the muxer internals to the rest of lavf
This isn't required any longer, when the mpegts muxer uses it
as a proper chained muxer.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-03 01:18:11 +03:00
Michael Niedermayer e4de71677f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aac_latm: reconfigure decoder on audio specific config changes
  latmdec: fix audio specific config parsing
  Add avcodec_decode_audio4().
  avcodec: change number of plane pointers from 4 to 8 at next major bump.
  Update developers documentation with coding conventions.
  svq1dec: avoid undefined get_bits(0) call
  ARM: h264dsp_neon cosmetics
  ARM: make some NEON macros reusable
  Do not memcpy raw video frames when using null muxer
  fate: update asf seektest
  vp8: flush buffers on size changes.
  doc: improve general documentation for MacOSX
  asf: use packet dts as approximation of pts
  asf: do not call av_read_frame
  rtsp: Initialize the media_type_mask in the rtp guessing demuxer
  Cleaned up alacenc.c

Conflicts:
	doc/APIchanges
	doc/developer.texi
	libavcodec/8svx.c
	libavcodec/aacdec.c
	libavcodec/ac3dec.c
	libavcodec/avcodec.h
	libavcodec/nellymoserdec.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/wmadec.c
	libavformat/asfdec.c
	tests/ref/seek/lavf_asf

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-03 03:00:30 +01:00
Janne Grunau fd095539d1 latmdec: fix audio specific config parsing
Pass the correct size in bits to mpeg4audio_get_config and add a flag
to disable parsing of the sync extension when the size is not known.

Latm with AudioMuxVersion 0 does not specify the size of the audio
specific config. Data after the audio specific config can be
misinterpreted as sync extension resulting in random and wrong configs.
2011-12-03 00:42:48 +01:00
Michael Niedermayer 4dcd1a3145 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  adtsenc: Check frame size.
  txd: Fix order of operations.
  APIchanges: fill in some blanks
  timer: fix misspelling of "decicycles"
  Eliminate pointless 0/NULL initializers in AVCodec and similar declarations.
  indeo3: cosmetics
  md5proto: Fix order of operations.
  dca: Replace oversized unused get_bits() with skip_bits_long().

Conflicts:
	doc/APIchanges
	libavformat/mmsh.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-29 00:20:29 +01:00
Alex Converse ac47e014bb adtsenc: Check frame size.
Inspired by work from: Michael Niedermayer <michaelni@gmx.at>.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2011-11-28 11:22:40 -08:00
Michael Niedermayer dd8ffc1925 Merge remote-tracking branch 'qatar/master'
* qatar/master: (47 commits)
  lavc: hide private symbols.
  lavc: deprecate img_get_alpha_info().
  lavc: use avpriv_ prefix for ff_toupper4.
  lavc: use avpriv_ prefix for ff_copy_bits and align_put_bits.
  lavc: use avpriv_ prefix for ff_ac3_parse_header.
  lavc: use avpriv_ prefix for ff_frame_rate_tab.
  lavc: rename ff_find_start_code to avpriv_mpv_find_start_code
  lavc: use avpriv_ prefix for ff_split_xiph_headers.
  lavc: use avpriv_ prefix for ff_dirac_parse_sequence_header.
  lavc: use avpriv_ prefix for some dv symbols used in lavf.
  lavc: use avpriv_ prefix for some flac symbols used in lavf.
  lavc: use avpriv_ prefix for some mpeg4audio symbols used in lavf.
  lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf.
  lavc: use avpriv_ prefix for ff_aac_parse_header().
  lavf: hide private symbols.
  lavf: use avpriv_ prefix for some dv functions.
  lavf: use avpriv_ prefix for ff_new_chapter().
  avcodec: add CODEC_CAP_DELAY note to avcodec_decode_audio3() documentation
  avcodec: clarify the CODEC_CAP_DELAY note in avcodec_decode_video2()
  avcodec: clarify documentation of CODEC_CAP_DELAY
  ...

Conflicts:
	configure
	doc/general.texi
	libavcodec/Makefile
	libavcodec/aacdec.c
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/dv.c
	libavcodec/dvdata.c
	libavcodec/dvdata.h
	libavcodec/libspeexenc.c
	libavcodec/mpegvideo.c
	libavcodec/version.h
	libavformat/avidec.c
	libavformat/dv.c
	libavformat/dv.h
	libavformat/flvenc.c
	libavformat/mov.c
	libavformat/mp3enc.c
	libavformat/oggparsespeex.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-21 02:01:26 +02:00
Anton Khirnov 59a9a23581 lavc: use avpriv_ prefix for some mpeg4audio symbols used in lavf.
Specifically, ff_mpeg4audio_sample_rates, ff_mpeg4audio_get_config and
ff_copy_pce_data
2011-10-20 21:06:57 +02:00
Michael Niedermayer 78accb876c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  ffmpeg: fix some indentation
  ffmpeg: fix operation with --disable-avfilter
  simple_idct: remove disabled code
  motion_est: remove disabled code
  vc1: remove disabled code
  fate: separate lavf-mxf_d10 test from lavf-mxf
  cabac: Move code only used in the cabac test program to cabac.c.
  ffplay: warn that -pix_fmt is no longer working, suggest alternative
  ffplay: warn that -s is no longer working, suggest alternative
  lavf: rename enc variable in utils.c:has_codec_parameters()
  lavf: use designated initialisers for all (de)muxers.
  wav: remove a use of deprecated AV_METADATA_ macro
  rmdec: remove useless ap parameter from rm_read_header_old()
  dct-test: remove write-only variable
  des: fix #if conditional around P_shuffle
  Use LOCAL_ALIGNED in ff_check_alignment()

Conflicts:
	ffmpeg.c
	libavformat/avidec.c
	libavformat/matroskaenc.c
	libavformat/mp3enc.c
	libavformat/oggenc.c
	libavformat/utils.c
	tests/ref/lavf/mxf

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-17 20:12:02 +02:00