Commit Graph

56 Commits

Author SHA1 Message Date
Piotr Uracz
7ceceee8b6 avcodec/aac_ac3_parser: fix channel information parsing in case decoder is disabled
Fixes #7372
2021-02-01 18:02:11 +01:00
Alexander Strasser
ecd71916d1 lavc/aac_ac3_parser: fix potential overflow when averaging bitrate
The new code is analog to how it's done in our mpegaudio parser.

Acked-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2020-08-12 17:35:38 +02:00
Jun Zhao
60d79b1df9 lavc/aac_ac3_parser: improve the raw AAC file bit rate calculation
Now we just use one ADTS raw frame to calculate the bit rate, it's
lead to a larger error when get the duration from bit rate, the
improvement cumulate Nth ADTS frames to get the average bit rate.

e,g used the command get the duration like:
ffprobe -show_entries format=duration -i fate-suite/aac/foo.aac

before this improvement dump the duration=2.173935
after this improvement  dump the duration=1.979267

in fact, the real duration can be get by command like:
ffmpeg -i fate-suite/aac/foo.aac -f null /dev/null with time=00:00:01.97

Also update the fate-adtstoasc_ticket3715.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-06-26 09:53:36 +08:00
Hendrik Leppkes
8df8a92993 avcodec/aac_ac3_parser: account for data already in the parsing buffer
If a frame starts very close to a packet boundary, the start code may
already have been added to the parsing buffer, indicated by a small
negative value of "i", while the header is still being tracked in the
"state" variable.

Reduce the remaining size accordingly, otherwise trying to find the next
frame could skip over the frame header and lump two frames together as
one.
2018-04-15 10:18:26 +02:00
Paul B Mahol
ae92970976 avcodec/eac3: add support for dependent stream
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-03-29 10:19:03 +02:00
James Almer
9484b9f4ba Merge commit 'dd3aa85b68c017c419acb0c39ff6aa890ce89e87'
* commit 'dd3aa85b68c017c419acb0c39ff6aa890ce89e87':
  aac_ac3_parser: Drop in-parser downmix functionality

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 17:19:52 -03:00
Vittorio Giovara
dd3aa85b68 aac_ac3_parser: Drop in-parser downmix functionality
request_channel_layout is a decoder option and it makes no sense
to have it in a parser.

This feature was needed in the past when the decoder was allowed
to reuse the avctx from the demuxer. Nowadays the decoder receives
only the parameters from it, already containing the real channel
layout (and the correct request_channel_layout option).

After initialization the decoder overwrites the channel layout
with the downmixed one that is actually output, so there is no need
to preserve this functionality in the parser.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-04-27 14:19:50 -04:00
Rodger Combs
f0ea536c47 lavc/aac_ac3_parser: reindent 2016-02-27 16:31:46 -06:00
Rodger Combs
9f5baf9085 lavc/aac_ac3_parser: avoid zeroing codec parameters if we haven't read a frame
This caused issues when seeking in some unusual MPEGTS files
2016-02-27 16:31:46 -06:00
Hendrik Leppkes
b27ddffbfb Merge commit 'dc70c19476e76f1118df73b5d97cc76f0e5f6f6c'
* commit 'dc70c19476e76f1118df73b5d97cc76f0e5f6f6c':
  lavc: Drop deprecated request_channels related functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 16:42:44 +02:00
Vittorio Giovara
dc70c19476 lavc: Drop deprecated request_channels related functions
Deprecated in 04/2011.
2015-08-28 16:01:16 +02:00
Michael Niedermayer
2e5780a53f Merge commit 'b53285462263ef8a795f0e289abd5799b4c57652'
* commit 'b53285462263ef8a795f0e289abd5799b4c57652':
  ac3: implement request_channel_layout.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-23 12:18:33 +01:00
Tim Walker
b532854622 ac3: implement request_channel_layout.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-22 23:27:33 +01:00
Michael Niedermayer
32ab5b82f4 Merge commit '69d4dbfd1faa99563065329656bbe597d612ca03'
* commit '69d4dbfd1faa99563065329656bbe597d612ca03':
  aac_ac3_parser: simplify an expression

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-19 04:14:21 +01:00
Tim Walker
69d4dbfd1f aac_ac3_parser: simplify an expression
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-11-19 02:02:53 +01:00
Michael Niedermayer
c581cb4e4f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Fix even more missing includes after the common.h removal
  build: Factor out rangecoder dependencies to CONFIG_RANGECODER
  build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE
  x86: avcodec: Consistently name all init files
  Add more missing includes after removing the implicit common.h
  Add some more missing includes after removing the implicit common.h
  Don't include common.h from avutil.h
  rtmp: Automatically compute the hash for SWFVerification

