[Ffmpeg-cvslog] r7320 - in trunk: doc/ffmpeg-doc.texi libavformat/x11grab.c
takis
subversion
Fri Dec 15 14:19:03 CET 2006
Author: takis
Date: Fri Dec 15 14:19:03 2006
New Revision: 7320
Modified:
trunk/doc/ffmpeg-doc.texi
trunk/libavformat/x11grab.c
Log:
Allow provision of displaynumber, screennumber, x-offset and y-offset parameters
to the x11grab device.
Modified: trunk/doc/ffmpeg-doc.texi
==============================================================================
--- trunk/doc/ffmpeg-doc.texi (original)
+++ trunk/doc/ffmpeg-doc.texi Fri Dec 15 14:19:03 2006
@@ -50,6 +50,13 @@
0.0 is display.screen number of your X11 server, same as
the DISPLAY environment variable.
+ at example
+ffmpeg -f x11grab -vd x11:0.0+10,20 /tmp/out.mpg
+ at end example
+
+0.0 is display.screen number of your X11 server, same as the DISPLAY environment
+variable. 10 is the x-offset and 20 the y-offset for the grabbing.
+
@section Video and Audio file format conversion
* FFmpeg can use any supported file format and protocol as input:
Modified: trunk/libavformat/x11grab.c
==============================================================================
--- trunk/libavformat/x11grab.c (original)
+++ trunk/libavformat/x11grab.c Fri Dec 15 14:19:03 2006
@@ -94,20 +94,33 @@
int x_off = 0;
int y_off = 0;
int use_shm;
+ char *param, *offset;
- dpy = XOpenDisplay(NULL);
- if(!dpy) {
- av_free(st);
+ if (!ap->device) {
+ av_log(s1, AV_LOG_ERROR, "AVParameters don't specify any device. Use -vd.\n");
return AVERROR_IO;
}
- if (!ap->device) {
- av_log(s1, AV_LOG_ERROR, "AVParameters don't specify any device. Use -vd.\n");
+ param = strchr(ap->device, ':');
+ if (!param) {
+ av_free(st);
return AVERROR_IO;
}
- sscanf(ap->device, "x11:%d,%d", &x_off, &y_off);
- av_log(s1, AV_LOG_INFO, "device: %s -> x: %d y: %d width: %d height: %d\n", ap->device, x_off, y_off, ap->width, ap->height);
+ param = av_strdup(param);
+ offset = strchr(param, '+');
+ if (offset) {
+ sscanf(offset, "%d,%d", &x_off, &y_off);
+ *offset= 0;
+ }
+
+ av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n", ap->device, param, x_off, y_off, ap->width, ap->height);
+
+ dpy = XOpenDisplay(param);
+ if(!dpy) {
+ av_log(s1, AV_LOG_ERROR, "Could not open X display.\n");
+ return AVERROR_IO;
+ }
if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
av_log(s1, AV_LOG_ERROR, "AVParameters don't have any video size. Use -s.\n");
More information about the ffmpeg-cvslog
mailing list