r793: Small API addon, so plugins can 'see' camera and projector automation
[cinelerra_cv/mob.git] / cinelerra / asset.h
blobc1e4394f75f40489569fc13603cb8fc95ea8bfa1
1 #ifndef ASSET_H
2 #define ASSET_H
5 #include "arraylist.h"
6 #include "bcwindowbase.inc"
7 #include "defaults.inc"
8 #include "filexml.inc"
9 #include "linklist.h"
10 #include "pluginserver.inc"
13 #include <stdint.h>
15 // Time code formats
16 #define TC_DROPFRAME 0
17 #define TC_NONDROPFRAME 1
18 #define TC_PAL 2
19 #define TC_FILM 3
21 // Asset can be one of the following:
22 // 1) a pure media file
23 // 2) an EDL
24 // 3) a log
25 // The EDL can reference itself if it contains a media file
26 class Asset : public ListItem<Asset>
28 public:
29 Asset();
30 Asset(Asset &asset);
31 Asset(const char *path);
32 Asset(const int plugin_type, const char *plugin_path);
33 ~Asset();
35 int init_values();
36 int dump();
38 void copy_from(Asset *asset, int do_index);
39 void copy_location(Asset *asset);
40 void copy_format(Asset *asset, int do_index = 1);
41 void copy_index(Asset *asset);
42 int64_t get_index_offset(int channel);
43 int64_t get_index_size(int channel);
44 // Get an english description of the compression. Used by AssetEdit
45 char* get_compression_text(int audio, int video);
47 // Load and save parameters for a render dialog
48 // Used by render, record, menueffects, preferences
49 void load_defaults(Defaults *defaults,
50 char *prefix /* = 0 */,
51 int do_format /* = 0 */,
52 int do_compression,
53 int do_path,
54 int do_data_types,
55 int do_bits);
56 void save_defaults(Defaults *defaults,
57 char *prefix /* = 0 */,
58 int do_format, /* Don't save format which is autodetected by file loader */
59 int do_compression, /* Don't save compression which is fixed by driver */
60 int do_path,
61 int do_data_types,
62 int do_bits);
63 char* construct_param(char *param, char *prefix, char *return_value);
65 // defaults which are specific to format used
66 void load_format_defaults(Defaults *defaults);
67 void save_format_defaults(Defaults *defaults);
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 // Path to file
104 char path[BCTEXTLEN];
106 // Pipe command
107 char pipe[BCTEXTLEN];
108 int use_pipe;
110 // Prefix used to generate this asset
111 char prefix[BCTEXTLEN];
113 // Folder in resource manager
114 char folder[BCTEXTLEN];
116 // Format of file. An enumeration from file.inc.
117 int format;
119 // contains audio data
120 int audio_data;
121 int channels;
122 int sample_rate;
123 int bits;
124 int byte_order;
125 int signed_;
126 int header;
127 int dither;
128 // String or FourCC describing compression
129 char acodec[BCTEXTLEN];
132 int64_t audio_length;
145 // contains video data
146 int video_data;
147 int layers;
148 double frame_rate;
150 // Timecode information. User setable, in case of errors in source
151 char reel_name[BCTEXTLEN];
152 int reel_number;
153 int64_t tcstart;
154 int64_t tcend;
155 int tcformat;
157 int width, height;
158 // String or FourCC describing compression
159 char vcodec[BCTEXTLEN];
161 // Length in units of asset
162 int64_t video_length;
168 // mpeg audio information
169 int ampeg_bitrate;
170 // 2 - 3
171 int ampeg_derivative;
173 // Vorbis compression
174 int vorbis_min_bitrate;
175 int vorbis_bitrate;
176 int vorbis_max_bitrate;
177 int vorbis_vbr;
179 // Theora compression
180 int theora_fix_bitrate;
181 int theora_bitrate;
182 int theora_quality;
183 int theora_sharpness;
184 int theora_keyframe_frequency;
185 int theora_keyframe_force_frequency;
188 // mp3 compression
189 int mp3_bitrate;
191 // mp4a compression
192 int mp4a_bitrate;
193 int mp4a_quantqual;
196 // Set by package render during file creation. -1 means square pixels.
197 double aspect_ratio;
199 // for the interlace mode
200 int interlace_autofixoption;
201 int interlace_mode;
202 int interlace_fixmethod;
204 // for jpeg compression
205 int jpeg_quality;
207 // for mpeg video compression
208 int vmpeg_iframe_distance;
209 int vmpeg_progressive;
210 int vmpeg_denoise;
211 int vmpeg_seq_codes;
212 int vmpeg_bitrate;
213 // 1 - 2
214 int vmpeg_derivative;
215 int vmpeg_quantization;
216 int vmpeg_cmodel;
217 int vmpeg_fix_bitrate;
219 // mjpegtools
220 int vmpeg_preset;
221 // top field first
222 int vmpeg_field_order;
223 int vmpeg_pframe_distance;
232 // Divx video compression
233 int divx_bitrate;
234 int divx_rc_period;
235 int divx_rc_reaction_ratio;
236 int divx_rc_reaction_period;
237 int divx_max_key_interval;
238 int divx_max_quantizer;
239 int divx_min_quantizer;
240 int divx_quantizer;
241 int divx_quality;
242 int divx_fix_bitrate;
244 // h264 video compression
245 int h264_bitrate;
246 int h264_quantizer;
247 int h264_fix_bitrate;
249 // Divx video decompression
250 int divx_use_deblocking;
252 // PNG video compression
253 int png_use_alpha;
255 // EXR video compression
256 int exr_use_alpha;
257 int exr_compression;
259 // TIFF video compression. An enumeration from filetiff.h
260 int tiff_cmodel;
261 int tiff_compression;
263 // Microsoft MPEG-4
264 int ms_bitrate;
265 int ms_bitrate_tolerance;
266 int ms_interlaced;
267 int ms_quantization;
268 int ms_gop_size;
269 int ms_fix_bitrate;
272 int ac3_bitrate;
276 // Image file sequences. Background rendering doesn't want to write a
277 // sequence header but instead wants to start the sequence numbering at a certain
278 // number. This ensures deletion of all the frames which aren't being used.
279 // We still want sequence headers sometimes because loading a directory full of images
280 // for editing would create new assets for every image.
281 int use_header;
285 // Edits store data for the transition
287 // index info
288 int index_status; // Macro from assets.inc
289 int64_t index_zoom; // zoom factor of index data
290 int64_t index_start; // byte start of index data in the index file
291 // Total bytes in source file when the index was buillt
292 int64_t index_bytes;
293 int64_t index_end, old_index_end; // values for index build
294 // offsets of channels in index buffer in floats
295 int64_t *index_offsets;
296 // Sizes of channels in index buffer in floats. This allows
297 // variable channel size.
298 int64_t *index_sizes;
299 // [ index channel ][ index channel ]
300 // [high][low][high][low][high][low][high][low]
301 float *index_buffer;
302 int id;
306 #endif