[Ffmpeg-devel] avcodec_decode_video/audio return values
Diego Biurrun
diego
Tue Oct 31 19:07:52 CET 2006
On Tue, Oct 31, 2006 at 12:00:33AM +0100, Michael Niedermayer wrote:
>
> 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
What about removing the redundant description from avcodec.h then?
Diego
More information about the ffmpeg-devel
mailing list