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 "bccmodels.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 (interpolation_type != ptr->interpolation_type) ||
99 (video_every_frame != ptr->video_every_frame) ||
100 (video_asynchronous != ptr->video_asynchronous) ||
101 (real_time_playback != ptr->real_time_playback) ||
102 (playback_software_position != ptr->playback_software_position) ||
103 (test_playback_edits != ptr->test_playback_edits) ||
104 (playback_buffer != ptr->playback_buffer) ||
105 (decode_subtitles != ptr->decode_subtitles) ||
106 (subtitle_number != ptr->subtitle_number) ||
107 (interpolate_raw != ptr->interpolate_raw) ||
108 (white_balance_raw != ptr->white_balance_raw);
111 void EDLSession::equivalent_output(EDLSession *session, double *result)
113 if(session->output_w != output_w ||
114 session->output_h != output_h ||
115 session->frame_rate != frame_rate ||
116 session->color_model != color_model ||
117 session->interpolation_type != interpolation_type ||
118 session->interpolate_raw != interpolate_raw ||
119 session->white_balance_raw != white_balance_raw ||
120 session->mpeg4_deblock != mpeg4_deblock ||
121 session->decode_subtitles != decode_subtitles ||
122 session->subtitle_number != subtitle_number)
125 // If it's before the current brender_start, render extra data.
126 // If it's after brender_start, check brender map.
127 if(brender_start != session->brender_start &&
128 (*result < 0 || *result > brender_start))
129 *result = brender_start;
133 int EDLSession::load_defaults(BC_Hash *defaults)
135 char string[BCTEXTLEN];
137 // Default channel positions
138 for(int i = 0; i < MAXCHANNELS; i++)
140 sprintf(string, "ACHANNEL_ANGLE_%d", i);
141 int default_position = i * 30;
143 if(i == 0) default_position = 180;
145 if(i == 1) default_position = 0;
147 if(default_position == 90) default_position = 300;
149 if(default_position == 0) default_position = 330;
151 achannel_positions[i] = defaults->get(string, default_position);
153 aconfig_in->load_defaults(defaults);
154 assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
155 aspect_w = defaults->get("ASPECTW", (float)4);
156 aspect_h = defaults->get("ASPECTH", (float)3);
157 for(int i = 0; i < ASSET_COLUMNS; i++)
159 sprintf(string, "ASSET_COLUMN%d", i);
160 asset_columns[i] = defaults->get(string, 100);
162 audio_channels = defaults->get("ACHANNELS", 2);
163 audio_tracks = defaults->get("ATRACKS", 2);
164 auto_conf->load_defaults(defaults);
165 autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
166 brender_start = defaults->get("BRENDER_START", brender_start);
167 BC_CModels::to_text(string, BC_RGBA8888);
168 color_model = BC_CModels::from_text(defaults->get("COLOR_MODEL", string));
169 eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0);
170 crop_x1 = defaults->get("CROP_X1", 0);
171 crop_x2 = defaults->get("CROP_X2", 320);
172 crop_y1 = defaults->get("CROP_Y1", 0);
173 crop_y2 = defaults->get("CROP_Y2", 240);
174 ruler_x1 = defaults->get("RULER_X1", 0.0);
175 ruler_x2 = defaults->get("RULER_X2", 0.0);
176 ruler_y1 = defaults->get("RULER_Y1", 0.0);
177 ruler_y2 = defaults->get("RULER_Y2", 0.0);
178 sprintf(current_folder, MEDIA_FOLDER);
179 defaults->get("CURRENT_FOLDER", current_folder);
180 cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 0);
181 typeless_keyframes = defaults->get("TYPELESS_KEYFRAMES", 0);
182 cwindow_dest = defaults->get("CWINDOW_DEST", 0);
183 cwindow_mask = defaults->get("CWINDOW_MASK", 0);
184 cwindow_meter = defaults->get("CWINDOW_METER", 1);
185 cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
186 cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 1);
187 cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
188 cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
189 cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
190 sprintf(default_atransition, "Crossfade");
191 defaults->get("DEFAULT_ATRANSITION", default_atransition);
192 sprintf(default_vtransition, "Dissolve");
193 defaults->get("DEFAULT_VTRANSITION", default_vtransition);
194 default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
195 edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
196 edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ONE_EDIT);
197 edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_NO_EDITS);
198 editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM);
199 enable_duplex = defaults->get("ENABLE_DUPLEX", 1);
200 folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_ICONS);
201 frame_rate = defaults->get("FRAMERATE", (double)30000.0/1001);
202 frames_per_foot = defaults->get("FRAMES_PER_FOOT", (float)16);
203 interpolation_type = defaults->get("INTERPOLATION_TYPE", interpolation_type);
204 interpolate_raw = defaults->get("INTERPOLATE_RAW", interpolate_raw);
205 white_balance_raw = defaults->get("WHITE_BALANCE_RAW", white_balance_raw);
206 labels_follow_edits = defaults->get("LABELS_FOLLOW_EDITS", 1);
207 plugins_follow_edits = defaults->get("PLUGINS_FOLLOW_EDITS", 1);
208 single_standalone = defaults->get("SINGLE_STANDALONE", 1);
209 auto_keyframes = defaults->get("AUTO_KEYFRAMES", 0);
210 meter_format = defaults->get("METER_FORMAT", METER_DB);
211 min_meter_db = defaults->get("MIN_METER_DB", -85);
212 max_meter_db = defaults->get("MAX_METER_DB", 6);
213 mpeg4_deblock = defaults->get("MPEG4_DEBLOCK", mpeg4_deblock);
214 output_w = defaults->get("OUTPUTW", 720);
215 output_h = defaults->get("OUTPUTH", 480);
216 playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096);
217 playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0);
218 delete playback_config;
219 playback_config = new PlaybackConfig;
220 playback_config->load_defaults(defaults);
221 real_time_playback = defaults->get("PLAYBACK_REALTIME", 0);
222 real_time_record = defaults->get("REALTIME_RECORD", 0);
223 record_positioning = defaults->get("RECORD_POSITIONING", 1);
224 record_raw_stream = defaults->get("RECORD_RAW_STREAM", 0);
225 record_sync_drives = defaults->get("RECORD_SYNC_DRIVES", 0);
226 // record_speed = defaults->get("RECORD_SPEED", 24);
227 record_fragment_size = defaults->get("RECORD_FRAGMENT_SIZE", 2048);
228 record_write_length = defaults->get("RECORD_WRITE_LENGTH", 131072);
229 record_realtime_toc = defaults->get("RECORD_REALTIME_TOC", 1);
230 recording_format->load_defaults(defaults,
237 safe_regions = defaults->get("SAFE_REGIONS", 1);
238 sample_rate = defaults->get("SAMPLERATE", 48000);
239 scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
240 show_assets = defaults->get("SHOW_ASSETS", 1);
241 show_titles = defaults->get("SHOW_TITLES", 1);
242 // test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
243 time_format = defaults->get("TIME_FORMAT", TIME_HMS);
244 nudge_seconds = defaults->get("NUDGE_FORMAT", 1);
245 tool_window = defaults->get("TOOL_WINDOW", 0);
246 vconfig_in->load_defaults(defaults);
247 for(int i = 0; i < MAXCHANNELS; i++)
249 int default_position = i * output_w;
250 sprintf(string, "VCHANNEL_X_%d", i);
251 vchannel_x[i] = defaults->get(string, default_position);
252 sprintf(string, "VCHANNEL_Y_%d", i);
253 vchannel_y[i] = defaults->get(string, 0);
255 video_channels = defaults->get("VCHANNELS", 1);
256 video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 1);
257 video_asynchronous = defaults->get("VIDEO_ASYNCHRONOUS", 0);
258 video_tracks = defaults->get("VTRACKS", 1);
259 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
260 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
261 vwindow_meter = defaults->get("VWINDOW_METER", 1);
264 decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
265 subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
266 label_cells = defaults->get("LABEL_CELLS", label_cells);
267 program_no = defaults->get("PROGRAM_NO", program_no);
269 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
275 int EDLSession::save_defaults(BC_Hash *defaults)
277 char string[BCTEXTLEN];
280 for(int i = 0; i < MAXCHANNELS; i++)
282 sprintf(string, "ACHANNEL_ANGLE_%d", i);
283 defaults->update(string, achannel_positions[i]);
285 defaults->update("ACHANNELS", audio_channels);
286 aconfig_in->save_defaults(defaults);
287 for(int i = 0; i < ASSET_COLUMNS; i++)
289 sprintf(string, "ASSET_COLUMN%d", i);
290 defaults->update(string, asset_columns[i]);
292 auto_conf->save_defaults(defaults);
293 defaults->update("ASSETLIST_FORMAT", assetlist_format);
294 defaults->update("ASPECTW", aspect_w);
295 defaults->update("ASPECTH", aspect_h);
296 defaults->update("ATRACKS", audio_tracks);
297 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
298 defaults->update("BRENDER_START", brender_start);
299 BC_CModels::to_text(string, color_model);
300 defaults->update("COLOR_MODEL", string);
301 defaults->update("EYEDROP_RADIUS", eyedrop_radius);
302 defaults->update("CROP_X1", crop_x1);
303 defaults->update("CROP_X2", crop_x2);
304 defaults->update("CROP_Y1", crop_y1);
305 defaults->update("CROP_Y2", crop_y2);
306 defaults->update("RULER_X1", ruler_x1);
307 defaults->update("RULER_X2", ruler_x2);
308 defaults->update("RULER_Y1", ruler_y1);
309 defaults->update("RULER_Y2", ruler_y2);
310 defaults->update("CURRENT_FOLDER", current_folder);
311 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
312 defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes);
313 defaults->update("CWINDOW_DEST", cwindow_dest);
314 defaults->update("CWINDOW_MASK", cwindow_mask);
315 defaults->update("CWINDOW_METER", cwindow_meter);
316 defaults->update("CWINDOW_OPERATION", cwindow_operation);
317 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
318 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
319 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
320 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
321 defaults->update("DEFAULT_ATRANSITION", default_atransition);
322 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
323 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
324 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
325 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
326 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
327 defaults->update("EDITING_MODE", editing_mode);
328 defaults->update("ENABLE_DUPLEX", enable_duplex);
329 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
330 defaults->update("FRAMERATE", frame_rate);
331 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
332 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
333 defaults->update("INTERPOLATION_TYPE", interpolation_type);
334 defaults->update("INTERPOLATE_RAW", interpolate_raw);
335 defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
336 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
337 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
338 defaults->update("SINGLE_STANDALONE", single_standalone);
339 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
340 defaults->update("METER_FORMAT", meter_format);
341 defaults->update("MIN_METER_DB", min_meter_db);
342 defaults->update("MAX_METER_DB", max_meter_db);
343 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
344 defaults->update("OUTPUTW", output_w);
345 defaults->update("OUTPUTH", output_h);
346 defaults->update("PLAYBACK_BUFFER", playback_buffer);
347 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
348 playback_config->save_defaults(defaults);
349 defaults->update("PLAYBACK_REALTIME", real_time_playback);
350 defaults->update("REALTIME_RECORD", real_time_record);
351 defaults->update("RECORD_POSITIONING", record_positioning);
352 defaults->update("RECORD_RAW_STREAM", record_raw_stream);
353 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
354 // defaults->update("RECORD_SPEED", record_speed);
355 defaults->update("RECORD_FRAGMENT_SIZE", record_fragment_size);
356 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
357 defaults->update("RECORD_REALTIME_TOC", record_realtime_toc);
358 recording_format->save_defaults(defaults,
365 defaults->update("SAFE_REGIONS", safe_regions);
366 defaults->update("SAMPLERATE", sample_rate);
367 defaults->update("SCRUB_SPEED", scrub_speed);
368 defaults->update("SHOW_ASSETS", show_assets);
369 defaults->update("SHOW_TITLES", show_titles);
370 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
371 defaults->update("TIME_FORMAT", time_format);
372 defaults->update("NUDGE_FORMAT", nudge_seconds);
373 defaults->update("TOOL_WINDOW", tool_window);
374 vconfig_in->save_defaults(defaults);
375 for(int i = 0; i < MAXCHANNELS; i++)
377 sprintf(string, "VCHANNEL_X_%d", i);
378 defaults->update(string, vchannel_x[i]);
379 sprintf(string, "VCHANNEL_Y_%d", i);
380 defaults->update(string, vchannel_y[i]);
382 defaults->update("VCHANNELS", video_channels);
383 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
384 defaults->update("VIDEO_ASYNCHRONOUS", video_asynchronous);
385 defaults->update("VTRACKS", video_tracks);
386 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
387 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
388 defaults->update("VWINDOW_METER", vwindow_meter);
389 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
391 defaults->update("DECODE_SUBTITLES", decode_subtitles);
392 defaults->update("SUBTITLE_NUMBER", subtitle_number);
393 defaults->update("LABEL_CELLS", label_cells);
394 defaults->update("PROGRAM_NO", program_no);
401 // GCC 3.0 fails to compile
402 #define BC_INFINITY 65536
405 void EDLSession::boundaries()
407 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
408 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
409 Workarounds::clamp(sample_rate, 1, 1000000);
410 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
411 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
412 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
413 Workarounds::clamp(min_meter_db, -80, -20);
414 Workarounds::clamp(max_meter_db, 0, 10);
415 Workarounds::clamp(frames_per_foot, 1, 32);
416 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
417 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
418 Workarounds::clamp(video_write_length, 1, 1000);
419 //printf("EDLSession::boundaries 1\n");
425 Workarounds::clamp(eyedrop_radius, 0, 255);
426 Workarounds::clamp(crop_x1, 0, output_w);
427 Workarounds::clamp(crop_x2, 0, output_w);
428 Workarounds::clamp(crop_y1, 0, output_h);
429 Workarounds::clamp(crop_y2, 0, output_h);
430 Workarounds::clamp(ruler_x1, 0.0, output_w);
431 Workarounds::clamp(ruler_x2, 0.0, output_w);
432 Workarounds::clamp(ruler_y1, 0.0, output_h);
433 Workarounds::clamp(ruler_y2, 0.0, output_h);
434 if(brender_start < 0) brender_start = 0.0;
436 Workarounds::clamp(subtitle_number, 0, 31);
438 // Correct framerates
439 frame_rate = Units::fix_framerate(frame_rate);
444 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
447 if(append_mode) return 0;
448 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
449 interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
450 white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
451 BC_CModels::to_text(string, color_model);
452 color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string));
453 video_channels = file->tag.get_property("CHANNELS", video_channels);
454 for(int i = 0; i < video_channels; i++)
456 int default_position = i * output_w;
457 sprintf(string, "VCHANNEL_X_%d", i);
458 vchannel_x[i] = file->tag.get_property(string, default_position);
459 sprintf(string, "VCHANNEL_Y_%d", i);
460 vchannel_y[i] = file->tag.get_property(string, 0);
463 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
464 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
465 output_w = file->tag.get_property("OUTPUTW", output_w);
466 output_h = file->tag.get_property("OUTPUTH", output_h);
467 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
468 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
472 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
475 // load channels setting
476 if(append_mode) return 0;
477 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
480 for(int i = 0; i < audio_channels; i++)
482 sprintf(string, "ACHANNEL_ANGLE_%d", i);
483 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
484 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
487 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
491 int EDLSession::load_xml(FileXML *file,
495 char string[BCTEXTLEN];
502 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
503 for(int i = 0; i < ASSET_COLUMNS; i++)
505 sprintf(string, "ASSET_COLUMN%d", i);
506 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
508 auto_conf->load_xml(file);
509 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
510 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
511 brender_start = file->tag.get_property("BRENDER_START", brender_start);
512 eyedrop_radius = file->tag.get_property("EYEDROP_RADIUS", eyedrop_radius);
513 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
514 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
515 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
516 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
517 ruler_x1 = file->tag.get_property("RULER_X1", ruler_x1);
518 ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1);
519 ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2);
520 ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2);
521 file->tag.get_property("CURRENT_FOLDER", current_folder);
522 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
523 typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes);
524 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
525 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
526 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
527 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
528 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
529 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
530 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
531 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
532 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
533 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
534 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
535 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
536 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
537 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
538 single_standalone = file->tag.get_property("SINGLE_STANDALONE", single_standalone);
539 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
540 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
541 show_titles = file->tag.get_property("SHOW_TITLES", 1);
542 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
543 time_format = file->tag.get_property("TIME_FORMAT", time_format);
544 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
545 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
546 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
547 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
549 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
550 subtitle_number = file->tag.get_property("SUBTITLE_NUMBER", subtitle_number);
551 label_cells = file->tag.get_property("LABEL_CELLS", label_cells);
552 program_no = file->tag.get_property("PROGRAM_NO", program_no);
559 int EDLSession::save_xml(FileXML *file)
561 //printf("EDLSession::save_session 1\n");
562 char string[BCTEXTLEN];
563 file->tag.set_title("SESSION");
564 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
565 for(int i = 0; i < ASSET_COLUMNS; i++)
567 sprintf(string, "ASSET_COLUMN%d", i);
568 file->tag.set_property(string, asset_columns[i]);
570 auto_conf->save_xml(file);
571 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
572 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
573 file->tag.set_property("BRENDER_START", brender_start);
574 file->tag.set_property("EYEDROP_RADIUS", eyedrop_radius);
575 file->tag.set_property("CROP_X1", crop_x1);
576 file->tag.set_property("CROP_Y1", crop_y1);
577 file->tag.set_property("CROP_X2", crop_x2);
578 file->tag.set_property("CROP_Y2", crop_y2);
579 file->tag.set_property("RULER_X1", ruler_x1);
580 file->tag.set_property("RULER_Y1", ruler_y1);
581 file->tag.set_property("RULER_X2", ruler_x2);
582 file->tag.set_property("RULER_Y2", ruler_y2);
583 file->tag.set_property("CURRENT_FOLDER", current_folder);
584 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
585 file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes);
586 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
587 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
588 file->tag.set_property("CWINDOW_METER", cwindow_meter);
589 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
590 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
591 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
592 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
593 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
594 file->tag.set_property("EDITING_MODE", editing_mode);
595 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
596 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
597 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
598 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
599 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
600 file->tag.set_property("SINGLE_STANDALONE", single_standalone);
601 file->tag.set_property("SAFE_REGIONS", safe_regions);
602 file->tag.set_property("SHOW_ASSETS", show_assets);
603 file->tag.set_property("SHOW_TITLES", show_titles);
604 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
605 file->tag.set_property("TIME_FORMAT", time_format);
606 file->tag.set_property("NUDGE_FORMAT", nudge_seconds);
607 file->tag.set_property("TOOL_WINDOW", tool_window);
608 file->tag.set_property("VWINDOW_METER", vwindow_meter);
609 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
612 file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
613 file->tag.set_property("SUBTITLE_NUMBER", subtitle_number);
618 file->append_newline();
619 file->append_newline();
620 //printf("EDLSession::save_session 3\n");
624 int EDLSession::save_video_config(FileXML *file)
627 file->tag.set_title("VIDEO");
628 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
629 file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
630 file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
631 BC_CModels::to_text(string, color_model);
632 file->tag.set_property("COLORMODEL", string);
633 file->tag.set_property("CHANNELS", video_channels);
634 for(int i = 0; i < video_channels; i++)
636 sprintf(string, "VCHANNEL_X_%d", i);
637 file->tag.set_property(string, vchannel_x[i]);
638 sprintf(string, "VCHANNEL_Y_%d", i);
639 file->tag.set_property(string, vchannel_y[i]);
642 file->tag.set_property("FRAMERATE", frame_rate);
643 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
644 file->tag.set_property("OUTPUTW", output_w);
645 file->tag.set_property("OUTPUTH", output_h);
646 file->tag.set_property("ASPECTW", aspect_w);
647 file->tag.set_property("ASPECTH", aspect_h);
649 file->append_newline();
650 file->append_newline();
654 int EDLSession::save_audio_config(FileXML *file)
657 file->tag.set_title("AUDIO");
658 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
659 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
661 for(int i = 0; i < audio_channels; i++)
663 sprintf(string, "ACHANNEL_ANGLE_%d", i);
664 file->tag.set_property(string, achannel_positions[i]);
668 file->append_newline();
669 file->append_newline();
673 int EDLSession::copy(EDLSession *session)
675 // Audio channel positions
676 for(int i = 0; i < MAXCHANNELS; i++)
678 achannel_positions[i] = session->achannel_positions[i];
680 aconfig_in->copy_from(session->aconfig_in);
681 for(int i = 0; i < ASSET_COLUMNS; i++)
683 asset_columns[i] = session->asset_columns[i];
685 assetlist_format = session->assetlist_format;
686 auto_conf->copy_from(session->auto_conf);
687 aspect_w = session->aspect_w;
688 aspect_h = session->aspect_h;
689 audio_channels = session->audio_channels;
690 audio_tracks = session->audio_tracks;
691 autos_follow_edits = session->autos_follow_edits;
692 brender_start = session->brender_start;
693 color_model = session->color_model;
694 eyedrop_radius = session->eyedrop_radius;
695 crop_x1 = session->crop_x1;
696 crop_y1 = session->crop_y1;
697 crop_x2 = session->crop_x2;
698 crop_y2 = session->crop_y2;
699 ruler_x1 = session->ruler_x1;
700 ruler_y1 = session->ruler_y1;
701 ruler_x2 = session->ruler_x2;
702 ruler_y2 = session->ruler_y2;
703 strcpy(current_folder, session->current_folder);
704 cursor_on_frames = session->cursor_on_frames;
705 typeless_keyframes = session->typeless_keyframes;
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 single_standalone = session->single_standalone;
732 auto_keyframes = session->auto_keyframes;
733 // last_playback_position = session->last_playback_position;
734 meter_format = session->meter_format;
735 min_meter_db = session->min_meter_db;
736 max_meter_db = session->max_meter_db;
737 mpeg4_deblock = session->mpeg4_deblock;
738 output_w = session->output_w;
739 output_h = session->output_h;
740 playback_buffer = session->playback_buffer;
741 delete playback_config;
742 playback_config = new PlaybackConfig;
743 playback_config->copy_from(session->playback_config);
744 playback_cursor_visible = session->playback_cursor_visible;
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_positioning = session->record_positioning;
749 record_raw_stream = session->record_raw_stream;
750 record_speed = session->record_speed;
751 record_sync_drives = session->record_sync_drives;
752 record_fragment_size = session->record_fragment_size;
753 record_write_length = session->record_write_length;
754 record_realtime_toc = session->record_realtime_toc;
755 recording_format->copy_from(session->recording_format, 0);
756 safe_regions = session->safe_regions;
757 sample_rate = session->sample_rate;
758 scrub_speed = session->scrub_speed;
759 show_assets = session->show_assets;
760 show_titles = session->show_titles;
761 test_playback_edits = session->test_playback_edits;
762 time_format = session->time_format;
763 nudge_seconds = session->nudge_seconds;
764 tool_window = session->tool_window;
765 for(int i = 0; i < MAXCHANNELS; i++)
767 vchannel_x[i] = session->vchannel_x[i];
768 vchannel_y[i] = session->vchannel_y[i];
770 video_channels = session->video_channels;
771 *vconfig_in = *session->vconfig_in;
772 video_every_frame = session->video_every_frame;
773 video_asynchronous = session->video_asynchronous;
774 video_tracks = session->video_tracks;
775 video_write_length = session->video_write_length;
776 view_follows_playback = session->view_follows_playback;
777 vwindow_meter = session->vwindow_meter;
778 vwindow_zoom = session->vwindow_zoom;
780 subtitle_number = session->subtitle_number;
781 decode_subtitles = session->decode_subtitles;
782 label_cells = session->label_cells;
783 program_no = session->program_no;
789 void EDLSession::dump()
791 printf("EDLSession::dump\n");
792 printf(" audio_tracks=%d audio_channels=%d sample_rate=" _LD "\n"
793 " video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n"
794 " decode subtitles=%d subtitle_number=%d label_cells=%d program_no=%d\n",
795 audio_tracks, audio_channels, sample_rate, video_tracks,
796 frame_rate, output_w, output_h, aspect_w, aspect_h,
797 decode_subtitles, subtitle_number, label_cells, program_no);