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"
31 #include "filexml.inc"
32 #include "indexable.h"
33 #include "indexfile.inc"
34 #include "indexstate.inc"
36 #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 char* construct_param(const char *param, const char *prefix, char *return_value);
82 // Executed during index building only
83 int equivalent(Asset &asset, int test_audio, int test_video, EDL *edl=0);
84 // Return 1 if the paths match
85 int test_path(const char *path);
86 int read(FileXML *file,
87 int expand_relative = 1);
88 int read_audio(FileXML *xml);
89 int read_video(FileXML *xml);
90 int read_format(FileXML *xml);
91 int read_index(FileXML *xml);
95 // Output path is the path of the output file if name truncation is desired.
96 // It is a "" if; complete names should be used.
97 int write(FileXML *file, int include_index, const char *output_path);
100 int get_audio_channels();
101 int get_sample_rate();
102 int64_t get_audio_samples();
107 double get_frame_rate();
108 int get_video_layers();
109 int64_t get_video_frames();
111 void write_index(char *path, int data_bytes);
113 // Necessary for renderfarm to get encoding parameters
114 int write_audio(FileXML *xml);
115 int write_video(FileXML *xml);
116 int write_index(FileXML *xml);
118 double total_length_framealigned(double fps);
120 // Format of file. An enumeration from file.inc.
123 // contains audio data
132 // String or FourCC describing compression
133 char acodec[BCTEXTLEN];
135 int64_t audio_length;
137 // contains video data, single frame data set
138 int video_data, single_frame;
142 int actual_width, actual_height;
144 // scale factor or 0 if not proxy, proxy_edl if proxyed from nested_edl
145 int proxy_scale, proxy_edl;
146 // String or FourCC describing compression
147 char vcodec[BCTEXTLEN];
150 // -1 means a still photo
151 int64_t video_length;
152 // timecode, unknown=-2, no timecode=-1, timecode>=0
158 // mpeg audio information
161 int ampeg_derivative;
163 // Vorbis compression
164 int vorbis_min_bitrate;
166 int vorbis_max_bitrate;
169 // Theora compression
170 int theora_fix_bitrate;
173 int theora_sharpness;
174 int theora_keyframe_frequency;
175 int theora_keyframe_force_frequency;
178 // Set by package render during file creation. -1 means square pixels.
181 // for the interlace mode
183 // for jpeg compression
187 // for mpeg video compression
188 int vmpeg_iframe_distance;
189 int vmpeg_progressive;
194 int vmpeg_derivative;
195 int vmpeg_quantization;
197 int vmpeg_fix_bitrate;
202 int vmpeg_field_order;
203 int vmpeg_pframe_distance;
206 char fformat[BCSTRLEN];
207 char ff_format_options[BCTEXTLEN];
208 char ff_video_options[BCTEXTLEN];
209 char ff_pixel_format[BCSTRLEN];
210 int ff_video_bitrate, ff_video_quality;
211 int ff_color_space, ff_color_range;
212 char ff_audio_options[BCTEXTLEN];
213 char ff_sample_format[BCSTRLEN];
214 int ff_audio_bitrate, ff_audio_quality;
216 // PNG video compression
220 // EXR video compression
224 // TIFF video compression. An enumeration from filetiff.h
226 int tiff_compression;
230 int flac_compression;
231 // Insert tag for spherical playback
232 int mov_sphere, jpeg_sphere;
234 // Image file sequences. Background rendering doesn't want to write a
235 // sequence header but instead wants to start the sequence numbering at a certain
236 // number. This ensures deletion of all the frames which aren't being used.
237 // We still want sequence headers sometimes because loading a directory full of images
238 // for editing would create new assets for every image.