[Ffmpeg-devel] avcodec_decode_video/audio return values
Michael Niedermayer
michaelni
Tue Oct 31 00:00:33 CET 2006
Hi
On Mon, Oct 30, 2006 at 09:08:32PM +0100, Diego Biurrun wrote:
> On Tue, Oct 10, 2006 at 08:36:39AM +0200, Michael Niedermayer wrote:
> >
> > On Mon, Oct 09, 2006 at 04:02:18PM +1000, Richard Khoury wrote:
> > > Looking at the doxygen documentation I noticed that
> > > avcodec_decode_audio should return 0 if successful and -1 if not,
> > > however I've found that this function returns the number of bytes
> > > used much the same way that avcodec_decode_video is implemented. Is
> > > this a mistake in documentation or in code?
> >
> > if thats written in the docs, then the docs are wrong
>
> OK, found the problem. In libavcodec/avcodec.h we have
>
>
> /**
> * Decode an audio frame.
> *
> * @param avctx the codec context.
> * @param samples output buffer, 16 byte aligned
> * @param frame_size_ptr the output buffer size in bytes, zero if no
> * frame could be compressed
> * @param buf input buffer, 16 byte aligned
> * @param buf_size the input buffer size
> * @return 0 if successful, -1 if not.
> */
>
> int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
> int *frame_size_ptr,
> uint8_t *buf, int buf_size);
>
>
> but in libavcodec/utils.c we have
>
>
> /* decode an audio frame. return -1 if error, otherwise return the
> *number of bytes used. If no frame could be decompressed,
> *frame_size_ptr is zero. Otherwise, it is the decompressed frame
> *size in BYTES. */
> int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
> int *frame_size_ptr,
> uint8_t *buf, int buf_size)
>
>
> So what's it going to be?
returning the number of bytes used provides more info to the user so its
"better" imho
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list