4 #include "colormodels.h"
7 #include "edlsession.h"
9 #include "interlacemodes.h"
10 #include "overlayframe.inc"
11 #include "playbackconfig.h"
12 #include "recordconfig.h"
14 #include "workarounds.h"
16 int EDLSession::current_id = 0;
18 EDLSession::EDLSession(EDL *edl)
20 highlighted_track = 0;
21 playback_cursor_visible = 0;
22 aconfig_in = new AudioInConfig;
23 aconfig_duplex = new AudioOutConfig(1);
24 vconfig_in = new VideoInConfig;
25 recording_format = new Asset;
26 interpolation_type = CUBIC_LINEAR;
28 white_balance_raw = 1;
29 test_playback_edits = 1;
33 playback_config = new PlaybackConfig;
34 auto_conf = new AutoConf;
35 strcpy(vwindow_folder, "");
36 strcpy(current_folder, "");
37 strcpy(default_atransition, "");
38 strcpy(default_vtransition, "");
39 default_transition_length = 1.0;
40 folderlist_format = ASSETS_ICONS;
41 frame_rate = 25; // just has to be something by default
42 autos_follow_edits = 1; // this is needed for predictability
43 labels_follow_edits = 1;
44 plugins_follow_edits = 1;
45 audio_tracks = -10; // these insane values let us crash early if something is forgotten to be set
51 frames_per_foot = -10;
56 video_write_length = -1000;
58 interlace_mode = BC_ILACE_MODE_UNDETECTED;
64 EDLSession::~EDLSession()
67 delete aconfig_duplex;
70 delete playback_config;
71 Garbage::delete_object(recording_format);
75 char* EDLSession::get_cwindow_display()
77 if(playback_config->vconfig->x11_host[0])
78 return playback_config->vconfig->x11_host;
83 int EDLSession::need_rerender(EDLSession *ptr)
85 return (playback_preload != ptr->playback_preload) ||
86 (interpolation_type != ptr->interpolation_type) ||
87 (video_every_frame != ptr->video_every_frame) ||
88 (real_time_playback != ptr->real_time_playback) ||
89 (playback_software_position != ptr->playback_software_position) ||
90 (test_playback_edits != ptr->test_playback_edits) ||
91 (playback_buffer != ptr->playback_buffer) ||
92 (decode_subtitles != ptr->decode_subtitles) ||
93 (subtitle_number != ptr->subtitle_number) ||
94 (interpolate_raw != ptr->interpolate_raw) ||
95 (white_balance_raw != ptr->white_balance_raw);
98 void EDLSession::equivalent_output(EDLSession *session, double *result)
100 if(session->output_w != output_w ||
101 session->output_h != output_h ||
102 session->frame_rate != frame_rate ||
103 session->color_model != color_model ||
104 session->interpolation_type != interpolation_type ||
105 session->interpolate_raw != interpolate_raw ||
106 session->white_balance_raw != white_balance_raw ||
107 session->mpeg4_deblock != mpeg4_deblock ||
108 session->decode_subtitles != decode_subtitles ||
109 session->subtitle_number != subtitle_number)
112 // If it's before the current brender_start, render extra data.
113 // If it's after brender_start, check brender map.
114 if(brender_start != session->brender_start &&
115 (*result < 0 || *result > brender_start))
116 *result = brender_start;
120 int EDLSession::load_defaults(BC_Hash *defaults)
122 char string[BCTEXTLEN];
124 // Default channel positions
125 for(int i = 0; i < MAXCHANNELS; i++)
127 sprintf(string, "ACHANNEL_ANGLE_%d", i);
128 int default_position = i * 30;
130 if(i == 0) default_position = 180;
132 if(i == 1) default_position = 0;
134 if(default_position == 90) default_position = 300;
136 if(default_position == 0) default_position = 330;
138 achannel_positions[i] = defaults->get(string, default_position);
140 aconfig_duplex->load_defaults(defaults);
141 aconfig_in->load_defaults(defaults);
142 actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1);
143 assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
144 aspect_w = defaults->get("ASPECTW", (float)4);
145 aspect_h = defaults->get("ASPECTH", (float)3);
146 for(int i = 0; i < ASSET_COLUMNS; i++)
148 sprintf(string, "ASSET_COLUMN%d", i);
149 asset_columns[i] = defaults->get(string, 100);
151 audio_channels = defaults->get("ACHANNELS", 2);
152 audio_tracks = defaults->get("ATRACKS", 2);
153 auto_conf->load_defaults(defaults);
154 autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
155 brender_start = defaults->get("BRENDER_START", brender_start);
156 cmodel_to_text(string, BC_RGBA8888);
157 color_model = cmodel_from_text(defaults->get("COLOR_MODEL", string));
158 ilacemode_to_xmltext(string, BC_ILACE_MODE_NOTINTERLACED);
159 interlace_mode = ilacemode_from_xmltext(defaults->get("INTERLACE_MODE",string), BC_ILACE_MODE_NOTINTERLACED);
160 crop_x1 = defaults->get("CROP_X1", 0);
161 crop_x2 = defaults->get("CROP_X2", 320);
162 crop_y1 = defaults->get("CROP_Y1", 0);
163 crop_y2 = defaults->get("CROP_Y2", 240);
164 sprintf(current_folder, MEDIA_FOLDER);
165 defaults->get("CURRENT_FOLDER", current_folder);
166 cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 1);
167 cwindow_dest = defaults->get("CWINDOW_DEST", 0);
168 cwindow_mask = defaults->get("CWINDOW_MASK", 0);
169 cwindow_meter = defaults->get("CWINDOW_METER", 1);
170 cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
171 cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 1);
172 cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
173 cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
174 cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
175 sprintf(default_atransition, "Crossfade");
176 defaults->get("DEFAULT_ATRANSITION", default_atransition);
177 sprintf(default_vtransition, "Dissolve");
178 defaults->get("DEFAULT_VTRANSITION", default_vtransition);
179 default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
180 edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
181 edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ONE_EDIT);
182 edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_NO_EDITS);
183 editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM);
184 enable_duplex = defaults->get("ENABLE_DUPLEX", 1);
185 folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_ICONS);
186 frame_rate = defaults->get("FRAMERATE", (double)30000.0/1001);
187 frames_per_foot = defaults->get("FRAMES_PER_FOOT", (float)16);
188 interpolation_type = defaults->get("INTERPOLATION_TYPE", interpolation_type);
189 interpolate_raw = defaults->get("INTERPOLATE_RAW", interpolate_raw);
190 white_balance_raw = defaults->get("WHITE_BALANCE_RAW", white_balance_raw);
191 labels_follow_edits = defaults->get("LABELS_FOLLOW_EDITS", 1);
192 plugins_follow_edits = defaults->get("PLUGINS_FOLLOW_EDITS", 1);
193 auto_keyframes = defaults->get("AUTO_KEYFRAMES", 0);
194 meter_format = defaults->get("METER_FORMAT", METER_DB);
195 min_meter_db = defaults->get("MIN_METER_DB", -85);
196 max_meter_db = defaults->get("MAX_METER_DB", 6);
197 mpeg4_deblock = defaults->get("MPEG4_DEBLOCK", mpeg4_deblock);
198 output_w = defaults->get("OUTPUTW", 720);
199 output_h = defaults->get("OUTPUTH", 480);
200 playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096);
201 playback_preload = defaults->get("PLAYBACK_PRELOAD", 0);
202 playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0);
203 delete playback_config;
204 playback_config = new PlaybackConfig;
205 playback_config->load_defaults(defaults);
206 real_time_playback = defaults->get("PLAYBACK_REALTIME", 0);
207 real_time_record = defaults->get("REALTIME_RECORD", 0);
208 record_software_position = defaults->get("RECORD_SOFTWARE_POSITION", 1);
209 record_sync_drives = defaults->get("RECORD_SYNC_DRIVES", 0);
210 // record_speed = defaults->get("RECORD_SPEED", 24);
211 record_write_length = defaults->get("RECORD_WRITE_LENGTH", 131072);
212 recording_format->load_defaults(defaults,
219 safe_regions = defaults->get("SAFE_REGIONS", 1);
220 sample_rate = defaults->get("SAMPLERATE", 48000);
221 scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
222 si_useduration = defaults->get("SI_USEDURATION",0);
223 si_duration = defaults->get("SI_DURATION",5);
225 show_assets = defaults->get("SHOW_ASSETS", 1);
226 show_titles = defaults->get("SHOW_TITLES", 1);
227 // test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
228 time_format = defaults->get("TIME_FORMAT", TIME_HMS);
229 for(int i = 0; i < 4; i++)
231 sprintf(string, "TIMECODE_OFFSET_%d", i);
232 timecode_offset[i] = defaults->get(string, 0);
234 nudge_seconds = defaults->get("NUDGE_FORMAT", 1);
235 tool_window = defaults->get("TOOL_WINDOW", 0);
236 vconfig_in->load_defaults(defaults);
237 for(int i = 0; i < MAXCHANNELS; i++)
239 int default_position = i * output_w;
240 sprintf(string, "VCHANNEL_X_%d", i);
241 vchannel_x[i] = defaults->get(string, default_position);
242 sprintf(string, "VCHANNEL_Y_%d", i);
243 vchannel_y[i] = defaults->get(string, 0);
245 video_channels = defaults->get("VCHANNELS", 1);
246 video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 0);
247 video_tracks = defaults->get("VTRACKS", 1);
248 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
249 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
250 vwindow_meter = defaults->get("VWINDOW_METER", 1);
253 decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
254 subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
256 vwindow_folder[0] = 0;
258 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
264 int EDLSession::save_defaults(BC_Hash *defaults)
266 char string[BCTEXTLEN];
269 for(int i = 0; i < MAXCHANNELS; i++)
271 sprintf(string, "ACHANNEL_ANGLE_%d", i);
272 defaults->update(string, achannel_positions[i]);
274 defaults->update("ACHANNELS", audio_channels);
275 aconfig_duplex->save_defaults(defaults);
276 aconfig_in->save_defaults(defaults);
277 for(int i = 0; i < ASSET_COLUMNS; i++)
279 sprintf(string, "ASSET_COLUMN%d", i);
280 defaults->update(string, asset_columns[i]);
282 auto_conf->save_defaults(defaults);
283 defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate);
284 defaults->update("ASSETLIST_FORMAT", assetlist_format);
285 defaults->update("ASPECTW", aspect_w);
286 defaults->update("ASPECTH", aspect_h);
287 defaults->update("ATRACKS", audio_tracks);
288 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
289 defaults->update("BRENDER_START", brender_start);
290 cmodel_to_text(string, color_model);
291 defaults->update("COLOR_MODEL", string);
292 ilacemode_to_xmltext(string, interlace_mode);
293 defaults->update("INTERLACE_MODE", string);
294 defaults->update("CROP_X1", crop_x1);
295 defaults->update("CROP_X2", crop_x2);
296 defaults->update("CROP_Y1", crop_y1);
297 defaults->update("CROP_Y2", crop_y2);
298 defaults->update("CURRENT_FOLDER", current_folder);
299 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
300 defaults->update("CWINDOW_DEST", cwindow_dest);
301 defaults->update("CWINDOW_MASK", cwindow_mask);
302 defaults->update("CWINDOW_METER", cwindow_meter);
303 defaults->update("CWINDOW_OPERATION", cwindow_operation);
304 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
305 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
306 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
307 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
308 defaults->update("DEFAULT_ATRANSITION", default_atransition);
309 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
310 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
311 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
312 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
313 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
314 defaults->update("EDITING_MODE", editing_mode);
315 defaults->update("ENABLE_DUPLEX", enable_duplex);
316 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
317 defaults->update("FRAMERATE", frame_rate);
318 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
319 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
320 defaults->update("INTERPOLATION_TYPE", interpolation_type);
321 defaults->update("INTERPOLATE_RAW", interpolate_raw);
322 defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
323 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
324 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
325 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
326 defaults->update("METER_FORMAT", meter_format);
327 defaults->update("MIN_METER_DB", min_meter_db);
328 defaults->update("MAX_METER_DB", max_meter_db);
329 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
330 defaults->update("OUTPUTW", output_w);
331 defaults->update("OUTPUTH", output_h);
332 defaults->update("PLAYBACK_BUFFER", playback_buffer);
333 defaults->update("PLAYBACK_PRELOAD", playback_preload);
334 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
335 playback_config->save_defaults(defaults);
336 defaults->update("PLAYBACK_REALTIME", real_time_playback);
337 defaults->update("REALTIME_RECORD", real_time_record);
338 defaults->update("RECORD_SOFTWARE_POSITION", record_software_position);
339 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
340 // defaults->update("RECORD_SPEED", record_speed);
341 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
342 recording_format->save_defaults(defaults,
349 defaults->update("SAFE_REGIONS", safe_regions);
350 defaults->update("SAMPLERATE", sample_rate);
351 defaults->update("SCRUB_SPEED", scrub_speed);
352 defaults->update("SI_USEDURATION",si_useduration);
353 defaults->update("SI_DURATION",si_duration);
354 defaults->update("SHOW_ASSETS", show_assets);
355 defaults->update("SHOW_TITLES", show_titles);
356 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
357 defaults->update("TIME_FORMAT", time_format);
358 for(int i = 0; i < 4; i++)
360 sprintf(string, "TIMECODE_OFFSET_%d", i);
361 defaults->update(string, timecode_offset[i]);
363 defaults->update("NUDGE_FORMAT", nudge_seconds);
364 defaults->update("TOOL_WINDOW", tool_window);
365 vconfig_in->save_defaults(defaults);
366 for(int i = 0; i < MAXCHANNELS; i++)
368 sprintf(string, "VCHANNEL_X_%d", i);
369 defaults->update(string, vchannel_x[i]);
370 sprintf(string, "VCHANNEL_Y_%d", i);
371 defaults->update(string, vchannel_y[i]);
373 defaults->update("VCHANNELS", video_channels);
374 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
375 defaults->update("VTRACKS", video_tracks);
376 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
377 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
378 defaults->update("VWINDOW_METER", vwindow_meter);
379 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
381 defaults->update("DECODE_SUBTITLES", decode_subtitles);
382 defaults->update("SUBTITLE_NUMBER", subtitle_number);
390 // GCC 3.0 fails to compile
391 #define BC_INFINITY 65536
394 void EDLSession::boundaries()
396 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
397 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
398 Workarounds::clamp(sample_rate, 1, 1000000);
399 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
400 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
401 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
402 Workarounds::clamp(min_meter_db, -80, -20);
403 Workarounds::clamp(max_meter_db, 0, 10);
404 Workarounds::clamp(frames_per_foot, 1, 32);
405 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
406 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
407 Workarounds::clamp(video_write_length, 1, 1000);
408 //printf("EDLSession::boundaries 1\n");
414 Workarounds::clamp(crop_x1, 0, output_w);
415 Workarounds::clamp(crop_x2, 0, output_w);
416 Workarounds::clamp(crop_y1, 0, output_h);
417 Workarounds::clamp(crop_y2, 0, output_h);
418 if(brender_start < 0) brender_start = 0.0;
420 Workarounds::clamp(subtitle_number, 0, 31);
422 // Correct framerates
423 frame_rate = Units::fix_framerate(frame_rate);
424 //printf("EDLSession::boundaries 1 %p %p\n", edl->assets, edl->tracks);
425 // if(vwindow_source < 0 || vwindow_source >= edl->assets->total() + 1) vwindow_source = 0;
426 // if(cwindow_dest < 0 || cwindow_dest > edl->tracks->total()) cwindow_dest = 0;
427 //printf("EDLSession::boundaries 2\n");
432 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
435 if(append_mode) return 0;
436 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
437 interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
438 white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
439 cmodel_to_text(string, color_model);
440 color_model = cmodel_from_text(file->tag.get_property("COLORMODEL", string));
441 interlace_mode = ilacemode_from_xmltext(file->tag.get_property("INTERLACE_MODE"), BC_ILACE_MODE_NOTINTERLACED);
442 video_channels = file->tag.get_property("CHANNELS", video_channels);
443 for(int i = 0; i < video_channels; i++)
445 int default_position = i * output_w;
446 sprintf(string, "VCHANNEL_X_%d", i);
447 vchannel_x[i] = file->tag.get_property(string, default_position);
448 sprintf(string, "VCHANNEL_Y_%d", i);
449 vchannel_y[i] = file->tag.get_property(string, 0);
452 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
453 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
454 output_w = file->tag.get_property("OUTPUTW", output_w);
455 output_h = file->tag.get_property("OUTPUTH", output_h);
456 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
457 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
461 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
464 // load channels setting
465 if(append_mode) return 0;
466 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
469 for(int i = 0; i < audio_channels; i++)
471 sprintf(string, "ACHANNEL_ANGLE_%d", i);
472 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
473 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
476 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
480 int EDLSession::load_xml(FileXML *file,
484 char string[BCTEXTLEN];
491 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
492 for(int i = 0; i < ASSET_COLUMNS; i++)
494 sprintf(string, "ASSET_COLUMN%d", i);
495 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
497 auto_conf->load_xml(file);
498 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
499 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
500 brender_start = file->tag.get_property("BRENDER_START", brender_start);
501 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
502 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
503 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
504 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
505 file->tag.get_property("CURRENT_FOLDER", current_folder);
506 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
507 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
508 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
509 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
510 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
511 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
512 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
513 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
514 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
515 file->tag.get_property("DEFAULT_ATRANSITION", default_atransition);
516 file->tag.get_property("DEFAULT_VTRANSITION", default_vtransition);
517 default_transition_length = file->tag.get_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
518 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
519 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
520 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
521 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
522 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
523 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
524 playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload);
525 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
526 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
527 show_titles = file->tag.get_property("SHOW_TITLES", 1);
528 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
529 time_format = file->tag.get_property("TIME_FORMAT", time_format);
530 for(int i = 0; i < 4; i++)
532 sprintf(string, "TIMECODE_OFFSET_%d", i);
533 timecode_offset[i] = file->tag.get_property(string, timecode_offset[i]);
535 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
536 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
537 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
538 file->tag.get_property("VWINDOW_FOLDER", vwindow_folder);
539 vwindow_source = file->tag.get_property("VWINDOW_SOURCE", vwindow_source);
540 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
542 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
543 subtitle_number = file->tag.get_property("subtitle_number", subtitle_number);
550 int EDLSession::save_xml(FileXML *file)
552 //printf("EDLSession::save_session 1\n");
553 char string[BCTEXTLEN];
554 file->tag.set_title("SESSION");
555 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
556 for(int i = 0; i < ASSET_COLUMNS; i++)
558 sprintf(string, "ASSET_COLUMN%d", i);
559 file->tag.set_property(string, asset_columns[i]);
561 auto_conf->save_xml(file);
562 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
563 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
564 file->tag.set_property("BRENDER_START", brender_start);
565 file->tag.set_property("CROP_X1", crop_x1);
566 file->tag.set_property("CROP_Y1", crop_y1);
567 file->tag.set_property("CROP_X2", crop_x2);
568 file->tag.set_property("CROP_Y2", crop_y2);
569 file->tag.set_property("CURRENT_FOLDER", current_folder);
570 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
571 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
572 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
573 file->tag.set_property("CWINDOW_METER", cwindow_meter);
574 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
575 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
576 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
577 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
578 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
579 file->tag.set_property("DEFAULT_ATRANSITION", default_atransition);
580 file->tag.set_property("DEFAULT_VTRANSITION", default_vtransition);
581 file->tag.set_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
582 file->tag.set_property("EDITING_MODE", editing_mode);
583 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
584 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
585 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
586 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
587 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
588 file->tag.set_property("PLAYBACK_PRELOAD", playback_preload);
589 file->tag.set_property("SAFE_REGIONS", safe_regions);
590 file->tag.set_property("SHOW_ASSETS", show_assets);
591 file->tag.set_property("SHOW_TITLES", show_titles);
592 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
593 file->tag.set_property("TIME_FORMAT", time_format);
594 for(int i = 0; i < 4; i++)
596 sprintf(string, "TIMECODE_OFFSET_%d", i);
597 file->tag.set_property(string, timecode_offset[i]);
599 file->tag.set_property("NUDGE_SECONDS", nudge_seconds);
600 file->tag.set_property("TOOL_WINDOW", tool_window);
601 file->tag.set_property("VWINDOW_METER", vwindow_meter);
602 file->tag.set_property("VWINDOW_FOLDER", vwindow_folder);
603 file->tag.set_property("VWINDOW_SOURCE", vwindow_source);
604 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
607 file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
608 file->tag.set_property("subtitle_number", subtitle_number);
613 file->tag.set_title("/SESSION");
615 file->append_newline();
616 file->append_newline();
617 //printf("EDLSession::save_session 3\n");
621 int EDLSession::save_video_config(FileXML *file)
624 file->tag.set_title("VIDEO");
625 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
626 file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
627 file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
628 cmodel_to_text(string, color_model);
629 file->tag.set_property("COLORMODEL", string);
630 ilacemode_to_xmltext(string, interlace_mode);
631 file->tag.set_property("INTERLACE_MODE",string);
632 file->tag.set_property("CHANNELS", video_channels);
633 for(int i = 0; i < video_channels; i++)
635 sprintf(string, "VCHANNEL_X_%d", i);
636 file->tag.set_property(string, vchannel_x[i]);
637 sprintf(string, "VCHANNEL_Y_%d", i);
638 file->tag.set_property(string, vchannel_y[i]);
641 file->tag.set_property("FRAMERATE", frame_rate);
642 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
643 file->tag.set_property("OUTPUTW", output_w);
644 file->tag.set_property("OUTPUTH", output_h);
645 file->tag.set_property("ASPECTW", aspect_w);
646 file->tag.set_property("ASPECTH", aspect_h);
648 file->tag.set_title("/VIDEO");
650 file->append_newline();
651 file->append_newline();
655 int EDLSession::save_audio_config(FileXML *file)
658 file->tag.set_title("AUDIO");
659 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
660 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
662 for(int i = 0; i < audio_channels; i++)
664 sprintf(string, "ACHANNEL_ANGLE_%d", i);
665 file->tag.set_property(string, achannel_positions[i]);
669 file->tag.set_title("/AUDIO");
671 file->append_newline();
672 file->append_newline();
676 int EDLSession::copy(EDLSession *session)
678 // Audio channel positions
679 for(int i = 0; i < MAXCHANNELS; i++)
681 achannel_positions[i] = session->achannel_positions[i];
683 aconfig_duplex->copy_from(session->aconfig_duplex);
684 aconfig_in->copy_from(session->aconfig_in);
685 actual_frame_rate = session->actual_frame_rate;
686 for(int i = 0; i < ASSET_COLUMNS; i++)
688 asset_columns[i] = session->asset_columns[i];
690 assetlist_format = session->assetlist_format;
691 auto_conf->copy_from(session->auto_conf);
692 aspect_w = session->aspect_w;
693 aspect_h = session->aspect_h;
694 audio_channels = session->audio_channels;
695 audio_tracks = session->audio_tracks;
696 autos_follow_edits = session->autos_follow_edits;
697 brender_start = session->brender_start;
698 color_model = session->color_model;
699 interlace_mode = session->interlace_mode;
700 crop_x1 = session->crop_x1;
701 crop_y1 = session->crop_y1;
702 crop_x2 = session->crop_x2;
703 crop_y2 = session->crop_y2;
704 strcpy(current_folder, session->current_folder);
705 cursor_on_frames = session->cursor_on_frames;
706 cwindow_dest = session->cwindow_dest;
707 cwindow_mask = session->cwindow_mask;
708 cwindow_meter = session->cwindow_meter;
709 cwindow_operation = session->cwindow_operation;
710 cwindow_scrollbars = session->cwindow_scrollbars;
711 cwindow_xscroll = session->cwindow_xscroll;
712 cwindow_yscroll = session->cwindow_yscroll;
713 cwindow_zoom = session->cwindow_zoom;
714 strcpy(default_atransition, session->default_atransition);
715 strcpy(default_vtransition, session->default_vtransition);
716 default_transition_length = session->default_transition_length;
717 edit_handle_mode[0] = session->edit_handle_mode[0];
718 edit_handle_mode[1] = session->edit_handle_mode[1];
719 edit_handle_mode[2] = session->edit_handle_mode[2];
720 editing_mode = session->editing_mode;
721 enable_duplex = session->enable_duplex;
722 folderlist_format = session->folderlist_format;
723 frame_rate = session->frame_rate;
724 frames_per_foot = session->frames_per_foot;
725 highlighted_track = session->highlighted_track;
726 interpolation_type = session->interpolation_type;
727 interpolate_raw = session->interpolate_raw;
728 white_balance_raw = session->white_balance_raw;
729 labels_follow_edits = session->labels_follow_edits;
730 plugins_follow_edits = session->plugins_follow_edits;
731 auto_keyframes = session->auto_keyframes;
732 // last_playback_position = session->last_playback_position;
733 meter_format = session->meter_format;
734 min_meter_db = session->min_meter_db;
735 max_meter_db = session->max_meter_db;
736 mpeg4_deblock = session->mpeg4_deblock;
737 output_w = session->output_w;
738 output_h = session->output_h;
739 playback_buffer = session->playback_buffer;
740 delete playback_config;
741 playback_config = new PlaybackConfig;
742 playback_config->copy_from(session->playback_config);
743 playback_cursor_visible = session->playback_cursor_visible;
744 playback_preload = session->playback_preload;
745 playback_software_position = session->playback_software_position;
746 real_time_playback = session->real_time_playback;
747 real_time_record = session->real_time_record;
748 record_software_position = session->record_software_position;
749 // record_speed = session->record_speed;
750 record_sync_drives = session->record_sync_drives;
751 record_write_length = session->record_write_length;
752 recording_format->copy_from(session->recording_format, 0);
753 safe_regions = session->safe_regions;
754 sample_rate = session->sample_rate;
755 scrub_speed = session->scrub_speed;
756 si_useduration = session->si_useduration;
757 si_duration = session->si_duration;
758 show_assets = session->show_assets;
759 show_titles = session->show_titles;
760 test_playback_edits = session->test_playback_edits;
761 time_format = session->time_format;
762 for(int i = 0; i < 4; i++)
764 timecode_offset[i] = session->timecode_offset[i];
766 nudge_seconds = session->nudge_seconds;
767 tool_window = session->tool_window;
768 for(int i = 0; i < MAXCHANNELS; i++)
770 vchannel_x[i] = session->vchannel_x[i];
771 vchannel_y[i] = session->vchannel_y[i];
773 video_channels = session->video_channels;
774 *vconfig_in = *session->vconfig_in;
775 video_every_frame = session->video_every_frame;
776 video_tracks = session->video_tracks;
777 video_write_length = session->video_write_length;
778 view_follows_playback = session->view_follows_playback;
779 vwindow_meter = session->vwindow_meter;
780 strcpy(vwindow_folder, session->vwindow_folder);
781 vwindow_source = session->vwindow_source;
782 vwindow_zoom = session->vwindow_zoom;
784 subtitle_number = session->subtitle_number;
785 decode_subtitles = session->decode_subtitles;
790 int64_t EDLSession::get_frame_offset()
792 return int64_t((timecode_offset[3] * 3600 +
793 timecode_offset[2] * 60 +
794 timecode_offset[1]) *
799 void EDLSession::dump()
801 printf("EDLSession::dump\n");
802 printf(" audio_tracks=%d audio_channels=%d sample_rate=%lld\n"
803 "video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f decode subtitles=%d subtitle_number=%d\n",