4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "colormodels.h"
28 #include "edlsession.h"
31 #include "overlayframe.inc"
32 #include "playbackconfig.h"
33 #include "recordconfig.h"
35 #include "workarounds.h"
37 int EDLSession::current_id = 0;
39 EDLSession::EDLSession(EDL *edl)
41 highlighted_track = 0;
42 playback_cursor_visible = 0;
43 aconfig_in = new AudioInConfig;
44 vconfig_in = new VideoInConfig;
45 recording_format = new Asset;
46 interpolation_type = CUBIC_LINEAR;
48 white_balance_raw = 1;
49 test_playback_edits = 1;
53 playback_config = new PlaybackConfig;
54 auto_conf = new AutoConf;
55 strcpy(current_folder, "");
56 strcpy(default_atransition, "");
57 strcpy(default_vtransition, "");
58 default_transition_length = 1.0;
59 folderlist_format = ASSETS_ICONS;
60 frame_rate = 25; // just has to be something by default
61 autos_follow_edits = 1; // this is needed for predictability
62 labels_follow_edits = 1;
63 plugins_follow_edits = 1;
64 single_standalone = 1;
65 audio_tracks = -10; // these insane values let us crash early if something is forgotten to be set
71 frames_per_foot = -10;
76 video_write_length = -1000;
86 EDLSession::~EDLSession()
91 delete playback_config;
92 recording_format->Garbage::remove_user();
96 int EDLSession::need_rerender(EDLSession *ptr)
98 return (playback_preload != ptr->playback_preload) ||
99 (interpolation_type != ptr->interpolation_type) ||
100 (video_every_frame != ptr->video_every_frame) ||
101 (video_asynchronous != ptr->video_asynchronous) ||
102 (real_time_playback != ptr->real_time_playback) ||
103 (playback_software_position != ptr->playback_software_position) ||
104 (test_playback_edits != ptr->test_playback_edits) ||
105 (playback_buffer != ptr->playback_buffer) ||
106 (decode_subtitles != ptr->decode_subtitles) ||
107 (subtitle_number != ptr->subtitle_number) ||
108 (interpolate_raw != ptr->interpolate_raw) ||
109 (white_balance_raw != ptr->white_balance_raw);
112 void EDLSession::equivalent_output(EDLSession *session, double *result)
114 if(session->output_w != output_w ||
115 session->output_h != output_h ||
116 session->frame_rate != frame_rate ||
117 session->color_model != color_model ||
118 session->interpolation_type != interpolation_type ||
119 session->interpolate_raw != interpolate_raw ||
120 session->white_balance_raw != white_balance_raw ||
121 session->mpeg4_deblock != mpeg4_deblock ||
122 session->decode_subtitles != decode_subtitles ||
123 session->subtitle_number != subtitle_number)
126 // If it's before the current brender_start, render extra data.
127 // If it's after brender_start, check brender map.
128 if(brender_start != session->brender_start &&
129 (*result < 0 || *result > brender_start))
130 *result = brender_start;
134 int EDLSession::load_defaults(BC_Hash *defaults)
136 char string[BCTEXTLEN];
138 // Default channel positions
139 for(int i = 0; i < MAXCHANNELS; i++)
141 sprintf(string, "ACHANNEL_ANGLE_%d", i);
142 int default_position = i * 30;
144 if(i == 0) default_position = 180;
146 if(i == 1) default_position = 0;
148 if(default_position == 90) default_position = 300;
150 if(default_position == 0) default_position = 330;
152 achannel_positions[i] = defaults->get(string, default_position);
154 aconfig_in->load_defaults(defaults);
155 assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
156 aspect_w = defaults->get("ASPECTW", (float)4);
157 aspect_h = defaults->get("ASPECTH", (float)3);
158 for(int i = 0; i < ASSET_COLUMNS; i++)
160 sprintf(string, "ASSET_COLUMN%d", i);
161 asset_columns[i] = defaults->get(string, 100);
163 audio_channels = defaults->get("ACHANNELS", 2);
164 audio_tracks = defaults->get("ATRACKS", 2);
165 auto_conf->load_defaults(defaults);
166 autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
167 brender_start = defaults->get("BRENDER_START", brender_start);
168 cmodel_to_text(string, BC_RGBA8888);
169 color_model = cmodel_from_text(defaults->get("COLOR_MODEL", string));
170 eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0);
171 crop_x1 = defaults->get("CROP_X1", 0);
172 crop_x2 = defaults->get("CROP_X2", 320);
173 crop_y1 = defaults->get("CROP_Y1", 0);
174 crop_y2 = defaults->get("CROP_Y2", 240);
175 ruler_x1 = defaults->get("RULER_X1", 0.0);
176 ruler_x2 = defaults->get("RULER_X2", 0.0);
177 ruler_y1 = defaults->get("RULER_Y1", 0.0);
178 ruler_y2 = defaults->get("RULER_Y2", 0.0);
179 sprintf(current_folder, MEDIA_FOLDER);
180 defaults->get("CURRENT_FOLDER", current_folder);
181 cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 0);
182 typeless_keyframes = defaults->get("TYPELESS_KEYFRAMES", 0);
183 cwindow_dest = defaults->get("CWINDOW_DEST", 0);
184 cwindow_mask = defaults->get("CWINDOW_MASK", 0);
185 cwindow_meter = defaults->get("CWINDOW_METER", 1);
186 cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
187 cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 1);
188 cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
189 cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
190 cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
191 sprintf(default_atransition, "Crossfade");
192 defaults->get("DEFAULT_ATRANSITION", default_atransition);
193 sprintf(default_vtransition, "Dissolve");
194 defaults->get("DEFAULT_VTRANSITION", default_vtransition);
195 default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
196 edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
197 edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ONE_EDIT);
198 edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_NO_EDITS);
199 editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM);
200 enable_duplex = defaults->get("ENABLE_DUPLEX", 1);
201 folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_ICONS);
202 frame_rate = defaults->get("FRAMERATE", (double)30000.0/1001);
203 frames_per_foot = defaults->get("FRAMES_PER_FOOT", (float)16);
204 interpolation_type = defaults->get("INTERPOLATION_TYPE", interpolation_type);
205 interpolate_raw = defaults->get("INTERPOLATE_RAW", interpolate_raw);
206 white_balance_raw = defaults->get("WHITE_BALANCE_RAW", white_balance_raw);
207 labels_follow_edits = defaults->get("LABELS_FOLLOW_EDITS", 1);
208 plugins_follow_edits = defaults->get("PLUGINS_FOLLOW_EDITS", 1);
209 single_standalone = defaults->get("SINGLE_STANDALONE", 1);
210 auto_keyframes = defaults->get("AUTO_KEYFRAMES", 0);
211 meter_format = defaults->get("METER_FORMAT", METER_DB);
212 min_meter_db = defaults->get("MIN_METER_DB", -85);
213 max_meter_db = defaults->get("MAX_METER_DB", 6);
214 mpeg4_deblock = defaults->get("MPEG4_DEBLOCK", mpeg4_deblock);
215 output_w = defaults->get("OUTPUTW", 720);
216 output_h = defaults->get("OUTPUTH", 480);
217 playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096);
218 playback_preload = defaults->get("PLAYBACK_PRELOAD", 0);
219 playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0);
220 delete playback_config;
221 playback_config = new PlaybackConfig;
222 playback_config->load_defaults(defaults);
223 real_time_playback = defaults->get("PLAYBACK_REALTIME", 0);
224 real_time_record = defaults->get("REALTIME_RECORD", 0);
225 record_positioning = defaults->get("RECORD_POSITIONING", 1);
226 record_raw_stream = defaults->get("RECORD_RAW_STREAM", 0);
227 record_sync_drives = defaults->get("RECORD_SYNC_DRIVES", 0);
228 // record_speed = defaults->get("RECORD_SPEED", 24);
229 record_fragment_size = defaults->get("RECORD_FRAGMENT_SIZE", 2048);
230 record_write_length = defaults->get("RECORD_WRITE_LENGTH", 131072);
231 record_realtime_toc = defaults->get("RECORD_REALTIME_TOC", 1);
232 recording_format->load_defaults(defaults,
239 safe_regions = defaults->get("SAFE_REGIONS", 1);
240 sample_rate = defaults->get("SAMPLERATE", 48000);
241 scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
242 show_assets = defaults->get("SHOW_ASSETS", 1);
243 show_titles = defaults->get("SHOW_TITLES", 1);
244 // test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
245 time_format = defaults->get("TIME_FORMAT", TIME_HMS);
246 nudge_seconds = defaults->get("NUDGE_FORMAT", 1);
247 tool_window = defaults->get("TOOL_WINDOW", 0);
248 vconfig_in->load_defaults(defaults);
249 for(int i = 0; i < MAXCHANNELS; i++)
251 int default_position = i * output_w;
252 sprintf(string, "VCHANNEL_X_%d", i);
253 vchannel_x[i] = defaults->get(string, default_position);
254 sprintf(string, "VCHANNEL_Y_%d", i);
255 vchannel_y[i] = defaults->get(string, 0);
257 video_channels = defaults->get("VCHANNELS", 1);
258 video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 1);
259 video_asynchronous = defaults->get("VIDEO_ASYNCHRONOUS", 0);
260 video_tracks = defaults->get("VTRACKS", 1);
261 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
262 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
263 vwindow_meter = defaults->get("VWINDOW_METER", 1);
266 decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
267 subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
268 label_cells = defaults->get("LABEL_CELLS", label_cells);
269 program_no = defaults->get("PROGRAM_NO", program_no);
271 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
277 int EDLSession::save_defaults(BC_Hash *defaults)
279 char string[BCTEXTLEN];
282 for(int i = 0; i < MAXCHANNELS; i++)
284 sprintf(string, "ACHANNEL_ANGLE_%d", i);
285 defaults->update(string, achannel_positions[i]);
287 defaults->update("ACHANNELS", audio_channels);
288 aconfig_in->save_defaults(defaults);
289 for(int i = 0; i < ASSET_COLUMNS; i++)
291 sprintf(string, "ASSET_COLUMN%d", i);
292 defaults->update(string, asset_columns[i]);
294 auto_conf->save_defaults(defaults);
295 defaults->update("ASSETLIST_FORMAT", assetlist_format);
296 defaults->update("ASPECTW", aspect_w);
297 defaults->update("ASPECTH", aspect_h);
298 defaults->update("ATRACKS", audio_tracks);
299 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
300 defaults->update("BRENDER_START", brender_start);
301 cmodel_to_text(string, color_model);
302 defaults->update("COLOR_MODEL", string);
303 defaults->update("EYEDROP_RADIUS", eyedrop_radius);
304 defaults->update("CROP_X1", crop_x1);
305 defaults->update("CROP_X2", crop_x2);
306 defaults->update("CROP_Y1", crop_y1);
307 defaults->update("CROP_Y2", crop_y2);
308 defaults->update("RULER_X1", ruler_x1);
309 defaults->update("RULER_X2", ruler_x2);
310 defaults->update("RULER_Y1", ruler_y1);
311 defaults->update("RULER_Y2", ruler_y2);
312 defaults->update("CURRENT_FOLDER", current_folder);
313 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
314 defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes);
315 defaults->update("CWINDOW_DEST", cwindow_dest);
316 defaults->update("CWINDOW_MASK", cwindow_mask);
317 defaults->update("CWINDOW_METER", cwindow_meter);
318 defaults->update("CWINDOW_OPERATION", cwindow_operation);
319 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
320 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
321 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
322 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
323 defaults->update("DEFAULT_ATRANSITION", default_atransition);
324 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
325 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
326 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
327 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
328 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
329 defaults->update("EDITING_MODE", editing_mode);
330 defaults->update("ENABLE_DUPLEX", enable_duplex);
331 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
332 defaults->update("FRAMERATE", frame_rate);
333 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
334 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
335 defaults->update("INTERPOLATION_TYPE", interpolation_type);
336 defaults->update("INTERPOLATE_RAW", interpolate_raw);
337 defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
338 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
339 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
340 defaults->update("SINGLE_STANDALONE", single_standalone);
341 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
342 defaults->update("METER_FORMAT", meter_format);
343 defaults->update("MIN_METER_DB", min_meter_db);
344 defaults->update("MAX_METER_DB", max_meter_db);
345 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
346 defaults->update("OUTPUTW", output_w);
347 defaults->update("OUTPUTH", output_h);
348 defaults->update("PLAYBACK_BUFFER", playback_buffer);
349 defaults->update("PLAYBACK_PRELOAD", playback_preload);
350 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
351 playback_config->save_defaults(defaults);
352 defaults->update("PLAYBACK_REALTIME", real_time_playback);
353 defaults->update("REALTIME_RECORD", real_time_record);
354 defaults->update("RECORD_POSITIONING", record_positioning);
355 defaults->update("RECORD_RAW_STREAM", record_raw_stream);
356 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
357 // defaults->update("RECORD_SPEED", record_speed);
358 defaults->update("RECORD_FRAGMENT_SIZE", record_fragment_size);
359 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
360 defaults->update("RECORD_REALTIME_TOC", record_realtime_toc);
361 recording_format->save_defaults(defaults,
368 defaults->update("SAFE_REGIONS", safe_regions);
369 defaults->update("SAMPLERATE", sample_rate);
370 defaults->update("SCRUB_SPEED", scrub_speed);
371 defaults->update("SHOW_ASSETS", show_assets);
372 defaults->update("SHOW_TITLES", show_titles);
373 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
374 defaults->update("TIME_FORMAT", time_format);
375 defaults->update("NUDGE_FORMAT", nudge_seconds);
376 defaults->update("TOOL_WINDOW", tool_window);
377 vconfig_in->save_defaults(defaults);
378 for(int i = 0; i < MAXCHANNELS; i++)
380 sprintf(string, "VCHANNEL_X_%d", i);
381 defaults->update(string, vchannel_x[i]);
382 sprintf(string, "VCHANNEL_Y_%d", i);
383 defaults->update(string, vchannel_y[i]);
385 defaults->update("VCHANNELS", video_channels);
386 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
387 defaults->update("VIDEO_ASYNCHRONOUS", video_asynchronous);
388 defaults->update("VTRACKS", video_tracks);
389 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
390 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
391 defaults->update("VWINDOW_METER", vwindow_meter);
392 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
394 defaults->update("DECODE_SUBTITLES", decode_subtitles);
395 defaults->update("SUBTITLE_NUMBER", subtitle_number);
396 defaults->update("LABEL_CELLS", label_cells);
397 defaults->update("PROGRAM_NO", program_no);
404 // GCC 3.0 fails to compile
405 #define BC_INFINITY 65536
408 void EDLSession::boundaries()
410 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
411 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
412 Workarounds::clamp(sample_rate, 1, 1000000);
413 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
414 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
415 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
416 Workarounds::clamp(min_meter_db, -80, -20);
417 Workarounds::clamp(max_meter_db, 0, 10);
418 Workarounds::clamp(frames_per_foot, 1, 32);
419 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
420 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
421 Workarounds::clamp(video_write_length, 1, 1000);
422 //printf("EDLSession::boundaries 1\n");
428 Workarounds::clamp(eyedrop_radius, 0, 255);
429 Workarounds::clamp(crop_x1, 0, output_w);
430 Workarounds::clamp(crop_x2, 0, output_w);
431 Workarounds::clamp(crop_y1, 0, output_h);
432 Workarounds::clamp(crop_y2, 0, output_h);
433 Workarounds::clamp(ruler_x1, 0.0, output_w);
434 Workarounds::clamp(ruler_x2, 0.0, output_w);
435 Workarounds::clamp(ruler_y1, 0.0, output_h);
436 Workarounds::clamp(ruler_y2, 0.0, output_h);
437 if(brender_start < 0) brender_start = 0.0;
439 Workarounds::clamp(subtitle_number, 0, 31);
441 // Correct framerates
442 frame_rate = Units::fix_framerate(frame_rate);
447 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
450 if(append_mode) return 0;
451 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
452 interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
453 white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
454 cmodel_to_text(string, color_model);
455 color_model = cmodel_from_text(file->tag.get_property("COLORMODEL", string));
456 video_channels = file->tag.get_property("CHANNELS", video_channels);
457 for(int i = 0; i < video_channels; i++)
459 int default_position = i * output_w;
460 sprintf(string, "VCHANNEL_X_%d", i);
461 vchannel_x[i] = file->tag.get_property(string, default_position);
462 sprintf(string, "VCHANNEL_Y_%d", i);
463 vchannel_y[i] = file->tag.get_property(string, 0);
466 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
467 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
468 output_w = file->tag.get_property("OUTPUTW", output_w);
469 output_h = file->tag.get_property("OUTPUTH", output_h);
470 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
471 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
475 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
478 // load channels setting
479 if(append_mode) return 0;
480 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
483 for(int i = 0; i < audio_channels; i++)
485 sprintf(string, "ACHANNEL_ANGLE_%d", i);
486 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
487 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
490 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
494 int EDLSession::load_xml(FileXML *file,
498 char string[BCTEXTLEN];
505 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
506 for(int i = 0; i < ASSET_COLUMNS; i++)
508 sprintf(string, "ASSET_COLUMN%d", i);
509 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
511 auto_conf->load_xml(file);
512 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
513 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
514 brender_start = file->tag.get_property("BRENDER_START", brender_start);
515 eyedrop_radius = file->tag.get_property("EYEDROP_RADIUS", eyedrop_radius);
516 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
517 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
518 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
519 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
520 ruler_x1 = file->tag.get_property("RULER_X1", ruler_x1);
521 ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1);
522 ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2);
523 ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2);
524 file->tag.get_property("CURRENT_FOLDER", current_folder);
525 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
526 typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes);
527 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
528 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
529 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
530 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
531 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
532 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
533 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
534 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
535 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
536 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
537 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
538 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
539 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
540 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
541 single_standalone = file->tag.get_property("SINGLE_STANDALONE", single_standalone);
542 playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload);
543 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
544 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
545 show_titles = file->tag.get_property("SHOW_TITLES", 1);
546 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
547 time_format = file->tag.get_property("TIME_FORMAT", time_format);
548 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
549 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
550 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
551 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
553 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
554 subtitle_number = file->tag.get_property("SUBTITLE_NUMBER", subtitle_number);
555 label_cells = file->tag.get_property("LABEL_CELLS", label_cells);
556 program_no = file->tag.get_property("PROGRAM_NO", program_no);
563 int EDLSession::save_xml(FileXML *file)
565 //printf("EDLSession::save_session 1\n");
566 char string[BCTEXTLEN];
567 file->tag.set_title("SESSION");
568 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
569 for(int i = 0; i < ASSET_COLUMNS; i++)
571 sprintf(string, "ASSET_COLUMN%d", i);
572 file->tag.set_property(string, asset_columns[i]);
574 auto_conf->save_xml(file);
575 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
576 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
577 file->tag.set_property("BRENDER_START", brender_start);
578 file->tag.set_property("EYEDROP_RADIUS", eyedrop_radius);
579 file->tag.set_property("CROP_X1", crop_x1);
580 file->tag.set_property("CROP_Y1", crop_y1);
581 file->tag.set_property("CROP_X2", crop_x2);
582 file->tag.set_property("CROP_Y2", crop_y2);
583 file->tag.set_property("RULER_X1", ruler_x1);
584 file->tag.set_property("RULER_Y1", ruler_y1);
585 file->tag.set_property("RULER_X2", ruler_x2);
586 file->tag.set_property("RULER_Y2", ruler_y2);
587 file->tag.set_property("CURRENT_FOLDER", current_folder);
588 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
589 file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes);
590 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
591 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
592 file->tag.set_property("CWINDOW_METER", cwindow_meter);
593 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
594 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
595 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
596 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
597 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
598 file->tag.set_property("EDITING_MODE", editing_mode);
599 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
600 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
601 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
602 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
603 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
604 file->tag.set_property("SINGLE_STANDALONE", single_standalone);
605 file->tag.set_property("PLAYBACK_PRELOAD", playback_preload);
606 file->tag.set_property("SAFE_REGIONS", safe_regions);
607 file->tag.set_property("SHOW_ASSETS", show_assets);
608 file->tag.set_property("SHOW_TITLES", show_titles);
609 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
610 file->tag.set_property("TIME_FORMAT", time_format);
611 file->tag.set_property("NUDGE_FORMAT", nudge_seconds);
612 file->tag.set_property("TOOL_WINDOW", tool_window);
613 file->tag.set_property("VWINDOW_METER", vwindow_meter);
614 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
617 file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
618 file->tag.set_property("SUBTITLE_NUMBER", subtitle_number);
623 file->append_newline();
624 file->append_newline();
625 //printf("EDLSession::save_session 3\n");
629 int EDLSession::save_video_config(FileXML *file)
632 file->tag.set_title("VIDEO");
633 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
634 file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
635 file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
636 cmodel_to_text(string, color_model);
637 file->tag.set_property("COLORMODEL", string);
638 file->tag.set_property("CHANNELS", video_channels);
639 for(int i = 0; i < video_channels; i++)
641 sprintf(string, "VCHANNEL_X_%d", i);
642 file->tag.set_property(string, vchannel_x[i]);
643 sprintf(string, "VCHANNEL_Y_%d", i);
644 file->tag.set_property(string, vchannel_y[i]);
647 file->tag.set_property("FRAMERATE", frame_rate);
648 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
649 file->tag.set_property("OUTPUTW", output_w);
650 file->tag.set_property("OUTPUTH", output_h);
651 file->tag.set_property("ASPECTW", aspect_w);
652 file->tag.set_property("ASPECTH", aspect_h);
654 file->append_newline();
655 file->append_newline();
659 int EDLSession::save_audio_config(FileXML *file)
662 file->tag.set_title("AUDIO");
663 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
664 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
666 for(int i = 0; i < audio_channels; i++)
668 sprintf(string, "ACHANNEL_ANGLE_%d", i);
669 file->tag.set_property(string, achannel_positions[i]);
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_in->copy_from(session->aconfig_in);
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 eyedrop_radius = session->eyedrop_radius;
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 ruler_x1 = session->ruler_x1;
705 ruler_y1 = session->ruler_y1;
706 ruler_x2 = session->ruler_x2;
707 ruler_y2 = session->ruler_y2;
708 strcpy(current_folder, session->current_folder);
709 cursor_on_frames = session->cursor_on_frames;
710 typeless_keyframes = session->typeless_keyframes;
711 cwindow_dest = session->cwindow_dest;
712 cwindow_mask = session->cwindow_mask;
713 cwindow_meter = session->cwindow_meter;
714 cwindow_operation = session->cwindow_operation;
715 cwindow_scrollbars = session->cwindow_scrollbars;
716 cwindow_xscroll = session->cwindow_xscroll;
717 cwindow_yscroll = session->cwindow_yscroll;
718 cwindow_zoom = session->cwindow_zoom;
719 strcpy(default_atransition, session->default_atransition);
720 strcpy(default_vtransition, session->default_vtransition);
721 default_transition_length = session->default_transition_length;
722 edit_handle_mode[0] = session->edit_handle_mode[0];
723 edit_handle_mode[1] = session->edit_handle_mode[1];
724 edit_handle_mode[2] = session->edit_handle_mode[2];
725 editing_mode = session->editing_mode;
726 enable_duplex = session->enable_duplex;
727 folderlist_format = session->folderlist_format;
728 frame_rate = session->frame_rate;
729 frames_per_foot = session->frames_per_foot;
730 highlighted_track = session->highlighted_track;
731 interpolation_type = session->interpolation_type;
732 interpolate_raw = session->interpolate_raw;
733 white_balance_raw = session->white_balance_raw;
734 labels_follow_edits = session->labels_follow_edits;
735 plugins_follow_edits = session->plugins_follow_edits;
736 single_standalone = session->single_standalone;
737 auto_keyframes = session->auto_keyframes;
738 // last_playback_position = session->last_playback_position;
739 meter_format = session->meter_format;
740 min_meter_db = session->min_meter_db;
741 max_meter_db = session->max_meter_db;
742 mpeg4_deblock = session->mpeg4_deblock;
743 output_w = session->output_w;
744 output_h = session->output_h;
745 playback_buffer = session->playback_buffer;
746 delete playback_config;
747 playback_config = new PlaybackConfig;
748 playback_config->copy_from(session->playback_config);
749 playback_cursor_visible = session->playback_cursor_visible;
750 playback_preload = session->playback_preload;
751 playback_software_position = session->playback_software_position;
752 real_time_playback = session->real_time_playback;
753 real_time_record = session->real_time_record;
754 record_positioning = session->record_positioning;
755 record_raw_stream = session->record_raw_stream;
756 record_speed = session->record_speed;
757 record_sync_drives = session->record_sync_drives;
758 record_fragment_size = session->record_fragment_size;
759 record_write_length = session->record_write_length;
760 record_realtime_toc = session->record_realtime_toc;
761 recording_format->copy_from(session->recording_format, 0);
762 safe_regions = session->safe_regions;
763 sample_rate = session->sample_rate;
764 scrub_speed = session->scrub_speed;
765 show_assets = session->show_assets;
766 show_titles = session->show_titles;
767 test_playback_edits = session->test_playback_edits;
768 time_format = session->time_format;
769 nudge_seconds = session->nudge_seconds;
770 tool_window = session->tool_window;
771 for(int i = 0; i < MAXCHANNELS; i++)
773 vchannel_x[i] = session->vchannel_x[i];
774 vchannel_y[i] = session->vchannel_y[i];
776 video_channels = session->video_channels;
777 *vconfig_in = *session->vconfig_in;
778 video_every_frame = session->video_every_frame;
779 video_asynchronous = session->video_asynchronous;
780 video_tracks = session->video_tracks;
781 video_write_length = session->video_write_length;
782 view_follows_playback = session->view_follows_playback;
783 vwindow_meter = session->vwindow_meter;
784 vwindow_zoom = session->vwindow_zoom;
786 subtitle_number = session->subtitle_number;
787 decode_subtitles = session->decode_subtitles;
788 label_cells = session->label_cells;
789 program_no = session->program_no;
795 void EDLSession::dump()
797 printf("EDLSession::dump\n");
798 printf(" audio_tracks=%d audio_channels=%d sample_rate=" _LD "\n"
799 " video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n"
800 " decode subtitles=%d subtitle_number=%d label_cells=%d program_no=%d\n",
801 audio_tracks, audio_channels, sample_rate, video_tracks,
802 frame_rate, output_w, output_h, aspect_w, aspect_h,
803 decode_subtitles, subtitle_number, label_cells, program_no);