rework android-rmt display, add a few buttons
[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 // Format of file.  An enumeration from file.inc.
126         int format;
127
128 // contains audio data
129         int audio_data;
130         int channels;
131         int sample_rate;
132         int bits;
133         int byte_order;
134         int signed_;
135         int header;
136         int dither;
137 // String or FourCC describing compression
138         char acodec[BCTEXTLEN];
139
140         int64_t audio_length;
141
142 // contains video data
143         int video_data;       
144         int layers, program;
145         double frame_rate;
146         int actual_width, actual_height;
147         int width, height;
148 // String or FourCC describing compression
149         char vcodec[BCTEXTLEN];
150
151 // Length in frames
152         int64_t video_length;
153
154
155
156 // mp3 compression
157         int mp3_bitrate;
158
159 // mpeg audio information
160         int ampeg_bitrate;
161 // 2 - 3
162         int ampeg_derivative;
163
164 // Vorbis compression
165         int vorbis_min_bitrate;
166         int vorbis_bitrate;
167         int vorbis_max_bitrate;
168         int vorbis_vbr;
169
170 // Theora compression
171         int theora_fix_bitrate;
172         int theora_bitrate;
173         int theora_quality;
174         int theora_sharpness;
175         int theora_keyframe_frequency;
176         int theora_keyframe_force_frequency;
177
178
179 // Set by package render during file creation. -1 means square pixels.
180         double aspect_ratio;
181
182 // for jpeg compression
183         int jpeg_quality;     
184
185 // for mpeg video compression
186         int vmpeg_iframe_distance;
187         int vmpeg_progressive;
188         int vmpeg_denoise;
189         int vmpeg_seq_codes;
190         int vmpeg_bitrate;
191 // 1 - 2
192         int vmpeg_derivative;
193         int vmpeg_quantization;
194         int vmpeg_cmodel;
195         int vmpeg_fix_bitrate;
196
197 // mjpegtools
198         int vmpeg_preset;
199 // top field first
200         int vmpeg_field_order;
201         int vmpeg_pframe_distance;
202
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;
210
211 // PNG video compression
212         int png_use_alpha;
213
214 // EXR video compression
215         int exr_use_alpha;
216         int exr_compression;
217
218 // TIFF video compression.  An enumeration from filetiff.h
219         int tiff_cmodel;
220         int tiff_compression;
221
222         int ac3_bitrate;
223
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.
229         int use_header;
230 };
231
232
233 #endif