Conflicts:
	configure
	doc/APIchanges
	doc/examples/decoding_encoding.c
	libavcodec/Makefile
	libavcodec/assdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/avpacket.c
	libavcodec/dv_profile.c
	libavcodec/dwt.c
	libavcodec/libtheoraenc.c
	libavcodec/rawdec.c
	libavcodec/rv40dsp.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c
	libavcodec/v210dec.h
	libavcodec/vc1dsp.c
	libavcodec/x86/Makefile
	libavfilter/asrc_anullsrc.c
	libavfilter/avfilter.c
	libavfilter/buffer.c
	libavfilter/formats.c
	libavfilter/vf_ass.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_select.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavformat/version.h
	libavutil/audioconvert.c
	libavutil/error.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 16:20:30 +02:00
Martin Storsjö
1d9c2dc89a Don't include common.h from avutil.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03: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
eadd4264ee Merge remote-tracking branch 'qatar/master'
* qatar/master: (36 commits)
  adpcmenc: Use correct frame_size for Yamaha ADPCM.
  avcodec: add ff_samples_to_time_base() convenience function to internal.h
  adx parser: set duration
  mlp parser: set duration instead of frame_size
  gsm parser: set duration
  mpegaudio parser: set duration instead of frame_size
  (e)ac3 parser: set duration instead of frame_size
  flac parser: set duration instead of frame_size
  avcodec: add duration field to AVCodecParserContext
  avutil: add av_rescale_q_rnd() to allow different rounding
  pnmdec: remove useless .pix_fmts
  libmp3lame: support float and s32 sample formats
  libmp3lame: renaming, rearrangement, alignment, and comments
  libmp3lame: use the LAME default bit rate
  libmp3lame: use avpriv_mpegaudio_decode_header() for output frame parsing
  libmp3lame: cosmetics: remove some pointless comments
  libmp3lame: convert some debugging code to av_dlog()
  libmp3lame: remove outdated comment.
  libmp3lame: do not set coded_frame->key_frame.
  libmp3lame: improve error handling in MP3lame_encode_init()
  ...

Conflicts:
	doc/APIchanges
	libavcodec/libmp3lame.c
	libavcodec/pcxenc.c
	libavcodec/pnmdec.c
	libavcodec/pnmenc.c
	libavcodec/sgienc.c
	libavcodec/utils.c
	libavformat/hls.c
	libavutil/avutil.h
	libswscale/x86/swscale_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-21 05:10:12 +01:00
Justin Ruggles
16e54ac725 (e)ac3 parser: set duration instead of frame_size 2012-02-20 15:08:40 -05:00
Michael Niedermayer
27ef7b1bcd Merge remote-tracking branch 'newdev/master'
* newdev/master:
  mov: set audio service type for AC-3 from bitstream mode in the 'dac3' atom.
  Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser and decoder, and vice-versa for the AC-3 encoder.
  Use audio_service_type to set stream disposition.
  Add APIchanges entry for audio_service_type.
  Add audio_service_type field to AVCodecContext for encoding and reporting of the service type in the audio bitstream.
  configure: in check_ld, place new -l flags before existing ones
  support @heading, @subheading, @subsubheading, and @subsubsection in texi2pod.pl
  doc: update build system documentation
  aacenc: indentation
  aacenc: fix the side calculation in search_for_ms
  vp8.c: rename EDGE_* to VP8_EDGE_*.

Conflicts:
	doc/APIchanges
	libavcodec/avcodec.h
	libavcodec/version.h
	libavcodec/vp8.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-03-26 03:06:30 +01:00
Justin Ruggles
be18738801 Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser
and decoder, and vice-versa for the AC-3 encoder.
2011-03-25 16:59:00 -04:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Alex Converse
65bec42e33 Cosmetics: Re-indent after last commit.
Originally committed as revision 22195 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-04 02:32:48 +00:00
Alex Converse
ca1fa4144f AAC parser: Don't write channels, sample rate, and frame size each frame.
Thanks to backwards compatible HE-AAC signalling these values are unreliable.

