Statistics
| Branch: | Revision:

ffmpeg / libavdevice / x11grab.c @ 2912e87a

History | View | Annotate | Download (14.5 KB)

1 f58f4ce1 Guillaume Poirier
/*
2
 * X11 video grab interface
3 2909f177 Edouard Gomez
 *
4 2912e87a Mans Rullgard
 * This file is part of Libav.
5 f58f4ce1 Guillaume Poirier
 *
6 2912e87a Mans Rullgard
 * Libav integration:
7 ef84bf04 Edouard Gomez
 * Copyright (C) 2006 Clemens Fruhwirth <clemens@endorphin.org>
8
 *                    Edouard Gomez <ed.gomez@free.fr>
9 f58f4ce1 Guillaume Poirier
 *
10 ef84bf04 Edouard Gomez
 * This file contains code from grab.c:
11 aac105fc Edouard Gomez
 * Copyright (c) 2000-2001 Fabrice Bellard
12 f58f4ce1 Guillaume Poirier
 *
13
 * This file contains code from the xvidcap project:
14 ef84bf04 Edouard Gomez
 * Copyright (C) 1997-1998 Rasca, Berlin
15
 *               2003-2004 Karl H. Beckers, Frankfurt
16 f58f4ce1 Guillaume Poirier
 *
17 2912e87a Mans Rullgard
 * Libav is free software; you can redistribute it and/or modify
18 f58f4ce1 Guillaume Poirier
 * it under the terms of the GNU General Public License as published by
19
 * the Free Software Foundation; either version 2 of the License, or
20
 * (at your option) any later version.
21
 *
22 2912e87a Mans Rullgard
 * Libav is distributed in the hope that it will be useful,
23 f58f4ce1 Guillaume Poirier
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27 e5a389a1 Diego Biurrun
 * You should have received a copy of the GNU General Public License
28 2912e87a Mans Rullgard
 * along with Libav; if not, write to the Free Software
29 e5a389a1 Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 f58f4ce1 Guillaume Poirier
 */
31 2909f177 Edouard Gomez
32 6e71a18e Edouard Gomez
/**
33 ba87f080 Diego Biurrun
 * @file
34 6e71a18e Edouard Gomez
 * X11 frame device demuxer by Clemens Fruhwirth <clemens@endorphin.org>
35
 * and Edouard Gomez <ed.gomez@free.fr>.
36
 */
37
38 3d1ebac8 Carl Eugen Hoyos
#define _XOPEN_SOURCE 600
39
40 b0067549 Diego Biurrun
#include "config.h"
41 245976da Diego Biurrun
#include "libavformat/avformat.h"
42 f58f4ce1 Guillaume Poirier
#include <time.h>
43
#include <X11/X.h>
44
#include <X11/Xlib.h>
45
#include <X11/Xlibint.h>
46
#include <X11/Xproto.h>
47 ef84bf04 Edouard Gomez
#include <X11/Xutil.h>
48 f58f4ce1 Guillaume Poirier
#include <sys/shm.h>
49
#include <X11/extensions/XShm.h>
50 781c1aa6 Roxis
#include <X11/extensions/Xfixes.h>
51 f58f4ce1 Guillaume Poirier
52 6e71a18e Edouard Gomez
/**
53
 * X11 Device Demuxer context
54
 */
