[Ffmpeg-devel] [PATCH] Allow choosing display and screen number for x11grab device
Michael Niedermayer
michaelni
Thu Dec 14 17:50:44 CET 2006
Hi
On Wed, Dec 13, 2006 at 10:28:11PM +0100, Panagiotis Issaris wrote:
> Hi,
>
> The attached patch allows one to provide the displaynumber.screennumber
> parameters to the x11grab device, for example:
> ffmpeg -vd x11:0.1 -s 640x480 test.avi
>
> Currently the docs stated this was already the case, but that was incorrect. The
> parameters that currently were parsed were used as an offset within the screen
> for doing the grabbing. I've taken the usual '+' as a separator for still being
> able to provide that offset. If no offset is provided, 0,0 is taken by
> default.
>
> So, to grab from display number 0, screen number 1 and start grabbing at
> location (10,20), use:
> ffmpeg -vd x11:0.1+10,20 -s 640x480 test.avi
>
> With friendly regards,
> Takis
[...]
> Index: libavformat/x11grab.c
> ===================================================================
> --- libavformat/x11grab.c (revision 7317)
> +++ libavformat/x11grab.c (working copy)
> @@ -94,21 +94,33 @@
> int x_off = 0;
> int y_off = 0;
> int use_shm;
> + char *param, *offset;
>
> - dpy = XOpenDisplay(NULL);
> - if(!dpy) {
> + if (!ap->device) {
> + av_log(s1, AV_LOG_ERROR, "AVParameters don't specify any device. Use -vd.\n");
> + return AVERROR_IO;
> + }
> +
> + param = strchr(ap->device, ':');
> + if (!param) {
> av_free(st);
> return AVERROR_IO;
> }
> +
> + offset = strchr(param, '+');
> + if (offset) {
> + sscanf(offset, "%d,%d", &x_off, &y_off);
> + *offset = 0;
hmm that writes into ap->device, why?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
More information about the ffmpeg-devel
mailing list