From 2f8edd72dbfcb682f134596b3db853e185d4a5ed Mon Sep 17 00:00:00 2001 From: rizzo Date: Sat, 29 Dec 2007 01:10:14 +0000 Subject: virtualize the interface for video grabbers, which should make it easier to add support for more grabbers (V4L2, firewire, and so on). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@95288 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/console_gui.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'channels/console_gui.c') diff --git a/channels/console_gui.c b/channels/console_gui.c index a8c095b9a..f733a1a0a 100644 --- a/channels/console_gui.c +++ b/channels/console_gui.c @@ -503,17 +503,6 @@ static void handle_keyboard_input(struct video_desc *env, SDLKey key) return; } -/* - * Check if the grab point is inside the X screen. - * - * x represent the new grab value - * limit represent the upper value to use - */ -static int boundary_checks(int x, int limit) -{ - return (x <= 0) ? 0 : (x > limit ? limit : x); -} - /* implement superlinear acceleration on the movement */ static int move_accel(int delta) { @@ -521,6 +510,7 @@ static int move_accel(int delta) return (delta > 0) ? delta + d1 : delta - d1; } +static void grabber_move(struct video_out_desc *, int dx, int dy); /* * Move the source of the captured video. * @@ -529,21 +519,17 @@ static int move_accel(int delta) */ static void move_capture_source(struct video_desc *env, int x_final_drag, int y_final_drag) { - int new_x, new_y; /* new coordinates for grabbing local video */ - int x = env->out.loc_src.x; /* old value */ - int y = env->out.loc_src.y; /* old value */ + int dx, dy; /* move the origin */ #define POLARITY -1 /* +1 or -1 depending on the desired direction */ - new_x = x + POLARITY*move_accel(x_final_drag - env->gui->x_drag) * 3; - new_y = y + POLARITY*move_accel(y_final_drag - env->gui->y_drag) * 3; + dx = POLARITY*move_accel(x_final_drag - env->gui->x_drag) * 3; + dy = POLARITY*move_accel(y_final_drag - env->gui->y_drag) * 3; #undef POLARITY env->gui->x_drag = x_final_drag; /* update origin */ env->gui->y_drag = y_final_drag; - /* check boundary and let the source to grab from the new points */ - env->out.loc_src.x = boundary_checks(new_x, env->out.screen_width - env->out.loc_src.w); - env->out.loc_src.y = boundary_checks(new_y, env->out.screen_height - env->out.loc_src.h); + grabber_move(&env->out, dx, dy); return; } -- cgit v1.2.3