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"
40 #define TC_DROPFRAME 0
41 #define TC_NONDROPFRAME 1
45 class Asset : public Indexable, public ListItem<Asset>
50 Asset(const char *path);
51 Asset(const int plugin_type, const char *plugin_path);
55 int dump(FILE *fp=stdout);
58 void copy_from(Asset *asset, int do_index);
59 void copy_location(Asset *asset);
60 void copy_format(Asset *asset, int do_index = 1);
61 void copy_index(Asset *asset);
62 int64_t get_index_offset(int channel);
63 int64_t get_index_size(int channel);
64 // Get an english description of the compression. Used by AssetEdit
65 char* get_compression_text(int audio, int video);
67 // Load and save parameters for a render dialog
68 // Used by render, record, menueffects, preferences
69 void load_defaults(BC_Hash *defaults,
70 const char *prefix /* = 0 */,
71 int do_format /* = 0 */,
76 void save_defaults(BC_Hash *defaults,
77 const char *prefix /* = 0 */,
78 int do_format, /* Don't save format which is autodetected by file loader */
79 int do_compression, /* Don't save compression which is fixed by driver */
83 char* construct_param(const char *param, const char *prefix, char *return_value);
88 // Executed during index building only
89 int equivalent(Asset &asset, int test_audio, int test_video, EDL *edl=0);
90 // Return 1 if the paths match
91 int test_path(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_format(FileXML *xml);
97 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();
117 void write_index(char *path, int data_bytes);
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);
124 double total_length_framealigned(double fps);
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, single frame data set
144 int video_data, single_frame;
148 int actual_width, actual_height;
150 // scale factor or 0 if not proxy
152 // String or FourCC describing compression
153 char vcodec[BCTEXTLEN];
156 // -1 means a still photo
157 int64_t video_length;
164 // mpeg audio information
167 int ampeg_derivative;
169 // Vorbis compression
170 int vorbis_min_bitrate;
172 int vorbis_max_bitrate;
175 // Theora compression
176 int theora_fix_bitrate;
179 int theora_sharpness;
180 int theora_keyframe_frequency;
181 int theora_keyframe_force_frequency;
184 // Set by package render during file creation. -1 means square pixels.
187 // for the interlace mode
189 // for jpeg compression
193 // for mpeg video compression
194 int vmpeg_iframe_distance;
195 int vmpeg_progressive;
200 int vmpeg_derivative;
201 int vmpeg_quantization;
203 int vmpeg_fix_bitrate;
208 int vmpeg_field_order;
209 int vmpeg_pframe_distance;
212 char fformat[BCSTRLEN];
213 char ff_format_options[BCTEXTLEN];
214 char ff_video_options[BCTEXTLEN];
215 char ff_pixel_format[BCSTRLEN];
216 int ff_video_bitrate, ff_video_quality;
217 int ff_color_space, ff_color_range;
218 char ff_audio_options[BCTEXTLEN];
219 char ff_sample_format[BCSTRLEN];
220 int ff_audio_bitrate, ff_audio_quality;
222 // PNG video compression
226 // EXR video compression
230 // TIFF video compression. An enumeration from filetiff.h
232 int tiff_compression;
236 // Insert tag for spherical playback
237 int mov_sphere, jpeg_sphere;
239 // Image file sequences. Background rendering doesn't want to write a
240 // sequence header but instead wants to start the sequence numbering at a certain
241 // number. This ensures deletion of all the frames which aren't being used.
242 // We still want sequence headers sometimes because loading a directory full of images
243 // for editing would create new assets for every image.