1 /* This file is part of Opo, a small Video Whale
3 Copyright (C) 2011 Douglas Bagnall
5 Opo is free software: you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation, either version 3 of the License, or (at your
8 option) any later version.
10 Opo is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #define QUOTE(x) QUOTE_(x)
21 //default per-screen size
22 #define DEFAULT_WIDTH (640 / 4)
23 #define DEFAULT_HEIGHT 480
24 #define BILLION ((guint64)(1000 * 1000 * 1000))
25 #define NS_PER_FRAME ((guint64)(BILLION / 25))
27 static gint option_fake
= 0;
28 static gboolean option_force_multiscreen
= FALSE
;
29 static gboolean option_fullscreen
= FALSE
;
30 static gint option_x_screens
= 1;
31 static gint option_screens
= 4;
32 static gint option_width
= 0;
33 static gint option_height
= 0;
34 static gint option_autosize
= 0; //not actually exposed to commandline
35 static guint option_loop_end
= 0;
36 static char *option_content
= NULL
;
40 #define MAX_X_SCREENS 8
41 #define MIN_X_SCREENS 1
42 #define MAX_PIXELS 999999
45 static GOptionEntry entries
[] =
47 { "fake-source", 'F', 0, G_OPTION_ARG_INT
, &option_fake
,
48 "use videotestsrc (1, 2 ->different patterns)", NULL
},
49 { "full-screen", 'f', 0, G_OPTION_ARG_NONE
, &option_fullscreen
, "run full screen", NULL
},
50 { "force-multiscreen", 'm', 0, G_OPTION_ARG_NONE
, &option_force_multiscreen
,
51 "put windows on proper screens, or crash", NULL
},
52 { "x-screens", 'x', 0, G_OPTION_ARG_INT
, &option_x_screens
,
53 "use this many X screens", NULL
},
54 { "loop-end", 'l', 0, G_OPTION_ARG_INT
, &option_loop_end
,
55 "loop after this many seconds, rather than at end (0 = end)", NULL
},
56 { "width", 'w', 0, G_OPTION_ARG_INT
, &option_width
, "width of each screen", NULL
},
57 { "height", 'h', 0, G_OPTION_ARG_INT
, &option_height
, "height of screen", NULL
},
58 { "screens", 's', 0, G_OPTION_ARG_INT
, &option_screens
, "Use this many screens, (max "
59 QUOTE(MAX_SCREENS
) ")", "S" },
60 { "content", 'c', 0, G_OPTION_ARG_FILENAME
, &option_content
, "Content video file", NULL
},
61 { NULL
, 0, 0, 0, NULL
, NULL
, NULL
}
64 typedef struct window_s
{
69 char display
[sizeof(":0.00")];