r969: Render format selector: Do not change the path name when the format is changed.
[cinelerra_cv/ct.git] / cinelerra / asset.h
blob8e3fd4940fe5b96a5b2c7fdbc983cff2c3975492
1 #ifndef ASSET_H
2 #define ASSET_H
5 #include "arraylist.h"
6 #include "bcwindowbase.inc"
7 #include "bchash.inc"
8 #include "filexml.inc"
9 #include "garbage.h"
10 #include "linklist.h"
11 #include "pluginserver.inc"
14 #include <stdint.h>
16 // Time code formats
17 #define TC_DROPFRAME 0
18 #define TC_NONDROPFRAME 1
19 #define TC_PAL 2
20 #define TC_FILM 3
22 // Asset can be one of the following:
23 // 1) a pure media file
24 // 2) an EDL
25 // 3) a log
26 // The EDL can reference itself if it contains a media file
27 class Asset : public ListItem<Asset>, public GarbageObject
29 public:
30 Asset();
31 Asset(Asset &asset);
32 Asset(const char *path);
33 Asset(const int plugin_type, const char *plugin_path);
34 ~Asset();
36 int init_values();
37 int dump();
39 void copy_from(Asset *asset, int do_index);
40 void copy_location(Asset *asset);
41 void copy_format(Asset *asset, int do_index = 1);
42 void copy_index(Asset *asset);
43 int64_t get_index_offset(int channel);
44 int64_t get_index_size(int channel);
45 // Get an english description of the compression. Used by AssetEdit
46 char* get_compression_text(int audio, int video);
48 // Load and save parameters for a render dialog
49 // Used by render, record, menueffects, preferences
50 void load_defaults(BC_Hash *defaults,
51 char *prefix /* = 0 */,
52 int do_format /* = 0 */,
53 int do_compression,
54 int do_path,
55 int do_data_types,
56 int do_bits);
57 void save_defaults(BC_Hash *defaults,
58 char *prefix /* = 0 */,
59 int do_format, /* Don't save format which is autodetected by file loader */
60 int do_compression, /* Don't save compression which is fixed by driver */
61 int do_path,
62 int do_data_types,
63 int do_bits);
64 char* construct_param(char *param, char *prefix, char *return_value);
66 // defaults which are specific to format used
67 void load_format_defaults(BC_Hash *defaults);
68 void save_format_defaults(BC_Hash *defaults);
70 // Executed during index building only
71 void update_index(Asset *asset);
72 int equivalent(Asset &asset,
73 int test_audio,
74 int test_video);
75 Asset& operator=(Asset &asset);
76 int operator==(Asset &asset);
77 int operator!=(Asset &asset);
78 int test_path(const char *path);
79 int test_plugin_title(const char *path);
80 int read(FileXML *file, int expand_relative = 1);
81 int read_audio(FileXML *xml);
82 int read_video(FileXML *xml);
83 int read_index(FileXML *xml);
84 int reset_index(); // When the index file is wrong, reset the asset values
86 int set_timecode(char *tc, int format, int end);
87 int reset_timecode();
89 // Output path is the path of the output file if name truncation is desired.
90 // It is a "" if; complete names should be used.
91 int write(FileXML *file,
92 int include_index,
93 char *output_path);
94 // Write the index data and asset info. Used by IndexThread.
95 int write_index(char *path, int data_bytes);
98 // Necessary for renderfarm to get encoding parameters
99 int write_audio(FileXML *xml);
100 int write_video(FileXML *xml);
101 int write_index(FileXML *xml);
102 int update_path(char *new_path);
104 double total_length_framealigned(double fps);
106 // Path to file
107 char path[BCTEXTLEN];
109 // Pipe command
110 char pipe[BCTEXTLEN];
111 int use_pipe;
113 // Prefix used to generate this asset
114 char prefix[BCTEXTLEN];
116 // Folder in resource manager
117 char folder[BCTEXTLEN];
119 // Format of file. An enumeration from file.inc.
120 int format;
122 // contains audio data
123 int audio_data;
124 int channels;
125 int sample_rate;
126 int bits;
127 int byte_order;
128 int signed_;
129 int header;
130 int dither;
131 // String or FourCC describing compression
132 char acodec[BCTEXTLEN];
135 int64_t audio_length;
148 // contains video data
149 int video_data;
150 int layers;
151 double frame_rate;
153 // Timecode information. User setable, in case of errors in source
154 char reel_name[BCTEXTLEN];
155 int reel_number;
156 int64_t tcstart;
157 int64_t tcend;
158 int tcformat;
160 int width, height;
161 // String or FourCC describing compression
162 char vcodec[BCTEXTLEN];
164 // Length in units of asset
165 int64_t video_length;
171 // mpeg audio information
172 int ampeg_bitrate;
173 // 2 - 3
174 int ampeg_derivative;
176 // Vorbis compression
177 int vorbis_min_bitrate;
178 int vorbis_bitrate;
179 int vorbis_max_bitrate;
180 int vorbis_vbr;
182 // Theora compression
183 int theora_fix_bitrate;
184 int theora_bitrate;
185 int theora_quality;
186 int theora_sharpness;
187 int theora_keyframe_frequency;
188 int theora_keyframe_force_frequency;
191 // mp3 compression
192 int mp3_bitrate;
194 // mp4a compression
195 int mp4a_bitrate;
196 int mp4a_quantqual;
199 // Set by package render during file creation. -1 means square pixels.
200 double aspect_ratio;
202 // for the interlace mode
203 int interlace_autofixoption;
204 int interlace_mode;
205 int interlace_fixmethod;
207 // for jpeg compression
208 int jpeg_quality;
210 // for mpeg video compression
211 int vmpeg_iframe_distance;
212 int vmpeg_progressive;
213 int vmpeg_denoise;
214 int vmpeg_seq_codes;
215 int vmpeg_bitrate;
216 // 1 - 2
217 int vmpeg_derivative;
218 int vmpeg_quantization;
219 int vmpeg_cmodel;
220 int vmpeg_fix_bitrate;
222 // mjpegtools
223 int vmpeg_preset;
224 // top field first
225 int vmpeg_field_order;
226 int vmpeg_pframe_distance;
235 // Divx video compression
236 int divx_bitrate;
237 int divx_rc_period;
238 int divx_rc_reaction_ratio;
239 int divx_rc_reaction_period;
240 int divx_max_key_interval;
241 int divx_max_quantizer;
242 int divx_min_quantizer;
243 int divx_quantizer;
244 int divx_quality;
245 int divx_fix_bitrate;
247 // h264 video compression
248 int h264_bitrate;
249 int h264_quantizer;
250 int h264_fix_bitrate;
252 // Divx video decompression
253 int divx_use_deblocking;
255 // PNG video compression
256 int png_use_alpha;
258 // EXR video compression
259 int exr_use_alpha;
260 int exr_compression;
262 // TIFF video compression. An enumeration from filetiff.h
263 int tiff_cmodel;
264 int tiff_compression;
266 // Microsoft MPEG-4
267 int ms_bitrate;
268 int ms_bitrate_tolerance;
269 int ms_interlaced;
270 int ms_quantization;
271 int ms_gop_size;
272 int ms_fix_bitrate;
275 int ac3_bitrate;
279 // Image file sequences. Background rendering doesn't want to write a
280 // sequence header but instead wants to start the sequence numbering at a certain
281 // number. This ensures deletion of all the frames which aren't being used.
282 // We still want sequence headers sometimes because loading a directory full of images
283 // for editing would create new assets for every image.
284 int use_header;
288 // Edits store data for the transition
290 // index info
291 int index_status; // Macro from assets.inc
292 int64_t index_zoom; // zoom factor of index data
293 int64_t index_start; // byte start of index data in the index file
294 // Total bytes in source file when the index was buillt
295 int64_t index_bytes;
296 int64_t index_end, old_index_end; // values for index build
297 // offsets of channels in index buffer in floats
298 int64_t *index_offsets;
299 // Sizes of channels in index buffer in floats. This allows
300 // variable channel size.
301 int64_t *index_sizes;
302 // [ index channel ][ index channel ]
303 // [high][low][high][low][high][low][high][low]
304 float *index_buffer;
305 int id;
309 #endif