55 616deed2 Diego Biurrun
struct x11_grab
56 2909f177 Edouard Gomez
{
57 6e71a18e Edouard Gomez
    int frame_size;          /**< Size in bytes of a grabbed frame */
58
    AVRational time_base;    /**< Time base */
59
    int64_t time_frame;      /**< Current time */
60
61
    int height;              /**< Height of the grab frame */
62
    int width;               /**< Width of the grab frame */
63
    int x_off;               /**< Horizontal top-left corner coordinate */
64
    int y_off;               /**< Vertical top-left corner coordinate */
65
66
    Display *dpy;            /**< X11 display from which x11grab grabs frames */
67
    XImage *image;           /**< X11 image holding the grab */
68
    int use_shm;             /**< !0 when using XShm extension */
69
    XShmSegmentInfo shminfo; /**< When using XShm, keeps track of XShm infos */
70 f6dcc937 Michael Niedermayer
    int nomouse;
71 616deed2 Diego Biurrun
};
72 6e71a18e Edouard Gomez
73
/**
74 49bd8e4b Måns Rullgård
 * Initialize the x11 grab device demuxer (public device demuxer API).
75 6e71a18e Edouard Gomez
 *
76
 * @param s1 Context from avformat core
77
 * @param ap Parameters from avformat core
78
 * @return <ul>
79 5632e568 Panagiotis Issaris
 *          <li>AVERROR(ENOMEM) no memory left</li>
80 6f3e0b21 Panagiotis Issaris
 *          <li>AVERROR(EIO) other failure case</li>
81 6e71a18e Edouard Gomez
 *          <li>0 success</li>
82
 *         </ul>
83
 */
84 2909f177 Edouard Gomez
static int
85
x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
86 f58f4ce1 Guillaume Poirier
{
87 616deed2 Diego Biurrun
    struct x11_grab *x11grab = s1->priv_data;
88 aac105fc Edouard Gomez
    Display *dpy;
89
    AVStream *st = NULL;
90 1f15747f Carl Eugen Hoyos
    enum PixelFormat input_pixfmt;
91 aac105fc Edouard Gomez
    XImage *image;
92 6e71a18e Edouard Gomez
    int x_off = 0;
93
    int y_off = 0;
94 aac105fc Edouard Gomez
    int use_shm;
95 0cd4faf9 Panagiotis Issaris
    char *param, *offset;
96 aac105fc Edouard Gomez
97 cc58300e Ramiro Polla
    param = av_strdup(s1->filename);
98 0cd4faf9 Panagiotis Issaris
    offset = strchr(param, '+');
99
    if (offset) {
100
        sscanf(offset, "%d,%d", &x_off, &y_off);
101 f6dcc937 Michael Niedermayer
        x11grab->nomouse= strstr(offset, "nomouse");
102 0cd4faf9 Panagiotis Issaris
        *offset= 0;
103
    }
104
105 cc58300e Ramiro Polla
    av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n", s1->filename, param, x_off, y_off, ap->width, ap->height);
106 0cd4faf9 Panagiotis Issaris
107
    dpy = XOpenDisplay(param);
108
    if(!dpy) {
109
        av_log(s1, AV_LOG_ERROR, "Could not open X display.\n");
110 6f3e0b21 Panagiotis Issaris
        return AVERROR(EIO);
111 0cd4faf9 Panagiotis Issaris
    }
112 aac105fc Edouard Gomez
113 85f273c7 Ramiro Polla
    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
114 e2d3e82d Benoit Fouet
        av_log(s1, AV_LOG_ERROR, "AVParameters don't have video size and/or rate. Use -s and -r.\n");
115 6f3e0b21 Panagiotis Issaris
        return AVERROR(EIO);
116 aac105fc Edouard Gomez
    }
117
118
    st = av_new_stream(s1, 0);
119
    if (!st) {
120 8fa36ae0 François Revol
        return AVERROR(ENOMEM);
121 aac105fc Edouard Gomez
    }
122
    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
123
124
    use_shm = XShmQueryExtension(dpy);
125 6e71a18e Edouard Gomez
    av_log(s1, AV_LOG_INFO, "shared memory extension %s found\n", use_shm ? "" : "not");
