Support 6 argument variant of \move.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19049 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
eugeni 2006-07-12 22:28:20 +00:00
parent a935cb0a87
commit 5ca4a9ad1e
1 changed files with 20 additions and 7 deletions

View File

@ -653,7 +653,7 @@ static char* parse_tag(char* p, double pwr) {
change_border(val); change_border(val);
} else if (mystrcmp(&p, "move")) { } else if (mystrcmp(&p, "move")) {
int x1, x2, y1, y2; int x1, x2, y1, y2;
long long t1, delta_t, t; long long t1, t2, delta_t, t;
int x, y; int x, y;
double k; double k;
skip('('); skip('(');
@ -664,12 +664,25 @@ static char* parse_tag(char* p, double pwr) {
x2 = strtol(p, &p, 10); x2 = strtol(p, &p, 10);
skip(','); skip(',');
y2 = strtol(p, &p, 10); y2 = strtol(p, &p, 10);
skip(')'); // FIXME: 2 more optional args if (*p == ',') {
mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement: (%d, %d) -> (%d, %d)\n", x1, y1, x2, y2); skip(',');
t1 = render_context.event->Start; t1 = strtoll(p, &p, 10);
delta_t = render_context.event->Duration; skip(',');
t = frame_context.time; // FIXME: move to render_context t2 = strtoll(p, &p, 10);
k = ((double)(t - t1)) / delta_t; mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement6: (%d, %d) -> (%d, %d), (%lld .. %lld)\n", x1, y1, x2, y2, t1, t2);
} else {
t1 = 0;
t2 = render_context.event->Duration;
mp_msg(MSGT_GLOBAL, MSGL_DBG2, "movement: (%d, %d) -> (%d, %d)\n", x1, y1, x2, y2);
}
skip(')');
delta_t = t2 - t1;
t = frame_context.time - render_context.event->Start;
if (t < t1)
k = 0.;
else if (t > t2)
k = 1.;
else k = ((double)(t - t1)) / delta_t;
x = k * (x2 - x1) + x1; x = k * (x2 - x1) + x1;
y = k * (y2 - y1) + y1; y = k * (y2 - y1) + y1;
render_context.pos_x = x; render_context.pos_x = x;