74eb3471d944ea832c0165c19bc98cf2952e2838
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / edlsession.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "asset.h"
23 #include "assets.h"
24 #include "autoconf.h"
25 #include "awindowgui.h"
26 #include "bccmodels.h"
27 #include "bchash.h"
28 #include "clip.h"
29 #include "edl.h"
30 #include "edlsession.h"
31 #include "filexml.h"
32 #include "interlacemodes.h"
33 #include "overlayframe.inc"
34 #include "playbackconfig.h"
35 #include "recordconfig.h"
36 #include "tracks.h"
37 #include "workarounds.h"
38
39 int EDLSession::current_id = 0;
40
41 EDLSession::EDLSession(EDL *edl)
42 {
43         this->edl = edl;
44         for(int i = 0; i < MAXCHANNELS; i++)
45                 achannel_positions[i] = 0;
46         assetlist_format = ASSETS_ICONS;
47         int xs100 = xS(100);
48         for(int i = 0; i < ASSET_COLUMNS; i++)
49                 asset_columns[i] = xs100;
50         auto_conf = new AutoConf;
51         awindow_folder = AW_MEDIA_FOLDER;
52         aspect_w = 4;  aspect_h = 3;
53         audio_channels = 2;
54         audio_tracks = 2;
55         autos_follow_edits = 1; // this is needed for predictability
56         auto_keyframes = 0;
57         span_keyframes = 0;
58         brender_start = brender_end = 0.0;
59         clipboard_length = 0; // unused
60         color_model = BC_RGBA8888;
61         interlace_mode = ILACE_MODE_UNDETECTED;
62         crop_x1 = 0; crop_x2 = xS(320);
63         crop_y1 = 0; crop_y2 = yS(240);
64         eyedrop_radius = 0;
65         ruler_x1 = ruler_y1 = 0.0;
66         ruler_x2 = ruler_y2 = 0.0;
67         cursor_on_frames = 1;
68         typeless_keyframes = 0;
69         cwindow_dest = 0;
70         cwindow_mask = 0;
71         cwindow_meter = 0;
72         cwindow_operation = 0;
73         cwindow_scrollbars = 0;
74         cwindow_xscroll = cwindow_yscroll = 0;
75         cwindow_zoom = 1.0;
76         cwindow_click2play = 0;
77         cwindow_clear_color = BLACK;
78         cwindow_clear_alpha = 0;
79         strcpy(default_atransition, INIT_ATRANSITION);
80         strcpy(default_vtransition, INIT_VTRANSITION);
81         default_transition_length = 1.0;
82         edit_handle_mode[0] = MOVE_RIPPLE;
83         edit_handle_mode[1] = MOVE_ROLL;
84         edit_handle_mode[2] = MOVE_SLIP;
85         editing_mode = EDITING_IBEAM;
86         enable_duplex = 1;
87         folderlist_format = FOLDERS_ICONS;
88         frame_rate = 30000./1001;
89         frames_per_foot = 16;
90         highlighted_track = 0;
91         interpolation_type = CUBIC_CUBIC;
92         interpolate_raw = 1;
93         white_balance_raw = 1;
94         labels_follow_edits = 1;
95         plugins_follow_edits = 1;
96         single_standalone = 1;
97         meter_format = METER_DB;
98         min_meter_db = -85;
99         max_meter_db = 6;
100         output_w = 720;
101         output_h = 480;
102         playback_buffer = 4096;
103         playback_cursor_visible = 0;
104         playback_preload = 0;
105         proxy_scale = 1;
106         proxy_disabled_scale = 1;
107         proxy_use_scaler = 0;
108         proxy_auto_scale = 1;
109         proxy_beep = 0;
110         render_beep = 0;
111         decode_subtitles = 0;
112         subtitle_number = 0;
113         label_cells = 0;
114         program_no = 0;
115         playback_software_position = 0;
116 //      playback_strategy
117         real_time_playback = 0;
118         real_time_record = 0;
119         record_positioning = 1;
120         record_raw_stream = 0;
121         record_sync_drives = 0;
122         record_speed = frame_rate;
123         record_fragment_size = 2048;
124         record_write_length = 131072;
125         record_realtime_toc = 1;
126
127         safe_regions = 0;
128         sample_rate = 48000;
129         scrub_speed = 2.;
130         show_assets = 1;
131         show_titles = 1;
132         gang_tracks = GANG_NONE;
133         si_useduration = 1;
134         si_duration = 3;
135         test_playback_edits = 1;
136         time_format = TIME_HMSF;
137         nudge_format = 1;
138         tool_window = 0;
139         for(int i = 0; i < MAXCHANNELS; i++) {
140                 vchannel_x[i] = 64*i;
141                 vchannel_y[i] = 0;
142         }
143         video_channels = 1;
144         aconfig_in = new AudioInConfig;
145         vconfig_in = new VideoInConfig;
146         recording_format = new Asset;
147         video_every_frame = 0;
148 //      video_asynchronous = 0;
149         video_tracks = 1;
150         video_write_length = 30;
151         view_follows_playback = 1;
152         vwindow_meter = 0;
153         vwindow_zoom = 1.;
154         vwindow_click2play = 0;
155
156         playback_config = new PlaybackConfig;
157 }
158
159 EDLSession::~EDLSession()
160 {
161         delete aconfig_in;
162         delete auto_conf;
163         delete vconfig_in;
164         delete playback_config;
165         recording_format->Garbage::remove_user();
166 }
167
168
169 int EDLSession::need_rerender(EDLSession *ptr)
170 {
171         return ((playback_preload != ptr->playback_preload) ||
172                 (interpolation_type != ptr->interpolation_type) ||
173                 (video_every_frame != ptr->video_every_frame) ||
174 //              (video_asynchronous != ptr->video_asynchronous) ||
175                 (real_time_playback != ptr->real_time_playback) ||
176                 (playback_software_position != ptr->playback_software_position) ||
177                 (test_playback_edits != ptr->test_playback_edits) ||
178                 (playback_buffer != ptr->playback_buffer) ||
179                 (decode_subtitles != ptr->decode_subtitles) ||
180                 (subtitle_number != ptr->subtitle_number) ||
181                 (interpolate_raw != ptr->interpolate_raw) ||
182                 (white_balance_raw != ptr->white_balance_raw) ||
183                 (proxy_disabled_scale != ptr->proxy_disabled_scale) ||
184                 (proxy_scale != ptr->proxy_scale) ||
185                 (proxy_use_scaler != ptr->proxy_use_scaler) ||
186                 (cwindow_clear_color != ptr->cwindow_clear_color) ||
187                 (cwindow_clear_alpha != ptr->cwindow_clear_alpha));
188 }
189
190 void EDLSession::equivalent_output(EDLSession *session, double *result)
191 {
192         if( session->output_w != output_w ||
193             session->output_h != output_h ||
194             !EQUIV(session->frame_rate, frame_rate) ||
195             session->color_model != color_model ||
196             session->interpolation_type != interpolation_type ||
197             session->interpolate_raw != interpolate_raw ||
198             session->white_balance_raw != white_balance_raw ||
199             session->decode_subtitles != decode_subtitles ||
200             session->subtitle_number != subtitle_number ||
201             session->proxy_disabled_scale != proxy_disabled_scale ||
202             session->proxy_scale != proxy_scale ||
203             session->proxy_use_scaler != proxy_use_scaler )
204                 *result = 0;
205
206 // If it's before the current brender_start, render extra data.
207 // If it's after brender_start, check brender map.
208         if(brender_start != session->brender_start &&
209                 (*result < 0 || *result > brender_start))
210                 *result = brender_start;
211 }
212
213 int EDLSession::load_defaults(BC_Hash *defaults)
214 {
215         char string[BCTEXTLEN];
216         audio_channels = defaults->get("ACHANNELS", audio_channels);
217         audio_tracks = defaults->get("ATRACKS", audio_tracks);
218 // Default channel positions
219         for( int i=0; i<MAXCHANNELS; ++i ) {
220                 sprintf(string, "ACHANNEL_ANGLE_%d", i);
221                 achannel_positions[i] = defaults->get(string,
222                         default_audio_channel_position(i, audio_channels));
223         }
224         aconfig_in->load_defaults(defaults);
225         assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
226         aspect_w = defaults->get("ASPECTW", aspect_w);
227         aspect_h = defaults->get("ASPECTH", aspect_h);
228         for(int i = 0; i < ASSET_COLUMNS; i++)
229         {
230                 sprintf(string, "ASSET_COLUMN%d", i);
231                 asset_columns[i] = defaults->get(string, 100);
232         }
233         auto_conf->load_defaults(defaults);
234         autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
235         brender_start = defaults->get("BRENDER_START", brender_start);
236         brender_end = defaults->get("BRENDER_END", brender_end);
237         BC_CModels::to_text(string, BC_RGBA8888);
238         color_model = BC_CModels::from_text(defaults->get("COLOR_MODEL", string));
239         eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0);
240         ilacemode_to_xmltext(string, interlace_mode);
241         const char *ilace_mode = defaults->get("INTERLACE_MODE",string);
242         interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED);
243         crop_x1 = defaults->get("CROP_X1", 0);
244         crop_x2 = defaults->get("CROP_X2", 320);
245         crop_y1 = defaults->get("CROP_Y1", 0);
246         crop_y2 = defaults->get("CROP_Y2", 240);
247         ruler_x1 = defaults->get("RULER_X1", 0.0);
248         ruler_x2 = defaults->get("RULER_X2", 0.0);
249         ruler_y1 = defaults->get("RULER_Y1", 0.0);
250         ruler_y2 = defaults->get("RULER_Y2", 0.0);
251         awindow_folder = defaults->get("AWINDOW_FOLDER", AW_MEDIA_FOLDER);
252         cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 1);
253         typeless_keyframes = defaults->get("TYPELESS_KEYFRAMES", 0);
254         cwindow_dest = defaults->get("CWINDOW_DEST", 0);
255         cwindow_mask = defaults->get("CWINDOW_MASK", 0);
256         cwindow_meter = defaults->get("CWINDOW_METER", 0);
257         cwindow_operation = defaults->get("CWINDOW_OPERATION", 0);
258         cwindow_scrollbars = defaults->get("CWINDOW_SCROLLBARS", 0);
259         cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
260         cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
261         cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
262         cwindow_click2play = defaults->get("CWINDOW_CLICK2PLAY", 0);
263         cwindow_clear_color = defaults->get("CWINDOW_CLEAR_COLOR", BLACK);
264         cwindow_clear_alpha = defaults->get("CWINDOW_CLEAR_ALPHA", 0);
265         sprintf(default_atransition, INIT_ATRANSITION);
266         defaults->get("DEFAULT_ATRANSITION", default_atransition);
267         sprintf(default_vtransition, INIT_VTRANSITION);
268         defaults->get("DEFAULT_VTRANSITION", default_vtransition);
269         default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
270         edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_RIPPLE);
271         edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ROLL);
272         edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_SLIP);
273         editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM);
274         enable_duplex = defaults->get("ENABLE_DUPLEX", 1);
275         folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_TEXT);
276         frame_rate = defaults->get("FRAMERATE", frame_rate);
277         frames_per_foot = defaults->get("FRAMES_PER_FOOT", (float)16);
278         interpolation_type = defaults->get("INTERPOLATION_TYPE", interpolation_type);
279         interpolate_raw = defaults->get("INTERPOLATE_RAW", interpolate_raw);
280         white_balance_raw = defaults->get("WHITE_BALANCE_RAW", white_balance_raw);
281         labels_follow_edits = defaults->get("LABELS_FOLLOW_EDITS", 1);
282         plugins_follow_edits = defaults->get("PLUGINS_FOLLOW_EDITS", 1);
283         single_standalone = defaults->get("SINGLE_STANDALONE", 1);
284         playback_preload = defaults->get("PLAYBACK_PRELOAD", 0);
285         auto_keyframes = defaults->get("AUTO_KEYFRAMES", 0);
286         span_keyframes = defaults->get("SPAN_KEYFRAMES", 0);
287         meter_format = defaults->get("METER_FORMAT", METER_DB);
288         min_meter_db = defaults->get("MIN_METER_DB", -85);
289         max_meter_db = defaults->get("MAX_METER_DB", 6);
290         output_w = defaults->get("OUTPUTW", output_w);
291         output_h = defaults->get("OUTPUTH", output_h);
292         playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096);
293         playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0);
294         delete playback_config;
295         playback_config = new PlaybackConfig;
296         playback_config->load_defaults(defaults);
297         real_time_playback = defaults->get("PLAYBACK_REALTIME", 0);
298         real_time_record = defaults->get("REALTIME_RECORD", 0);
299         record_positioning = defaults->get("RECORD_POSITIONING", 1);
300         record_raw_stream = defaults->get("RECORD_RAW_STREAM", 0);
301         record_sync_drives = defaults->get("RECORD_SYNC_DRIVES", 0);
302 //      record_speed = defaults->get("RECORD_SPEED", 24);
303         record_fragment_size = defaults->get("RECORD_FRAGMENT_SIZE", 2048);
304         record_write_length = defaults->get("RECORD_WRITE_LENGTH", 131072);
305
306 // set some defaults that work
307         recording_format->video_data = 1;
308         recording_format->audio_data = 1;
309         recording_format->format = FILE_FFMPEG;
310         strcpy(recording_format->acodec, "mp4.qt");
311         strcpy(recording_format->vcodec, "mp4.qt");
312         recording_format->channels = 2;
313         recording_format->sample_rate = 48000;
314         recording_format->bits = 16;
315         recording_format->dither = 0;
316
317         record_realtime_toc = defaults->get("RECORD_REALTIME_TOC", 1);
318         recording_format->load_defaults(defaults, "RECORD_", 1, 1, 1, 1, 1);
319
320         safe_regions = defaults->get("SAFE_REGIONS", 0);
321         sample_rate = defaults->get("SAMPLERATE", sample_rate);
322         scrub_speed = defaults->get("SCRUB_SPEED", (float)2);
323         si_useduration = defaults->get("SI_USEDURATION",1);
324         si_duration = defaults->get("SI_DURATION",3);
325
326         show_assets = defaults->get("SHOW_ASSETS", 1);
327         show_titles = defaults->get("SHOW_TITLES", 1);
328         gang_tracks = defaults->get("GANG_TRACKS", GANG_NONE);
329 //      test_playback_edits = defaults->get("TEST_PLAYBACK_EDITS", 1);
330         time_format = defaults->get("TIME_FORMAT", TIME_HMSF);
331         nudge_format = defaults->get("NUDGE_FORMAT", 1);
332         tool_window = defaults->get("TOOL_WINDOW", 0);
333         vconfig_in->load_defaults(defaults);
334         for(int i = 0; i < MAXCHANNELS; i++) {
335                 int default_position = i * output_w;
336                 sprintf(string, "VCHANNEL_X_%d", i);
337                 vchannel_x[i] = defaults->get(string, default_position);
338                 sprintf(string, "VCHANNEL_Y_%d", i);
339                 vchannel_y[i] = defaults->get(string, 0);
340         }
341         video_channels = defaults->get("VCHANNELS", video_channels);
342         video_every_frame = defaults->get("VIDEO_EVERY_FRAME", 0);
343 //      video_asynchronous = defaults->get("VIDEO_ASYNCHRONOUS", 0);
344         video_tracks = defaults->get("VTRACKS", video_tracks);
345         video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
346         view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
347         vwindow_meter = defaults->get("VWINDOW_METER", 0);
348         vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
349         vwindow_click2play = defaults->get("VWINDOW_CLICK2PLAY", 0);
350
351         decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
352         subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
353         label_cells = defaults->get("LABEL_CELLS", label_cells);
354         program_no = defaults->get("PROGRAM_NO", program_no);
355         proxy_beep = defaults->get("PROXY_BEEP", proxy_beep);
356         render_beep = defaults->get("RENDER_BEEP", render_beep);
357
358         boundaries();
359
360         return 0;
361 }
362
363 int EDLSession::save_defaults(BC_Hash *defaults)
364 {
365         char string[BCTEXTLEN];
366
367 // Session
368         for(int i = 0; i < MAXCHANNELS; i++)
369         {
370                 sprintf(string, "ACHANNEL_ANGLE_%d", i);
371                 defaults->update(string, achannel_positions[i]);
372         }
373         defaults->update("ACHANNELS", audio_channels);
374         aconfig_in->save_defaults(defaults);
375         for(int i = 0; i < ASSET_COLUMNS; i++)
376         {
377                 sprintf(string, "ASSET_COLUMN%d", i);
378                 defaults->update(string, asset_columns[i]);
379         }
380         auto_conf->save_defaults(defaults);
381         defaults->update("ASSETLIST_FORMAT", assetlist_format);
382         defaults->update("ASPECTW", aspect_w);
383         defaults->update("ASPECTH", aspect_h);
384         defaults->update("ATRACKS", audio_tracks);
385         defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
386         defaults->update("BRENDER_START", brender_start);
387         defaults->update("BRENDER_END", brender_end);
388         BC_CModels::to_text(string, color_model);
389         defaults->update("COLOR_MODEL", string);
390         ilacemode_to_xmltext(string, interlace_mode);
391         defaults->update("INTERLACE_MODE", string);
392         defaults->update("EYEDROP_RADIUS", eyedrop_radius);
393         defaults->update("CROP_X1", crop_x1);
394         defaults->update("CROP_X2", crop_x2);
395         defaults->update("CROP_Y1", crop_y1);
396         defaults->update("CROP_Y2", crop_y2);
397         defaults->update("RULER_X1", ruler_x1);
398         defaults->update("RULER_X2", ruler_x2);
399         defaults->update("RULER_Y1", ruler_y1);
400         defaults->update("RULER_Y2", ruler_y2);
401         defaults->update("AWINDOW_FOLDER", awindow_folder);
402         defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
403         defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes);
404         defaults->update("CWINDOW_DEST", cwindow_dest);
405         defaults->update("CWINDOW_MASK", cwindow_mask);
406         defaults->update("CWINDOW_METER", cwindow_meter);
407         defaults->update("CWINDOW_OPERATION", cwindow_operation);
408         defaults->update("CWINDOW_SCROLLBARS", cwindow_scrollbars);
409         defaults->update("CWINDOW_XSCROLL", cwindow_xscroll);
410         defaults->update("CWINDOW_YSCROLL", cwindow_yscroll);
411         defaults->update("CWINDOW_ZOOM", cwindow_zoom);
412         defaults->update("CWINDOW_CLICK2PLAY", cwindow_click2play);
413         defaults->update("CWINDOW_CLEAR_COLOR", cwindow_clear_color);
414         defaults->update("CWINDOW_CLEAR_ALPHA", cwindow_clear_alpha);
415         defaults->update("DEFAULT_ATRANSITION", default_atransition);
416         defaults->update("DEFAULT_VTRANSITION", default_vtransition);
417         defaults->update("DEFAULT_TRANSITION_LENGTH", default_transition_length);
418         defaults->update("EDIT_HANDLE_MODE0", edit_handle_mode[0]);
419         defaults->update("EDIT_HANDLE_MODE1", edit_handle_mode[1]);
420         defaults->update("EDIT_HANDLE_MODE2", edit_handle_mode[2]);
421         defaults->update("EDITING_MODE", editing_mode);
422         defaults->update("ENABLE_DUPLEX", enable_duplex);
423         defaults->update("FOLDERLIST_FORMAT", folderlist_format);
424         defaults->update("FRAMERATE", frame_rate);
425         defaults->update("FRAMES_PER_FOOT", frames_per_foot);
426         defaults->update("HIGHLIGHTED_TRACK", highlighted_track);
427         defaults->update("INTERPOLATION_TYPE", interpolation_type);
428         defaults->update("INTERPOLATE_RAW", interpolate_raw);
429         defaults->update("WHITE_BALANCE_RAW", white_balance_raw);
430         defaults->update("LABELS_FOLLOW_EDITS", labels_follow_edits);
431         defaults->update("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
432         defaults->update("SINGLE_STANDALONE", single_standalone);
433         defaults->update("PLAYBACK_PRELOAD", playback_preload);
434         defaults->update("AUTO_KEYFRAMES", auto_keyframes);
435         defaults->update("SPAN_KEYFRAMES", span_keyframes);
436         defaults->update("METER_FORMAT", meter_format);
437         defaults->update("MIN_METER_DB", min_meter_db);
438         defaults->update("MAX_METER_DB", max_meter_db);
439         defaults->update("OUTPUTW", output_w);
440         defaults->update("OUTPUTH", output_h);
441         defaults->update("PLAYBACK_BUFFER", playback_buffer);
442         defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position);
443         playback_config->save_defaults(defaults);
444         defaults->update("PLAYBACK_REALTIME", real_time_playback);
445         defaults->update("REALTIME_RECORD", real_time_record);
446         defaults->update("RECORD_POSITIONING", record_positioning);
447         defaults->update("RECORD_RAW_STREAM", record_raw_stream);
448         defaults->update("RECORD_SYNC_DRIVES", record_sync_drives);
449 //      defaults->update("RECORD_SPEED", record_speed);
450         defaults->update("RECORD_FRAGMENT_SIZE", record_fragment_size);
451         defaults->update("RECORD_WRITE_LENGTH", record_write_length); // Heroine kernel 2.2 scheduling sucks.
452         defaults->update("RECORD_REALTIME_TOC", record_realtime_toc);
453         recording_format->save_defaults(defaults,
454                 "RECORD_",
455                 1,
456                 1,
457                 1,
458                 1,
459                 1);
460         defaults->update("SAFE_REGIONS", safe_regions);
461         defaults->update("SAMPLERATE", sample_rate);
462         defaults->update("SCRUB_SPEED", scrub_speed);
463         defaults->update("SI_USEDURATION",si_useduration);
464         defaults->update("SI_DURATION",si_duration);
465         defaults->update("SHOW_ASSETS", show_assets);
466         defaults->update("SHOW_TITLES", show_titles);
467         defaults->update("GANG_TRACKS", gang_tracks);
468 //      defaults->update("TEST_PLAYBACK_EDITS", test_playback_edits);
469         defaults->update("TIME_FORMAT", time_format);
470         defaults->update("NUDGE_FORMAT", nudge_format);
471         defaults->update("TOOL_WINDOW", tool_window);
472         vconfig_in->save_defaults(defaults);
473         for(int i = 0; i < MAXCHANNELS; i++) {
474                 sprintf(string, "VCHANNEL_X_%d", i);
475                 defaults->update(string, vchannel_x[i]);
476                 sprintf(string, "VCHANNEL_Y_%d", i);
477                 defaults->update(string, vchannel_y[i]);
478         }
479         defaults->update("VCHANNELS", video_channels);
480         defaults->update("VIDEO_EVERY_FRAME", video_every_frame);
481 //      defaults->update("VIDEO_ASYNCHRONOUS", video_asynchronous);
482         defaults->update("VTRACKS", video_tracks);
483         defaults->update("VIDEO_WRITE_LENGTH", video_write_length);
484         defaults->update("VIEW_FOLLOWS_PLAYBACK", view_follows_playback);
485         defaults->update("VWINDOW_METER", vwindow_meter);
486         defaults->update("VWINDOW_ZOOM", vwindow_zoom);
487         defaults->update("VWINDOW_CLICK2PLAY", vwindow_click2play);
488
489         defaults->update("DECODE_SUBTITLES", decode_subtitles);
490         defaults->update("SUBTITLE_NUMBER", subtitle_number);
491         defaults->update("LABEL_CELLS", label_cells);
492         defaults->update("PROGRAM_NO", program_no);
493         defaults->update("PROXY_BEEP", proxy_beep);
494         defaults->update("RENDER_BEEP", render_beep);
495         return 0;
496 }
497
498
499
500 // GCC 3.0 fails to compile
501 #define BC_INFINITY 65536
502
503
504 void EDLSession::boundaries()
505 {
506         Workarounds::clamp(audio_tracks, 0, (int)BC_INFINITY);
507         Workarounds::clamp(audio_channels, 0, MAXCHANNELS - 1);
508         Workarounds::clamp(sample_rate, 1, 1000000);
509         Workarounds::clamp(video_tracks, 0, (int)BC_INFINITY);
510         Workarounds::clamp(video_channels, 1, MAXCHANNELS - 1);
511         Workarounds::clamp(frame_rate, 1.0, (double)BC_INFINITY);
512         Workarounds::clamp(min_meter_db, -80, -20);
513         Workarounds::clamp(max_meter_db, 0, 10);
514         Workarounds::clamp(frames_per_foot, 1, 32);
515         Workarounds::clamp(proxy_scale, 1, 32);
516         Workarounds::clamp(output_w, 16, (int)BC_INFINITY);
517         Workarounds::clamp(output_h, 16, (int)BC_INFINITY);
518         Workarounds::clamp(video_write_length, 1, 1000);
519 //printf("EDLSession::boundaries 1\n");
520         output_w /= 2;
521         output_w *= 2;
522         output_h /= 2;
523         output_h *= 2;
524
525         Workarounds::clamp(eyedrop_radius, 0, 255);
526         Workarounds::clamp(crop_x1, 0, output_w);
527         Workarounds::clamp(crop_x2, 0, output_w);
528         Workarounds::clamp(crop_y1, 0, output_h);
529         Workarounds::clamp(crop_y2, 0, output_h);
530         Workarounds::clamp(ruler_x1, 0.0, output_w);
531         Workarounds::clamp(ruler_x2, 0.0, output_w);
532         Workarounds::clamp(ruler_y1, 0.0, output_h);
533         Workarounds::clamp(ruler_y2, 0.0, output_h);
534         if(brender_start < 0) brender_start = 0.0;
535         if(brender_end < 0) brender_end = 0.0;
536
537         Workarounds::clamp(subtitle_number, 0, 31);
538         Workarounds::clamp(awindow_folder, 0, AWINDOW_FOLDERS - 1);
539
540 // Correct framerates
541         frame_rate = Units::fix_framerate(frame_rate);
542 }
543
544
545
546 int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_flags)
547 {
548         char string[BCTEXTLEN];
549         if(append_mode) return 0;
550         interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type);
551         interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw);
552         white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw);
553         BC_CModels::to_text(string, color_model);
554         color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string));
555         const char *ilace_mode = file->tag.get_property("INTERLACE_MODE");
556         interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED);
557         video_channels = file->tag.get_property("CHANNELS", video_channels);
558         for(int i = 0; i < video_channels; i++)
559         {
560                 int default_position = i * output_w;
561                 sprintf(string, "VCHANNEL_X_%d", i);
562                 vchannel_x[i] = file->tag.get_property(string, default_position);
563                 sprintf(string, "VCHANNEL_Y_%d", i);
564                 vchannel_y[i] = file->tag.get_property(string, 0);
565         }
566
567         frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
568         frames_per_foot = file->tag.get_property("FRAMES_PER_FOOT", frames_per_foot);
569         output_w = file->tag.get_property("OUTPUTW", output_w);
570         output_h = file->tag.get_property("OUTPUTH", output_h);
571         aspect_w = file->tag.get_property("ASPECTW", aspect_w);
572         aspect_h = file->tag.get_property("ASPECTH", aspect_h);
573         proxy_scale = file->tag.get_property("PROXY_SCALE", proxy_scale);
574         proxy_disabled_scale = file->tag.get_property("PROXY_DISABLED_SCALE", proxy_disabled_scale);
575         proxy_use_scaler = file->tag.get_property("PROXY_USE_SCALER", proxy_use_scaler);
576         proxy_auto_scale = file->tag.get_property("PROXY_AUTO_SCALE", proxy_auto_scale);
577         return 0;
578 }
579
580 int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_flags)
581 {
582         char string[32];
583 // load channels setting
584         if(append_mode) return 0;
585         audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
586         for(int i = 0; i < audio_channels; i++)
587         {
588                 sprintf(string, "ACHANNEL_ANGLE_%d", i);
589                 achannel_positions[i] = file->tag.get_property(string, achannel_positions[i]);
590 //printf("EDLSession::load_audio_config 1 %d %d\n", i, achannel_positions[i]);
591         }
592
593         sample_rate = file->tag.get_property("SAMPLERATE", (int64_t)sample_rate);
594         return 0;
595 }
596
597 int EDLSession::load_xml(FileXML *file,
598         int append_mode,
599         uint32_t load_flags)
600 {
601         char string[BCTEXTLEN];
602
603         if(append_mode)
604         {
605         }
606         else
607         {
608                 assetlist_format = file->tag.get_property("ASSETLIST_FORMAT", assetlist_format);
609                 for(int i = 0; i < ASSET_COLUMNS; i++) {
610                         sprintf(string, "ASSET_COLUMN%d", i);
611                         asset_columns[i] = file->tag.get_property(string, asset_columns[i]);
612                 }
613                 auto_conf->load_xml(file);
614                 auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
615                 span_keyframes = file->tag.get_property("SPAN_KEYFRAMES", span_keyframes);
616                 autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
617                 brender_start = file->tag.get_property("BRENDER_START", brender_start);
618                 brender_end = file->tag.get_property("BRENDER_END", brender_end);
619                 eyedrop_radius = file->tag.get_property("EYEDROP_RADIUS", eyedrop_radius);
620                 crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
621                 crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
622                 crop_x2 = file->tag.get_property("CROP_X2", crop_x2);
623                 crop_y2 = file->tag.get_property("CROP_Y2", crop_y2);
624                 ruler_x1 = file->tag.get_property("RULER_X1", ruler_x1);
625                 ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1);
626                 ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2);
627                 ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2);
628                 awindow_folder = file->tag.get_property("AWINDOW_FOLDER", AW_MEDIA_FOLDER);
629                 cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
630                 typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes);
631                 cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
632                 cwindow_mask = file->tag.get_property("CWINDOW_MASK", cwindow_mask);
633                 cwindow_meter = file->tag.get_property("CWINDOW_METER", cwindow_meter);
634                 cwindow_operation = file->tag.get_property("CWINDOW_OPERATION", cwindow_operation);
635                 cwindow_scrollbars = file->tag.get_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
636                 cwindow_xscroll = file->tag.get_property("CWINDOW_XSCROLL", cwindow_xscroll);
637                 cwindow_yscroll = file->tag.get_property("CWINDOW_YSCROLL", cwindow_yscroll);
638                 cwindow_zoom = file->tag.get_property("CWINDOW_ZOOM", cwindow_zoom);
639                 cwindow_click2play = file->tag.get_property("CWINDOW_CLICK2PLAY", cwindow_click2play);
640                 cwindow_clear_color = file->tag.get_property("CWINDOW_CLEAR_COLOR", cwindow_clear_color);
641                 cwindow_clear_alpha = file->tag.get_property("CWINDOW_CLEAR_ALPHA", cwindow_clear_alpha);
642                 editing_mode = file->tag.get_property("EDITING_MODE", editing_mode);
643                 folderlist_format = file->tag.get_property("FOLDERLIST_FORMAT", folderlist_format);
644                 highlighted_track = file->tag.get_property("HIGHLIGHTED_TRACK", 0);
645                 labels_follow_edits = file->tag.get_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
646                 plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
647                 single_standalone = file->tag.get_property("SINGLE_STANDALONE", single_standalone);
648                 playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload);
649                 safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions);
650                 show_assets = file->tag.get_property("SHOW_ASSETS", 1);
651                 show_titles = file->tag.get_property("SHOW_TITLES", 1);
652                 gang_tracks = file->tag.get_property("GANG_TRACKS", GANG_NONE);
653 //              test_playback_edits = file->tag.get_property("TEST_PLAYBACK_EDITS", test_playback_edits);
654                 time_format = file->tag.get_property("TIME_FORMAT", time_format);
655                 nudge_format = file->tag.get_property("NUDGE_FORMAT", nudge_format);
656                 tool_window = file->tag.get_property("TOOL_WINDOW", tool_window);
657                 vwindow_meter = file->tag.get_property("VWINDOW_METER", vwindow_meter);
658                 vwindow_zoom = file->tag.get_property("VWINDOW_ZOOM", vwindow_zoom);
659                 vwindow_click2play = file->tag.get_property("VWINDOW_CLICK2PLAY", vwindow_click2play);
660
661                 decode_subtitles = file->tag.get_property("DECODE_SUBTITLES", decode_subtitles);
662                 subtitle_number = file->tag.get_property("SUBTITLE_NUMBER", subtitle_number);
663                 label_cells = file->tag.get_property("LABEL_CELLS", label_cells);
664                 program_no = file->tag.get_property("PROGRAM_NO", program_no);
665                 proxy_beep = file->tag.get_property("PROXY_BEEP", proxy_beep);
666                 render_beep = file->tag.get_property("RENDER_BEEP", render_beep);
667                 boundaries();
668         }
669
670         return 0;
671 }
672
673 int EDLSession::save_xml(FileXML *file)
674 {
675 //printf("EDLSession::save_session 1\n");
676         char string[BCTEXTLEN];
677         file->tag.set_title("SESSION");
678         file->tag.set_property("ASSETLIST_FORMAT", assetlist_format);
679         for(int i = 0; i < ASSET_COLUMNS; i++) {
680                 sprintf(string, "ASSET_COLUMN%d", i);
681                 file->tag.set_property(string, asset_columns[i]);
682         }
683         auto_conf->save_xml(file);
684         file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
685         file->tag.set_property("SPAN_KEYFRAMES", span_keyframes);
686         file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
687         file->tag.set_property("BRENDER_START", brender_start);
688         file->tag.set_property("BRENDER_END", brender_end);
689         file->tag.set_property("EYEDROP_RADIUS", eyedrop_radius);
690         file->tag.set_property("CROP_X1", crop_x1);
691         file->tag.set_property("CROP_Y1", crop_y1);
692         file->tag.set_property("CROP_X2", crop_x2);
693         file->tag.set_property("CROP_Y2", crop_y2);
694         file->tag.set_property("RULER_X1", ruler_x1);
695         file->tag.set_property("RULER_Y1", ruler_y1);
696         file->tag.set_property("RULER_X2", ruler_x2);
697         file->tag.set_property("RULER_Y2", ruler_y2);
698         file->tag.set_property("AWINDOW_FOLDER", awindow_folder);
699         file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
700         file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes);
701         file->tag.set_property("CWINDOW_DEST", cwindow_dest);
702         file->tag.set_property("CWINDOW_MASK", cwindow_mask);
703         file->tag.set_property("CWINDOW_METER", cwindow_meter);
704         file->tag.set_property("CWINDOW_OPERATION", cwindow_operation);
705         file->tag.set_property("CWINDOW_SCROLLBARS", cwindow_scrollbars);
706         file->tag.set_property("CWINDOW_XSCROLL", cwindow_xscroll);
707         file->tag.set_property("CWINDOW_YSCROLL", cwindow_yscroll);
708         file->tag.set_property("CWINDOW_ZOOM", cwindow_zoom);
709         file->tag.set_property("CWINDOW_CLICK2PLAY", cwindow_click2play);
710         file->tag.set_property("CWINDOW_CLEAR_COLOR", cwindow_clear_color);
711         file->tag.set_property("CWINDOW_CLEAR_ALPHA", cwindow_clear_alpha);
712         file->tag.set_property("EDITING_MODE", editing_mode);
713         file->tag.set_property("FOLDERLIST_FORMAT", folderlist_format);
714         file->tag.set_property("HIGHLIGHTED_TRACK", highlighted_track);
715         file->tag.set_property("LABELS_FOLLOW_EDITS", labels_follow_edits);
716         file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits);
717         file->tag.set_property("SINGLE_STANDALONE", single_standalone);
718         file->tag.set_property("PLAYBACK_PRELOAD", playback_preload);
719         file->tag.set_property("SAFE_REGIONS", safe_regions);
720         file->tag.set_property("SHOW_ASSETS", show_assets);
721         file->tag.set_property("SHOW_TITLES", show_titles);
722         file->tag.set_property("GANG_TRACKS", gang_tracks);
723         file->tag.set_property("TEST_PLAYBACK_EDITS", test_playback_edits);
724         file->tag.set_property("TIME_FORMAT", time_format);
725         file->tag.set_property("NUDGE_FORMAT", nudge_format);
726         file->tag.set_property("TOOL_WINDOW", tool_window);
727         file->tag.set_property("VWINDOW_METER", vwindow_meter);
728         file->tag.set_property("VWINDOW_ZOOM", vwindow_zoom);
729         file->tag.set_property("VWINDOW_CLICK2PLAY", vwindow_click2play);
730
731         file->tag.set_property("DECODE_SUBTITLES", decode_subtitles);
732         file->tag.set_property("SUBTITLE_NUMBER", subtitle_number);
733         file->tag.set_property("PROXY_BEEP", proxy_beep);
734         file->tag.set_property("RENDER_BEEP", render_beep);
735
736         file->append_tag();
737         file->tag.set_title("/SESSION");
738         file->append_tag();
739         file->append_newline();
740         file->append_newline();
741 //printf("EDLSession::save_session 3\n");
742         return 0;
743 }
744
745 int EDLSession::save_video_config(FileXML *file)
746 {
747         char string[BCTEXTLEN];
748         file->tag.set_title("VIDEO");
749         file->tag.set_property("INTERPOLATION_TYPE", interpolation_type);
750         file->tag.set_property("INTERPOLATE_RAW", interpolate_raw);
751         file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw);
752         BC_CModels::to_text(string, color_model);
753         file->tag.set_property("COLORMODEL", string);
754         ilacemode_to_xmltext(string, interlace_mode);
755         file->tag.set_property("INTERLACE_MODE",string);
756         file->tag.set_property("CHANNELS", video_channels);
757         for(int i = 0; i < video_channels; i++)
758         {
759                 sprintf(string, "VCHANNEL_X_%d", i);
760                 file->tag.set_property(string, vchannel_x[i]);
761                 sprintf(string, "VCHANNEL_Y_%d", i);
762                 file->tag.set_property(string, vchannel_y[i]);
763         }
764
765         file->tag.set_property("FRAMERATE", frame_rate);
766         file->tag.set_property("FRAMES_PER_FOOT", frames_per_foot);
767         file->tag.set_property("OUTPUTW", output_w);
768         file->tag.set_property("OUTPUTH", output_h);
769         file->tag.set_property("ASPECTW", aspect_w);
770         file->tag.set_property("ASPECTH", aspect_h);
771         file->tag.set_property("PROXY_SCALE", proxy_scale);
772         file->tag.set_property("PROXY_DISABLED_SCALE", proxy_disabled_scale);
773         file->tag.set_property("PROXY_USE_SCALER", proxy_use_scaler);
774         file->tag.set_property("PROXY_AUTO_SCALE", proxy_auto_scale);
775         file->append_tag();
776         file->tag.set_title("/VIDEO");
777         file->append_tag();
778         file->append_newline();
779         file->append_newline();
780         return 0;
781 }
782
783 int EDLSession::save_audio_config(FileXML *file)
784 {
785         char string[1024];
786         file->tag.set_title("AUDIO");
787         file->tag.set_property("SAMPLERATE", (int64_t)sample_rate);
788         file->tag.set_property("CHANNELS", (int64_t)audio_channels);
789
790         for(int i = 0; i < audio_channels; i++)
791         {
792                 sprintf(string, "ACHANNEL_ANGLE_%d", i);
793                 file->tag.set_property(string, achannel_positions[i]);
794         }
795
796         file->append_tag();
797         file->tag.set_title("/AUDIO");
798         file->append_tag();
799         file->append_newline();
800         file->append_newline();
801         return 0;
802 }
803
804 int EDLSession::copy(EDLSession *session)
805 {
806 // Audio channel positions
807         for(int i = 0; i < MAXCHANNELS; i++)
808         {
809                 achannel_positions[i] = session->achannel_positions[i];
810         }
811         aconfig_in->copy_from(session->aconfig_in);
812         for(int i = 0; i < ASSET_COLUMNS; i++)
813         {
814                 asset_columns[i] = session->asset_columns[i];
815         }
816         assetlist_format = session->assetlist_format;
817         auto_conf->copy_from(session->auto_conf);
818         aspect_w = session->aspect_w;
819         aspect_h = session->aspect_h;
820         audio_channels = session->audio_channels;
821         audio_tracks = session->audio_tracks;
822         autos_follow_edits = session->autos_follow_edits;
823         brender_start = session->brender_start;
824         brender_end = session->brender_end;
825         color_model = session->color_model;
826         interlace_mode = session->interlace_mode;
827         eyedrop_radius = session->eyedrop_radius;
828         crop_x1 = session->crop_x1;
829         crop_y1 = session->crop_y1;
830         crop_x2 = session->crop_x2;
831         crop_y2 = session->crop_y2;
832         ruler_x1 = session->ruler_x1;
833         ruler_y1 = session->ruler_y1;
834         ruler_x2 = session->ruler_x2;
835         ruler_y2 = session->ruler_y2;
836         awindow_folder = session->awindow_folder;
837         cursor_on_frames = session->cursor_on_frames;
838         typeless_keyframes = session->typeless_keyframes;
839         cwindow_dest = session->cwindow_dest;
840         cwindow_mask = session->cwindow_mask;
841         cwindow_meter = session->cwindow_meter;
842         cwindow_operation = session->cwindow_operation;
843         cwindow_scrollbars = session->cwindow_scrollbars;
844         cwindow_xscroll = session->cwindow_xscroll;
845         cwindow_yscroll = session->cwindow_yscroll;
846         cwindow_zoom = session->cwindow_zoom;
847         cwindow_click2play = session->cwindow_click2play;
848         cwindow_clear_color = session->cwindow_clear_color;
849         cwindow_clear_alpha = session->cwindow_clear_alpha;
850         strcpy(default_atransition, session->default_atransition);
851         strcpy(default_vtransition, session->default_vtransition);
852         default_transition_length = session->default_transition_length;
853         edit_handle_mode[0] = session->edit_handle_mode[0];
854         edit_handle_mode[1] = session->edit_handle_mode[1];
855         edit_handle_mode[2] = session->edit_handle_mode[2];
856         editing_mode = session->editing_mode;
857         enable_duplex = session->enable_duplex;
858         folderlist_format = session->folderlist_format;
859         frame_rate = session->frame_rate;
860         frames_per_foot = session->frames_per_foot;
861         highlighted_track = session->highlighted_track;
862         interpolation_type = session->interpolation_type;
863         interpolate_raw = session->interpolate_raw;
864         white_balance_raw = session->white_balance_raw;
865         labels_follow_edits = session->labels_follow_edits;
866         plugins_follow_edits = session->plugins_follow_edits;
867         single_standalone = session->single_standalone;
868         auto_keyframes = session->auto_keyframes;
869         span_keyframes = session->span_keyframes;
870 //      last_playback_position = session->last_playback_position;
871         meter_format = session->meter_format;
872         min_meter_db = session->min_meter_db;
873         max_meter_db = session->max_meter_db;
874         output_w = session->output_w;
875         output_h = session->output_h;
876         playback_buffer = session->playback_buffer;
877         delete playback_config;
878         playback_config = new PlaybackConfig;
879         playback_config->copy_from(session->playback_config);
880         playback_cursor_visible = session->playback_cursor_visible;
881         playback_software_position = session->playback_software_position;
882         real_time_playback = session->real_time_playback;
883         real_time_record = session->real_time_record;
884         record_positioning = session->record_positioning;
885         record_raw_stream = session->record_raw_stream;
886         record_speed = session->record_speed;
887         record_sync_drives = session->record_sync_drives;
888         record_fragment_size = session->record_fragment_size;
889         record_write_length = session->record_write_length;
890         record_realtime_toc = session->record_realtime_toc;
891         recording_format->copy_from(session->recording_format, 0);
892         safe_regions = session->safe_regions;
893         sample_rate = session->sample_rate;
894         scrub_speed = session->scrub_speed;
895         si_useduration = session->si_useduration;
896         si_duration = session->si_duration;
897         show_assets = session->show_assets;
898         show_titles = session->show_titles;
899         gang_tracks = session->gang_tracks;
900         test_playback_edits = session->test_playback_edits;
901         time_format = session->time_format;
902         nudge_format = session->nudge_format;
903         tool_window = session->tool_window;
904         for(int i = 0; i < MAXCHANNELS; i++) {
905                 vchannel_x[i] = session->vchannel_x[i];
906                 vchannel_y[i] = session->vchannel_y[i];
907         }
908         video_channels = session->video_channels;
909         *vconfig_in = *session->vconfig_in;
910         video_every_frame = session->video_every_frame;
911 //      video_asynchronous = session->video_asynchronous;
912         video_tracks = session->video_tracks;
913         video_write_length = session->video_write_length;
914         view_follows_playback = session->view_follows_playback;
915         vwindow_meter = session->vwindow_meter;
916         vwindow_zoom = session->vwindow_zoom;
917         vwindow_click2play = session->vwindow_click2play;
918         proxy_scale = session->proxy_scale;
919         proxy_disabled_scale = session->proxy_disabled_scale;
920         proxy_use_scaler = session->proxy_use_scaler;
921         proxy_auto_scale = session->proxy_auto_scale;
922         proxy_beep = session->proxy_beep;
923         render_beep = session->render_beep;
924
925         subtitle_number = session->subtitle_number;
926         decode_subtitles = session->decode_subtitles;
927         label_cells = session->label_cells;
928         program_no = session->program_no;
929
930         return 0;
931 }
932
933 void EDLSession::dump()
934 {
935         printf("EDLSession::dump\n");
936         printf("    audio_tracks=%d audio_channels=%d sample_rate=%jd\n"
937                 "    video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n"
938                 "    decode subtitles=%d subtitle_number=%d label_cells=%d program_no=%d\n"
939                 "    proxy scale=%d\n disabled_scale=%d, use_scaler=%d, auto_scale=%d\n"
940                 "    proxy_beep=%f render_beep=%f\n",
941                 audio_tracks, audio_channels, sample_rate, video_tracks,
942                 frame_rate, output_w, output_h, aspect_w, aspect_h,
943                 decode_subtitles, subtitle_number, label_cells, program_no,
944                 proxy_scale, proxy_disabled_scale, proxy_use_scaler, proxy_auto_scale,
945                 proxy_beep, render_beep);
946 }
947