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 #define TC_DROPFRAME 0
40 #define TC_NONDROPFRAME 1
44 class Asset : public Indexable, public ListItem<Asset>
49 Asset(const char *path);
50 Asset(const int plugin_type, const char *plugin_path);
54 int dump(FILE *fp=stdout);
57 void copy_from(Asset *asset, int do_index);
58 void copy_location(Asset *asset);
59 void copy_format(Asset *asset, int do_index = 1);
60 void copy_index(Asset *asset);
61 int64_t get_index_offset(int channel);
62 int64_t get_index_size(int channel);
63 // Get an english description of the compression. Used by AssetEdit
64 char* get_compression_text(int audio, int video);
66 // Load and save parameters for a render dialog
67 // Used by render, record, menueffects, preferences
68 void load_defaults(BC_Hash *defaults,
69 const char *prefix /* = 0 */,
70 int do_format /* = 0 */,
75 void save_defaults(BC_Hash *defaults,
76 const char *prefix /* = 0 */,
77 int do_format, /* Don't save format which is autodetected by file loader */
78 int do_compression, /* Don't save compression which is fixed by driver */
82 char* construct_param(const char *param, const char *prefix, char *return_value);
87 // Executed during index building only
88 int equivalent(Asset &asset,
91 Asset& operator=(Asset &asset);
92 int operator==(Asset &asset);
93 int operator!=(Asset &asset);
94 // Return 1 if the paths match
95 int test_path(const char *path);
96 int read(FileXML *file,
97 int expand_relative = 1);
98 int read_audio(FileXML *xml);
99 int read_video(FileXML *xml);
100 int read_index(FileXML *xml);
103 int set_timecode(char *tc, int format, int end);
104 int reset_timecode();
106 // Output path is the path of the output file if name truncation is desired.
107 // It is a "" if; complete names should be used.
108 int write(FileXML *file, int include_index, const char *output_path);
111 int get_audio_channels();
112 int get_sample_rate();
113 int64_t get_audio_samples();
118 double get_frame_rate();
119 int get_video_layers();
120 int64_t get_video_frames();
122 void write_index(char *path, int data_bytes);
124 // Necessary for renderfarm to get encoding parameters
125 int write_audio(FileXML *xml);
126 int write_video(FileXML *xml);
127 int write_index(FileXML *xml);
129 double total_length_framealigned(double fps);
131 // Format of file. An enumeration from file.inc.
134 // contains audio data
143 // String or FourCC describing compression
144 char acodec[BCTEXTLEN];
146 int64_t audio_length;
148 // contains video data, single frame data set
149 int video_data, single_frame;
153 // Timecode information. User setable, in case of errors in source
154 char reel_name[BCTEXTLEN];
160 int actual_width, actual_height;
162 // String or FourCC describing compression
163 char vcodec[BCTEXTLEN];
166 int64_t video_length;
173 // mpeg audio information
176 int ampeg_derivative;
178 // Vorbis compression
179 int vorbis_min_bitrate;
181 int vorbis_max_bitrate;
184 // Theora compression
185 int theora_fix_bitrate;
188 int theora_sharpness;
189 int theora_keyframe_frequency;
190 int theora_keyframe_force_frequency;
193 // Set by package render during file creation. -1 means square pixels.
196 // for the interlace mode
197 int interlace_autofixoption;
199 int interlace_fixmethod;
200 // for jpeg compression
203 // for mpeg video compression
204 int vmpeg_iframe_distance;
205 int vmpeg_progressive;
210 int vmpeg_derivative;
211 int vmpeg_quantization;
213 int vmpeg_fix_bitrate;
218 int vmpeg_field_order;
219 int vmpeg_pframe_distance;
221 // ffmpeg muxer file extension
222 char fformat[BCSTRLEN];
223 char ff_audio_options[BCTEXTLEN];
224 char ff_video_options[BCTEXTLEN];
225 int ff_audio_bitrate;
226 int ff_video_bitrate;
227 int ff_video_quality;
229 // PNG video compression
232 // EXR video compression
236 // TIFF video compression. An enumeration from filetiff.h
238 int tiff_compression;
242 // Image file sequences. Background rendering doesn't want to write a
243 // sequence header but instead wants to start the sequence numbering at a certain
244 // number. This ensures deletion of all the frames which aren't being used.
245 // We still want sequence headers sometimes because loading a directory full of images
246 // for editing would create new assets for every image.