From 3de33b00de219a749f3e5c9d1f1f68d7cfa58502 Mon Sep 17 00:00:00 2001 From: Wim Lewis Date: Sat, 2 Apr 2011 15:30:24 -0700 Subject: avcodec.h: add or elaborate on some documentation comments. Signed-off-by: Michael Niedermayer Signed-off-by: Anton Khirnov --- libavcodec/avcodec.h | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ce3a4a6b94..a70d8adb90 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3253,7 +3253,9 @@ void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int c void av_resample_close(struct AVResampleContext *c); /** - * Allocate memory for a picture. Call avpicture_free to free it. + * Allocate memory for a picture. Call avpicture_free() to free it. + * + * \see avpicture_fill() * * @param picture the picture to be filled in * @param pix_fmt the format of the picture @@ -3265,6 +3267,8 @@ int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int /** * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. * * @param picture the AVPicture to be freed */ @@ -3280,6 +3284,9 @@ void avpicture_free(AVPicture *picture); * will be stored in the lines_sizes array. * Call with ptr == NULL to get the required size for the ptr buffer. * + * To allocate the buffer and fill in the AVPicture fields in one call, + * use avpicture_alloc(). + * * @param picture AVPicture whose fields are to be filled in * @param ptr Buffer which will contain or contains the actual image data * @param pix_fmt The format in which the picture data is stored. @@ -3289,6 +3296,22 @@ void avpicture_free(AVPicture *picture); */ int avpicture_fill(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * The data is stored compactly, without any gaps for alignment or padding + * which may be applied by avpicture_fill(). + * + * \see avpicture_get_size() + * + * @param[in] src AVPicture containing image data + * @param[in] pix_fmt The format in which the picture data is stored. + * @param[in] width the width of the image in pixels. + * @param[in] height the height of the image in pixels. + * @param[out] dest A buffer into which picture data will be copied. + * @param[in] dest_size The size of 'dest'. + * @return The number of bytes written to dest, or a negative value (error code) on error. + */ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size); @@ -3296,8 +3319,8 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, * Calculate the size in bytes that a picture of the given width and height * would occupy if stored in the given picture format. * Note that this returns the size of a compact representation as generated - * by avpicture_layout, which can be smaller than the size required for e.g. - * avpicture_fill. + * by avpicture_layout(), which can be smaller than the size required for e.g. + * avpicture_fill(). * * @param pix_fmt the given picture format * @param width the width of the image @@ -3426,16 +3449,19 @@ const char *avcodec_license(void); /** * Initialize libavcodec. + * If called more than once, does nothing. * * @warning This function must be called before any other libavcodec * function. + * + * @warning This function is not thread-safe. */ void avcodec_init(void); /** * Register the codec codec and initialize libavcodec. * - * @see avcodec_init() + * @see avcodec_init(), avcodec_register_all() */ void avcodec_register(AVCodec *codec); @@ -3615,7 +3641,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, * @param avctx The context which will be set up to use the given codec. * @param codec The codec to use within the context. * @return zero on success, a negative value on error - * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder + * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder, avcodec_close */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); -- cgit v1.2.3