3 * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "arraylist.h"
28 #include "bcwindowbase.inc"
30 #include "filexml.inc"
31 #include "indexable.h"
32 #include "indexfile.inc"
34 #include "pluginserver.inc"
38 class Asset : public Indexable, public ListItem<Asset>
43 Asset(const char *path);
44 Asset(const int plugin_type, const char *plugin_path);
48 int dump(FILE *fp=stdout);
51 void copy_from(Asset *asset, int do_index);
52 void copy_location(Asset *asset);
53 void copy_format(Asset *asset, int do_index = 1);
54 void copy_index(Asset *asset);
55 int64_t get_index_offset(int channel);
56 int64_t get_index_size(int channel);
57 // Get an english description of the compression. Used by AssetEdit
58 char* get_compression_text(int audio, int video);
60 // Load and save parameters for a render dialog
61 // Used by render, record, menueffects, preferences
62 void load_defaults(BC_Hash *defaults,
63 const char *prefix /* = 0 */,
64 int do_format /* = 0 */,
69 void save_defaults(BC_Hash *defaults,
70 const char *prefix /* = 0 */,
71 int do_format, /* Don't save format which is autodetected by file loader */
72 int do_compression, /* Don't save compression which is fixed by driver */
76 const char* construct_param(const char *param, const char *prefix, char *return_value);
81 // Executed during index building only
82 void update_index(Asset *asset);
83 int equivalent(Asset &asset,
86 Asset& operator=(Asset &asset);
87 int operator==(Asset &asset);
88 int operator!=(Asset &asset);
89 // Return 1 if the paths match
90 int test_path(const char *path);
91 int test_plugin_title(const char *path);
92 int read(FileXML *file,
93 int expand_relative = 1);
94 int read_audio(FileXML *xml);
95 int read_video(FileXML *xml);
96 int read_index(FileXML *xml);
99 void reset_index(); // When the index file is wrong, reset the asset values
100 int reset_timecode();
102 // Output path is the path of the output file if name truncation is desired.
103 // It is a "" if; complete names should be used.
104 int write(FileXML *file,
106 const char *output_path);
107 // Write the index data and asset info. Used by IndexThread.
108 int write_index(const char *path, int data_bytes);
112 int get_audio_channels();
113 int get_sample_rate();
114 int64_t get_audio_samples();
119 double get_frame_rate();
120 int get_video_layers();
121 int64_t get_video_frames();
125 // Necessary for renderfarm to get encoding parameters
126 int write_audio(FileXML *xml);
127 int write_video(FileXML *xml);
128 int write_index(FileXML *xml);
129 int update_path(char *new_path);
133 // Format of file. An enumeration from file.inc.
136 // contains audio data
145 // String or FourCC describing compression
146 char acodec[BCTEXTLEN];
148 int64_t audio_length;
150 // Timecode information. User setable, in case of errors in source
151 char reel_name[BCTEXTLEN];
157 // contains video data
161 int actual_width, actual_height;
163 // String or FourCC describing compression
164 char vcodec[BCTEXTLEN];
167 int64_t video_length;
171 // mpeg audio information
174 int ampeg_derivative;
176 // Vorbis compression
177 int vorbis_min_bitrate;
179 int vorbis_max_bitrate;
182 // Theora compression
183 int theora_fix_bitrate;
186 int theora_sharpness;
187 int theora_keyframe_frequency;
188 int theora_keyframe_force_frequency;
199 // Set by package render during file creation. -1 means square pixels.
202 // for jpeg compression
205 // for mpeg video compression
206 int vmpeg_iframe_distance;
207 int vmpeg_progressive;
212 int vmpeg_derivative;
213 int vmpeg_quantization;
215 int vmpeg_fix_bitrate;
220 int vmpeg_field_order;
221 int vmpeg_pframe_distance;
230 // Divx video compression
233 int divx_rc_reaction_ratio;
234 int divx_rc_reaction_period;
235 int divx_max_key_interval;
236 int divx_max_quantizer;
237 int divx_min_quantizer;
240 int divx_fix_bitrate;
242 // h264 video compression
245 int h264_fix_bitrate;
247 // Divx video decompression
248 int divx_use_deblocking;
250 // PNG video compression
253 // EXR video compression
257 // TIFF video compression. An enumeration from filetiff.h
259 int tiff_compression;
263 int ms_bitrate_tolerance;
272 char pipe[BCTEXTLEN];
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.