Commit 3de33b00 authored by Wim Lewis's avatar Wim Lewis Committed by Anton Khirnov

avcodec.h: add or elaborate on some documentation comments.

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 33aec3f4
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment