r499: This commit was manufactured by cvs2svn to create tag 'r1_2_1-last'.
[cinelerra_cv.git] / hvirtual / cinelerra / asset.h
blob3c0d9123631253f1ac06dffd9b4c8f1e653a7766
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);
45 // Load and save parameters for a render dialog
46 // Used by render, record, menueffects, preferences
47 void load_defaults(Defaults *defaults,
48 char *prefix /* = 0 */,
49 int do_format /* = 0 */,
50 int do_compression,
51 int do_path,
52 int do_data_types,
53 int do_bits);
54 void save_defaults(Defaults *defaults,
55 char *prefix /* = 0 */,
56 int do_format, /* Don't save format which is autodetected by file loader */
57 int do_compression, /* Don't save compression which is fixed by driver */
58 int do_path,
59 int do_data_types,
60 int do_bits);
61 char* construct_param(char *param, char *prefix, char *return_value);
63 // defaults which are specific to format used
64 void load_format_defaults(Defaults *defaults);
65 void save_format_defaults(Defaults *defaults);
67 // Executed during index building only
68 void update_index(Asset *asset);
69 int equivalent(Asset &asset,
70 int test_audio,
71 int test_video);
72 Asset& operator=(Asset &asset);
73 int operator==(Asset &asset);
74 int operator!=(Asset &asset);
75 int test_path(const char *path);
76 int test_plugin_title(const char *path);
77 int read(FileXML *file, int expand_relative = 1);
78 int read(ArrayList<PluginServer*> *plugindb, FileXML *xml, int expand_relative = 1);
79 int read_audio(FileXML *xml);
80 int read_video(FileXML *xml);
81 int read_index(FileXML *xml);
82 int reset_index(); // When the index file is wrong, reset the asset values
84 int set_timecode(char *tc, int format, int end);
85 int reset_timecode();
87 // Output path is the path of the output file if name truncation is desired.
88 // It is a "" if complete names should be used.
89 int write(FileXML *file,
90 int include_index,
91 char *output_path);
92 int write(ArrayList<PluginServer*> *plugindb,
93 FileXML *xml,
94 int include_index,
95 char *output_path);
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 // Path to file
105 char path[BCTEXTLEN];
107 // Pipe command
108 char pipe[BCTEXTLEN];
109 int use_pipe;
111 // Prefix used to generate this asset
112 char prefix[BCTEXTLEN];
114 // Folder in resource manager
115 char folder[BCTEXTLEN];
117 // Determines the file engine to use
118 int format; // format of file
120 // contains audio data
121 int audio_data;
122 int channels;
123 int sample_rate;
124 int bits;
125 int byte_order;
126 int signed_;
127 int header;
128 int dither;
129 // String or FourCC describing compression
130 char acodec[BCTEXTLEN];
133 int64_t audio_length;
146 // contains video data
147 int video_data;
148 int layers;
149 double frame_rate;
151 // Timecode information. User setable, in case of errors in source
152 char reel_name[BCTEXTLEN];
153 int reel_number;
154 int64_t tcstart;
155 int64_t tcend;
156 int tcformat;
158 int width, height;
159 // String or FourCC describing compression
160 char vcodec[BCTEXTLEN];
162 // Length in units of asset
163 int64_t video_length;
169 // mpeg audio information
170 int ampeg_bitrate;
171 // 2 - 3
172 int ampeg_derivative;
174 // Vorbis compression
175 int vorbis_min_bitrate;
176 int vorbis_bitrate;
177 int vorbis_max_bitrate;
178 int vorbis_vbr;
180 // mp3 compression
181 int mp3_bitrate;
184 // Set by package render during file creation. -1 means square pixels.
185 double aspect_ratio;
190 // for jpeg compression
191 int jpeg_quality;
193 // for mpeg video compression
194 int vmpeg_iframe_distance;
195 int vmpeg_bframe_distance;
196 int vmpeg_progressive;
197 int vmpeg_denoise;
198 int vmpeg_seq_codes;
199 int vmpeg_bitrate;
200 // 1 - 2
201 int vmpeg_derivative;
202 int vmpeg_quantization;
203 int vmpeg_cmodel;
204 int vmpeg_fix_bitrate;
206 // Divx video compression
207 int divx_bitrate;
208 int divx_rc_period;
209 int divx_rc_reaction_ratio;
210 int divx_rc_reaction_period;
211 int divx_max_key_interval;
212 int divx_max_quantizer;
213 int divx_min_quantizer;
214 int divx_quantizer;
215 int divx_quality;
216 int divx_fix_bitrate;
219 // Divx video decompression
220 int divx_use_deblocking;
222 // PNG video compression
223 int png_use_alpha;
225 // EXR video compression
226 int exr_use_alpha;
227 int exr_compression;
229 // TIFF video compression. An enumeration from filetiff.h
230 int tiff_cmodel;
231 int tiff_compression;
233 // Microsoft MPEG-4
234 int ms_bitrate;
235 int ms_bitrate_tolerance;
236 int ms_interlaced;
237 int ms_quantization;
238 int ms_gop_size;
239 int ms_fix_bitrate;
242 int ac3_bitrate;
246 // Image file sequences. Background rendering doesn't want to write a
247 // sequence header but instead wants to start the sequence numbering at a certain
248 // number. This ensures deletion of all the frames which aren't being used.
249 // We still want sequence headers sometimes because loading a directory full of images
250 // for editing would create new assets for every image.
251 int use_header;
255 // Edits store data for the transition
257 // index info
258 int index_status; // 0 ready 1 not tested 2 being built 3 small source
259 int64_t index_zoom; // zoom factor of index data
260 int64_t index_start; // byte start of index data in the index file
261 int64_t index_bytes; // Total bytes in source file for comparison before rebuilding the index
262 int64_t index_end, old_index_end; // values for index build
263 int64_t* index_offsets; // offsets of channels in index file in floats
264 float* index_buffer;
265 int id;
270 #endif