summaryrefslogtreecommitdiff
path: root/libavdevice/x11grab.c
diff options
context:
space:
mode:
authorSven C. Dack <sven.c.dack@virginmedia.com>2011-03-30 17:02:29 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-03-30 17:02:29 +0200
commit39530272c5ab218407e5d7bcca80fd7f608a6eca (patch)
treeecfbe8b437ceb8c1fd0c2c8608557a5a7209ccae /libavdevice/x11grab.c
parent007b1f04d76175da1befd8853c30b4fada90a0f2 (diff)
Remove a memory allocation and the associated memcpy.
Diffstat (limited to 'libavdevice/x11grab.c')
-rw-r--r--libavdevice/x11grab.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index be0586a7db..6a674ee6f9 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -386,10 +386,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) {
@@ -406,9 +405,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;
}