add Autosave continuous backups by Andras Reuss and Andrew-R
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / packagedispatcher.h
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 #ifndef PACKAGEDISPATCHER_H
23 #define PACKAGEDISPATCHER_H
24
25
26 #include "arraylist.h"
27 #include "assets.inc"
28 #include "edl.inc"
29 #include "mutex.inc"
30 #include "mwindow.inc"
31 #include "packagerenderer.inc"
32 #include "preferences.inc"
33 #include "packagingengine.h"
34
35
36
37 // Allocates fragments given a total start and total end.
38 // Checks the existence of every file.
39 // Adjusts package size for load.
40 class PackageDispatcher
41 {
42 public:
43         PackageDispatcher();
44         ~PackageDispatcher();
45
46         int create_packages(MWindow *mwindow,
47                 EDL *edl,
48                 Preferences *preferences,
49                 int strategy,
50                 Asset *default_asset,
51                 double total_start,
52                 double total_end,
53                 int test_overwrite);
54 // Supply a frame rate of the calling node.  If the client number is -1
55 // the frame rate isn't added to the preferences table.
56         RenderPackage* get_package(double frames_per_second,
57                 int client_number,
58                 int use_local_rate);
59 // Return a new path list of what was rendered.
60         void get_package_paths(ArrayList<char*> *path_list);
61 // Return a new asset list of what was rendered.
62         int get_asset_list(ArrayList<Indexable*> &idxbls);
63
64         RenderPackage* get_package(int number);
65         int get_total_packages();
66         int64_t get_progress_max();
67         int packages_are_done();
68
69 private:
70         EDL *edl;
71         int64_t audio_position;
72         int64_t video_position;
73         int64_t audio_end;
74         int64_t video_end;
75         double total_start;
76         double total_end;
77         double total_len;
78         int strategy;
79         Asset *default_asset;
80         Preferences *preferences;
81         int current_number;    // The number being injected into the filename.
82         int number_start;      // Character in the filename path at which the number begins
83         int total_digits;      // Total number of digits including padding the user specified.
84         double package_len;    // Target length of a single package
85         double min_package_len; // Minimum package length after load balancing
86         int64_t total_packages;   // Total packages to base calculations on
87         int64_t total_allocated;  // Total packages to test the existence of
88         int nodes;
89         MWindow *mwindow;
90         RenderPackage **packages;
91         int current_package;
92         Mutex *package_lock;
93
94         PackagingEngine *packaging_engine;
95 };
96
97
98 #endif
99
100