Merge remote-tracking branch 'qatar/master'

* qatar/master: (34 commits)
  mlp_parser: fix the channel mask value used for the top surround channel
  vorbisenc: check all allocations for failure
  roqaudioenc: return AVERROR codes instead of -1
  roqaudioenc: set correct bit rate
  roqaudioenc: use AVCodecContext.frame_size correctly.
  roqaudioenc: remove unneeded sample_fmt check
  ra144enc: use int16_t* for input samples rather than void*
  ra144enc: set AVCodecContext.coded_frame
  ra144enc: remove unneeded sample_fmt check
  nellymoserenc: set AVCodecContext.coded_frame
  nellymoserenc: improve error checking in encode_init()
  nellymoserenc: return AVERROR codes instead of -1
  libvorbis: improve error checking in oggvorbis_encode_init()
  mpegaudioenc: return AVERROR codes instead of -1
  libfaac: improve error checking and handling in Faac_encode_init()
  avutil: add AVERROR_UNKNOWN
  check for coded_frame allocation failure in several audio encoders
  audio encoders: do not set coded_frame->key_frame.
  g722enc: check for trellis data allocation error
  libspeexenc: export encoder delay through AVCodecContext.delay
  ...

Conflicts:
	doc/APIchanges
	libavcodec/avcodec.h
	libavcodec/fraps.c
	libavcodec/kgv1dec.c
	libavcodec/libfaac.c
	libavcodec/libgsm.c
	libavcodec/libvorbis.c
	libavcodec/mlp_parser.c
	libavcodec/roqaudioenc.c
	libavcodec/vorbisenc.c
	libavutil/avutil.h
	libavutil/error.c
	libavutil/error.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2012-02-26 04:47:56 +01:00
30 changed files with 572 additions and 257 deletions

View File

@ -81,7 +81,6 @@ typedef struct {
int cbr_quality; ///< CBR quality 0 to 10
int abr; ///< flag to enable ABR
int pkt_frame_count; ///< frame count for the current packet
int lookahead; ///< encoder delay
int64_t next_pts; ///< next pts, in sample_rate time base
int pkt_sample_count; ///< sample count in the current packet
} LibSpeexEncContext;
@ -200,8 +199,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->header.frames_per_packet = s->frames_per_packet;
/* set encoding delay */
speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &s->lookahead);
s->next_pts = -s->lookahead;
speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &avctx->delay);
/* create header packet bytes from header struct */
/* note: libspeex allocates the memory for header_data, which is freed
@ -257,7 +255,8 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
/* write output if all frames for the packet have been encoded */
if (s->pkt_frame_count == s->frames_per_packet) {
s->pkt_frame_count = 0;
avctx->coded_frame->pts = ff_samples_to_time_base(avctx, s->next_pts);
avctx->coded_frame->pts = ff_samples_to_time_base(avctx, s->next_pts -
avctx->delay);
s->next_pts += s->pkt_sample_count;
s->pkt_sample_count = 0;
if (buf_size > speex_bits_nbytes(&s->bits)) {