summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorSven C. Dack <sven.c.dack@virginmedia.com>2011-03-30 17:02:29 +0200
committerAnton Khirnov <anton@khirnov.net>2011-06-12 12:18:05 +0200
commit2f2c60400a4e383b6aa7db64d6032a42c2725882 (patch)
tree5f8e18a93826c86c7c964fa0a35308185f5ac38d /libavdevice
parent151c5841881591552be685b7fd50b488f128ba5b (diff)
x11grab: remove a memory allocation and the associated memcpy.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/x11grab.c10
1 files 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;
}