diff options
author | Luigi Rizzo <rizzo@icir.org> | 2007-12-29 01:10:14 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2007-12-29 01:10:14 +0000 |
commit | f2702ec721dac9a18457a4c6b3f2132d93844ee3 (patch) | |
tree | 0b777aca60c4327dd4b48b916e6a01279c2c341a /channels/console_gui.c | |
parent | a799456578bc58dd01b00245a64293d466850212 (diff) |
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: https://origsvn.digium.com/svn/asterisk/trunk@95288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/console_gui.c')
-rw-r--r-- | channels/console_gui.c | 24 |
1 files changed, 5 insertions, 19 deletions
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; } |