r1006: configure: Use libx264_pic instead of libx264 if available.
[cinelerra_cv/mob.git] / cinelerra / panautos.C
blobc00be9b98c58e9be22135f42c13c92742f49590e
1 #include "automation.inc"
2 #include "panauto.h"
3 #include "panautos.h"
4 #include "transportque.inc"
6 PanAutos::PanAutos(EDL *edl, Track *track)
7  : Autos(edl, track)
9         type = AUTOMATION_TYPE_PAN;
12 PanAutos::~PanAutos()
17 Auto* PanAutos::new_auto()
19         return new PanAuto(edl, this);
22 void PanAutos::get_handle(int &handle_x,
23                 int &handle_y,
24                 int64_t position, 
25                 int direction,
26                 PanAuto* &previous,
27                 PanAuto* &next)
29         previous = (PanAuto*)get_prev_auto(position, direction, (Auto* &)previous);
30         next = (PanAuto*)get_next_auto(position, direction, (Auto* &)next);
32 // Constant
33         if(previous->handle_x == next->handle_x &&
34                 previous->handle_y == next->handle_y)
35         {
36                 handle_x = previous->handle_x;
37                 handle_y = previous->handle_y;
38                 return;
39         }
41 // Interpolate
42         int64_t total = labs(next->position - previous->position);
43         double fraction;
44         if(direction == PLAY_FORWARD)
45         {
46                 fraction = (double)(position - previous->position) / total;
47         }
48         else
49         {
50                 fraction = (double)(previous->position - position) / total;
51         }
53         handle_x = (int)(previous->handle_x + (next->handle_x - previous->handle_x) * fraction);
54         handle_y = (int)(previous->handle_y + (next->handle_y - previous->handle_y) * fraction);
57 void PanAutos::dump()
59         printf("        PanAutos::dump %p\n", this);
60                 printf("        Default: position %ld\n", default_auto->position);
61                 ((PanAuto*)default_auto)->dump();
62         for(Auto* current = first; current; current = NEXT)
63         {
64                 printf("        position %ld\n", current->position);
65                 ((PanAuto*)current)->dump();
66         }