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_CUBIC;
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 = FOLDERS_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", 0);
185 cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
186 cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 0);
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);
230 // set some defaults that work
231 recording_format->video_data = 1;
232 recording_format->audio_data = 1;
233 recording_format->format = FILE_FFMPEG;
234 strcpy(recording_format->acodec, "mp4.qt");
235 strcpy(recording_format->vcodec, "mp4.qt");
236 recording_format->channels = 2;
237 recording_format->sample_rate = 48000;
238 recording_format->bits = 16;
239 recording_format->dither = 0;
241 record_realtime_toc = defaults->get("RECORD_REALTIME_TOC", 1);
242 recording_format->load_defaults(defaults, "RECORD_", 1, 1, 1, 1, 1);
244 safe_regions = defaults->get("SAFE_REGIONS", 0);
245 sample_rate = defaults->get("SAMPLERATE", 48000);
246 scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
247 show_assets = defaults->get("SHOW_ASSETS", 1);
248 show_titles = defaults->get("SHOW_TITLES", 1);
249 // test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
250 time_format = defaults->get("TIME_FORMAT", TIME_HMS);
251 nudge_seconds = defaults->get("NUDGE_FORMAT", 1);
252 tool_window = defaults->get("TOOL_WINDOW", 0);
253 vconfig_in->load_defaults(defaults);
254 for(int i = 0; i < MAXCHANNELS; i++)
256 int default_position = i * output_w;
257 sprintf(string, "VCHANNEL_X_%d", i);
258 vchannel_x[i] = defaults->get(string, default_position);
259 sprintf(string, "VCHANNEL_Y_%d", i);
260 vchannel_y[i] = defaults->get(string, 0);
262 video_channels = defaults->get("VCHANNELS", 1);
263 video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 1);
264 video_asynchronous = defaults->get("VIDEO_ASYNCHRONOUS", 0);
265 video_tracks = defaults->get("VTRACKS", 1);
266 video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
267 view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
268 vwindow_meter = defaults->get("VWINDOW_METER", 0);
271 decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
272 subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
273 label_cells = defaults->get("LABEL_CELLS", label_cells);
274 program_no = defaults->get("PROGRAM_NO", program_no);
276 vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
282 int EDLSession::save_defaults(BC_Hash *defaults)
284 char string[BCTEXTLEN];
287 for(int i = 0; i < MAXCHANNELS; i++)
289 sprintf(string, "ACHANNEL_ANGLE_%d", i);
290 defaults->update(string, achannel_positions[i]);
292 defaults->update("ACHANNELS", audio_channels);
293 aconfig_in->save_defaults(defaults);
294 for(int i = 0; i < ASSET_COLUMNS; i++)
296 sprintf(string, "ASSET_COLUMN%d", i);
297 defaults->update(string, asset_columns[i]);
299 auto_conf->save_defaults(defaults);
300 defaults->update("ASSETLIST_FORMAT", assetlist_format);
301 defaults->update("ASPECTW", aspect_w);
302 defaults->update("ASPECTH", aspect_h);
303 defaults->update("ATRACKS", audio_tracks);
304 defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
305 defaults->update("BRENDER_START", brender_start);
306 BC_CModels::to_text(string, color_model);
307 defaults->update("COLOR_MODEL", string);
308 defaults->update("EYEDROP_RADIUS", eyedrop_radius);
309 defaults->update("CROP_X1", crop_x1);
310 defaults->update("CROP_X2", crop_x2);
311 defaults->update("CROP_Y1", crop_y1);
312 defaults->update("CROP_Y2", crop_y2);
313 defaults->update("RULER_X1", ruler_x1);
314 defaults->update("RULER_X2", ruler_x2);
315 defaults->update("RULER_Y1", ruler_y1);
316 defaults->update("RULER_Y2", ruler_y2);
317 defaults->update("CURRENT_FOLDER", current_folder);
318 defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
319 defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes);
320 defaults->update("CWINDOW_DEST", cwindow_dest);
321 defaults->update("CWINDOW_MASK", cwindow_mask);
322 defaults->update("CWINDOW_METER", cwindow_meter);
323 defaults->update("CWINDOW_OPERATION", cwindow_operation);
324 defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
325 defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
326 defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
327 defaults->update("CWINDOW_ZOOM", cwindow_zoom);
328 defaults->update("DEFAULT_ATRANSITION", default_atransition);
329 defaults->update("DEFAULT_VTRANSITION", default_vtransition);
330 defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
331 defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
332 defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
333 defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
334 defaults->update("EDITING_MODE", editing_mode);
335 defaults->update("ENABLE_DUPLEX", enable_duplex);
336 defaults->update("FOLDERLIST_FORMAT", folderlist_format);
337 defaults->update("FRAMERATE", frame_rate);
338 defaults->update("FRAMES_PER_FOOT", frames_per_foot);
339 defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
340 defaults->update("INTERPOLATION_TYPE", interpolation_type);
341 defaults->update("INTERPOLATE_RAW", interpolate_raw);
342 defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
343 defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
344 defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
345 defaults->update("SINGLE_STANDALONE", single_standalone);
346 defaults->update("AUTO_KEYFRAMES", auto_keyframes);
347 defaults->update("METER_FORMAT", meter_format);
348 defaults->update("MIN_METER_DB", min_meter_db);
349 defaults->update("MAX_METER_DB", max_meter_db);
350 defaults->update("MPEG4_DEBLOCK", mpeg4_deblock);
351 defaults->update("OUTPUTW", output_w);
352 defaults->update("OUTPUTH", output_h);
353 defaults->update("PLAYBACK_BUFFER", playback_buffer);
354 defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
355 playback_config->save_defaults(defaults);
356 defaults->update("PLAYBACK_REALTIME", real_time_playback);
357 defaults->update("REALTIME_RECORD", real_time_record);
358 defaults->update("RECORD_POSITIONING", record_positioning);
359 defaults->update("RECORD_RAW_STREAM", record_raw_stream);
360 defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
361 // defaults->update("RECORD_SPEED", record_speed);
362 defaults->update("RECORD_FRAGMENT_SIZE", record_fragment_size);
363 defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
364 defaults->update("RECORD_REALTIME_TOC", record_realtime_toc);
365 recording_format->save_defaults(defaults,
372 defaults->update("SAFE_REGIONS", safe_regions);
373 defaults->update("SAMPLERATE", sample_rate);
374 defaults->update("SCRUB_SPEED", scrub_speed);
375 defaults->update("SHOW_ASSETS", show_assets);
376 defaults->update("SHOW_TITLES", show_titles);
377 // defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
378 defaults->update("TIME_FORMAT", time_format);
379 defaults->update("NUDGE_FORMAT", nudge_seconds);
380 defaults->update("TOOL_WINDOW", tool_window);
381 vconfig_in->save_defaults(defaults);
382 for(int i = 0; i < MAXCHANNELS; i++)
384 sprintf(string, "VCHANNEL_X_%d", i);
385 defaults->update(string, vchannel_x[i]);
386 sprintf(string, "VCHANNEL_Y_%d", i);
387 defaults->update(string, vchannel_y[i]);
389 defaults->update("VCHANNELS", video_channels);
390 defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
391 defaults->update("VIDEO_ASYNCHRONOUS", video_asynchronous);
392 defaults->update("VTRACKS", video_tracks);
393 defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
394 defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
395 defaults->update("VWINDOW_METER", vwindow_meter);
396 defaults->update("VWINDOW_ZOOM", vwindow_zoom);
398 defaults->update("DECODE_SUBTITLES", decode_subtitles);
399 defaults->update("SUBTITLE_NUMBER", subtitle_number);
400 defaults->update("LABEL_CELLS", label_cells);
401 defaults->update("PROGRAM_NO", program_no);
408 // GCC 3.0 fails to compile
409 #define BC_INFINITY 65536
412 void EDLSession::boundaries()
414 Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
415 Workarounds::clamp(audio_channels, 1, MAXCHANNELS - 1);
416 Workarounds::clamp(sample_rate, 1, 1000000);
417 Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
418 Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
419 Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
420 Workarounds::clamp(min_meter_db, -80, -20);
421 Workarounds::clamp(max_meter_db, 0, 10);
422 Workarounds::clamp(frames_per_foot, 1, 32);
423 Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
424 Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
425 Workarounds::clamp(video_write_length, 1, 1000);
426 //printf("EDLSession::boundaries 1\n");
432 Workarounds::clamp(eyedrop_radius, 0, 255);
433 Workarounds::clamp(crop_x1, 0, output_w);
434 Workarounds::clamp(crop_x2, 0, output_w);
435 Workarounds::clamp(crop_y1, 0, output_h);
436 Workarounds::clamp(crop_y2, 0, output_h);
437 Workarounds::clamp(ruler_x1, 0.0, output_w);
438 Workarounds::clamp(ruler_x2, 0.0, output_w);
439 Workarounds::clamp(ruler_y1, 0.0, output_h);
440 Workarounds::clamp(ruler_y2, 0.0, output_h);
441 if(brender_start < 0) brender_start = 0.0;
443 Workarounds::clamp(subtitle_number, 0, 31);
445 // Correct framerates
446 frame_rate = Units::fix_framerate(frame_rate);
451 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
453 char string[BCTEXTLEN];
454 if(append_mode) return 0;
455 interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
456 interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
457 white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
458 BC_CModels::to_text(string, color_model);
459 color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string));
460 video_channels = file->tag.get_property("CHANNELS", video_channels);
461 for(int i = 0; i < video_channels; i++)
463 int default_position = i * output_w;
464 sprintf(string, "VCHANNEL_X_%d", i);
465 vchannel_x[i] = file->tag.get_property(string, default_position);
466 sprintf(string, "VCHANNEL_Y_%d", i);
467 vchannel_y[i] = file->tag.get_property(string, 0);
470 frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
471 frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
472 output_w = file->tag.get_property("OUTPUTW", output_w);
473 output_h = file->tag.get_property("OUTPUTH", output_h);
474 aspect_w = file->tag.get_property("ASPECTW", aspect_w);
475 aspect_h = file->tag.get_property("ASPECTH", aspect_h);
479 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
482 // load channels setting
483 if(append_mode) return 0;
484 audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
487 for(int i = 0; i < audio_channels; i++)
489 sprintf(string, "ACHANNEL_ANGLE_%d", i);
490 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
491 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
494 sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
498 int EDLSession::load_xml(FileXML *file,
502 char string[BCTEXTLEN];
509 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
510 for(int i = 0; i < ASSET_COLUMNS; i++)
512 sprintf(string, "ASSET_COLUMN%d", i);
513 asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
515 auto_conf->load_xml(file);
516 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
517 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
518 brender_start = file->tag.get_property("BRENDER_START", brender_start);
519 eyedrop_radius = file->tag.get_property("EYEDROP_RADIUS", eyedrop_radius);
520 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
521 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
522 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
523 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
524 ruler_x1 = file->tag.get_property("RULER_X1", ruler_x1);
525 ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1);
526 ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2);
527 ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2);
528 file->tag.get_property("CURRENT_FOLDER", current_folder);
529 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
530 typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes);
531 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
532 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
533 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
534 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
535 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
536 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
537 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
538 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
539 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
540 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
541 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
542 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
543 mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock);
544 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
545 single_standalone = file->tag.get_property("SINGLE_STANDALONE", single_standalone);
546 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
547 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
548 show_titles = file->tag.get_property("SHOW_TITLES", 1);
549 // test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
550 time_format = file->tag.get_property("TIME_FORMAT", time_format);
551 nudge_seconds = file->tag.get_property("NUDGE_FORMAT", nudge_seconds);
552 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
553 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
554 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
556 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
557 subtitle_number = file->tag.get_property("SUBTITLE_NUMBER", subtitle_number);
558 label_cells = file->tag.get_property("LABEL_CELLS", label_cells);
559 program_no = file->tag.get_property("PROGRAM_NO", program_no);
566 int EDLSession::save_xml(FileXML *file)
568 //printf("EDLSession::save_session 1\n");
569 char string[BCTEXTLEN];
570 file->tag.set_title("SESSION");
571 file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
572 for(int i = 0; i < ASSET_COLUMNS; i++)
574 sprintf(string, "ASSET_COLUMN%d", i);
575 file->tag.set_property(string, asset_columns[i]);
577 auto_conf->save_xml(file);
578 file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
579 file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
580 file->tag.set_property("BRENDER_START", brender_start);
581 file->tag.set_property("EYEDROP_RADIUS", eyedrop_radius);
582 file->tag.set_property("CROP_X1", crop_x1);
583 file->tag.set_property("CROP_Y1", crop_y1);
584 file->tag.set_property("CROP_X2", crop_x2);
585 file->tag.set_property("CROP_Y2", crop_y2);
586 file->tag.set_property("RULER_X1", ruler_x1);
587 file->tag.set_property("RULER_Y1", ruler_y1);
588 file->tag.set_property("RULER_X2", ruler_x2);
589 file->tag.set_property("RULER_Y2", ruler_y2);
590 file->tag.set_property("CURRENT_FOLDER", current_folder);
591 file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
592 file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes);
593 file->tag.set_property("CWINDOW_DEST", cwindow_dest);
594 file->tag.set_property("CWINDOW_MASK", cwindow_mask);
595 file->tag.set_property("CWINDOW_METER", cwindow_meter);
596 file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
597 file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
598 file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
599 file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
600 file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
601 file->tag.set_property("EDITING_MODE", editing_mode);
602 file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
603 file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
604 file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
605 file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock);
606 file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
607 file->tag.set_property("SINGLE_STANDALONE", single_standalone);
608 file->tag.set_property("SAFE_REGIONS", safe_regions);
609 file->tag.set_property("SHOW_ASSETS", show_assets);
610 file->tag.set_property("SHOW_TITLES", show_titles);
611 file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
612 file->tag.set_property("TIME_FORMAT", time_format);
613 file->tag.set_property("NUDGE_FORMAT", nudge_seconds);
614 file->tag.set_property("TOOL_WINDOW", tool_window);
615 file->tag.set_property("VWINDOW_METER", vwindow_meter);
616 file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
619 file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
620 file->tag.set_property("SUBTITLE_NUMBER", subtitle_number);
625 file->append_newline();
626 file->append_newline();
627 //printf("EDLSession::save_session 3\n");
631 int EDLSession::save_video_config(FileXML *file)
633 char string[BCTEXTLEN];
634 file->tag.set_title("VIDEO");
635 file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
636 file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
637 file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
638 BC_CModels::to_text(string, color_model);
639 file->tag.set_property("COLORMODEL", string);
640 file->tag.set_property("CHANNELS", video_channels);
641 for(int i = 0; i < video_channels; i++)
643 sprintf(string, "VCHANNEL_X_%d", i);
644 file->tag.set_property(string, vchannel_x[i]);
645 sprintf(string, "VCHANNEL_Y_%d", i);
646 file->tag.set_property(string, vchannel_y[i]);
649 file->tag.set_property("FRAMERATE", frame_rate);
650 file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
651 file->tag.set_property("OUTPUTW", output_w);
652 file->tag.set_property("OUTPUTH", output_h);
653 file->tag.set_property("ASPECTW", aspect_w);
654 file->tag.set_property("ASPECTH", aspect_h);
656 file->append_newline();
657 file->append_newline();
661 int EDLSession::save_audio_config(FileXML *file)
664 file->tag.set_title("AUDIO");
665 file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
666 file->tag.set_property("CHANNELS", (int64_t)audio_channels);
668 for(int i = 0; i < audio_channels; i++)
670 sprintf(string, "ACHANNEL_ANGLE_%d", i);
671 file->tag.set_property(string, achannel_positions[i]);
675 file->append_newline();
676 file->append_newline();
680 int EDLSession::copy(EDLSession *session)
682 // Audio channel positions
683 for(int i = 0; i < MAXCHANNELS; i++)
685 achannel_positions[i] = session->achannel_positions[i];
687 aconfig_in->copy_from(session->aconfig_in);
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 eyedrop_radius = session->eyedrop_radius;
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 ruler_x1 = session->ruler_x1;
707 ruler_y1 = session->ruler_y1;
708 ruler_x2 = session->ruler_x2;
709 ruler_y2 = session->ruler_y2;
710 strcpy(current_folder, session->current_folder);
711 cursor_on_frames = session->cursor_on_frames;
712 typeless_keyframes = session->typeless_keyframes;
713 cwindow_dest = session->cwindow_dest;
714 cwindow_mask = session->cwindow_mask;
715 cwindow_meter = session->cwindow_meter;
716 cwindow_operation = session->cwindow_operation;
717 cwindow_scrollbars = session->cwindow_scrollbars;
718 cwindow_xscroll = session->cwindow_xscroll;
719 cwindow_yscroll = session->cwindow_yscroll;
720 cwindow_zoom = session->cwindow_zoom;
721 strcpy(default_atransition, session->default_atransition);
722 strcpy(default_vtransition, session->default_vtransition);
723 default_transition_length = session->default_transition_length;
724 edit_handle_mode[0] = session->edit_handle_mode[0];
725 edit_handle_mode[1] = session->edit_handle_mode[1];
726 edit_handle_mode[2] = session->edit_handle_mode[2];
727 editing_mode = session->editing_mode;
728 enable_duplex = session->enable_duplex;
729 folderlist_format = session->folderlist_format;
730 frame_rate = session->frame_rate;
731 frames_per_foot = session->frames_per_foot;
732 highlighted_track = session->highlighted_track;
733 interpolation_type = session->interpolation_type;
734 interpolate_raw = session->interpolate_raw;
735 white_balance_raw = session->white_balance_raw;
736 labels_follow_edits = session->labels_follow_edits;
737 plugins_follow_edits = session->plugins_follow_edits;
738 single_standalone = session->single_standalone;
739 auto_keyframes = session->auto_keyframes;
740 // last_playback_position = session->last_playback_position;
741 meter_format = session->meter_format;
742 min_meter_db = session->min_meter_db;
743 max_meter_db = session->max_meter_db;
744 mpeg4_deblock = session->mpeg4_deblock;
745 output_w = session->output_w;
746 output_h = session->output_h;
747 playback_buffer = session->playback_buffer;
748 delete playback_config;
749 playback_config = new PlaybackConfig;
750 playback_config->copy_from(session->playback_config);
751 playback_cursor_visible = session->playback_cursor_visible;
752 playback_software_position = session->playback_software_position;
753 real_time_playback = session->real_time_playback;
754 real_time_record = session->real_time_record;
755 record_positioning = session->record_positioning;
756 record_raw_stream = session->record_raw_stream;
757 record_speed = session->record_speed;
758 record_sync_drives = session->record_sync_drives;
759 record_fragment_size = session->record_fragment_size;
760 record_write_length = session->record_write_length;
761 record_realtime_toc = session->record_realtime_toc;
762 recording_format->copy_from(session->recording_format, 0);
763 safe_regions = session->safe_regions;
764 sample_rate = session->sample_rate;
765 scrub_speed = session->scrub_speed;
766 show_assets = session->show_assets;
767 show_titles = session->show_titles;
768 test_playback_edits = session->test_playback_edits;
769 time_format = session->time_format;
770 nudge_seconds = session->nudge_seconds;
771 tool_window = session->tool_window;
772 for(int i = 0; i < MAXCHANNELS; i++)
774 vchannel_x[i] = session->vchannel_x[i];
775 vchannel_y[i] = session->vchannel_y[i];
777 video_channels = session->video_channels;
778 *vconfig_in = *session->vconfig_in;
779 video_every_frame = session->video_every_frame;
780 video_asynchronous = session->video_asynchronous;
781 video_tracks = session->video_tracks;
782 video_write_length = session->video_write_length;
783 view_follows_playback = session->view_follows_playback;
784 vwindow_meter = session->vwindow_meter;
785 vwindow_zoom = session->vwindow_zoom;
787 subtitle_number = session->subtitle_number;
788 decode_subtitles = session->decode_subtitles;
789 label_cells = session->label_cells;
790 program_no = session->program_no;
796 void EDLSession::dump()
798 printf("EDLSession::dump\n");
799 printf(" audio_tracks=%d audio_channels=%d sample_rate=" _LD "\n"
800 " video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n"
801 " decode subtitles=%d subtitle_number=%d label_cells=%d program_no=%d\n",
802 audio_tracks, audio_channels, sample_rate, video_tracks,
803 frame_rate, output_w, output_h, aspect_w, aspect_h,
804 decode_subtitles, subtitle_number, label_cells, program_no);