remove filefork
[goodguy/history.git] / cinelerra-5.0 / cinelerra / asset.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
4  * 
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.
9  * 
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.
14  * 
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
18  * 
19  */
20
21 #ifndef ASSET_H
22 #define ASSET_H
23
24 #include <stdio.h>
25 #include <stdint.h>
26
27 #include "arraylist.h"
28 #include "bcwindowbase.inc"
29 #include "bchash.inc"
30 #include "filexml.inc"
31 #include "indexable.h"
32 #include "indexfile.inc"
33 #include "indexstate.inc"
34 #include "linklist.h"
35 #include "pluginserver.inc"
36
37
38
39 class Asset : public Indexable, public ListItem<Asset>
40 {
41 public:
42         Asset();
43         Asset(Asset &asset);
44         Asset(const char *path);
45         Asset(const int plugin_type, const char *plugin_path);
46         ~Asset();
47
48         int init_values();
49         int dump(FILE *fp=stdout);
50         void boundaries();
51
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);
60
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 */,
66                 int do_compression,
67                 int do_path,
68                 int do_data_types,
69                 int do_bits);
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 */
74                 int do_path,
75                 int do_data_types,
76                 int do_bits);
77         const char* construct_param(const char *param, const char *prefix, char *return_value);
78
79
80
81
82 // Executed during index building only
83         int equivalent(Asset &asset, 
84                 int test_audio, 
85                 int test_video);
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);
97         void reset_audio();
98         void reset_video();
99         int reset_timecode();
100
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);
104
105 // For Indexable
106         int get_audio_channels();
107         int get_sample_rate();
108         int64_t get_audio_samples();
109         int have_audio();
110         int have_video();
111         int get_w();
112         int get_h();
113         double get_frame_rate();
114         int get_video_layers();
115         int64_t get_video_frames();
116         int get_program();
117
118
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);
123
124
125
126 // Format of file.  An enumeration from file.inc.
127         int format;
128
129 // contains audio data
130         int audio_data;
131         int channels;
132         int sample_rate;
133         int bits;
134         int byte_order;
135         int signed_;
136         int header;
137         int dither;
138 // String or FourCC describing compression
139         char acodec[BCTEXTLEN];
140
141         int64_t audio_length;
142
143 // contains video data
144         int video_data;       
145         int layers, program;
146         double frame_rate;
147         int actual_width, actual_height;
148         int width, height;
149 // String or FourCC describing compression
150         char vcodec[BCTEXTLEN];
151
152 // Length in frames
153         int64_t video_length;
154
155
156
157 // mpeg audio information
158         int ampeg_bitrate;
159 // 2 - 3
160         int ampeg_derivative;
161
162 // Vorbis compression
163         int vorbis_min_bitrate;
164         int vorbis_bitrate;
165         int vorbis_max_bitrate;
166         int vorbis_vbr;
167
168 // Theora compression
169         int theora_fix_bitrate;
170         int theora_bitrate;
171         int theora_quality;
172         int theora_sharpness;
173         int theora_keyframe_frequency;
174         int theora_keyframe_force_frequency;
175
176
177 // mp3 compression
178         int mp3_bitrate;
179
180 // mp4a compression
181         int mp4a_bitrate;
182         int mp4a_quantqual;
183
184
185 // Set by package render during file creation. -1 means square pixels.
186         double aspect_ratio;
187
188 // for jpeg compression
189         int jpeg_quality;     
190
191 // for mpeg video compression
192         int vmpeg_iframe_distance;
193         int vmpeg_progressive;
194         int vmpeg_denoise;
195         int vmpeg_seq_codes;
196         int vmpeg_bitrate;
197 // 1 - 2
198         int vmpeg_derivative;
199         int vmpeg_quantization;
200         int vmpeg_cmodel;
201         int vmpeg_fix_bitrate;
202
203 // mjpegtools
204         int vmpeg_preset;
205 // top field first
206         int vmpeg_field_order;
207         int vmpeg_pframe_distance;
208
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;
216
217 // Divx video compression
218         int divx_bitrate;
219         int divx_rc_period;
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;
225         int divx_quantizer;
226         int divx_quality;
227         int divx_fix_bitrate;
228
229 // h264 video compression
230         int h264_bitrate;
231         int h264_quantizer;
232         int h264_fix_bitrate;
233
234 // Divx video decompression
235         int divx_use_deblocking;
236
237 // PNG video compression
238         int png_use_alpha;
239
240 // EXR video compression
241         int exr_use_alpha;
242         int exr_compression;
243
244 // TIFF video compression.  An enumeration from filetiff.h
245         int tiff_cmodel;
246         int tiff_compression;
247
248 // Microsoft MPEG-4
249         int ms_bitrate;
250         int ms_bitrate_tolerance;
251         int ms_interlaced;
252         int ms_quantization;
253         int ms_gop_size;
254         int ms_fix_bitrate;
255
256
257         int ac3_bitrate;
258
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.
264         int use_header;
265
266
267 };
268
269
270 #endif