126 aac105fc Edouard Gomez
127
    if(use_shm) {
128
        int scr = XDefaultScreen(dpy);
129
        image = XShmCreateImage(dpy,
130
                                DefaultVisual(dpy, scr),
131
                                DefaultDepth(dpy, scr),
132
                                ZPixmap,
133
                                NULL,
134
                                &x11grab->shminfo,
135
                                ap->width, ap->height);
136
        x11grab->shminfo.shmid = shmget(IPC_PRIVATE,
137
                                        image->bytes_per_line * image->height,
138
                                        IPC_CREAT|0777);
139
        if (x11grab->shminfo.shmid == -1) {
140
            av_log(s1, AV_LOG_ERROR, "Fatal: Can't get shared memory!\n");
141 8fa36ae0 François Revol
            return AVERROR(ENOMEM);
142 aac105fc Edouard Gomez
        }
143
        x11grab->shminfo.shmaddr = image->data = shmat(x11grab->shminfo.shmid, 0, 0);
144
        x11grab->shminfo.readOnly = False;
145
146
        if (!XShmAttach(dpy, &x11grab->shminfo)) {
147
            av_log(s1, AV_LOG_ERROR, "Fatal: Failed to attach shared memory!\n");
148
            /* needs some better error subroutine :) */
149 6f3e0b21 Panagiotis Issaris
            return AVERROR(EIO);
150 aac105fc Edouard Gomez
        }
151
    } else {
152
        image = XGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)),
153
                          x_off,y_off,
154
                          ap->width,ap->height,
155
                          AllPlanes, ZPixmap);
156
    }
157
158
    switch (image->bits_per_pixel) {
159
    case 8:
160 6187b8bd Diego Biurrun
        av_log (s1, AV_LOG_DEBUG, "8 bit palette\n");
161 aac105fc Edouard Gomez
        input_pixfmt = PIX_FMT_PAL8;
162
        break;
163
    case 16:
164 6e71a18e Edouard Gomez
        if (       image->red_mask   == 0xf800 &&
165
                   image->green_mask == 0x07e0 &&
166
                   image->blue_mask  == 0x001f ) {
167 aac105fc Edouard Gomez
            av_log (s1, AV_LOG_DEBUG, "16 bit RGB565\n");
168
            input_pixfmt = PIX_FMT_RGB565;
169 6e71a18e Edouard Gomez
        } else if (image->red_mask   == 0x7c00 &&
170
                   image->green_mask == 0x03e0 &&
171
                   image->blue_mask  == 0x001f ) {
172 aac105fc Edouard Gomez
            av_log(s1, AV_LOG_DEBUG, "16 bit RGB555\n");
173
            input_pixfmt = PIX_FMT_RGB555;
174
        } else {
175
            av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
176
            av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
177 6f3e0b21 Panagiotis Issaris
            return AVERROR(EIO);
178 aac105fc Edouard Gomez
        }
179
        break;
180
    case 24:
181 6e71a18e Edouard Gomez
        if (        image->red_mask   == 0xff0000 &&
182
                    image->green_mask == 0x00ff00 &&
183
                    image->blue_mask  == 0x0000ff ) {
184 aac105fc Edouard Gomez
            input_pixfmt = PIX_FMT_BGR24;
185 6e71a18e Edouard Gomez
        } else if ( image->red_mask   == 0x0000ff &&
186
                    image->green_mask == 0x00ff00 &&
187
                    image->blue_mask  == 0xff0000 ) {
188 aac105fc Edouard Gomez
            input_pixfmt = PIX_FMT_RGB24;
189
        } else {
190
            av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
191
            av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
192 6f3e0b21 Panagiotis Issaris
            return AVERROR(EIO);
193 aac105fc Edouard Gomez
        }
194
        break;
195
    case 32:
196 f58f4ce1 Guillaume Poirier
#if 0
197 aac105fc Edouard Gomez
        GetColorInfo (image, &c_info);
198 6e71a18e Edouard Gomez
        if ( c_info.alpha_mask == 0xff000000 && image->green_mask == 0x0000ff00) {
199 aac105fc Edouard Gomez
            /* byte order is relevant here, not endianness
200
             * endianness is handled by avcodec, but atm no such thing
201
             * as having ABGR, instead of ARGB in a word. Since we
202
             * need this for Solaris/SPARC, but need to do the conversion
203
             * for every frame we do it outside of this loop, cf. below
204
             * this matches both ARGB32 and ABGR32 */
205
            input_pixfmt = PIX_FMT_ARGB32;
206
        }  else {
207
            av_log(s1, AV_LOG_ERROR,"image depth %i not supported ... aborting\n", image->bits_per_pixel);
208 6f3e0b21 Panagiotis Issaris
            return AVERROR(EIO);
209 aac105fc Edouard Gomez
        }
210 f58f4ce1 Guillaume Poirier
#endif
211 71e445fc Diego Biurrun
        input_pixfmt = PIX_FMT_RGB32;
212 aac105fc Edouard Gomez
        break;
213
    default:
214
        av_log(s1, AV_LOG_ERROR, "image depth %i not supported ... aborting\n", image->bits_per_pixel);
215
        return -1;
216
    }
