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 = Asset_GC(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;
74 char* EDLSession::get_cwindow_display()
76 if(playback_config->vconfig->x11_host[0])
77 return playback_config->vconfig->x11_host;
82 int EDLSession::need_rerender(EDLSession *ptr)
84 return (playback_preload != ptr->playback_preload) ||
85 (interpolation_type != ptr->interpolation_type) ||
86 (video_every_frame != ptr->video_every_frame) ||
87 (video_asynchronous != ptr->video_asynchronous) ||
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", 1);
247 video_asynchronous = defaults->get("VIDEO_ASYNCHRONOUS", 0);
248 video_tracks = defaults->get("VTRACKS", 1);
249 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
250 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
251 vwindow_meter = defaults->get("VWINDOW_METER", 1);
254 decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
255 subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
257 vwindow_folder[0] = 0;
259 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
265 int EDLSession::save_defaults(BC_Hash *defaults)
267 char string[BCTEXTLEN];
270 for(int i = 0; i < MAXCHANNELS; i++)
272 sprintf(string, "ACHANNEL_ANGLE_%d", i);
273 defaults->update(string, achannel_positions[i]);
275 defaults->update("ACHANNELS", audio_channels);
276 aconfig_duplex->save_defaults(defaults);
277 aconfig_in->save_defaults(defaults);
278 for(int i = 0; i < ASSET_COLUMNS; i++)
280 sprintf(string, "ASSET_COLUMN%d", i);
281 defaults->update(string, asset_columns[i]);
283 auto_conf->save_defaults(defaults);
284 defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate);
285 defaults->update("ASSETLIST_FORMAT", assetlist_format);
286 defaults->update("ASPECTW", aspect_w);
287 defaults->update("ASPECTH", aspect_h);
288 defaults->update("ATRACKS", audio_tracks);
289 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
290 defaults->update("BRENDER_START", brender_start);
291 cmodel_to_text(string, color_model);
292 defaults->update("COLOR_MODEL", string);
293 ilacemode_to_xmltext(string, interlace_mode);
294 defaults->update("INTERLACE_MODE", string);
295 defaults->update("CROP_X1", crop_x1);
296 defaults->update("CROP_X2", crop_x2);
297 defaults->update("CROP_Y1", crop_y1);
298 defaults->update("CROP_Y2", crop_y2);
299 defaults->update("CURRENT_FOLDER", current_folder);
300 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
301 defaults->update("CWINDOW_DEST", cwindow_dest);
302 defaults->update("CWINDOW_MASK", cwindow_mask);
303 defaults->update("CWINDOW_METER", cwindow_meter);
304 defaults->update("CWINDOW_OPERATION", cwindow_operation);
305 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
306 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
307 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
308 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
309 defaults->update("DEFAULT_ATRANSITION", default_atransition);
310 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
311 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
312 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
313 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
314 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
315 defaults->update("EDITING_MODE", editing_mode);
316 defaults->update("ENABLE_DUPLEX", enable_duplex);
317 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
318 defaults->update("FRAMERATE", frame_rate);
319 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
320 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
321 defaults->update("INTERPOLATION_TYPE", interpolation_type);
322 defaults->update("INTERPOLATE_RAW", interpolate_raw);
323 defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
324 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
325 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
326 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
327 defaults->update("METER_FORMAT", meter_format);
328 defaults->update("MIN_METER_DB", min_meter_db);
329 defaults->update("MAX_METER_DB", max_meter_db);
330 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
331 defaults->update("OUTPUTW", output_w);
332 defaults->update("OUTPUTH", output_h);
333 defaults->update("PLAYBACK_BUFFER", playback_buffer);
334 defaults->update("PLAYBACK_PRELOAD", playback_preload);
335 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
336 playback_config->save_defaults(defaults);
337 defaults->update("PLAYBACK_REALTIME", real_time_playback);
338 defaults->update("REALTIME_RECORD", real_time_record);
339 defaults->update("RECORD_SOFTWARE_POSITION", record_software_position);
340 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
341 // defaults->update("RECORD_SPEED", record_speed);
342 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
343 recording_format->save_defaults(defaults,
350 defaults->update("SAFE_REGIONS", safe_regions);
351 defaults->update("SAMPLERATE", sample_rate);
352 defaults->update("SCRUB_SPEED", scrub_speed);
353 defaults->update("SI_USEDURATION",si_useduration);
354 defaults->update("SI_DURATION",si_duration);
355 defaults->update("SHOW_ASSETS", show_assets);
356 defaults->update("SHOW_TITLES", show_titles);
357 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
358 defaults->update("TIME_FORMAT", time_format);
359 for(int i = 0; i < 4; i++)
361 sprintf(string, "TIMECODE_OFFSET_%d", i);
362 defaults->update(string, timecode_offset[i]);
364 defaults->update("NUDGE_FORMAT", nudge_seconds);
365 defaults->update("TOOL_WINDOW", tool_window);
366 vconfig_in->save_defaults(defaults);
367 for(int i = 0; i < MAXCHANNELS; i++)
369 sprintf(string, "VCHANNEL_X_%d", i);
370 defaults->update(string, vchannel_x[i]);
371 sprintf(string, "VCHANNEL_Y_%d", i);
372 defaults->update(string, vchannel_y[i]);
374 defaults->update("VCHANNELS", video_channels);
375 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
376 defaults->update("VIDEO_ASYNCHRONOUS", video_asynchronous);
377 defaults->update("VTRACKS", video_tracks);
378 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
379 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
380 defaults->update("VWINDOW_METER", vwindow_meter);
381 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
383 defaults->update("DECODE_SUBTITLES", decode_subtitles);
384 defaults->update("SUBTITLE_NUMBER", subtitle_number);
392 // GCC 3.0 fails to compile
393 #define BC_INFINITY 65536
396 void EDLSession::boundaries()
398 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
399 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
400 Workarounds::clamp(sample_rate, 1, 1000000);
401 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
402 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
403 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
404 Workarounds::clamp(min_meter_db, -80, -20);
405 Workarounds::clamp(max_meter_db, 0, 10);
406 Workarounds::clamp(frames_per_foot, 1, 32);
407 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
408 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
409 Workarounds::clamp(video_write_length, 1, 1000);
410 //printf("EDLSession::boundaries 1\n");
416 Workarounds::clamp(crop_x1, 0, output_w);
417 Workarounds::clamp(crop_x2, 0, output_w);
418 Workarounds::clamp(crop_y1, 0, output_h);
419 Workarounds::clamp(crop_y2, 0, output_h);
420 if(brender_start < 0) brender_start = 0.0;
422 Workarounds::clamp(subtitle_number, 0, 31);
424 // Correct framerates
425 frame_rate = Units::fix_framerate(frame_rate);
426 //printf("EDLSession::boundaries 1 %p %p\n", edl->assets, edl->tracks);
427 // if(vwindow_source < 0 || vwindow_source >= edl->assets->total() + 1) vwindow_source = 0;
428 // if(cwindow_dest < 0 || cwindow_dest > edl->tracks->total()) cwindow_dest = 0;
429 //printf("EDLSession::boundaries 2\n");
434 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
437 if(append_mode) return 0;
438 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
439 interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
440 white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
441 cmodel_to_text(string, color_model);
442 color_model = cmodel_from_text(file->tag.get_property("COLORMODEL", string));
443 interlace_mode = ilacemode_from_xmltext(file->tag.get_property("INTERLACE_MODE"), BC_ILACE_MODE_NOTINTERLACED);
444 video_channels = file->tag.get_property("CHANNELS", video_channels);
445 for(int i = 0; i < video_channels; i++)
447 int default_position = i * output_w;
448 sprintf(string, "VCHANNEL_X_%d", i);
449 vchannel_x[i] = file->tag.get_property(string, default_position);
450 sprintf(string, "VCHANNEL_Y_%d", i);
451 vchannel_y[i] = file->tag.get_property(string, 0);
454 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
455 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
456 output_w = file->tag.get_property("OUTPUTW", output_w);
457 output_h = file->tag.get_property("OUTPUTH", output_h);
458 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
459 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
463 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
466 // load channels setting
467 if(append_mode) return 0;
468 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
471 for(int i = 0; i < audio_channels; i++)
473 sprintf(string, "ACHANNEL_ANGLE_%d", i);
474 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
475 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
478 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
482 int EDLSession::load_xml(FileXML *file,
486 char string[BCTEXTLEN];
493 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
494 for(int i = 0; i < ASSET_COLUMNS; i++)
496 sprintf(string, "ASSET_COLUMN%d", i);
497 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
499 auto_conf->load_xml(file);
500 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
501 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
502 brender_start = file->tag.get_property("BRENDER_START", brender_start);
503 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
504 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
505 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
506 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
507 file->tag.get_property("CURRENT_FOLDER", current_folder);
508 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
509 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
510 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
511 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
512 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
513 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
514 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
515 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
516 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
517 file->tag.get_property("DEFAULT_ATRANSITION", default_atransition);
518 file->tag.get_property("DEFAULT_VTRANSITION", default_vtransition);
519 default_transition_length = file->tag.get_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
520 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
521 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
522 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
523 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
524 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
525 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
526 playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload);
527 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
528 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
529 show_titles = file->tag.get_property("SHOW_TITLES", 1);
530 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
531 time_format = file->tag.get_property("TIME_FORMAT", time_format);
532 for(int i = 0; i < 4; i++)
534 sprintf(string, "TIMECODE_OFFSET_%d", i);
535 timecode_offset[i] = file->tag.get_property(string, timecode_offset[i]);
537 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
538 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
539 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
540 file->tag.get_property("VWINDOW_FOLDER", vwindow_folder);
541 vwindow_source = file->tag.get_property("VWINDOW_SOURCE", vwindow_source);
542 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
544 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
545 subtitle_number = file->tag.get_property("subtitle_number", subtitle_number);
552 int EDLSession::save_xml(FileXML *file)
554 //printf("EDLSession::save_session 1\n");
555 char string[BCTEXTLEN];
556 file->tag.set_title("SESSION");
557 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
558 for(int i = 0; i < ASSET_COLUMNS; i++)
560 sprintf(string, "ASSET_COLUMN%d", i);
561 file->tag.set_property(string, asset_columns[i]);
563 auto_conf->save_xml(file);
564 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
565 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
566 file->tag.set_property("BRENDER_START", brender_start);
567 file->tag.set_property("CROP_X1", crop_x1);
568 file->tag.set_property("CROP_Y1", crop_y1);
569 file->tag.set_property("CROP_X2", crop_x2);
570 file->tag.set_property("CROP_Y2", crop_y2);
571 file->tag.set_property("CURRENT_FOLDER", current_folder);
572 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
573 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
574 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
575 file->tag.set_property("CWINDOW_METER", cwindow_meter);
576 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
577 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
578 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
579 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
580 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
581 file->tag.set_property("DEFAULT_ATRANSITION", default_atransition);
582 file->tag.set_property("DEFAULT_VTRANSITION", default_vtransition);
583 file->tag.set_property("DEFAULT_TRANSITION_LENGTH", default_transition_length);
584 file->tag.set_property("EDITING_MODE", editing_mode);
585 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
586 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
587 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
588 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
589 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
590 file->tag.set_property("PLAYBACK_PRELOAD", playback_preload);
591 file->tag.set_property("SAFE_REGIONS", safe_regions);
592 file->tag.set_property("SHOW_ASSETS", show_assets);
593 file->tag.set_property("SHOW_TITLES", show_titles);
594 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
595 file->tag.set_property("TIME_FORMAT", time_format);
596 for(int i = 0; i < 4; i++)
598 sprintf(string, "TIMECODE_OFFSET_%d", i);
599 file->tag.set_property(string, timecode_offset[i]);
601 file->tag.set_property("NUDGE_SECONDS", nudge_seconds);
602 file->tag.set_property("TOOL_WINDOW", tool_window);
603 file->tag.set_property("VWINDOW_METER", vwindow_meter);
604 file->tag.set_property("VWINDOW_FOLDER", vwindow_folder);
605 file->tag.set_property("VWINDOW_SOURCE", vwindow_source);
606 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
609 file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
610 file->tag.set_property("subtitle_number", subtitle_number);
615 file->tag.set_title("/SESSION");
617 file->append_newline();
618 file->append_newline();
619 //printf("EDLSession::save_session 3\n");
623 int EDLSession::save_video_config(FileXML *file)
626 file->tag.set_title("VIDEO");
627 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
628 file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
629 file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
630 cmodel_to_text(string, color_model);
631 file->tag.set_property("COLORMODEL", string);
632 ilacemode_to_xmltext(string, interlace_mode);
633 file->tag.set_property("INTERLACE_MODE",string);
634 file->tag.set_property("CHANNELS", video_channels);
635 for(int i = 0; i < video_channels; i++)
637 sprintf(string, "VCHANNEL_X_%d", i);
638 file->tag.set_property(string, vchannel_x[i]);
639 sprintf(string, "VCHANNEL_Y_%d", i);
640 file->tag.set_property(string, vchannel_y[i]);
643 file->tag.set_property("FRAMERATE", frame_rate);
644 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
645 file->tag.set_property("OUTPUTW", output_w);
646 file->tag.set_property("OUTPUTH", output_h);
647 file->tag.set_property("ASPECTW", aspect_w);
648 file->tag.set_property("ASPECTH", aspect_h);
650 file->tag.set_title("/VIDEO");
652 file->append_newline();
653 file->append_newline();
657 int EDLSession::save_audio_config(FileXML *file)
660 file->tag.set_title("AUDIO");
661 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
662 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
664 for(int i = 0; i < audio_channels; i++)
666 sprintf(string, "ACHANNEL_ANGLE_%d", i);
667 file->tag.set_property(string, achannel_positions[i]);
671 file->tag.set_title("/AUDIO");
673 file->append_newline();
674 file->append_newline();
678 int EDLSession::copy(EDLSession *session)
680 // Audio channel positions
681 for(int i = 0; i < MAXCHANNELS; i++)
683 achannel_positions[i] = session->achannel_positions[i];
685 aconfig_duplex->copy_from(session->aconfig_duplex);
686 aconfig_in->copy_from(session->aconfig_in);
687 actual_frame_rate = session->actual_frame_rate;
688 for(int i = 0; i < ASSET_COLUMNS; i++)
690 asset_columns[i] = session->asset_columns[i];
692 assetlist_format = session->assetlist_format;
693 auto_conf->copy_from(session->auto_conf);
694 aspect_w = session->aspect_w;
695 aspect_h = session->aspect_h;
696 audio_channels = session->audio_channels;
697 audio_tracks = session->audio_tracks;
698 autos_follow_edits = session->autos_follow_edits;
699 brender_start = session->brender_start;
700 color_model = session->color_model;
701 interlace_mode = session->interlace_mode;
702 crop_x1 = session->crop_x1;
703 crop_y1 = session->crop_y1;
704 crop_x2 = session->crop_x2;
705 crop_y2 = session->crop_y2;
706 strcpy(current_folder, session->current_folder);
707 cursor_on_frames = session->cursor_on_frames;
708 cwindow_dest = session->cwindow_dest;
709 cwindow_mask = session->cwindow_mask;
710 cwindow_meter = session->cwindow_meter;
711 cwindow_operation = session->cwindow_operation;
712 cwindow_scrollbars = session->cwindow_scrollbars;
713 cwindow_xscroll = session->cwindow_xscroll;
714 cwindow_yscroll = session->cwindow_yscroll;
715 cwindow_zoom = session->cwindow_zoom;
716 strcpy(default_atransition, session->default_atransition);
717 strcpy(default_vtransition, session->default_vtransition);
718 default_transition_length = session->default_transition_length;
719 edit_handle_mode[0] = session->edit_handle_mode[0];
720 edit_handle_mode[1] = session->edit_handle_mode[1];
721 edit_handle_mode[2] = session->edit_handle_mode[2];
722 editing_mode = session->editing_mode;
723 enable_duplex = session->enable_duplex;
724 folderlist_format = session->folderlist_format;
725 frame_rate = session->frame_rate;
726 frames_per_foot = session->frames_per_foot;
727 highlighted_track = session->highlighted_track;
728 interpolation_type = session->interpolation_type;
729 interpolate_raw = session->interpolate_raw;
730 white_balance_raw = session->white_balance_raw;
731 labels_follow_edits = session->labels_follow_edits;
732 plugins_follow_edits = session->plugins_follow_edits;
733 auto_keyframes = session->auto_keyframes;
734 // last_playback_position = session->last_playback_position;
735 meter_format = session->meter_format;
736 min_meter_db = session->min_meter_db;
737 max_meter_db = session->max_meter_db;
738 mpeg4_deblock = session->mpeg4_deblock;
739 output_w = session->output_w;
740 output_h = session->output_h;
741 playback_buffer = session->playback_buffer;
742 delete playback_config;
743 playback_config = new PlaybackConfig;
744 playback_config->copy_from(session->playback_config);
745 playback_cursor_visible = session->playback_cursor_visible;
746 playback_preload = session->playback_preload;
747 playback_software_position = session->playback_software_position;
748 real_time_playback = session->real_time_playback;
749 real_time_record = session->real_time_record;
750 record_software_position = session->record_software_position;
751 // record_speed = session->record_speed;
752 record_sync_drives = session->record_sync_drives;
753 record_write_length = session->record_write_length;
754 recording_format->copy_from(*session->recording_format, 0);
755 safe_regions = session->safe_regions;
756 sample_rate = session->sample_rate;
757 scrub_speed = session->scrub_speed;
758 si_useduration = session->si_useduration;
759 si_duration = session->si_duration;
760 show_assets = session->show_assets;
761 show_titles = session->show_titles;
762 test_playback_edits = session->test_playback_edits;
763 time_format = session->time_format;
764 for(int i = 0; i < 4; i++)
766 timecode_offset[i] = session->timecode_offset[i];
768 nudge_seconds = session->nudge_seconds;
769 tool_window = session->tool_window;
770 for(int i = 0; i < MAXCHANNELS; i++)
772 vchannel_x[i] = session->vchannel_x[i];
773 vchannel_y[i] = session->vchannel_y[i];
775 video_channels = session->video_channels;
776 *vconfig_in = *session->vconfig_in;
777 video_every_frame = session->video_every_frame;
778 video_asynchronous = session->video_asynchronous;
779 video_tracks = session->video_tracks;
780 video_write_length = session->video_write_length;
781 view_follows_playback = session->view_follows_playback;
782 vwindow_meter = session->vwindow_meter;
783 strcpy(vwindow_folder, session->vwindow_folder);
784 vwindow_source = session->vwindow_source;
785 vwindow_zoom = session->vwindow_zoom;
787 subtitle_number = session->subtitle_number;
788 decode_subtitles = session->decode_subtitles;
793 int64_t EDLSession::get_frame_offset()
795 return int64_t((timecode_offset[3] * 3600 +
796 timecode_offset[2] * 60 +
797 timecode_offset[1]) *
802 void EDLSession::dump()
804 printf("EDLSession::dump\n");
805 printf(" audio_tracks=%d audio_channels=%d sample_rate=%lld\n"
806 "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",
822 // c-file-style: "linux"