fix awdw solo vicon crash, fix nested clip for binfolders, open edit edl
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / filelist.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 FILELIST_H
23 #define FILELIST_H
24
25 #include "file.inc"
26 #include "filebase.h"
27 #include "filelist.inc"
28 #include "loadbalance.h"
29 #include "mutex.inc"
30 #include "vframe.inc"
31
32 // Any file which is a list of frames.
33 // FileList handles both frame files and indexes of frame files.
34
35
36
37
38
39
40 class FileList : public FileBase
41 {
42 public:
43         FileList(Asset *asset,
44                 File *file,
45                 const char *list_prefix,
46                 const char *file_extension,
47                 int frame_type,
48                 int list_type);
49         virtual ~FileList();
50
51 // basic commands for every file interpreter
52         int open_file(int rd, int wr);
53         int close_file();
54
55         char* calculate_path(int number, char *string);
56         char* create_path(int number_override);
57         void add_return_value(int amount);
58
59         int read_list_header();
60         virtual int read_frame_header(char *path) { return 1; };
61         int read_frame(VFrame *frame);
62
63 // subclass returns whether the asset format is a list or single file
64         virtual int read_frame(VFrame *frame, VFrame *data) { return 0; };
65         virtual int read_frame(VFrame *frame, char *path) { return 0; };
66         virtual int write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit) { return 0; };
67 // Return 1 if read frame should use the path instead of the compressed data
68         virtual int use_path();
69
70         int write_list_header();
71         int write_frames(VFrame ***frames, int len);
72         VFrame* read_frame(int use_alpha, int use_float);
73         virtual int64_t get_memory_usage();
74 // Get the total writer units for calculating memory usage
75         int get_units();
76 // Get a writer unit for retrieving temporary usage.
77         FrameWriterUnit* get_unit(int number);
78
79         virtual FrameWriterUnit* new_writer_unit(FrameWriter *writer);
80
81 // Temp storage for compressed data
82         VFrame *data;
83 // Storage for single frame
84         VFrame *temp;
85
86 private:
87         int read_raw(VFrame *frame,
88                 float in_x1, float in_y1, float in_x2, float in_y2,
89                 float out_x1, float out_y1, float out_x2, float out_y2,
90                 int alpha, int use_alpha, int use_float, int interpolate);
91         int reset_parameters_derived();
92         ArrayList<char*> path_list;     // List of files
93         const char *list_prefix;
94         const char *file_extension;
95         int frame_type;
96         int list_type;
97         Mutex *table_lock;
98         FrameWriter *writer;
99         int return_value;
100         int first_number;
101         int number_start;
102         int number_digits;
103 };
104
105
106
107
108 class FrameWriterPackage : public LoadPackage
109 {
110 public:
111         FrameWriterPackage();
112         ~FrameWriterPackage();
113
114
115         VFrame *input;
116
117         char *path;
118 };
119
120
121
122
123 class FrameWriterUnit : public LoadClient
124 {
125 public:
126         FrameWriterUnit(FrameWriter *server);
127         virtual ~FrameWriterUnit();
128
129         void process_package(LoadPackage *package);
130
131         FrameWriter *server;
132         VFrame *output;
133 };
134
135
136
137
138
139 class FrameWriter : public LoadServer
140 {
141 public:
142         FrameWriter(FileList *file, int cpus);
143         ~FrameWriter();
144
145         void write_frames(VFrame ***frames, int len);
146         void init_packages();
147         LoadClient* new_client();
148         LoadPackage* new_package();
149
150         FileList *file;
151         VFrame ***frames;
152         int len;
153 };
154
155
156
157
158
159
160
161
162 #endif