ffmpeg:avcodec_decode_audio2
/** * Decodes an audio frame from \p buf into \p samples. * The avcodec_decode_audio2() function decodes an audio frame from the input * buffer \p buf of size \p buf_size. To decode it, it makes use of the * audio codec which was coupled with \p avctx using avcodec_open(). The * resulting decoded frame is stored in output buffer \p samples. If no frame * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the * decompressed frame size in \e bytes. * * @warning You \e must set \p frame_size_ptr to the allocated size of the * output buffer before calling avcodec_decode_audio2(). * * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * * @warning The end of the input buffer \p buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * * @note You might have to align the input buffer \p buf and output buffer \p * samples. The alignment requirements depend on the CPU: On some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others * it will work but it will have an impact on performance. In practice, the * bitstream should have 4 byte alignment at minimum and all sample data should * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If * the linesize is not a multiple of 16 then there's no sense in aligning the * start of the buffer to 16. * * @param avctx the codec context * @param[out] samples the output buffer * @param[in,out] frame_size_ptr the output buffer size in bytes * @param[in] buf the input buffer * @param[in] buf_size the input buffer size in bytes * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame could be decompressed. */ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size);
ffmpeg/avcodec_decode_audio2.txt · Last modified: 2007/12/30 14:52 by deva