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