From 2f2c60400a4e383b6aa7db64d6032a42c2725882 Mon Sep 17 00:00:00 2001 From: "Sven C. Dack" Date: Wed, 30 Mar 2011 17:02:29 +0200 Subject: [PATCH 1/2] x11grab: remove a memory allocation and the associated memcpy. Signed-off-by: Anton Khirnov --- libavdevice/x11grab.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index c6dc673520..6e77a5c52a 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -410,10 +410,9 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) nanosleep(&ts, NULL); } - if (av_new_packet(pkt, s->frame_size) < 0) { - return AVERROR(EIO); - } - + av_init_packet(pkt); + pkt->data = image->data; + pkt->size = s->frame_size; pkt->pts = curtime; if(s->use_shm) { @@ -430,9 +429,6 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) paint_mouse_pointer(image, s); } - - /* XXX: avoid memcpy */ - memcpy(pkt->data, image->data, s->frame_size); return s->frame_size; } From de859358830cfd1daffb1773f6bb069659027321 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 12 Jun 2011 13:54:22 +0200 Subject: [PATCH 2/2] cmdutils: add missing NULL check in parse_options() Fix ffplay -i FILE, which was recently broken. Signed-off-by: Anton Khirnov --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index b9a5d1b069..c73d5a1ca2 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -277,7 +277,7 @@ unknown_opt: *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_FLOAT) { *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); - } else { + } else if (po->u.func_arg) { if (po->u.func_arg(opt, arg) < 0) { fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt); exit(1);