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"
33 #include "indexstate.inc"
35 #include "pluginserver.inc"
39 class Asset : public Indexable, public ListItem<Asset>
44 Asset(const char *path);
45 Asset(const int plugin_type, const char *plugin_path);
49 int dump(FILE *fp=stdout);
52 void copy_from(Asset *asset, int do_index);
53 void copy_location(Asset *asset);
54 void copy_format(Asset *asset, int do_index = 1);
55 void copy_index(Asset *asset);
56 int64_t get_index_offset(int channel);
57 int64_t get_index_size(int channel);
58 // Get an english description of the compression. Used by AssetEdit
59 char* get_compression_text(int audio, int video);
61 // Load and save parameters for a render dialog
62 // Used by render, record, menueffects, preferences
63 void load_defaults(BC_Hash *defaults,
64 const char *prefix /* = 0 */,
65 int do_format /* = 0 */,
70 void save_defaults(BC_Hash *defaults,
71 const char *prefix /* = 0 */,
72 int do_format, /* Don't save format which is autodetected by file loader */
73 int do_compression, /* Don't save compression which is fixed by driver */
77 const char* construct_param(const char *param, const char *prefix, char *return_value);
82 // Executed during index building only
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);
101 // Output path is the path of the output file if name truncation is desired.
102 // It is a "" if; complete names should be used.
103 int write(FileXML *file, int include_index, const char *output_path);
106 int get_audio_channels();
107 int get_sample_rate();
108 int64_t get_audio_samples();
113 double get_frame_rate();
114 int get_video_layers();
115 int64_t get_video_frames();
119 // Necessary for renderfarm to get encoding parameters
120 int write_audio(FileXML *xml);
121 int write_video(FileXML *xml);
122 int write_index(FileXML *xml);
126 // Format of file. An enumeration from file.inc.
129 // contains audio data
138 // String or FourCC describing compression
139 char acodec[BCTEXTLEN];
141 int64_t audio_length;
143 // contains video data
147 int actual_width, actual_height;
149 // String or FourCC describing compression
150 char vcodec[BCTEXTLEN];
153 int64_t video_length;
157 // mpeg audio information
160 int ampeg_derivative;
162 // Vorbis compression
163 int vorbis_min_bitrate;
165 int vorbis_max_bitrate;
168 // Theora compression
169 int theora_fix_bitrate;
172 int theora_sharpness;
173 int theora_keyframe_frequency;
174 int theora_keyframe_force_frequency;
185 // Set by package render during file creation. -1 means square pixels.
188 // for jpeg compression
191 // for mpeg video compression
192 int vmpeg_iframe_distance;
193 int vmpeg_progressive;
198 int vmpeg_derivative;
199 int vmpeg_quantization;
201 int vmpeg_fix_bitrate;
206 int vmpeg_field_order;
207 int vmpeg_pframe_distance;
209 // ffmpeg muxer file extension
210 char fformat[BCSTRLEN];
211 char ff_audio_options[BCTEXTLEN];
212 char ff_video_options[BCTEXTLEN];
213 int ff_audio_bitrate;
214 int ff_video_bitrate;
215 int ff_video_quality;
217 // Divx video compression
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;
227 int divx_fix_bitrate;
229 // h264 video compression
232 int h264_fix_bitrate;
234 // Divx video decompression
235 int divx_use_deblocking;
237 // PNG video compression
240 // EXR video compression
244 // TIFF video compression. An enumeration from filetiff.h
246 int tiff_compression;
250 int ms_bitrate_tolerance;
259 // Image file sequences. Background rendering doesn't want to write a
260 // sequence header but instead wants to start the sequence numbering at a certain
261 // number. This ensures deletion of all the frames which aren't being used.
262 // We still want sequence headers sometimes because loading a directory full of images
263 // for editing would create new assets for every image.