Originally committed as revision 22194 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-04 02:30:51 +00:00
Alex Converse
f2e5c8b96a Cosmetics after last commit
Originally committed as revision 18816 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-05-13 17:59:46 +00:00
Alex Converse
90350d73f8 Allow parsing and decoding of ADTS AAC files with channel config = 0
Originally committed as revision 18815 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-05-13 17:57:58 +00:00
Justin Ruggles
bfeca7beb6 Add channel layout support to the AC-3 decoder and AC-3 parser.
Originally committed as revision 18622 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-19 15:05:32 +00:00
Joakim Plate
4cff8dc88f Allow AC-3 parser to modify codec_id.
Patch by Joakim Plate (elupus A ecce D se).

Originally committed as revision 17447 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-19 00:28:19 +00:00
Diego Biurrun
406792e7b0 cosmetics: Remove pointless period after copyright statement non-sentences.
Originally committed as revision 16684 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-19 15:46:40 +00:00
Michael Niedermayer
bf2cdefc6a Reset state after some frame header is found.
Fixes issue704

Originally committed as revision 15742 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-10-29 21:08:14 +00:00
Michael Niedermayer
8dbd9cb695 Fix all the recent problems Justin had run into with the AC3 parser,
including issue 459.

Originally committed as revision 15381 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-22 03:00:26 +00:00
Justin Ruggles
2988c93d94 create a separate codec_id for E-AC-3
Originally committed as revision 15143 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-01 14:33:54 +00:00
Justin Ruggles
14b7062829 cosmetics: make all references to AC-3 capitalized and hyphenated
Originally committed as revision 14523 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-03 16:42:32 +00:00
Michael Niedermayer
8870cf8277 This fixes the code so it is correct on both sides of the if().
Originally committed as revision 12902 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 11:14:55 +00:00
Michael Niedermayer
7bc5f6e53e indent
Originally committed as revision 12901 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 10:48:50 +00:00
Michael Niedermayer
e4d5a18558 100l I broke AC3 in MPEG seeking.
Originally committed as revision 12898 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 02:58:36 +00:00
Michael Niedermayer
8629e7562d part 1 of EAC3 support
Originally committed as revision 12896 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 02:28:24 +00:00
Michael Niedermayer
133ac890fb Add new_frame_start and need_next_header.
based on a patch by Bartlomiej

Originally committed as revision 12895 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 01:59:55 +00:00
Michael Niedermayer
454064ad1e Change aac and ac3 parsers to use ff_combine_frame().
Originally committed as revision 12894 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-19 01:50:40 +00:00
Michael Niedermayer
8c731c9743 remove AACAC3FrameFlag
Originally committed as revision 12888 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-18 03:09:01 +00:00
Bartlomiej Wolowiec
469d8816d6 undo changes in aac_ac3_parser
Originally committed as revision 12778 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-09 22:11:21 +00:00
Bartlomiej Wolowiec
e9089a5240 Correction of typo in aac_ac3_parser
Originally committed as revision 12768 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-08 06:18:36 +00:00
Bartlomiej Wolowiec
c09ed33e18 Corrections of errors in aac_ac3_parser
Originally committed as revision 12759 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-07 20:54:08 +00:00
Bartlomiej Wolowiec
0a5754c3b7 change of aac_ac3_parser, so it is able to send complete portion of data to decoder
Originally committed as revision 12758 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-05 20:09:36 +00:00
Bartlomiej Wolowiec
be1e2a2bfa removal of stream_type in AACAC3ParseContext and adding AACAC3FrameFlag
Originally committed as revision 12622 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-28 19:59:58 +00:00
Justin Ruggles
c599e297e7 Pass AACAC3ParseContext to sync() instead of individual arguments. Patch by
Bartlomiej Wolowiec (bartek wolowiec gmail com)

Originally committed as revision 12564 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-23 15:43:29 +00:00
Justin Ruggles
ef7f2bb782 add downmixing support to libfaad decoder
Originally committed as revision 11422 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-01-05 21:08:20 +00:00
Justin Ruggles
6cd325c106 do not set channels before checking request_channels
Originally committed as revision 11414 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-01-05 15:18:15 +00:00