r1014: Enable horizontal scrolling with the mouse wheel by pressing Ctrl.
[cinelerra_cv/ct.git] / cinelerra / fileavi.h
blob875b81c1953922f7dd14a2bbd1a2887087f92348
1 #ifndef FILEAVI_H
2 #define FILEAVI_H
4 #include "asset.inc"
5 #include "assets.inc"
6 #include "file.inc"
7 #include "filebase.h"
9 #ifdef USE_AVIFILE
10 #include "avifile.h"
11 #include <vector>
12 #endif
14 //class IAviWriteFile;
15 //class IAviReadFile;
16 //class IAviReadStream;
18 #define MAX_STREAMS 256
20 class FileAVI : public FileBase
22 public:
23 FileAVI(Asset *asset, File *file);
24 ~FileAVI();
26 static int check_sig(Asset *asset);
27 static void get_parameters(BC_WindowBase *parent_window,
28 Asset *asset,
29 BC_WindowBase* &format_window,
30 int audio_options,
31 int video_options,
32 char *locked_compressor);
34 int get_best_colormodel(int driver, int colormodel);
35 int open_file(int rd, int wr);
36 int close_file();
37 void reset();
38 int set_audio_position(int64_t x);
39 int set_video_position(int64_t x);
40 int write_samples(double **buffer, int64_t len);
41 int write_frames(VFrame ***frames, int len);
42 int write_compressed_frame(VFrame *buffer);
43 int read_compressed_frame(VFrame *buffer);
44 int64_t compressed_frame_size();
45 int read_samples(double *buffer, int64_t len);
46 int read_frame(VFrame *frame);
47 static char* vcodec_to_fourcc(char *input, char *output);
48 static char* fourcc_to_vcodec(char *input, char *output);
49 static char* acodec_to_fourcc(char *input, char *output);
50 static char* fourcc_to_acodec(char *input, char *output);
51 static int cmodel_bc_to_avi(int input);
53 static void initialize_avifile();
56 private:
57 static int check_sig_arne2(Asset *asset, int &score);
58 static int check_sig_arne1(Asset *asset, int &score);
59 static int check_sig_lavtools(Asset *asset, int &score);
60 static int check_sig_avifile(Asset *asset, int &score);
62 int open_avifile_in(Asset *asset);
63 int open_arne2_in(Asset *asset);
64 int open_arne1_in(Asset *asset);
65 int open_lavtools_in(Asset *asset);
68 int open_avifile_out(Asset *asset);
69 int open_arne2_out(Asset *asset);
70 int open_arne1_out(Asset *asset);
71 int open_lavtools_out(Asset *asset);
73 #ifdef USE_AVIFILE
74 IAviWriteFile *out_fd;
75 IAviReadFile *in_fd;
77 IAviReadStream *astream_in[MAX_STREAMS];
78 IAviReadStream *vstream_in[MAX_STREAMS];
79 IAviWriteStream *astream_out[MAX_STREAMS];
80 IAviVideoWriteStream *vstream_out[MAX_STREAMS];
81 int out_color_model;
82 BitmapInfo *out_bitmap_info;
83 static int avifile_initialized;
85 #endif
93 unsigned char *temp_audio;
94 int64_t temp_allocated;
95 int source_cmodel;
99 class AVIConfigAudio;
101 class AVIACodecList : public BC_PopupTextBox
103 public:
104 AVIACodecList(AVIConfigAudio *gui, int x, int y);
105 ~AVIACodecList();
107 int handle_event();
109 AVIConfigAudio *gui;
112 class AVIConfigAudio : public BC_Window
114 public:
115 AVIConfigAudio(BC_WindowBase *parent_window, Asset *asset);
116 ~AVIConfigAudio();
118 static int calculate_w(int format);
119 static int calculate_h(int format);
120 int create_objects();
121 int close_event();
122 int generate_codeclist();
123 void update_codecs();
125 AVIACodecList *list;
127 ArrayList<BC_ListBoxItem*> codec_items;
128 ArrayList<BC_ISlider*> attribute_sliders;
129 BC_WindowBase *parent_window;
130 Asset *asset;
131 char string[BCTEXTLEN];
134 class AVIConfigVideo;
136 class AVIVCodecList : public BC_PopupTextBox
138 public:
139 AVIVCodecList(AVIConfigVideo *gui, int x, int y);
140 ~AVIVCodecList();
142 int handle_event();
144 AVIConfigVideo *gui;
147 class AVIVAttributeList : public BC_ListBox
149 public:
150 AVIVAttributeList(AVIConfigVideo *gui, int x, int y);
151 int handle_event();
152 int selection_changed();
153 AVIConfigVideo *gui;
156 class AVIVAttribute : public BC_TextBox
158 public:
159 AVIVAttribute(AVIConfigVideo *gui, int x, int y);
160 int handle_event();
161 AVIConfigVideo *gui;
164 class AVIConfigVideo : public BC_Window
166 public:
167 AVIConfigVideo(BC_WindowBase *parent_window,
168 Asset *asset,
169 char *locked_compressor);
170 ~AVIConfigVideo();
172 static int calculate_w(int format);
173 static int calculate_h(int format);
174 int create_objects();
175 int close_event();
176 int generate_codeclist();
177 void generate_attributelist();
178 void update_attribute(int recursive);
179 // Get text associated with current attribute
180 char* get_current_attribute_text();
181 char* get_current_attribute_value();
182 void set_current_attribute(char *text);
183 void reset();
185 AVIVCodecList *list;
186 AVIVAttributeList *attributes;
187 AVIVAttribute *attribute;
188 ArrayList<BC_ListBoxItem*> codec_items;
189 ArrayList<BC_ListBoxItem*> attribute_items[2];
190 BC_WindowBase *parent_window;
191 Asset *asset;
192 char *locked_compressor;
193 char string[BCTEXTLEN];
198 #endif