217
218 6e71a18e Edouard Gomez
    x11grab->frame_size = ap->width * ap->height * image->bits_per_pixel/8;
219 aac105fc Edouard Gomez
    x11grab->dpy = dpy;
220
    x11grab->width = ap->width;
221
    x11grab->height = ap->height;
222 6e71a18e Edouard Gomez
    x11grab->time_base  = ap->time_base;
223
    x11grab->time_frame = av_gettime() / av_q2d(ap->time_base);
224 aac105fc Edouard Gomez
    x11grab->x_off = x_off;
225
    x11grab->y_off = y_off;
226
    x11grab->image = image;
227
    x11grab->use_shm = use_shm;
228
229 72415b2a Stefano Sabatini
    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
230 aac105fc Edouard Gomez
    st->codec->codec_id = CODEC_ID_RAWVIDEO;
231 6e71a18e Edouard Gomez
    st->codec->width = ap->width;
232
    st->codec->height = ap->height;
233 aac105fc Edouard Gomez
    st->codec->pix_fmt = input_pixfmt;
234 6e71a18e Edouard Gomez
    st->codec->time_base = ap->time_base;
235
    st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(ap->time_base) * 8;
236 aac105fc Edouard Gomez
237
    return 0;
238 f58f4ce1 Guillaume Poirier
}
239
240 6e71a18e Edouard Gomez
/**
241 49bd8e4b Måns Rullgård
 * Paint a mouse pointer in an X11 image.
242 6e71a18e Edouard Gomez
 *
243 bd107136 Diego Biurrun
 * @param image image to paint the mouse pointer to
244 6e71a18e Edouard Gomez
 * @param s context used to retrieve original grabbing rectangle
245
 *          coordinates
246
 */
247 2909f177 Edouard Gomez
static void
248 781c1aa6 Roxis
paint_mouse_pointer(XImage *image, struct x11_grab *s)
249 2909f177 Edouard Gomez
{
250 aac105fc Edouard Gomez
    int x_off = s->x_off;
251
    int y_off = s->y_off;
252
    int width = s->width;
253
    int height = s->height;
254 781c1aa6 Roxis
    Display *dpy = s->dpy;
255
    XFixesCursorImage *xcim;
256
    int x, y;
257
    int line, column;
258
    int to_line, to_column;
259 8ce803db Jason Garrett-Glaser
    int pixstride = image->bits_per_pixel >> 3;
260
    /* Warning: in its insanity, xlib provides unsigned image data through a
261
     * char* pointer, so we have to make it uint8_t to make things not break.
262
     * Anyone who performs further investigation of the xlib API likely risks
263
     * permanent brain damage. */
264
    uint8_t *pix = image->data;
265
266
    /* Code doesn't currently support 16-bit or PAL8 */
267
    if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32)
268
        return;
269 aac105fc Edouard Gomez
270 33e7febd Carl Eugen Hoyos
    xcim = XFixesGetCursorImage(dpy);
271 aac105fc Edouard Gomez
272 781c1aa6 Roxis
    x = xcim->x - xcim->xhot;
273
    y = xcim->y - xcim->yhot;
274
275
    to_line = FFMIN((y + xcim->height), (height + y_off));
276
    to_column = FFMIN((x + xcim->width), (width + x_off));
