batchrender asset path fix, ru xlat, fixup hevc/h265 opts, expand new bg pngs
[goodguy/history.git] / cinelerra-5.1 / cinelerra / asset.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2010 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 ASSET_H
22 #define ASSET_H
23
24 #include <stdio.h>
25 #include <stdint.h>
26
27 #include "arraylist.h"
28 #include "bcwindowbase.inc"
29 #include "bchash.inc"
30 #include "edl.inc"
31 #include "filexml.inc"
32 #include "indexable.h"
33 #include "indexfile.inc"
34 #include "indexstate.inc"
35 #include "linklist.h"
36 #include "pluginserver.inc"
37
38
39 // Time code formats
40 #define TC_DROPFRAME 0
41 #define TC_NONDROPFRAME 1
42 #define TC_PAL 2
43 #define TC_FILM 3
44
45 class Asset : public Indexable, public ListItem<Asset>
46 {
47 public:
48         Asset();
49         Asset(Asset &asset);
50         Asset(const char *path);
51         Asset(const int plugin_type, const char *plugin_path);
52         ~Asset();
53
54         int init_values();
55         int dump(FILE *fp=stdout);
56         void boundaries();
57
58         void copy_from(Asset *asset, int do_index);
59         void copy_location(Asset *asset);
60         void copy_format(Asset *asset, int do_index = 1);
61         void copy_index(Asset *asset);
62         int64_t get_index_offset(int channel);
63         int64_t get_index_size(int channel);
64 // Get an english description of the compression.  Used by AssetEdit
65         char* get_compression_text(int audio, int video);
66
67 // Load and save parameters for a render dialog
68 // Used by render, record, menueffects, preferences
69         void load_defaults(BC_Hash *defaults,
70                 const char *prefix /* = 0 */,
71                 int do_format /* = 0 */,
72                 int do_compression,
73                 int do_path,
74                 int do_data_types,
75                 int do_bits);
76         void save_defaults(BC_Hash *defaults,
77                 const char *prefix /* = 0 */,
78                 int do_format,     /* Don't save format which is autodetected by file loader */
79                 int do_compression,    /* Don't save compression which is fixed by driver */
80                 int do_path,
81                 int do_data_types,
82                 int do_bits);
83         char* construct_param(const char *param, const char *prefix, char *return_value);
84
85
86
87
88 // Executed during index building only
89         int equivalent(Asset &asset, int test_audio, int test_video, EDL *edl=0);
90 // Return 1 if the paths match
91         int test_path(const char *path);
92         int read(FileXML *file,
93                 int expand_relative = 1);
94         int read_audio(FileXML *xml);
95         int read_video(FileXML *xml);
96         int read_index(FileXML *xml);
97         void reset_audio();
98         void reset_video();
99         int set_timecode(char *tc, int format, int end);
100         int reset_timecode();
101
102 // Output path is the path of the output file if name truncation is desired.
103 // It is a "" if; complete names should be used.
104         int write(FileXML *file, int include_index, const char *output_path);
105
106 // For Indexable
107         int get_audio_channels();
108         int get_sample_rate();
109         int64_t get_audio_samples();
110         int have_audio();
111         int have_video();
112         int get_w();
113         int get_h();
114         double get_frame_rate();
115         int get_video_layers();
116         int64_t get_video_frames();
117         int get_program();
118         void write_index(char *path, int data_bytes);
119
120 // Necessary for renderfarm to get encoding parameters
121         int write_audio(FileXML *xml);
122         int write_video(FileXML *xml);
123         int write_index(FileXML *xml);
124
125         double total_length_framealigned(double fps);
126
127 // Format of file.  An enumeration from file.inc.
128         int format;
129
130 // contains audio data
131         int audio_data;
132         int channels;
133         int sample_rate;
134         int bits;
135         int byte_order;
136         int signed_;
137         int header;
138         int dither;
139 // String or FourCC describing compression
140         char acodec[BCTEXTLEN];
141
142         int64_t audio_length;
143
144 // contains video data, single frame data set
145         int video_data, single_frame;
146         int layers, program;
147         double frame_rate;
148
149 // Timecode information. User setable, in case of errors in source
150         char reel_name[BCTEXTLEN];
151         int reel_number;
152         int64_t tcstart;
153         int64_t tcend;
154         int tcformat;
155
156         int actual_width, actual_height;
157         int width, height;
158 // String or FourCC describing compression
159         char vcodec[BCTEXTLEN];
160
161 // Length in frames
162         int64_t video_length;
163
164
165
166 // mp3 compression
167         int mp3_bitrate;
168
169 // mpeg audio information
170         int ampeg_bitrate;
171 // 2 - 3
172         int ampeg_derivative;
173
174 // Vorbis compression
175         int vorbis_min_bitrate;
176         int vorbis_bitrate;
177         int vorbis_max_bitrate;
178         int vorbis_vbr;
179
180 // Theora compression
181         int theora_fix_bitrate;
182         int theora_bitrate;
183         int theora_quality;
184         int theora_sharpness;
185         int theora_keyframe_frequency;
186         int theora_keyframe_force_frequency;
187
188
189 // Set by package render during file creation. -1 means square pixels.
190         double aspect_ratio;
191
192 // for the interlace mode
193         int interlace_autofixoption;
194         int interlace_mode;
195         int interlace_fixmethod;
196 // for jpeg compression
197         int jpeg_quality;
198
199 // for mpeg video compression
200         int vmpeg_iframe_distance;
201         int vmpeg_progressive;
202         int vmpeg_denoise;
203         int vmpeg_seq_codes;
204         int vmpeg_bitrate;
205 // 1 - 2
206         int vmpeg_derivative;
207         int vmpeg_quantization;
208         int vmpeg_cmodel;
209         int vmpeg_fix_bitrate;
210
211 // mjpegtools
212         int vmpeg_preset;
213 // top field first
214         int vmpeg_field_order;
215         int vmpeg_pframe_distance;
216
217 // ffmpeg muxer file extension
218         char fformat[BCSTRLEN];
219         char ff_audio_options[BCTEXTLEN];
220         char ff_video_options[BCTEXTLEN];
221         int ff_audio_bitrate;
222         int ff_video_bitrate;
223         int ff_video_quality;
224
225 // PNG video compression
226         int png_use_alpha;
227
228 // EXR video compression
229         int exr_use_alpha;
230         int exr_compression;
231
232 // TIFF video compression.  An enumeration from filetiff.h
233         int tiff_cmodel;
234         int tiff_compression;
235
236         int ac3_bitrate;
237
238 // Image file sequences.  Background rendering doesn't want to write a
239 // sequence header but instead wants to start the sequence numbering at a certain
240 // number.  This ensures deletion of all the frames which aren't being used.
241 // We still want sequence headers sometimes because loading a directory full of images
242 // for editing would create new assets for every image.
243         int use_header;
244 };
245
246
247 #endif