Commit Graph

113 Commits

Author SHA1 Message Date
Andreas Rheinhardt
abc7d1c697 avformat/amr: Return error upon error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-09 21:25:03 +01:00
Andreas Rheinhardt
a22a71eb2c avformat/amr: Fix writing AMR header
Regression since f282c34c00.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-08 18:09:02 +01:00
Andreas Rheinhardt
a5a99cc11c avformat/amr: Don't reset AVFormatContext.priv_data
The AMR muxer doesn't have a private context, so it's priv_data
will be NULL. If it weren't, simply setting it to NULL would lead
to a memleak.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-08 18:07:35 +01:00
Andreas Rheinhardt
78a840e7a3 avformat/Makefile, amr: Add missing amr-demuxers->rawdec.o dependency
Forgotten in 1f447fd954.
Also only enable amr_probe() and amr_read_header() in case
the AMR demuxer is enabled; this avoids having to add
a rawdec.o dependency to the muxer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-08 18:04:31 +01:00
Paul B Mahol
f282c34c00 avcodec/amr*dec: add multichannel support 2021-10-03 11:42:15 +02:00
Paul B Mahol
1f447fd954 avcodec: add amr parser 2021-10-02 18:49:40 +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
b5985ce44d avformat/amr: Don't reimplement ff_raw_write_packet()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-14 18:52:44 +02:00
John Rummell
5b967f56b6 libavformat/amr.c: Check return value from avio_read()
If the buffer doesn't contain enough bytes when reading a stream,
fail rather than continuing on with initialized data. Caught by
Chromium fuzzeras (crbug.com/1065731).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-03 00:58:07 +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
Carl Eugen Hoyos
7becc70375 lavf/amr: Fix heuristic to avoid detection of repeated bytes. 2018-06-26 23:04:43 +02:00
Carl Eugen Hoyos
40b7e60718 lavf/amr: Make the heuristic for auto-detection even stricter.
Fixes ticket #7270.
2018-06-22 00:08:13 +02:00
Carl Eugen Hoyos
233f52fd25 lavf/amr: Stricter heuristic for auto-detection.
Fixes ticket #7125.
2018-04-06 00:21:22 +02:00
Carl Eugen Hoyos
0a60cc909e lavf/amr: Do not set codec_tag for raw amr_nb and raw amr_wb. 2017-11-06 13:36:40 +01:00
Carl Eugen Hoyos
e06bdc3c37 lavf/amr: Add amrnb and amrwb demuxers.
Fixes ticket #6678.
2017-11-05 20:51:03 +01:00
Carl Eugen Hoyos
76dd87c929 lavf/amr: Return AVERROR_EOF on EOF.
Fixes ticket #6280.
2017-03-31 18:19:41 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +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
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
James Almer
d34ec64a22 replace calls to url_feof() with avio_feof()
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 00:48:38 +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
Carl Eugen Hoyos
c43222f436 Improve amr bitrate calculation for VBR files.
Fixes ticket #3541.
2014-04-11 23:38:53 +02:00
Carl Eugen Hoyos
cf79f20275 Fix a typo in amr.c. 2014-04-09 23:21:38 +02:00
Carl Eugen Hoyos
2a3ff9fbba Remove an unneeded include of avassert.h from amr.c. 2014-04-09 23:21:38 +02:00
Carl Eugen Hoyos
d87ff55502 Remove an incorrect and unneeded assert in the amr demuxer.
Asserting a specific codec is not correct since libavformat
allows forcing a codec, an equivalent check is in the
following line.

Fixes ticket #3001.
2013-09-29 07:11:56 +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
7eb40d85f2 Merge commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b'
* commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b': (21 commits)
  jvdec: set channel layout
  iss: set channel layout
  ipmovie: set channel layout
  iff: set channel layout
  idroqdec: set channel layout
  gxfdec: set channel layout when applicable
  gsmdec: set channel layout
  flvdec: set channel layout
  dv: set channel layout
  dsicin: set channel layout
  daud: set channel layout
  cdxl: set channel layout
  bmv: set channel layout
  bink: set channel layout
  bfi: set channel layout
  bethsoftvid: set channel layout
  apc: set channel layout
  amr: set channel_layout
  ppc: replace pointer casting with AV_COPY32
  ppc: fix some unused variable warnings
  ...

Conflicts:
	libavformat/amr.c
	libavformat/iff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 10:55:07 +01:00
Justin Ruggles
5595368bcc amr: set channel_layout 2012-11-12 10:33:18 -05: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
82edf6727f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs
  lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs
  Add Dolby/DPLII downmix support to libavresample
  vorbisdec: replace div/mod in loop with a counter
  fate: vorbis: add 5.1 surround test
  rtpenc: Allow requesting H264 RTP packetization mode 0
  configure: Sort the library listings in the help text alphabetically
  dwt: remove variable-length arrays
  RTMPT protocol support
  http: Properly handle chunked transfer-encoding for replies to post data
  http: Fail reading if the connection has gone away
  amr: Mark an array const
  amr: More space cleanup
  rtpenc: Fix memory leaks in the muxer open function

