3 #include "colormodels.h"
6 #include "edlsession.h"
8 #include "interlacemodes.h"
9 #include "overlayframe.inc"
10 #include "playbackconfig.h"
11 #include "recordconfig.h"
13 #include "workarounds.h"
15 int EDLSession::current_id = 0;
17 EDLSession::EDLSession(EDL *edl)
19 highlighted_track = 0;
20 playback_cursor_visible = 0;
21 aconfig_in = new AudioInConfig;
22 aconfig_duplex = new AudioOutConfig(1);
23 vconfig_in = new VideoInConfig;
24 interpolation_type = CUBIC_LINEAR;
25 test_playback_edits = 1;
29 playback_config = new PlaybackConfig;
30 auto_conf = new AutoConf;
31 strcpy(vwindow_folder, "");
32 strcpy(current_folder, "");
33 strcpy(default_atransition, "");
34 strcpy(default_vtransition, "");
35 default_transition_length = 1.0;
36 folderlist_format = ASSETS_ICONS;
37 frame_rate = 25; // just has to be something by default
38 autos_follow_edits = 1; // this is needed for predictability
39 labels_follow_edits = 1;
40 plugins_follow_edits = 1;
41 audio_tracks = -10; // these insane values let us crash early if something is forgotten to be set
47 frames_per_foot = -10;
52 video_write_length = -1000;
54 interlace_mode = -100;
57 EDLSession::~EDLSession()
60 delete aconfig_duplex;
63 delete playback_config;
67 char* EDLSession::get_cwindow_display()
69 if(playback_config->vconfig->x11_host[0])
70 return playback_config->vconfig->x11_host;
77 void EDLSession::equivalent_output(EDLSession *session, double *result)
79 if(session->output_w != output_w ||
80 session->output_h != output_h ||
81 session->frame_rate != frame_rate ||
82 session->color_model != color_model ||
83 session->interpolation_type != interpolation_type ||
84 session->mpeg4_deblock != mpeg4_deblock)
87 // If it's before the current brender_start, render extra data.
88 // If it's after brender_start, check brender map.
89 if(brender_start != session->brender_start &&
90 (*result < 0 || *result > brender_start))
91 *result = brender_start;
95 int EDLSession::load_defaults(Defaults *defaults)
97 char string[BCTEXTLEN];
99 // Default channel positions
100 for(int i = 0; i < MAXCHANNELS; i++)
102 sprintf(string, "ACHANNEL_ANGLE_%d", i);
103 int default_position = i * 30;
105 if(i == 0) default_position = 180;
107 if(i == 1) default_position = 0;
109 if(default_position == 90) default_position = 300;
111 if(default_position == 0) default_position = 330;
113 achannel_positions[i] = defaults->get(string, default_position);
115 aconfig_duplex->load_defaults(defaults);
116 aconfig_in->load_defaults(defaults);
117 actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1);
118 assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
119 aspect_w = defaults->get("ASPECTW", (float)4);
120 aspect_h = defaults->get("ASPECTH", (float)3);
121 for(int i = 0; i < ASSET_COLUMNS; i++)
123 sprintf(string, "ASSET_COLUMN%d", i);
124 asset_columns[i] = defaults->get(string, 100);
126 audio_channels = defaults->get("ACHANNELS", 2);
127 audio_tracks = defaults->get("ATRACKS", 2);
128 auto_conf->load_defaults(defaults);
129 autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
130 brender_start = defaults->get("BRENDER_START", brender_start);
131 cmodel_to_text(string, BC_RGBA8888);
132 color_model = cmodel_from_text(defaults->get("COLOR_MODEL", string));
133 interlace_mode = defaults->get("INTERLACE_MODE", interlace_mode);
134 crop_x1 = defaults->get("CROP_X1", 0);
135 crop_x2 = defaults->get("CROP_X2", 320);
136 crop_y1 = defaults->get("CROP_Y1", 0);
137 crop_y2 = defaults->get("CROP_Y2", 240);
138 sprintf(current_folder, MEDIA_FOLDER);
139 defaults->get("CURRENT_FOLDER", current_folder);
140 cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 0);
141 cwindow_dest = defaults->get("CWINDOW_DEST", 0);
142 cwindow_mask = defaults->get("CWINDOW_MASK", 0);
143 cwindow_meter = defaults->get("CWINDOW_METER", 1);
144 cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
145 cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 1);
146 cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
147 cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
148 cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
149 sprintf(default_atransition, "Crossfade");
150 defaults->get("DEFAULT_ATRANSITION", default_atransition);
151 sprintf(default_vtransition, "Dissolve");
152 defaults->get("DEFAULT_VTRANSITION", default_vtransition);
153 default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
154 edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
155 edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ONE_EDIT);
156 edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_NO_EDITS);
157 editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM);
158 enable_duplex = defaults->get("ENABLE_DUPLEX", 1);
159 folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_ICONS);
160 frame_rate = defaults->get("FRAMERATE", (double)30000.0/1001);
161 frames_per_foot = defaults->get("FRAMES_PER_FOOT", (float)16);
162 interpolation_type = defaults->get("INTERPOLATION_TYPE", interpolation_type);
163 labels_follow_edits = defaults->get("LABELS_FOLLOW_EDITS", 1);
164 plugins_follow_edits = defaults->get("PLUGINS_FOLLOW_EDITS", 1);
165 auto_keyframes = defaults->get("AUTO_KEYFRAMES", 0);
166 meter_format = defaults->get("METER_FORMAT", METER_DB);
167 min_meter_db = defaults->get("MIN_METER_DB", -85);
168 max_meter_db = defaults->get("MAX_METER_DB", 6);
169 mpeg4_deblock = defaults->get("MPEG4_DEBLOCK", mpeg4_deblock);
170 output_w = defaults->get("OUTPUTW", 720);
171 output_h = defaults->get("OUTPUTH", 480);
172 playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096);
173 playback_preload = defaults->get("PLAYBACK_PRELOAD", 0);
174 playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0);
175 delete playback_config;
176 playback_config = new PlaybackConfig;
177 playback_config->load_defaults(defaults);
178 real_time_playback = defaults->get("PLAYBACK_REALTIME", 0);
179 real_time_record = defaults->get("REALTIME_RECORD", 0);
180 record_software_position = defaults->get("RECORD_SOFTWARE_POSITION", 1);
181 record_sync_drives = defaults->get("RECORD_SYNC_DRIVES", 0);
182 record_speed = defaults->get("RECORD_SPEED", 8);
183 record_write_length = defaults->get("RECORD_WRITE_LENGTH", 131072);
184 safe_regions = defaults->get("SAFE_REGIONS", 1);
185 sample_rate = defaults->get("SAMPLERATE", 48000);
186 scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
187 si_useduration = defaults->get("SI_USEDURATION",0);
188 si_duration = defaults->get("SI_DURATION",5);
190 show_titles = defaults->get("SHOW_TITLES", 1);
191 // test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
192 time_format = defaults->get("TIME_FORMAT", TIME_HMS);
193 for(int i = 0; i < 4; i++)
195 sprintf(string, "TIMECODE_OFFSET_%d", i);
196 timecode_offset[i] = defaults->get(string, 0);
198 nudge_seconds = defaults->get("NUDGE_FORMAT", 1);
199 tool_window = defaults->get("TOOL_WINDOW", 0);
200 vconfig_in->load_defaults(defaults);
201 for(int i = 0; i < MAXCHANNELS; i++)
203 int default_position = i * output_w;
204 sprintf(string, "VCHANNEL_X_%d", i);
205 vchannel_x[i] = defaults->get(string, default_position);
206 sprintf(string, "VCHANNEL_Y_%d", i);
207 vchannel_y[i] = defaults->get(string, 0);
209 video_channels = defaults->get("VCHANNELS", 1);
210 video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 0);
211 video_tracks = defaults->get("VTRACKS", 1);
212 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
213 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
214 vwindow_meter = defaults->get("VWINDOW_METER", 1);
216 vwindow_folder[0] = 0;
218 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
224 int EDLSession::save_defaults(Defaults *defaults)
226 char string[BCTEXTLEN];
229 for(int i = 0; i < MAXCHANNELS; i++)
231 sprintf(string, "ACHANNEL_ANGLE_%d", i);
232 defaults->update(string, achannel_positions[i]);
234 defaults->update("ACHANNELS", audio_channels);
235 aconfig_duplex->save_defaults(defaults);
236 aconfig_in->save_defaults(defaults);
237 for(int i = 0; i < ASSET_COLUMNS; i++)
239 sprintf(string, "ASSET_COLUMN%d", i);
240 defaults->update(string, asset_columns[i]);
242 auto_conf->save_defaults(defaults);
243 defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate);
244 defaults->update("ASSETLIST_FORMAT", assetlist_format);
245 defaults->update("ASPECTW", aspect_w);
246 defaults->update("ASPECTH", aspect_h);
247 defaults->update("ATRACKS", audio_tracks);
248 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
249 defaults->update("BRENDER_START", brender_start);
250 cmodel_to_text(string, color_model);
251 defaults->update("COLOR_MODEL", string);
252 defaults->update("INTERLACE_MODE", interlace_mode);
253 defaults->update("CROP_X1", crop_x1);
254 defaults->update("CROP_X2", crop_x2);
255 defaults->update("CROP_Y1", crop_y1);
256 defaults->update("CROP_Y2", crop_y2);
257 defaults->update("CURRENT_FOLDER", current_folder);
258 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
259 defaults->update("CWINDOW_DEST", cwindow_dest);
260 defaults->update("CWINDOW_MASK", cwindow_mask);
261 defaults->update("CWINDOW_METER", cwindow_meter);
262 defaults->update("CWINDOW_OPERATION", cwindow_operation);
263 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
264 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
265 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
266 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
267 defaults->update("DEFAULT_ATRANSITION", default_atransition);
268 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
269 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
270 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
271 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
272 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
273 defaults->update("EDITING_MODE", editing_mode);
274 defaults->update("ENABLE_DUPLEX", enable_duplex);
275 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
276 defaults->update("FRAMERATE", frame_rate);
277 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
278 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
279 defaults->update("INTERPOLATION_TYPE", interpolation_type);
280 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
281 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
282 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
283 defaults->update("METER_FORMAT", meter_format);
284 defaults->update("MIN_METER_DB", min_meter_db);
285 defaults->update("MAX_METER_DB", max_meter_db);
286 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
287 defaults->update("OUTPUTW", output_w);
288 defaults->update("OUTPUTH", output_h);
289 defaults->update("PLAYBACK_BUFFER", playback_buffer);
290 defaults->update("PLAYBACK_PRELOAD", playback_preload);
291 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
292 playback_config->save_defaults(defaults);
293 defaults->update("PLAYBACK_REALTIME", real_time_playback);
294 defaults->update("REALTIME_RECORD", real_time_record);
295 defaults->update("RECORD_SOFTWARE_POSITION", record_software_position);
296 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
297 defaults->update("RECORD_SPEED", record_speed); // Full lockup on anything higher
298 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
299 defaults->update("SAFE_REGIONS", safe_regions);
300 defaults->update("SAMPLERATE", sample_rate);
301 defaults->update("SCRUB_SPEED", scrub_speed);
302 defaults->update("SI_USEDURATION",si_useduration);
303 defaults->update("SI_DURATION",si_duration);
304 defaults->update("SHOW_TITLES", show_titles);
305 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
306 defaults->update("TIME_FORMAT", time_format);
307 for(int i = 0; i < 4; i++)
309 sprintf(string, "TIMECODE_OFFSET_%d", i);
310 defaults->update(string, timecode_offset[i]);
312 defaults->update("NUDGE_FORMAT", nudge_seconds);
313 defaults->update("TOOL_WINDOW", tool_window);
314 vconfig_in->save_defaults(defaults);
315 for(int i = 0; i < MAXCHANNELS; i++)
317 sprintf(string, "VCHANNEL_X_%d", i);
318 defaults->update(string, vchannel_x[i]);
319 sprintf(string, "VCHANNEL_Y_%d", i);
320 defaults->update(string, vchannel_y[i]);
322 defaults->update("VCHANNELS", video_channels);
323 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
324 defaults->update("VTRACKS", video_tracks);
325 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
326 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
327 defaults->update("VWINDOW_METER", vwindow_meter);
328 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
335 // GCC 3.0 fails to compile
336 #define BC_INFINITY 65536
339 void EDLSession::boundaries()
341 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
342 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
343 Workarounds::clamp(sample_rate, 1, 1000000);
344 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
345 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
346 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
347 Workarounds::clamp(min_meter_db, -80, -20);
348 Workarounds::clamp(max_meter_db, 0, 10);
349 Workarounds::clamp(frames_per_foot, 1, 32);
350 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
351 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
352 Workarounds::clamp(video_write_length, 1, 1000);
353 //printf("EDLSession::boundaries 1\n");
359 Workarounds::clamp(crop_x1, 0, output_w);
360 Workarounds::clamp(crop_x2, 0, output_w);
361 Workarounds::clamp(crop_y1, 0, output_h);
362 Workarounds::clamp(crop_y2, 0, output_h);
363 if(brender_start < 0) brender_start = 0.0;
364 // Correct framerates
365 frame_rate = Units::fix_framerate(frame_rate);
366 //printf("EDLSession::boundaries 1 %p %p\n", edl->assets, edl->tracks);
367 // if(vwindow_source < 0 || vwindow_source >= edl->assets->total() + 1) vwindow_source = 0;
368 // if(cwindow_dest < 0 || cwindow_dest > edl->tracks->total()) cwindow_dest = 0;
369 //printf("EDLSession::boundaries 2\n");
374 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
377 if(append_mode) return 0;
378 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
379 cmodel_to_text(string, color_model);
380 color_model = cmodel_from_text(file->tag.get_property("COLORMODEL", string));
381 video_channels = file->tag.get_property("CHANNELS", video_channels);
382 for(int i = 0; i < video_channels; i++)
384 int default_position = i * output_w;
385 sprintf(string, "VCHANNEL_X_%d", i);
386 vchannel_x[i] = file->tag.get_property(string, default_position);
387 sprintf(string, "VCHANNEL_Y_%d", i);
388 vchannel_y[i] = file->tag.get_property(string, 0);
391 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
392 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
393 output_w = file->tag.get_property("OUTPUTW", output_w);
394 output_h = file->tag.get_property("OUTPUTH", output_h);
395 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
396 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
400 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
403 // load channels setting
404 if(append_mode) return 0;
405 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
408 for(int i = 0; i < audio_channels; i++)
410 sprintf(string, "ACHANNEL_ANGLE_%d", i);
411 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
412 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
415 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
419 int EDLSession::load_xml(FileXML *file,
423 char string[BCTEXTLEN];
430 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
431 for(int i = 0; i < ASSET_COLUMNS; i++)
433 sprintf(string, "ASSET_COLUMN%d", i);
434 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
436 auto_conf->load_xml(file);
437 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
438 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
439 brender_start = file->tag.get_property("BRENDER_START", brender_start);
440 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
441 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
442 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
443 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
444 file->tag.get_property("CURRENT_FOLDER", current_folder);
445 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
446 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
447 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
448 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
449 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
450 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
451 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
452 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
453 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
454 file->tag.get_property("DEFAULT_ATRANSITION", default_atransition);
455 file->tag.get_property("DEFAULT_VTRANSITION", default_vtransition);
456 default_transition_length = file->tag.get_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
457 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
458 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
459 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
460 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
461 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
462 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
463 playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload);
464 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
465 show_titles = file->tag.get_property("SHOW_TITLES", 1);
466 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
467 time_format = file->tag.get_property("TIME_FORMAT", time_format);
468 for(int i = 0; i < 4; i++)
470 sprintf(string, "TIMECODE_OFFSET_%d", i);
471 timecode_offset[i] = file->tag.get_property(string, timecode_offset[i]);
473 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
474 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
475 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
476 file->tag.get_property("VWINDOW_FOLDER", vwindow_folder);
477 vwindow_source = file->tag.get_property("VWINDOW_SOURCE", vwindow_source);
478 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
485 int EDLSession::save_xml(FileXML *file)
487 //printf("EDLSession::save_session 1\n");
488 char string[BCTEXTLEN];
489 file->tag.set_title("SESSION");
490 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
491 for(int i = 0; i < ASSET_COLUMNS; i++)
493 sprintf(string, "ASSET_COLUMN%d", i);
494 file->tag.set_property(string, asset_columns[i]);
496 auto_conf->save_xml(file);
497 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
498 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
499 file->tag.set_property("BRENDER_START", brender_start);
500 file->tag.set_property("CROP_X1", crop_x1);
501 file->tag.set_property("CROP_Y1", crop_y1);
502 file->tag.set_property("CROP_X2", crop_x2);
503 file->tag.set_property("CROP_Y2", crop_y2);
504 file->tag.set_property("CURRENT_FOLDER", current_folder);
505 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
506 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
507 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
508 file->tag.set_property("CWINDOW_METER", cwindow_meter);
509 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
510 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
511 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
512 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
513 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
514 file->tag.set_property("DEFAULT_ATRANSITION", default_atransition);
515 file->tag.set_property("DEFAULT_VTRANSITION", default_vtransition);
516 file->tag.set_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
517 file->tag.set_property("EDITING_MODE", editing_mode);
518 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
519 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
520 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
521 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
522 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
523 file->tag.set_property("PLAYBACK_PRELOAD", playback_preload);
524 file->tag.set_property("SAFE_REGIONS", safe_regions);
525 file->tag.set_property("SHOW_TITLES", show_titles);
526 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
527 file->tag.set_property("TIME_FORMAT", time_format);
528 for(int i = 0; i < 4; i++)
530 sprintf(string, "TIMECODE_OFFSET_%d", i);
531 file->tag.set_property(string, timecode_offset[i]);
533 file->tag.set_property("NUDGE_SECONDS", nudge_seconds);
534 file->tag.set_property("TOOL_WINDOW", tool_window);
535 file->tag.set_property("VWINDOW_METER", vwindow_meter);
536 file->tag.set_property("VWINDOW_FOLDER", vwindow_folder);
537 file->tag.set_property("VWINDOW_SOURCE", vwindow_source);
538 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
540 file->tag.set_title("/SESSION");
542 file->append_newline();
543 file->append_newline();
544 //printf("EDLSession::save_session 3\n");
548 int EDLSession::save_video_config(FileXML *file)
551 file->tag.set_title("VIDEO");
552 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
553 cmodel_to_text(string, color_model);
554 file->tag.set_property("COLORMODEL", string);
555 file->tag.set_property("CHANNELS", video_channels);
556 for(int i = 0; i < video_channels; i++)
558 sprintf(string, "VCHANNEL_X_%d", i);
559 file->tag.set_property(string, vchannel_x[i]);
560 sprintf(string, "VCHANNEL_Y_%d", i);
561 file->tag.set_property(string, vchannel_y[i]);
564 file->tag.set_property("FRAMERATE", frame_rate);
565 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
566 file->tag.set_property("OUTPUTW", output_w);
567 file->tag.set_property("OUTPUTH", output_h);
568 file->tag.set_property("ASPECTW", aspect_w);
569 file->tag.set_property("ASPECTH", aspect_h);
571 file->tag.set_title("/VIDEO");
573 file->append_newline();
574 file->append_newline();
578 int EDLSession::save_audio_config(FileXML *file)
581 file->tag.set_title("AUDIO");
582 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
583 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
585 for(int i = 0; i < audio_channels; i++)
587 sprintf(string, "ACHANNEL_ANGLE_%d", i);
588 file->tag.set_property(string, achannel_positions[i]);
592 file->tag.set_title("/AUDIO");
594 file->append_newline();
595 file->append_newline();
599 int EDLSession::copy(EDLSession *session)
601 // Audio channel positions
602 for(int i = 0; i < MAXCHANNELS; i++)
604 achannel_positions[i] = session->achannel_positions[i];
606 aconfig_duplex->copy_from(session->aconfig_duplex);
607 aconfig_in->copy_from(session->aconfig_in);
608 actual_frame_rate = session->actual_frame_rate;
609 for(int i = 0; i < ASSET_COLUMNS; i++)
611 asset_columns[i] = session->asset_columns[i];
613 assetlist_format = session->assetlist_format;
614 auto_conf->copy_from(session->auto_conf);
615 aspect_w = session->aspect_w;
616 aspect_h = session->aspect_h;
617 audio_channels = session->audio_channels;
618 audio_tracks = session->audio_tracks;
619 autos_follow_edits = session->autos_follow_edits;
620 brender_start = session->brender_start;
621 color_model = session->color_model;
622 interlace_mode = session->interlace_mode;
623 crop_x1 = session->crop_x1;
624 crop_y1 = session->crop_y1;
625 crop_x2 = session->crop_x2;
626 crop_y2 = session->crop_y2;
627 strcpy(current_folder, session->current_folder);
628 cursor_on_frames = session->cursor_on_frames;
629 cwindow_dest = session->cwindow_dest;
630 cwindow_mask = session->cwindow_mask;
631 cwindow_meter = session->cwindow_meter;
632 cwindow_operation = session->cwindow_operation;
633 cwindow_scrollbars = session->cwindow_scrollbars;
634 cwindow_xscroll = session->cwindow_xscroll;
635 cwindow_yscroll = session->cwindow_yscroll;
636 cwindow_zoom = session->cwindow_zoom;
637 strcpy(default_atransition, session->default_atransition);
638 strcpy(default_vtransition, session->default_vtransition);
639 default_transition_length = session->default_transition_length;
640 edit_handle_mode[0] = session->edit_handle_mode[0];
641 edit_handle_mode[1] = session->edit_handle_mode[1];
642 edit_handle_mode[2] = session->edit_handle_mode[2];
643 editing_mode = session->editing_mode;
644 enable_duplex = session->enable_duplex;
645 folderlist_format = session->folderlist_format;
646 frame_rate = session->frame_rate;
647 frames_per_foot = session->frames_per_foot;
648 highlighted_track = session->highlighted_track;
649 interpolation_type = session->interpolation_type;
650 labels_follow_edits = session->labels_follow_edits;
651 plugins_follow_edits = session->plugins_follow_edits;
652 auto_keyframes = session->auto_keyframes;
653 // last_playback_position = session->last_playback_position;
654 meter_format = session->meter_format;
655 min_meter_db = session->min_meter_db;
656 max_meter_db = session->max_meter_db;
657 mpeg4_deblock = session->mpeg4_deblock;
658 output_w = session->output_w;
659 output_h = session->output_h;
660 playback_buffer = session->playback_buffer;
661 delete playback_config;
662 playback_config = new PlaybackConfig;
663 playback_config->copy_from(session->playback_config);
664 playback_cursor_visible = session->playback_cursor_visible;
665 playback_preload = session->playback_preload;
666 playback_software_position = session->playback_software_position;
667 real_time_playback = session->real_time_playback;
668 real_time_record = session->real_time_record;
669 record_software_position = session->record_software_position;
670 record_speed = session->record_speed;
671 record_sync_drives = session->record_sync_drives;
672 record_write_length = session->record_write_length;
673 safe_regions = session->safe_regions;
674 sample_rate = session->sample_rate;
675 scrub_speed = session->scrub_speed;
676 si_useduration = session->si_useduration;
677 si_duration = session->si_duration;
678 show_titles = session->show_titles;
679 test_playback_edits = session->test_playback_edits;
680 time_format = session->time_format;
681 for(int i = 0; i < 4; i++)
683 timecode_offset[i] = session->timecode_offset[i];
685 nudge_seconds = session->nudge_seconds;
686 tool_window = session->tool_window;
687 for(int i = 0; i < MAXCHANNELS; i++)
689 vchannel_x[i] = session->vchannel_x[i];
690 vchannel_y[i] = session->vchannel_y[i];
692 video_channels = session->video_channels;
693 *vconfig_in = *session->vconfig_in;
694 video_every_frame = session->video_every_frame;
695 video_tracks = session->video_tracks;
696 video_write_length = session->video_write_length;
697 view_follows_playback = session->view_follows_playback;
698 vwindow_meter = session->vwindow_meter;
699 strcpy(vwindow_folder, session->vwindow_folder);
700 vwindow_source = session->vwindow_source;
701 vwindow_zoom = session->vwindow_zoom;
705 int64_t EDLSession::get_frame_offset()
707 return (timecode_offset[3] * 3600 +
708 timecode_offset[2] * 60 +
709 timecode_offset[1]) *
714 void EDLSession::dump()
716 printf("EDLSession::dump\n");
717 printf(" audio_tracks=%d audio_channels=%d sample_rate=%lld\n"
718 "video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n",