[FFmpeg-devel] [PATCH] lavc: remove reset to zero of the AVPicture fields in case of avpicture_alloc() failure

Michael Niedermayer michaelni at gmx.at
Tue Jun 19 15:03:31 CEST 2012


On Tue, Jun 19, 2012 at 01:07:56PM +0200, Stefano Sabatini wrote:
> This behavior is not documented, and seems not required in the few places
> where avpicture_alloc() is used.
> 
> Make the behavior of avpicture_alloc() equivalent to that of
> av_image_alloc(), allowing for the function deprecation and API
> simplification.
> ---
>  libavcodec/avcodec.h    |   11 +++--------
>  libavcodec/imgconvert.c |    9 +--------
>  2 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f802e1f..9a8c5ac 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -4228,15 +4228,10 @@ void av_resample_close(struct AVResampleContext *c);
>   */
>  
>  /**
> - * Allocate memory for a picture.  Call avpicture_free() to free it.
> + * Allocate memory for a picture, always assumes a linesize alignment
> + * of 1.
>   *
> - * @see avpicture_fill()
> - *
> - * @param picture the picture to be filled in
> - * @param pix_fmt the format of the picture
> - * @param width the width of the picture
> - * @param height the height of the picture
> - * @return zero if successful, a negative value if not
> + * @see av_image_alloc()
>   */
>  int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
>  
> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> index 50d2aa1..8b630ba 100644
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -564,14 +564,7 @@ void ff_shrink88(uint8_t *dst, int dst_wrap,
>  int avpicture_alloc(AVPicture *picture,
>                      enum PixelFormat pix_fmt, int width, int height)

this should have warn_unused_result added


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120619/8cb872cf/attachment.asc>


More information about the ffmpeg-devel mailing list