[FFmpeg-devel] x11grab.c: minor clean up, added more documentation

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Apr 1 12:13:12 CEST 2011


Sven C. Dack <sven.c.dack <at> virginmedia.com> writes:

> -    char *param, *offset;
> +    char *dpyname, *offset;

If the variable renaming is necessary, it should be in a separate patch.

> -    param = av_strdup(s1->filename);
> -    offset = strchr(param, '+');
> +    dpyname = av_strdup(s1->filename);
> +    x11grab->dpyname = dpyname;
> +    
> +    offset = strchr(dpyname, '+');

... making this diff significantly smaller.

>      if (offset) {
>          sscanf(offset, "%d,%d", &x_off, &y_off);
> -        x11grab->nomouse= strstr(offset, "nomouse");
> -        *offset= 0;
> +        x11grab->nomouse = strstr(offset, "+nomouse") == NULL ? 0 : 1;
> +        *offset = '\0';

If I understand it correctly, this change is definitely not appropriate.

>      }
> 
> -    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);
> +    av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d
height: %d mouse: %s\n",
> s1->filename, dpyname, x_off, y_off, ap->width, ap->height, x11grab->nomouse ?
"no" : "yes");

Separate patch, please.

[...]

>      use_shm = XShmQueryExtension(dpy);
> -    av_log(s1, AV_LOG_INFO, "shared memory extension %s found\n", use_shm ?
"" : "not");
> +    av_log(s1, AV_LOG_INFO, "shared memory extension%s found\n", use_shm ? ""
: " not");

This is an unrelated change and should go into a separate patch.

> +    av_free(x11grab->dpyname);

So I guess my solution, to free param immediately after the call to
XOpenDisplay(), was wrong;-)

Carl Eugen



More information about the ffmpeg-devel mailing list