no longer need ffmpeg patch0 which was for Termux
[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 can_scale_input() { return 0; }
62         int read_frame(VFrame *frame);
63
64 // subclass returns whether the asset format is a list or single file
65         virtual int read_frame(VFrame *frame, VFrame *data) { return 0; };
66         virtual int read_frame(VFrame *frame, char *path) { return 0; };
67         virtual int write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit) { return 0; };
68 // Return 1 if read frame should use the path instead of the compressed data
69         virtual int use_path();
70
71         int write_list_header();
72         int write_frames(VFrame ***frames, int len);
73         VFrame* read_frame(int use_alpha, int use_float);
74         virtual int64_t get_memory_usage();
75 // Get the total writer units for calculating memory usage
76         int get_units();
77 // Get a writer unit for retrieving temporary usage.
78         FrameWriterUnit* get_unit(int number);
79
80         virtual FrameWriterUnit* new_writer_unit(FrameWriter *writer);
81
82 // Temp storage for compressed data
83         VFrame *data;
84 // Storage for single frame
85         VFrame *temp;
86
87 private:
88         int read_raw(VFrame *frame,
89                 float in_x1, float in_y1, float in_x2, float in_y2,
90                 float out_x1, float out_y1, float out_x2, float out_y2,
91                 int alpha, int use_alpha, int use_float, int interpolate);
92         int reset_parameters_derived();
93         ArrayList<char*> path_list;     // List of files
94         const char *list_prefix;
95         const char *file_extension;
96         int frame_type;
97         int list_type;
98         Mutex *table_lock;
99         FrameWriter *writer;
100         int return_value;
101         int first_number;
102         int number_start;
103         int number_digits;
104 };
105
106
107
108
109 class FrameWriterPackage : public LoadPackage
110 {
111 public:
112         FrameWriterPackage();
113         ~FrameWriterPackage();
114
115
116         VFrame *input;
117
118         char *path;
119 };
120
121
122
123
124 class FrameWriterUnit : public LoadClient
125 {
126 public:
127         FrameWriterUnit(FrameWriter *server);
128         virtual ~FrameWriterUnit();
129
130         void process_package(LoadPackage *package);
131
132         FrameWriter *server;
133         VFrame *output;
134 };
135
136
137
138
139
140 class FrameWriter : public LoadServer
141 {
142 public:
143         FrameWriter(FileList *file, int cpus);
144         ~FrameWriter();
145
146         void write_frames(VFrame ***frames, int len);
147         void init_packages();
148         LoadClient* new_client();
149         LoadPackage* new_package();
150
151         FileList *file;
152         VFrame ***frames;
153         int len;
154 };
155
156
157
158
159
160
161
162
163 #endif