This patch set is a little more involved than the last. The basic idea 
is to reduce the usage of frame_size, which has loosely-defined usage 
and is set in various places. It's practical use is primarily for 
duration guessing in libavformat. For demuxing, this duration guess is 
only needed to fill-in missing timestamps from demuxers which do not set 
them.

The first part of the patch set consolidates reliable calculation of 
packet duration based on codec_id and basic AVCodecContext params into a 
single function. While this is not ideal in terms of maintenance when we 
add new codecs, it avoids such hacks as forcing 
avformat_find_stream_info() to wait for the decoder to possibly set 
frame_size for select codecs in order to fill-in missing timestamps and
not break stream copy and/or seeking.

The second goal is related to muxing. In the muxer we want to avoid 
using frame_size for muxer time_base and/or header fields indicating 
packet duration because, when encoding, frame_size does not always 
directly correspond to the output packet duration. Rather, it is used to 
request the number of samples to be sent to the encoder (which may 
decide to delay, split, or combine input frames). So instead, it makes 
more sense to only use frame_size as a backup value when there is no 
known constant frame size for the codec_id being muxed.

Questions and suggestions are welcome!

Thanks,
Justin

Justin Ruggles (22):
  avcodec: add av_get_exact_bits_per_sample() function
  avcodec: add av_get_audio_frame_duration() function.
  riffenc: use av_get_audio_frame_duration()
  rtpenc: use av_get_audio_frame_duration() for max_frames_per_packet
  swfenc: use av_get_audio_frame_duration() instead of
    AVCodecContext.frame_size
  avformat: do not require frame_size in avformat_find_stream_info()
    for AAC
  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 CELT
  rdt: remove workaround for infinite loop with aac
  ape: do not set AVCodecContext.frame_size.
  mov: do not set AVCodecContext.frame_size
  aiffdec: do not set AVCodecContext.frame_size
  amr demuxer: do not set AVCodecContext.frame_size.
  siff: do not set AVCodecContext.frame_size
  alsdec: do not set AVCodecContext.frame_size
  libopencore-amr: do not set AVCodecContext.frame_size
  libspeexdec: do not set AVCodecContext.frame_size
  dca_parser: parse the sample rate and frame durations
  lavf: Use av_get_audio_frame_duration() in get_audio_frame_size()
  avformat: do not fill-in audio packet duration in
    compute_pkt_fields()
  avformat: do not require a pixel/sample format if there is no decoder
  cosmetics: reindent

 doc/APIchanges                |    6 ++
 libavcodec/Makefile           |    3 +-
 libavcodec/alsdec.c           |    1 -
 libavcodec/avcodec.h          |   20 +++++
 libavcodec/dca.c              |   47 +----------
 libavcodec/dca_parser.c       |   80 ++++++++++++++++++-
 libavcodec/libopencore-amr.c  |    1 -
 libavcodec/libspeexdec.c      |    3 -
 libavcodec/utils.c            |  176 ++++++++++++++++++++++++++++++++++++++---
 libavformat/aiffdec.c         |   30 ++++---
 libavformat/amr.c             |    2 -
 libavformat/ape.c             |    1 -
 libavformat/avformat.h        |    1 +
 libavformat/mov.c             |   13 ---
 libavformat/rdt.c             |    3 -
 libavformat/riff.c            |   28 ++++++-
 libavformat/rtpenc.c          |   11 ++-
 libavformat/siff.c            |    8 +-
 libavformat/swfenc.c          |    6 +-
 libavformat/utils.c           |  135 ++++++++++++++++++-------------
 tests/ref/fate/dxa-feeble     |    1 +
 tests/ref/fate/wmv8-drm-nodec |   40 +++++-----
 tests/ref/seek/adpcm_qt_aiff  |   36 ++++----
 23 files changed, 450 insertions(+), 202 deletions(-)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to