r602: Fix baver's code... don't insert timecode when show_tc is not set
[cinelerra_cv/mob.git] / cinelerra / asset.h
blobbe297928d037f10c8862ba4cc41895151a17b2d8
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 // Get an english description of the compression. Used by AssetEdit
44 char* get_compression_text(int audio, int video);
46 // Load and save parameters for a render dialog
47 // Used by render, record, menueffects, preferences
48 void load_defaults(Defaults *defaults,
49 char *prefix /* = 0 */,
50 int do_format /* = 0 */,
51 int do_compression,
52 int do_path,
53 int do_data_types,
54 int do_bits);
55 void save_defaults(Defaults *defaults,
56 char *prefix /* = 0 */,
57 int do_format, /* Don't save format which is autodetected by file loader */
58 int do_compression, /* Don't save compression which is fixed by driver */
59 int do_path,
60 int do_data_types,
61 int do_bits);
62 char* construct_param(char *param, char *prefix, char *return_value);
64 // defaults which are specific to format used
65 void load_format_defaults(Defaults *defaults);
66 void save_format_defaults(Defaults *defaults);
68 // Executed during index building only
69 void update_index(Asset *asset);
70 int equivalent(Asset &asset,
71 int test_audio,
72 int test_video);
73 Asset& operator=(Asset &asset);
74 int operator==(Asset &asset);
75 int operator!=(Asset &asset);
76 int test_path(const char *path);
77 int test_plugin_title(const char *path);
78 int read(FileXML *file, int expand_relative = 1);
79 int read(ArrayList<PluginServer*> *plugindb, FileXML *xml, 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 int write(ArrayList<PluginServer*> *plugindb,
94 FileXML *xml,
95 int include_index,
96 char *output_path);
99 // Necessary for renderfarm to get encoding parameters
100 int write_audio(FileXML *xml);
101 int write_video(FileXML *xml);
102 int write_index(FileXML *xml);
103 int update_path(char *new_path);
105 // Path to file
106 char path[BCTEXTLEN];
108 // Pipe command
109 char pipe[BCTEXTLEN];
110 int use_pipe;
112 // Prefix used to generate this asset
113 char prefix[BCTEXTLEN];
115 // Folder in resource manager
116 char folder[BCTEXTLEN];
118 // Format of file. An enumeration from file.inc.
119 int format;
121 // contains audio data
122 int audio_data;
123 int channels;
124 int sample_rate;
125 int bits;
126 int byte_order;
127 int signed_;
128 int header;
129 int dither;
130 // String or FourCC describing compression
131 char acodec[BCTEXTLEN];
134 int64_t audio_length;
147 // contains video data
148 int video_data;
149 int layers;
150 double frame_rate;
152 // Timecode information. User setable, in case of errors in source
153 char reel_name[BCTEXTLEN];
154 int reel_number;
155 int64_t tcstart;
156 int64_t tcend;
157 int tcformat;
159 int width, height;
160 // String or FourCC describing compression
161 char vcodec[BCTEXTLEN];
163 // Length in units of asset
164 int64_t video_length;
170 // mpeg audio information
171 int ampeg_bitrate;
172 // 2 - 3
173 int ampeg_derivative;
175 // Vorbis compression
176 int vorbis_min_bitrate;
177 int vorbis_bitrate;
178 int vorbis_max_bitrate;
179 int vorbis_vbr;
181 // Theora compression
182 int theora_fix_bitrate;
183 int theora_bitrate;
184 int theora_quality;
185 int theora_sharpness;
186 int theora_keyframe_frequency;
187 int theora_keyframe_force_frequency;
189 // mp3 compression
190 int mp3_bitrate;
193 // Set by package render during file creation. -1 means square pixels.
194 double aspect_ratio;
196 // for the interlace mode
197 int interlace_autofixoption;
198 int interlace_mode;
199 int interlace_fixmethod;
201 // for jpeg compression
202 int jpeg_quality;
204 // for mpeg video compression
205 int vmpeg_iframe_distance;
206 int vmpeg_bframe_distance;
207 int vmpeg_progressive;
208 int vmpeg_denoise;
209 int vmpeg_seq_codes;
210 int vmpeg_bitrate;
211 // 1 - 2
212 int vmpeg_derivative;
213 int vmpeg_quantization;
214 int vmpeg_cmodel;
215 int vmpeg_fix_bitrate;
217 // Divx video compression
218 int divx_bitrate;
219 int divx_rc_period;
220 int divx_rc_reaction_ratio;
221 int divx_rc_reaction_period;
222 int divx_max_key_interval;
223 int divx_max_quantizer;
224 int divx_min_quantizer;
225 int divx_quantizer;
226 int divx_quality;
227 int divx_fix_bitrate;
230 // Divx video decompression
231 int divx_use_deblocking;
233 // PNG video compression
234 int png_use_alpha;
236 // EXR video compression
237 int exr_use_alpha;
238 int exr_compression;
240 // TIFF video compression. An enumeration from filetiff.h
241 int tiff_cmodel;
242 int tiff_compression;
244 // Microsoft MPEG-4
245 int ms_bitrate;
246 int ms_bitrate_tolerance;
247 int ms_interlaced;
248 int ms_quantization;
249 int ms_gop_size;
250 int ms_fix_bitrate;
253 int ac3_bitrate;
257 // Image file sequences. Background rendering doesn't want to write a
258 // sequence header but instead wants to start the sequence numbering at a certain
259 // number. This ensures deletion of all the frames which aren't being used.
260 // We still want sequence headers sometimes because loading a directory full of images
261 // for editing would create new assets for every image.
262 int use_header;
266 // Edits store data for the transition
268 // index info
269 int index_status; // 0 ready 1 not tested 2 being built 3 small source
270 int64_t index_zoom; // zoom factor of index data
271 int64_t index_start; // byte start of index data in the index file
272 int64_t index_bytes; // Total bytes in source file for comparison before rebuilding the index
273 int64_t index_end, old_index_end; // values for index build
274 int64_t* index_offsets; // offsets of channels in index file in floats
275 float* index_buffer;
276 int id;
281 #endif