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);
125 // Format of file. An enumeration from file.inc.
128 // contains audio data
137 // String or FourCC describing compression
138 char acodec[BCTEXTLEN];
140 int64_t audio_length;
142 // contains video data
146 int actual_width, actual_height;
148 // String or FourCC describing compression
149 char vcodec[BCTEXTLEN];
152 int64_t video_length;
159 // mpeg audio information
162 int ampeg_derivative;
164 // Vorbis compression
165 int vorbis_min_bitrate;
167 int vorbis_max_bitrate;
170 // Theora compression
171 int theora_fix_bitrate;
174 int theora_sharpness;
175 int theora_keyframe_frequency;
176 int theora_keyframe_force_frequency;
179 // Set by package render during file creation. -1 means square pixels.
182 // for jpeg compression
185 // for mpeg video compression
186 int vmpeg_iframe_distance;
187 int vmpeg_progressive;
192 int vmpeg_derivative;
193 int vmpeg_quantization;
195 int vmpeg_fix_bitrate;
200 int vmpeg_field_order;
201 int vmpeg_pframe_distance;
203 // ffmpeg muxer file extension
204 char fformat[BCSTRLEN];
205 char ff_audio_options[BCTEXTLEN];
206 char ff_video_options[BCTEXTLEN];
207 int ff_audio_bitrate;
208 int ff_video_bitrate;
209 int ff_video_quality;
211 // PNG video compression
214 // EXR video compression
218 // TIFF video compression. An enumeration from filetiff.h
220 int tiff_compression;
224 // Image file sequences. Background rendering doesn't want to write a
225 // sequence header but instead wants to start the sequence numbering at a certain
226 // number. This ensures deletion of all the frames which aren't being used.
227 // We still want sequence headers sometimes because loading a directory full of images
228 // for editing would create new assets for every image.