diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-08-03 17:51:00 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-08-05 00:26:39 +0200 |
commit | 66747a61600e9c2dd2472f22a46a1938530fdada (patch) | |
tree | cb836aa88a11467b9d1f9014d5c8859ade370c7d /doc | |
parent | e776ee8f294984f7643a3c45db803c7266e1edfd (diff) | |
download | ffmpeg-66747a61600e9c2dd2472f22a46a1938530fdada.tar.gz |
examples/muxing: simplify alloc_picture()
Use avpicture_alloc() high level function.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/muxing.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c index a24c447a96..ca5e107db3 100644 --- a/doc/examples/muxing.c +++ b/doc/examples/muxing.c @@ -245,21 +245,9 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height) { - AVFrame *picture; - uint8_t *picture_buf; - int size; - - picture = avcodec_alloc_frame(); - if (!picture) - return NULL; - size = avpicture_get_size(pix_fmt, width, height); - picture_buf = av_malloc(size); - if (!picture_buf) { - av_free(picture); - return NULL; - } - avpicture_fill((AVPicture *)picture, picture_buf, - pix_fmt, width, height); + AVFrame *picture = avcodec_alloc_frame(); + if (!picture || avpicture_alloc((AVPicture *)picture, pix_fmt, width, height) < 0) + av_freep(&picture); return picture; } |