277
278
    for (line = FFMAX(y, y_off); line < to_line; line++) {
279
        for (column = FFMAX(x, x_off); column < to_column; column++) {
280 8ce803db Jason Garrett-Glaser
            int  xcim_addr = (line - y) * xcim->width + column - x;
281
            int image_addr = ((line - y_off) * width + column - x_off) * pixstride;
282
            int r = (uint8_t)(xcim->pixels[xcim_addr] >>  0);
283
            int g = (uint8_t)(xcim->pixels[xcim_addr] >>  8);
284
            int b = (uint8_t)(xcim->pixels[xcim_addr] >> 16);
285
            int a = (uint8_t)(xcim->pixels[xcim_addr] >> 24);
286
287
            if (a == 255) {
288
                pix[image_addr+0] = r;
289
                pix[image_addr+1] = g;
290
                pix[image_addr+2] = b;
291
            } else if (a) {
292
                /* pixel values from XFixesGetCursorImage come premultiplied by alpha */
293
                pix[image_addr+0] = r + (pix[image_addr+0]*(255-a) + 255/2) / 255;
294
                pix[image_addr+1] = g + (pix[image_addr+1]*(255-a) + 255/2) / 255;
295
                pix[image_addr+2] = b + (pix[image_addr+2]*(255-a) + 255/2) / 255;
296 0235a311 Edouard Gomez
            }
297 aac105fc Edouard Gomez
        }
298
    }
299 781c1aa6 Roxis
300
    XFree(xcim);
301
    xcim = NULL;
302 f58f4ce1 Guillaume Poirier
}
303
304
305 6e71a18e Edouard Gomez
/**
306 49bd8e4b Måns Rullgård
 * Read new data in the image structure.
307 6e71a18e Edouard Gomez
 *
308
 * @param dpy X11 display to grab from
309 05f3b6ab Guillaume Poirier
 * @param d
310 6e71a18e Edouard Gomez
 * @param image Image where the grab will be put
311
 * @param x Top-Left grabbing rectangle horizontal coordinate
312
 * @param y Top-Left grabbing rectangle vertical coordinate
313
 * @return 0 if error, !0 if successful
314 f58f4ce1 Guillaume Poirier
 */
315
static int
316 6e71a18e Edouard Gomez
xget_zpixmap(Display *dpy, Drawable d, XImage *image, int x, int y)
317 f58f4ce1 Guillaume Poirier
{
318 aac105fc Edouard Gomez
    xGetImageReply rep;
319
    xGetImageReq *req;
320
    long nbytes;
321
322
    if (!image) {
323 6e71a18e Edouard Gomez
        return 0;
324 aac105fc Edouard Gomez
    }
325
326
    LockDisplay(dpy);
327
    GetReq(GetImage, req);
328
329
    /* First set up the standard stuff in the request */
330
    req->drawable = d;
331
    req->x = x;
332
    req->y = y;
333
    req->width = image->width;
334
    req->height = image->height;
335
    req->planeMask = (unsigned int)AllPlanes;
336
    req->format = ZPixmap;
337
338 6e71a18e Edouard Gomez
    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.length) {
339 aac105fc Edouard Gomez
        UnlockDisplay(dpy);
340
        SyncHandle();
341 6e71a18e Edouard Gomez
        return 0;
342 aac105fc Edouard Gomez
    }
343
344
    nbytes = (long)rep.length << 2;
345
    _XReadPad(dpy, image->data, nbytes);
346
347
    UnlockDisplay(dpy);
348
    SyncHandle();
349 6e71a18e Edouard Gomez
    return 1;
350 f58f4ce1 Guillaume Poirier
}
351
352 6e71a18e Edouard Gomez
/**
353 49bd8e4b Måns Rullgård
 * Grab a frame from x11 (public device demuxer API).
354 6e71a18e Edouard Gomez
 *
355
 * @param s1 Context from avformat core
356
 * @param pkt Packet holding the brabbed frame
357
 * @return frame size in bytes
358
 */
