r1053: Add Russian translation.
[cinelerra_cv.git] / cinelerra / asset.h
blob4b0d1fcbc443493efdd2f83e61b2fb3778a2585a
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);
69 // Executed during index building only
70 void update_index(Asset *asset);
71 int equivalent(Asset &asset,
72 int test_audio,
73 int test_video);
74 Asset& operator=(Asset &asset);
75 int operator==(Asset &asset);
76 int operator!=(Asset &asset);
77 int test_path(const char *path);
78 int test_plugin_title(const char *path);
79 int read(FileXML *file, int expand_relative = 1);
80 int read_audio(FileXML *xml);
81 int read_video(FileXML *xml);
82 int read_index(FileXML *xml);
83 int reset_index(); // When the index file is wrong, reset the asset values
85 int set_timecode(char *tc, int format, int end);
86 int reset_timecode();
88 // Output path is the path of the output file if name truncation is desired.
89 // It is a "" if; complete names should be used.
90 int write(FileXML *file,
91 int include_index,
92 char *output_path);
93 // Write the index data and asset info. Used by IndexThread.
94 int write_index(char *path, int data_bytes);
97 // Necessary for renderfarm to get encoding parameters
98 int write_audio(FileXML *xml);
99 int write_video(FileXML *xml);
100 int write_index(FileXML *xml);
101 int update_path(char *new_path);
103 double total_length_framealigned(double fps);
105 // Path to file
106 char path[BCTEXTLEN];
108 // Pipe command
109 char pipe[BCTEXTLEN];
110 int use_pipe;
112 // Folder in resource manager
113 char folder[BCTEXTLEN];
115 // Format of file. An enumeration from file.inc.
116 int format;
118 // contains audio data
119 int audio_data;
120 int channels;
121 int sample_rate;
122 int bits;
123 int byte_order;
124 int signed_;
125 int header;
126 int dither;
127 // String or FourCC describing compression
128 char acodec[BCTEXTLEN];
131 int64_t audio_length;
144 // contains video data
145 int video_data;
146 int layers;
147 double frame_rate;
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;
156 int width, height;
157 // String or FourCC describing compression
158 char vcodec[BCTEXTLEN];
160 // Length in units of asset
161 int64_t video_length;
167 // mpeg audio information
168 int ampeg_bitrate;
169 // 2 - 3
170 int ampeg_derivative;
172 // Vorbis compression
173 int vorbis_min_bitrate;
174 int vorbis_bitrate;
175 int vorbis_max_bitrate;
176 int vorbis_vbr;
178 // Theora compression
179 int theora_fix_bitrate;
180 int theora_bitrate;
181 int theora_quality;
182 int theora_sharpness;
183 int theora_keyframe_frequency;
184 int theora_keyframe_force_frequency;
187 // mp3 compression
188 int mp3_bitrate;
190 // mp4a compression
191 int mp4a_bitrate;
192 int mp4a_quantqual;
195 // Set by package render during file creation. -1 means square pixels.
196 double aspect_ratio;
198 // for the interlace mode
199 int interlace_autofixoption;
200 int interlace_mode;
201 int interlace_fixmethod;
203 // for jpeg compression
204 int jpeg_quality;
206 // for mpeg video compression
207 int vmpeg_iframe_distance;
208 int vmpeg_progressive;
209 int vmpeg_denoise;
210 int vmpeg_seq_codes;
211 int vmpeg_bitrate;
212 // 1 - 2
213 int vmpeg_derivative;
214 int vmpeg_quantization;
215 int vmpeg_cmodel;
216 int vmpeg_fix_bitrate;
218 // mjpegtools
219 int vmpeg_preset;
220 // top field first
221 int vmpeg_field_order;
222 int vmpeg_pframe_distance;
231 // Divx video compression
232 int divx_bitrate;
233 int divx_rc_period;
234 int divx_rc_reaction_ratio;
235 int divx_rc_reaction_period;
236 int divx_max_key_interval;
237 int divx_max_quantizer;
238 int divx_min_quantizer;
239 int divx_quantizer;
240 int divx_quality;
241 int divx_fix_bitrate;
243 // h264 video compression
244 int h264_bitrate;
245 int h264_quantizer;
246 int h264_fix_bitrate;
248 // Divx video decompression
249 int divx_use_deblocking;
251 // PNG video compression
252 int png_use_alpha;
254 // EXR video compression
255 int exr_use_alpha;
256 int exr_compression;
258 // TIFF video compression. An enumeration from filetiff.h
259 int tiff_cmodel;
260 int tiff_compression;
262 // Microsoft MPEG-4
263 int ms_bitrate;
264 int ms_bitrate_tolerance;
265 int ms_interlaced;
266 int ms_quantization;
267 int ms_gop_size;
268 int ms_fix_bitrate;
271 int ac3_bitrate;
275 // Image file sequences. Background rendering doesn't want to write a
276 // sequence header but instead wants to start the sequence numbering at a certain
277 // number. This ensures deletion of all the frames which aren't being used.
278 // We still want sequence headers sometimes because loading a directory full of images
279 // for editing would create new assets for every image.
280 int use_header;
284 // Edits store data for the transition
286 // index info
287 int index_status; // Macro from assets.inc
288 int64_t index_zoom; // zoom factor of index data
289 int64_t index_start; // byte start of index data in the index file
290 // Total bytes in source file when the index was buillt
291 int64_t index_bytes;
292 int64_t index_end, old_index_end; // values for index build
293 // offsets of channels in index buffer in floats
294 int64_t *index_offsets;
295 // Sizes of channels in index buffer in floats. This allows
296 // variable channel size.
297 int64_t *index_sizes;
298 // [ index channel ][ index channel ]
299 // [high][low][high][low][high][low][high][low]
300 float *index_buffer;
301 int id;
305 #endif