[Ffmpeg-devel] [PATCH] Allow choosing display and screen number for x11grab device

Panagiotis Issaris takis.issaris
Thu Dec 14 20:51:28 CET 2006


Hi,

On Thu, Dec 14, 2006 at 05:50:44PM +0100, Michael Niedermayer wrote:
> [...]
> > 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?
To cut off the +xoffset,yoffset part to make it a valid X display name.  I was
not aware that ap->device would be reused or that it would be a problem for
other reasons, but I can surely change it to pass a copy of a part of the string
instead of a modified ("truncated") ap->device.

Thanks for reviewing!

With friendly regards,
Takis




More information about the ffmpeg-devel mailing list