Conflicts:
	Changelog
	configure
	doc/APIchanges
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-18 20:07:00 +02:00
Michael Niedermayer
6ca48ad044 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  amr: Cosmetic cleanup
  mov_chan: Fix operator precedence by adding parentheses
  doc: Add missing protocols to list of supported protocols.
  tcp: Check the listen call

Conflicts:
	libavformat/amr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-17 22:28:28 +02:00
Martin Storsjö
eb3918c1fd amr: Mark an array const
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 22:50:06 +03:00
Martin Storsjö
634e874de5 amr: More space cleanup
This was missed in the previous cleanup patch.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 22:50:04 +03:00
Martin Storsjö
5f26d4d448 amr: Cosmetic cleanup
Add spaces around operators, fix brace placement and whitespace to
match K&R style, vertically align code, remove redundant != 0 and
convert x == 0 into !x, drop useless braces.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 19:04:46 +03:00
Michael Niedermayer
17bbb818ae amr: use av_assert()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-15 19:44:42 +02:00
Michael Niedermayer
2e0c360abd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  cosmetics: Align muxer/demuxer declarations
  mpeg12: Do not change frame_pred_frame_dct flag and demote error into a warning
  avcodec: remove avcodec_guess_channel_layout()
  avutil: Add av_get_default_channel_layout()

Conflicts:
	doc/APIchanges
	libavcodec/mpeg12.c
	libavformat/cdg.c
	libavformat/matroskaenc.c
	libavformat/mpegts.c
	libavformat/nuv.c
	libavformat/wav.c
	libavutil/audioconvert.c
	libavutil/audioconvert.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-06 22:52:01 +02:00
Martin Storsjö
20234a4bd7 cosmetics: Align muxer/demuxer declarations
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 19:19:59 +03:00
Michael Niedermayer
f095391a14 Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
  cdxl demux: do not create packets with uninitialized data at EOF.
  Replace computations of remaining bits with calls to get_bits_left().
  amrnb/amrwb: Remove get_bits usage.
  cosmetics: reindent
  avformat: do not require a pixel/sample format if there is no decoder
  avformat: do not fill-in audio packet duration in compute_pkt_fields()
  lavf: Use av_get_audio_frame_duration() in get_audio_frame_size()
  dca_parser: parse the sample rate and frame durations
  libspeexdec: do not set AVCodecContext.frame_size
  libopencore-amr: do not set AVCodecContext.frame_size
  alsdec: do not set AVCodecContext.frame_size
  siff: do not set AVCodecContext.frame_size
  amr demuxer: do not set AVCodecContext.frame_size.
  aiffdec: do not set AVCodecContext.frame_size
  mov: do not set AVCodecContext.frame_size
  ape: do not set AVCodecContext.frame_size.
  rdt: remove workaround for infinite loop with aac
  avformat: do not require frame_size in avformat_find_stream_info() for CELT
  avformat: do not require frame_size in avformat_find_stream_info() for MP1/2/3
  avformat: do not require frame_size in avformat_find_stream_info() for AAC
  ...

Conflicts:
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/avcodec.h
	libavcodec/h264.c
	libavcodec/h264_ps.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/dsputil_mmx.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-06 06:03:32 +01:00
Justin Ruggles
ec2e767bf3 amr demuxer: do not set AVCodecContext.frame_size.
it is not necessary.
2012-03-05 13:08:17 -05:00
Michael Niedermayer
e37f161e66 Merge remote-tracking branch 'qatar/master'
* qatar/master: (71 commits)
  movenc: Allow writing to a non-seekable output if using empty moov
  movenc: Support adding isml (smooth streaming live) metadata
  libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
  sunrast: Document the different Sun Raster file format types.
  sunrast: Add a check for experimental type.
  libspeexenc: use AVSampleFormat instead of deprecated/removed SampleFormat
  lavf: remove disabled FF_API_SET_PTS_INFO cruft
  lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft
  lavf: remove disabled FF_API_REORDER_PRIVATE cruft
  lavf: remove disabled FF_API_SEEK_PUBLIC cruft
  lavf: remove disabled FF_API_STREAM_COPY cruft
  lavf: remove disabled FF_API_PRELOAD cruft
  lavf: remove disabled FF_API_NEW_STREAM cruft
  lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft
  lavf: remove disabled FF_API_MUXRATE cruft
  lavf: remove disabled FF_API_FILESIZE cruft
  lavf: remove disabled FF_API_TIMESTAMP cruft
  lavf: remove disabled FF_API_LOOP_OUTPUT cruft
  lavf: remove disabled FF_API_LOOP_INPUT cruft
  lavf: remove disabled FF_API_AVSTREAM_QUALITY cruft
  ...

Conflicts:
	doc/APIchanges
	libavcodec/8bps.c
	libavcodec/avcodec.h
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/options.c
	libavcodec/sunrast.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/h264_deblock.asm
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavformat/avformat.h
	libavformat/avio.c
	libavformat/avio.h
	libavformat/aviobuf.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/utils.c
	libavformat/version.h
	libavformat/wtv.c
	libavutil/Makefile
	libavutil/file.c
	libswscale/x86/input.asm
	libswscale/x86/swscale_mmx.c
	libswscale/x86/swscale_template.c
	tests/ref/lavf/ffm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-28 07:53:34 +01:00