alt transport keys, snap editing, grab focus, inv hilight clr, subtitle fix
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mwindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef MWINDOW_H
22 #define MWINDOW_H
23
24 #include <stdio.h>
25 #include <stdint.h>
26
27 #include "apatchgui.h"
28 #include "arraylist.h"
29 #include "asset.inc"
30 #include "assets.inc"
31 #include "audiodevice.inc"
32 #include "autos.inc"
33 #include "awindow.inc"
34 #include "batchrender.inc"
35 #include "bcwindowbase.inc"
36 #include "bdcreate.inc"
37 #include "brender.inc"
38 #include "cache.inc"
39 #include "channel.inc"
40 #include "channeldb.inc"
41 #include "commercials.inc"
42 #include "cwindow.inc"
43 #include "bchash.inc"
44 #include "devicedvbinput.inc"
45 #include "devicempeginput.inc"
46 #include "dvdcreate.inc"
47 #include "edit.inc"
48 #include "edl.inc"
49 #include "edlsession.inc"
50 #include "exportedl.inc"
51 #include "filesystem.inc"
52 #include "filexml.inc"
53 #include "framecache.inc"
54 #include "gwindow.inc"
55 #include "indexable.inc"
56 #include "keyframegui.inc"
57 #include "levelwindow.inc"
58 #include "loadmode.inc"
59 #include "mainerror.inc"
60 #include "mainindexes.inc"
61 #include "mainprogress.inc"
62 #include "mainsession.inc"
63 #include "mainundo.inc"
64 #include "maxchannels.h"
65 #include "mutex.inc"
66 #include "mwindow.inc"
67 #include "mwindowgui.inc"
68 #include "new.inc"
69 #include "patchbay.inc"
70 #include "playback3d.inc"
71 #include "playbackengine.inc"
72 #include "plugin.inc"
73 #include "pluginfclient.inc"
74 #include "pluginserver.inc"
75 #include "pluginset.inc"
76 #include "preferences.inc"
77 #include "preferencesthread.inc"
78 #include "record.inc"
79 #include "recordlabel.inc"
80 #include "render.inc"
81 #include "sharedlocation.inc"
82 #include "sighandler.inc"
83 #include "splashgui.inc"
84 #include "theme.inc"
85 #include "thread.h"
86 #include "threadloader.inc"
87 #include "timebar.inc"
88 #include "timebomb.h"
89 #include "tipwindow.inc"
90 #include "track.inc"
91 #include "tracking.inc"
92 #include "tracks.inc"
93 #include "transition.inc"
94 #include "transportque.inc"
95 #include "videowindow.inc"
96 #include "vpatchgui.h"
97 #include "vwindow.inc"
98 #include "wwindow.inc"
99 #include "wavecache.inc"
100
101 #define FONT_SEARCHPATH "fonts"
102
103 // All entry points for commands except for window locking should be here.
104 // This allows scriptability.
105
106 class MWindow : public Thread
107 {
108 public:
109         MWindow();
110         ~MWindow();
111
112 // ======================================== initialization commands
113         void create_objects(int want_gui,
114                 int want_new,
115                 char *config_path);
116         void show_splash();
117         void hide_splash();
118         void start();
119         void run();
120
121         int run_script(FileXML *script);
122         int new_project();
123         int delete_project(int flash = 1);
124         void quit();
125         int restart() { return restart_status; }
126
127         int load_defaults();
128         int save_defaults();
129         int set_filename(const char *filename);
130 // Total vertical pixels in timeline
131         int get_tracks_height();
132 // Total horizontal pixels in timeline
133         int get_tracks_width();
134 // Show windows
135         void show_vwindow();
136         void show_awindow();
137         void show_lwindow();
138         void show_cwindow();
139         void show_gwindow();
140         void hide_gwindow();
141         int tile_windows(int window_config);
142         char *get_cwindow_display();
143 //      void set_titles(int value);
144         void set_screens(int value);
145         int asset_to_edl(EDL *new_edl,
146                 Asset *new_asset,
147                 RecordLabels *labels = 0);
148 // Convert nested_edl to a nested EDL in new_edl
149 // suitable for pasting in paste_edls
150         int edl_to_nested(EDL *new_edl,
151                 EDL *nested_edl);
152
153 // Entry point to insert assets and insert edls.  Called by TrackCanvas
154 // and AssetPopup when assets are dragged in from AWindow.
155 // Takes the drag vectors from MainSession and
156 // pastes either assets or clips depending on which is full.
157 // Returns 1 if the vectors were full
158         int paste_assets(double position, Track *dest_track, int overwrite);
159
160 // Insert the assets at a point in the EDL.  Called by menueffects,
161 // render, and CWindow drop but recording calls paste_edls directly for
162 // labels.
163         void load_assets(ArrayList<Indexable*> *new_assets,
164                 double position,
165                 int load_mode,
166                 Track *first_track /* = 0 */,
167                 RecordLabels *labels /* = 0 */,
168                 int edit_labels,
169                 int edit_plugins,
170                 int edit_autos,
171                 int overwrite);
172         int paste_edls(ArrayList<EDL*> *new_edls,
173                 int load_mode,
174                 Track *first_track /* = 0 */,
175                 double current_position /* = -1 */,
176                 int edit_labels,
177                 int edit_plugins,
178                 int edit_autos,
179                 int overwrite);
180 // Reset everything for a load
181         void update_project(int load_mode);
182 // Fit selected time to horizontal display range
183         void fit_selection();
184 // Fit selected autos to the vertical display range
185         void fit_autos(int doall);
186         void change_currentautorange(int autogrouptype, int increment, int changemax);
187         void expand_autos(int changeall, int domin, int domax);
188         void shrink_autos(int changeall, int domin, int domax);
189 // move the window to include the cursor
190         void find_cursor();
191 // Search plugindb and put results in argument
192         static void search_plugindb(int do_audio,
193                 int do_video,
194                 int is_realtime,
195                 int is_transition,
196                 int is_theme,
197                 ArrayList<PluginServer*> &results);
198 // Find the plugin whose title matches title and return it
199         static PluginServer* scan_plugindb(char *title,
200                 int data_type);
201         static int plugin_exists(const char *plugin_path, ArrayList<PluginServer*> &plugins);
202         static int plugin_exists(char *plugin_path);
203         void dump_plugindb(FILE *fp);
204         void stop_playback(int wait=0);
205
206
207
208
209         int load_filenames(ArrayList<char*> *filenames,
210                 int load_mode = LOADMODE_REPLACE,
211 // Cause the project filename on the top of the window to be updated.
212 // Not wanted for loading backups.
213                 int update_filename = 1);
214
215
216 // Print out plugins which are referenced in the EDL but not loaded.
217         void test_plugins(EDL *new_edl, char *path);
218
219         int interrupt_indexes();  // Stop index building
220
221         int redraw_time_dependancies();     // after reconfiguring the time format, sample rate, frame rate
222
223 // =========================================== movement
224
225         void next_time_format();
226         void prev_time_format();
227         void time_format_common();
228         int reposition_timebar(int new_pixel, int new_height);
229         int expand_sample();
230         int zoom_in_sample();
231         int zoom_sample(int64_t zoom_sample);
232         void zoom_autos(float min, float max);
233         void zoom_amp(int64_t zoom_amp);
234         void zoom_track(int64_t zoom_track);
235         int fit_sample();
236         int move_left(int64_t distance = 0);
237         int move_right(int64_t distance = 0);
238         void move_up(int64_t distance = 0);
239         void move_down(int64_t distance = 0);
240
241 // seek to labels
242 // shift_down must be passed by the caller because different windows call
243 // into this
244         int next_label(int shift_down);
245         int prev_label(int shift_down);
246 // seek to edit handles
247         int next_edit_handle(int shift_down);
248         int prev_edit_handle(int shift_down);
249 // offset is pixels to add to track_start
250         void trackmovement(int offset, int pane_number);
251 // view_start is pixels
252         int samplemovement(int64_t view_start, int pane_number);
253         void select_all();
254         int goto_start();
255         int goto_end();
256         int goto_position(double position);
257         int expand_y();
258         int zoom_in_y();
259         int expand_t();
260         int zoom_in_t();
261         void split_x();
262         void split_y();
263         void crop_video();
264         void update_plugins();
265 // Call after every edit operation
266         void save_backup();
267         void load_backup();
268         void show_plugin(Plugin *plugin);
269         void hide_plugin(Plugin *plugin, int lock);
270         void hide_plugins();
271         void delete_plugin(PluginServer *plugin);
272 // Update plugins with configuration changes.
273 // Called by TrackCanvas::cursor_motion_event.
274         void update_plugin_guis(int do_keyframe_guis = 1);
275         void update_plugin_states();
276         void update_plugin_titles();
277 // Called by Attachmentpoint during playback.
278 // Searches for matching plugin and renders data in it.
279         void render_plugin_gui(void *data, Plugin *plugin);
280         void render_plugin_gui(void *data, int size, Plugin *plugin);
281
282 // Called from PluginVClient::process_buffer
283 // Returns 1 if a GUI for the plugin is open so OpenGL routines can determine if
284 // they can run.
285         int plugin_gui_open(Plugin *plugin);
286
287         void show_keyframe_gui(Plugin *plugin);
288         void hide_keyframe_guis();
289         void hide_keyframe_gui(Plugin *plugin);
290         void update_keyframe_guis();
291
292
293 // ============================= editing commands ========================
294
295 // Map each recordable audio track to the desired pattern
296         void map_audio(int pattern);
297         void remap_audio(int pattern);
298         enum
299         {
300                 AUDIO_5_1_TO_2,
301                 AUDIO_1_TO_1
302         };
303         void add_audio_track_entry(int above, Track *dst);
304         int add_audio_track(int above, Track *dst);
305         void add_clip_to_edl(EDL *edl);
306         void add_video_track_entry(Track *dst = 0);
307         int add_video_track(int above, Track *dst);
308         void add_subttl_track_entry(Track *dst = 0);
309         int add_subttl_track(int above, Track *dst);
310
311         void asset_to_all();
312         void asset_to_size();
313         void asset_to_rate();
314 // Entry point for clear operations.
315         void clear_entry();
316 // Clears active region in EDL.
317 // If clear_handle, edit boundaries are cleared if the range is 0.
318 // Called by paste, record, menueffects, render, and CWindow drop.
319         void clear(int clear_handle);
320         void clear_labels();
321         int clear_labels(double start, double end);
322         void concatenate_tracks();
323         void copy();
324         int copy(double start, double end);
325         void cut();
326         void cut(double start, double end, double new_position=-1);
327 // snap off edit from current position to handle/label
328         void snap_left_edit();
329         void snap_right_edit();
330         void snap_left_label();
331         void snap_right_label();
332
333 // Calculate aspect ratio from pixel counts
334         static int create_aspect_ratio(float &w, float &h, int width, int height);
335 // Calculate defaults path
336         static void create_defaults_path(char *string, const char *config_file);
337
338         void delete_folder(char *folder);
339         void delete_inpoint();
340         void delete_outpoint();
341
342         void delete_track();
343         void delete_track(Track *track);
344         void delete_tracks();
345         int feather_edits(int64_t feather_samples, int audio, int video);
346         int64_t get_feather(int audio, int video);
347         float get_aspect_ratio();
348         void insert(double position,
349                 FileXML *file,
350                 int edit_labels,
351                 int edit_plugins,
352                 int edit_autos,
353                 EDL *parent_edl /* = 0 */);
354
355 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
356 // into pluginset_highlighted.
357         void insert_effects_canvas(double start,
358                 double length);
359
360 // CWindow calls this to insert multiple effects from
361 // the drag_pluginservers array.
362         void insert_effects_cwindow(Track *dest_track);
363
364 // Attach new effect to all recordable tracks
365 // single_standalone - attach 1 standalone on the first track and share it with
366 // other tracks
367         void insert_effect(char *title,
368                 SharedLocation *shared_location,
369                 int data_type,
370                 int plugin_type,
371                 int single_standalone);
372
373 // This is called multiple times by the above functions.
374 // It can't sync parameters.
375         void insert_effect(char *title,
376                 SharedLocation *shared_location,
377                 Track *track,
378                 PluginSet *plugin_set,
379                 double start,
380                 double length,
381                 int plugin_type);
382
383         void match_output_size(Track *track);
384 // Move edit to new position
385         void move_edits(ArrayList<Edit*> *edits,
386                 Track *track,
387                 double position,
388                 int behaviour);       // behaviour: 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
389 // Move effect to position
390         void move_effect(Plugin *plugin,
391                 Track *track,
392                 int64_t position);
393         void move_effect(Plugin *plugin,
394                 PluginSet *plugin_set,
395                 int64_t position);
396         void move_plugins_up(PluginSet *plugin_set);
397         void move_plugins_down(PluginSet *plugin_set);
398         void move_track_down(Track *track);
399         void move_tracks_down();
400         void move_track_up(Track *track);
401         void move_tracks_up();
402         void mute_selection();
403         void new_folder(const char *new_folder);
404         void overwrite(EDL *source);
405 // For clipboard commands
406         void paste();
407 // For splice and overwrite
408         int paste(double start,
409                 double end,
410                 FileXML *file,
411                 int edit_labels,
412                 int edit_plugins,
413                 int edit_autos);
414         int paste_output(int64_t startproject,
415                                 int64_t endproject,
416                                 int64_t startsource_sample,
417                                 int64_t endsource_sample,
418                                 int64_t startsource_frame,
419                                 int64_t endsource_frame,
420                                 Asset *asset,
421                                 RecordLabels *new_labels);
422         void paste_silence();
423
424 // Detach single transition
425         void detach_transition(Transition *transition);
426 // Detach all transitions in selection
427         void detach_transitions();
428 // Attach dragged transition
429         void paste_transition();
430 // Attach transition to all edits in selection
431         void paste_transitions(int track_type, char *title);
432 // Attach transition dragged onto CWindow
433         void paste_transition_cwindow(Track *dest_track);
434 // Attach default transition to single edit
435         void paste_audio_transition();
436         void paste_video_transition();
437         void shuffle_edits();
438         void reverse_edits();
439         void align_edits();
440         void set_edit_length(double length);
441 // Set length of single transition
442         void set_transition_length(Transition *transition, double length);
443 // Set length in seconds of all transitions in active range
444         void set_transition_length(double length);
445
446         void remove_indexfile(Indexable *indexable);
447         void rebuild_indices();
448 // Asset removal from caches
449         void reset_caches();
450         void remove_asset_from_caches(Asset *asset);
451         void remove_assets_from_project(int push_undo /* = 0 */,
452                 int redraw /* 1 */,
453                 ArrayList<Indexable*> *drag_assets /* mwindow->session->drag_assets */,
454                 ArrayList<EDL*> *drag_clips /* mwindow->session->drag_clips */);
455         void remove_assets_from_disk();
456         void resize_track(Track *track, int w, int h);
457
458         void set_automation_mode(int mode);
459         void set_keyframe_type(int mode);
460         void set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow);
461         void set_auto_visibility(Autos *autos, int value);
462         void set_labels_follow_edits(int value);
463
464 // Update the editing mode
465         int set_editing_mode(int new_editing_mode, int lock_mwindow, int lock_cwindow);
466         void toggle_editing_mode();
467         void set_inpoint(int is_mwindow);
468         void set_outpoint(int is_mwindow);
469         void splice(EDL *source);
470         void toggle_loop_playback();
471         void trim_selection();
472 // Synchronize EDL settings with all playback engines depending on current
473 // operation.  Doesn't redraw anything.
474         void sync_parameters(int change_type = CHANGE_PARAMS);
475         void save_clip(EDL *new_edl, const char *txt);
476         void to_clip(EDL *edl, const char *txt);
477         int toggle_label(int is_mwindow);
478         void undo_entry(BC_WindowBase *calling_window_gui);
479         void redo_entry(BC_WindowBase *calling_window_gui);
480
481
482         int cut_automation();
483         int copy_automation();
484         int paste_automation();
485         void clear_automation();
486         int cut_default_keyframe();
487         int copy_default_keyframe();
488 // Use paste_automation to paste the default keyframe in other position.
489 // Use paste_default_keyframe to replace the default keyframe with whatever is
490 // in the clipboard.
491         int paste_default_keyframe();
492         int clear_default_keyframe();
493
494         FloatAuto* get_float_auto(PatchGUI *patch,int idx);
495         IntAuto* get_int_auto(PatchGUI *patch,int idx);
496         PanAuto* get_pan_auto(PatchGUI *patch);
497
498         int modify_edithandles();
499         int modify_pluginhandles();
500         void finish_modify_handles();
501         void set_proxy(int use_scaler, int new_scale, int auto_scale,
502                 ArrayList<Indexable*> *orig_assets,
503                 ArrayList<Indexable*> *proxy_assets);
504         void add_proxy(int use_scaler,
505                 ArrayList<Indexable*> *orig_assets,
506                 ArrayList<Indexable*> *proxy_assets);
507         void render_proxy(ArrayList<Indexable *> &new_idxbls);
508
509         void dump_plugins(FILE *fp=stdout);
510         void dump_edl(FILE *fp=stdout);
511         void dump_undo(FILE *fp=stdout);
512         void dump_exe(FILE *fp=stdout);
513         static void trap_hook(FILE *fp, void *vp);
514
515         void reset_android_remote();
516
517 // Send new EDL to caches
518         void age_caches();
519         int optimize_assets();            // delete unused assets from the cache and assets
520
521         void select_point(double position);
522         int set_loop_boundaries();         // toggle loop playback and set boundaries for loop playback
523
524
525         Playback3D *playback_3d;
526         SplashGUI *splash_window;
527
528 // Main undo stack
529         MainUndo *undo;
530         BC_Hash *defaults;
531         Assets *assets;
532 // CICaches for drawing timeline only
533         CICache *audio_cache, *video_cache;
534 // Frame cache for drawing timeline only.
535 // Cache drawing doesn't wait for file decoding.
536         FrameCache *frame_cache;
537         WaveCache *wave_cache;
538         Preferences *preferences;
539         PreferencesThread *preferences_thread;
540         MainSession *session;
541         Theme *theme;
542         MainIndexes *mainindexes;
543         MainProgress *mainprogress;
544         BRender *brender;
545         char cin_lang[4];
546         int brender_active;
547         const char *default_standard;
548         static Commercials *commercials;
549         int commercial_active;
550         int has_commercials();
551
552 // Menu items
553         ArrayList<ColormodelItem*> colormodels;
554         ArrayList<InterlacemodeItem*>          interlace_project_modes;
555         ArrayList<InterlacemodeItem*>          interlace_asset_modes;
556         ArrayList<InterlacefixmethodItem*>     interlace_asset_fixmethods;
557
558         int reset_meters();
559         void resync_guis();
560
561         int select_asset(Asset *asset, int vstream, int astream, int delete_tracks);
562         int select_asset(int vtrack, int delete_tracks);
563
564 // Channel DB for playback only.  Record channel DB's are in record.C
565         ChannelDB *channeldb_buz;
566         ChannelDB *channeldb_v4l2jpeg;
567
568 // ====================================== plugins ==============================
569
570 // Contains file descriptors for all the dlopens
571         static ArrayList<PluginServer*> *plugindb;
572 // Currently visible plugins
573         int64_t plugin_visibility;
574         ArrayList<PluginServer*> *plugin_guis;
575 // GUI Plugins to delete
576         ArrayList<PluginServer*> *dead_plugins;
577 // Keyframe editors
578         ArrayList<KeyFrameThread*> *keyframe_threads;
579
580 // Adjust sample position to line up with frames.
581         int fix_timing(int64_t &samples_out,
582                 int64_t &frames_out,
583                 int64_t samples_in);
584
585
586         CreateBD_Thread *create_bd;
587         CreateDVD_Thread *create_dvd;
588         BatchRenderThread *batch_render;
589         Render *render;
590
591         ExportEDL *exportedl;
592
593
594 // Master edl
595         EDL *edl;
596 // Main Window GUI
597         MWindowGUI *gui;
598 // Compositor
599         CWindow *cwindow;
600 // Viewer
601         Mutex *vwindows_lock;
602         ArrayList<VWindow*> vwindows;
603 // Asset manager
604         AWindow *awindow;
605 // Automation window
606         GWindow *gwindow;
607 // Tip of the day
608         TipWindow *twindow;
609 // Warning window
610         WWindow *wwindow;
611         void show_warning(int *do_warning, const char *text);
612         int wait_warning();
613 // Levels
614         LevelWindow *lwindow;
615         Mutex *run_lock;
616 // Lock during creation and destruction of GUI
617         Mutex *plugin_gui_lock;
618         Mutex *dead_plugin_lock;
619         Mutex *keyframe_gui_lock;
620 // Lock during creation and destruction of brender so playback doesn't use it.
621         Mutex *brender_lock;
622
623 // Initialize shared memory
624         void init_shm();
625
626 // Initialize channel DB's for playback
627         void init_channeldb();
628         void init_render();
629         void init_exportedl();
630 // These three happen synchronously with each other
631 // Make sure this is called after synchronizing EDL's.
632         void init_brender();
633 // Restart brender after testing its existence
634         void restart_brender();
635 // Stops brender after testing its existence
636         void stop_brender();
637 // This one happens asynchronously of the others.  Used by playback to
638 // see what frame is background rendered.
639         int brender_available(int position);
640         void set_brender_active(int v, int update=1);
641         int put_commercial();
642         void activate_commercial() { commercial_active = 1; }
643         void commit_commercial();
644         void undo_commercial();
645         void cut_commercials();
646         int paste_subtitle_text(char *text, double start, double end);
647
648         void init_error();
649         void finit_error();
650         static void init_defaults(BC_Hash* &defaults, char *config_path);
651         void check_language();
652         const char *default_std();
653         void fill_preset_defaults(const char *preset, EDLSession *session);
654         const char *get_preset_name(int index);
655         void init_edl();
656         void init_awindow();
657         void init_gwindow();
658         void init_tipwindow();
659 // Used by MWindow and RenderFarmClient
660         static void get_plugin_path(char *path, const char *plug_dir, const char *fs_path);
661         static int init_plugins(MWindow *mwindow, Preferences *preferences);
662         static int init_ladspa_plugins(MWindow *mwindow, Preferences *preferences);
663         static void init_plugin_tips(ArrayList<PluginServer*> &plugins, const char *lang);
664         static int check_plugin_index(ArrayList<PluginServer*> &plugins,
665                 const char *plug_dir, const char *plug_path);
666         static void init_plugin_index(MWindow *mwindow, Preferences *preferences,
667                 FILE *fp, const char *plugin_dir);
668         static int init_ladspa_index(MWindow *mwindow, Preferences *preferences,
669                 const char *index_path, const char *plugin_dir);
670         static void scan_plugin_index(MWindow *mwindow, Preferences *preferences,
671                 FILE *fp, const char *plug_dir, const char *plug_path, int &idx);
672         static void init_ffmpeg();
673         static void init_ffmpeg_index(MWindow *mwindow, Preferences *preferences, FILE *fp);
674         static int load_plugin_index(MWindow *mwindow, const char *index_path,
675                 const char *plugin_dir);
676         static PluginServer* new_ffmpeg_server(MWindow *mwindow, const char *name);
677         void init_preferences();
678         void init_signals();
679         void init_theme();
680         void init_compositor();
681         void init_levelwindow();
682 // Called when creating a new viewer to view footage
683         VWindow* get_viewer(int start_it, int idx=-1);
684         void init_cache();
685         void init_menus();
686         void init_indexes();
687         void init_gui();
688         void init_3d();
689         void init_playbackcursor();
690         void init_commercials();
691         static void add_plugins(ArrayList<PluginServer*> &plugins);
692         static void delete_plugins();
693 //
694         void clean_indexes();
695 //      TimeBomb timebomb;
696         SigHandler *sighandler;
697         int restart_status;
698         int screens;
699         int in_destructor;
700 };
701
702 #endif