Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 46 additions and 3 deletions. Show diff stats Hide diff stats

  1. 49  src/gui/videoin.c
49  src/gui/videoin.c
@@ -32,6 +32,8 @@
32 32
 #include "cp.h"
33 33
 #include "../input.h"
34 34
 #include "videoin.h"
  35
+#include "../compiler/compiler.h"
  36
+#include "guirender.h"
35 37
 
36 38
 static int appid;
37 39
 
@@ -193,6 +195,43 @@ static void close_videoin_window(void)
193 195
 	resmgr_release(RESOURCE_VIDEOIN);
194 196
 }
195 197
 
  198
+static void dummy_rmc(const char *msg)
  199
+{
  200
+}
  201
+
  202
+static void stop_callback(void)
  203
+{
  204
+	if(!resmgr_acquire("Video in settings", RESOURCE_VIDEOIN))
  205
+		return;
  206
+
  207
+	video_fd = open("/dev/video", O_RDWR);
  208
+	if(video_fd == -1) {
  209
+		perror("Unable to open video device");
  210
+		resmgr_release(RESOURCE_VIDEOIN);
  211
+		return;
  212
+	}
  213
+	input_add_callback(preview_update);
  214
+}
  215
+
  216
+static void fullscreen_callback(mtk_event *e, void *arg)
  217
+{
  218
+	struct patch *p;
  219
+	char *dummy_filename = "FS";
  220
+	char *code = "video_a=1;decay=0;";
  221
+
  222
+	p = patch_compile_filename(dummy_filename, code, dummy_rmc);
  223
+	if(p == NULL)
  224
+		return;
  225
+
  226
+	close(video_fd);
  227
+	input_delete_callback(preview_update);
  228
+	resmgr_release(RESOURCE_VIDEOIN);
  229
+
  230
+	guirender(appid, p, stop_callback);
  231
+
  232
+	patch_free(p);
  233
+}
  234
+
196 235
 static void ok_callback(mtk_event *e, void *arg)
197 236
 {
198 237
 	set_config();
@@ -280,11 +319,13 @@ void init_videoin(void)
280 319
 		"g.rowconfig(10, -size 10)",
281 320
 
282 321
 		"g_btn = new Grid()",
  322
+		"b_fullscreen = new Button(-text \"Full Screen\")",
283 323
 		"b_ok = new Button(-text \"OK\")",
284 324
 		"b_cancel = new Button(-text \"Cancel\")",
285  
-		"g_btn.columnconfig(1, -size 190)",
286  
-		"g_btn.place(b_ok, -column 2 -row 1)",
287  
-		"g_btn.place(b_cancel, -column 3 -row 1)",
  325
+		"g_btn.place(b_fullscreen, -column 1 -row 1)",
  326
+		"g_btn.columnconfig(2, -size 100)",
  327
+		"g_btn.place(b_ok, -column 3 -row 1)",
  328
+		"g_btn.place(b_cancel, -column 4 -row 1)",
288 329
 		"g.place(g_btn, -column 1 -row 11)",
289 330
 
290 331
 		"w = new Window(-content g -title \"Video input settings\" -worky 30)",
@@ -302,6 +343,8 @@ void init_videoin(void)
302 343
 	mtk_bind(appid, "s_contrast", "change", slide_callback, (void *)CONTROL_CONTRAST);
303 344
 	mtk_bind(appid, "s_hue", "change", slide_callback, (void *)CONTROL_HUE);
304 345
 
  346
+	mtk_bind(appid, "b_fullscreen", "commit", fullscreen_callback, NULL);
  347
+
305 348
 	mtk_bind(appid, "b_ok", "commit", ok_callback, NULL);
306 349
 	mtk_bind(appid, "b_cancel", "commit", close_callback, NULL);
307 350
 

No commit comments for this range

Something went wrong with that request. Please try again.