00001 #include "clip.h"
00002 #include "colors.h"
00003 #include "edl.h"
00004 #include "edlsession.h"
00005 #include "floatauto.h"
00006 #include "floatautos.h"
00007 #include "intauto.h"
00008 #include "intautos.h"
00009 #include "maskautos.h"
00010 #include "overlayframe.inc"
00011 #include "transportque.inc"
00012 #include "vautomation.h"
00013
00014
00015 VAutomation::VAutomation(EDL *edl, Track *track)
00016 : Automation(edl, track)
00017 {
00018 }
00019
00020
00021
00022 VAutomation::~VAutomation()
00023 {
00024 }
00025
00026
00027 int VAutomation::create_objects()
00028 {
00029 Automation::create_objects();
00030
00031 autos[AUTOMATION_FADE] = new FloatAutos(edl, track, 100);
00032 autos[AUTOMATION_FADE]->create_objects();
00033
00034 autos[AUTOMATION_MODE] = new IntAutos(edl, track, TRANSFER_NORMAL);
00035 autos[AUTOMATION_MODE]->create_objects();
00036
00037 autos[AUTOMATION_MASK] = new MaskAutos(edl, track);
00038 autos[AUTOMATION_MASK]->create_objects();
00039
00040 autos[AUTOMATION_CAMERA_X] = new FloatAutos(edl, track, 0.0);
00041 autos[AUTOMATION_CAMERA_X]->create_objects();
00042
00043 autos[AUTOMATION_CAMERA_Y] = new FloatAutos(edl, track, 0.0);
00044 autos[AUTOMATION_CAMERA_Y]->create_objects();
00045
00046 autos[AUTOMATION_PROJECTOR_X] = new FloatAutos(edl, track, 0.0);
00047 autos[AUTOMATION_PROJECTOR_X]->create_objects();
00048
00049 autos[AUTOMATION_PROJECTOR_Y] = new FloatAutos(edl, track, 0.0);
00050 autos[AUTOMATION_PROJECTOR_Y]->create_objects();
00051
00052 autos[AUTOMATION_CAMERA_Z] = new FloatAutos(edl, track, 1.0);
00053 autos[AUTOMATION_CAMERA_Z]->create_objects();
00054
00055 autos[AUTOMATION_PROJECTOR_Z] = new FloatAutos(edl, track, 1.0);
00056 autos[AUTOMATION_PROJECTOR_Z]->create_objects();
00057
00058
00059
00060
00061 return 0;
00062 }
00063
00064 int VAutomation::direct_copy_possible(int64_t start, int direction)
00065 {
00066 int64_t end = (direction == PLAY_FORWARD) ? (start + 1) : (start - 1);
00067
00068 if(!Automation::direct_copy_possible(start, direction))
00069 return 0;
00070
00071
00072 double constant;
00073 if(((FloatAutos*)autos[AUTOMATION_FADE])->automation_is_constant(
00074 start, 1, direction, constant))
00075 {
00076 if(!EQUIV(constant, 100))
00077 return 0;
00078 }
00079 else
00080
00081 return 0;
00082
00083
00084 if(autos[AUTOMATION_MUTE]->automation_is_constant(start, end))
00085 {
00086 if(autos[AUTOMATION_MUTE]->get_automation_constant(start, end) > 0)
00087 return 0;
00088 }
00089 else
00090 return 0;
00091
00092
00093 FloatAuto *previous = 0, *next = 0;
00094 float z = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Z])->get_value(
00095 start, direction, previous, next);
00096 if(!EQUIV(z, 1)) return 0;
00097
00098 previous = 0;
00099 next = 0;
00100 float x = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_X])->get_value(start,
00101 direction,
00102 previous,
00103 next);
00104 if(!EQUIV(x, 0)) return 0;
00105 previous = 0;
00106 next = 0;
00107 float y = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Y])->get_value(start,
00108 direction,
00109 previous,
00110 next);
00111 if(!EQUIV(y, 0)) return 0;
00112
00113
00114
00115
00116
00117 previous = 0;
00118 next = 0;
00119 z = ((FloatAutos*)autos[AUTOMATION_CAMERA_Z])->get_value(
00120 start,
00121 direction,
00122 previous,
00123 next);
00124 if(!EQUIV(z, 1)) return 0;
00125
00126
00127
00128 previous = 0;
00129 next = 0;
00130 x = ((FloatAutos*)autos[AUTOMATION_CAMERA_X])->get_value(start,
00131 direction,
00132 previous,
00133 next);
00134 if(!EQUIV(x, 0)) return 0;
00135
00136 previous = 0;
00137 next = 0;
00138 y = ((FloatAutos*)autos[AUTOMATION_CAMERA_Y])->get_value(start,
00139 direction,
00140 previous,
00141 next);
00142
00143 if(!EQUIV(y, 0)) return 0;
00144
00145
00146 if(((MaskAutos*)autos[AUTOMATION_MASK])->mask_exists(start, direction))
00147 return 0;
00148
00149 return 1;
00150 }
00151
00152 void VAutomation::get_projector(float *x,
00153 float *y,
00154 float *z,
00155 int64_t position,
00156 int direction)
00157 {
00158 FloatAuto *before, *after;
00159 before = 0;
00160 after = 0;
00161 *x = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_X])->get_value(position,
00162 direction,
00163 before,
00164 after);
00165 before = 0;
00166 after = 0;
00167 *y = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Y])->get_value(position,
00168 direction,
00169 before,
00170 after);
00171 before = 0;
00172 after = 0;
00173 *z = ((FloatAutos*)autos[AUTOMATION_PROJECTOR_Z])->get_value(position,
00174 direction,
00175 before,
00176 after);
00177 }
00178
00179
00180 void VAutomation::get_camera(float *x,
00181 float *y,
00182 float *z,
00183 int64_t position,
00184 int direction)
00185 {
00186 FloatAuto *before, *after;
00187 before = 0;
00188 after = 0;
00189 *x = ((FloatAutos*)autos[AUTOMATION_CAMERA_X])->get_value(position,
00190 direction,
00191 before,
00192 after);
00193 before = 0;
00194 after = 0;
00195 *y = ((FloatAutos*)autos[AUTOMATION_CAMERA_Y])->get_value(position,
00196 direction,
00197 before,
00198 after);
00199 before = 0;
00200 after = 0;
00201 *z = ((FloatAutos*)autos[AUTOMATION_CAMERA_Z])->get_value(position,
00202 direction,
00203 before,
00204 after);
00205 }
00206