summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-13 08:16:43 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-13 08:17:01 +0200
commit40ade0714110d26d9b520b457a851209e4851e99 (patch)
tree02b4915c659fb71e68999b41a26280856c3d2d52
parent29d64b1d8ebe78bf4f57a127b954cc3f0aec8f84 (diff)
parent16ea20c827ef2ffaf77d5e05d5cf9983689f7b2b (diff)
Merge commit '16ea20c827ef2ffaf77d5e05d5cf9983689f7b2b'
* commit '16ea20c827ef2ffaf77d5e05d5cf9983689f7b2b': lavc doxy: extend/clarify avcodec_decode_audio4() doxy Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/avcodec.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 756b356ced..0b23b64fb1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3782,11 +3782,20 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
* Decode the audio frame of size avpkt->size from avpkt->data into frame.
*
* Some decoders may support multiple frames in a single AVPacket. Such
- * decoders would then just decode the first frame. In this case,
- * avcodec_decode_audio4 has to be called again with an AVPacket containing
- * the remaining data in order to decode the second frame, etc...
- * Even if no frames are returned, the packet needs to be fed to the decoder
- * with remaining data until it is completely consumed or an error occurs.
+ * decoders would then just decode the first frame and the return value would be
+ * less than the packet size. In this case, avcodec_decode_audio4 has to be
+ * called again with an AVPacket containing the remaining data in order to
+ * decode the second frame, etc... Even if no frames are returned, the packet
+ * needs to be fed to the decoder with remaining data until it is completely
+ * consumed or an error occurs.
+ *
+ * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input
+ * and output. This means that for some packets they will not immediately
+ * produce decoded output and need to be flushed at the end of decoding to get
+ * all the decoded data. Flushing is done by calling this function with packets
+ * with avpkt->data set to NULL and avpkt->size set to 0 until it stops
+ * returning samples. It is safe to flush even those decoders that are not
+ * marked with CODEC_CAP_DELAY, then no samples will be returned.
*
* @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
* larger than the actual read bytes because some optimized bitstream
@@ -3806,7 +3815,10 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
* next call to this function or until closing or flushing the
* decoder. The caller may not write to it.
* @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
- * non-zero.
+ * non-zero. Note that this field being set to zero
+ * does not mean that an error has occurred. For
+ * decoders with CODEC_CAP_DELAY set, no given decode
+ * call is guaranteed to produce a frame.
* @param[in] avpkt The input AVPacket containing the input buffer.
* At least avpkt->data and avpkt->size should be set. Some
* decoders might also require additional fields to be set.