359 0235a311 Edouard Gomez
static int
360
x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
361 f58f4ce1 Guillaume Poirier
{
362 616deed2 Diego Biurrun
    struct x11_grab *s = s1->priv_data;
363 aac105fc Edouard Gomez
    Display *dpy = s->dpy;
364
    XImage *image = s->image;
365
    int x_off = s->x_off;
366
    int y_off = s->y_off;
367
368
    int64_t curtime, delay;
369
    struct timespec ts;
370
371
    /* Calculate the time of the next frame */
372 ba78f9d4 Baptiste Coudurier
    s->time_frame += INT64_C(1000000);
373 aac105fc Edouard Gomez
374
    /* wait based on the frame rate */
375
    for(;;) {
376
        curtime = av_gettime();
377 6e71a18e Edouard Gomez
        delay = s->time_frame * av_q2d(s->time_base) - curtime;
378 aac105fc Edouard Gomez
        if (delay <= 0) {
379 ba78f9d4 Baptiste Coudurier
            if (delay < INT64_C(-1000000) * av_q2d(s->time_base)) {
380
                s->time_frame += INT64_C(1000000);
381 aac105fc Edouard Gomez
            }
382
            break;
383
        }
384
        ts.tv_sec = delay / 1000000;
385
        ts.tv_nsec = (delay % 1000000) * 1000;
386
        nanosleep(&ts, NULL);
387
    }
388
389
    if (av_new_packet(pkt, s->frame_size) < 0) {
390 6f3e0b21 Panagiotis Issaris
        return AVERROR(EIO);
391 aac105fc Edouard Gomez
    }
392
393 6e71a18e Edouard Gomez
    pkt->pts = curtime;
394 aac105fc Edouard Gomez
395
    if(s->use_shm) {
396
        if (!XShmGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)), image, x_off, y_off, AllPlanes)) {
397
            av_log (s1, AV_LOG_INFO, "XShmGetImage() failed\n");
398
        }
399
    } else {
400 6e71a18e Edouard Gomez
        if (!xget_zpixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), image, x_off, y_off)) {
401 aac105fc Edouard Gomez
            av_log (s1, AV_LOG_INFO, "XGetZPixmap() failed\n");
402
        }
403
    }
404
405 f6dcc937 Michael Niedermayer
    if(!s->nomouse){
406 781c1aa6 Roxis
        paint_mouse_pointer(image, s);
407 aac105fc Edouard Gomez
    }
408
409
410
    /* XXX: avoid memcpy */
411
    memcpy(pkt->data, image->data, s->frame_size);
412
    return s->frame_size;
413 f58f4ce1 Guillaume Poirier
}
414
415 6e71a18e Edouard Gomez
/**
416 49bd8e4b Måns Rullgård
 * Close x11 frame grabber (public device demuxer API).
417 6e71a18e Edouard Gomez
 *
418
 * @param s1 Context from avformat core
419
 * @return 0 success, !0 failure
420
 */
421 0235a311 Edouard Gomez
static int
422
x11grab_read_close(AVFormatContext *s1)
423 f58f4ce1 Guillaume Poirier
{
424 616deed2 Diego Biurrun
    struct x11_grab *x11grab = s1->priv_data;
425 aac105fc Edouard Gomez
426
    /* Detach cleanly from shared mem */
427
    if (x11grab->use_shm) {
428
        XShmDetach(x11grab->dpy, &x11grab->shminfo);
429
        shmdt(x11grab->shminfo.shmaddr);
430
        shmctl(x11grab->shminfo.shmid, IPC_RMID, NULL);
431
    }
432
433
    /* Destroy X11 image */
434
    if (x11grab->image) {
435
        XDestroyImage(x11grab->image);
436
        x11grab->image = NULL;
437
    }
438
439
    /* Free X11 display */
440
    XCloseDisplay(x11grab->dpy);
441
    return 0;
442 f58f4ce1 Guillaume Poirier
}
443
444 6e71a18e Edouard Gomez
/** x11 grabber device demuxer declaration */
445 c6610a21 Diego Elio Pettenò
AVInputFormat ff_x11_grab_device_demuxer =
446 2909f177 Edouard Gomez
{
447 aac105fc Edouard Gomez
    "x11grab",
448 bde15e74 Stefano Sabatini
    NULL_IF_CONFIG_SMALL("X11grab"),
449 616deed2 Diego Biurrun
    sizeof(struct x11_grab),
450 aac105fc Edouard Gomez
    NULL,
451
    x11grab_read_header,
452
    x11grab_read_packet,
453
    x11grab_read_close,
454
    .flags = AVFMT_NOFILE,
455 f58f4ce1 Guillaume Poirier
};