4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 //class IAviWriteFile;
37 //class IAviReadStream;
39 #define MAX_STREAMS 256
41 class FileAVI : public FileBase
44 FileAVI(Asset *asset, File *file);
47 static int check_sig(Asset *asset);
48 static void get_parameters(BC_WindowBase *parent_window,
50 BC_WindowBase* &format_window,
53 const char *locked_compressor);
55 int get_best_colormodel(int driver, int colormodel);
56 int open_file(int rd, int wr);
59 int set_audio_position(int64_t x);
60 int set_video_position(int64_t x);
61 int write_samples(double **buffer, int64_t len);
62 int write_frames(VFrame ***frames, int len);
63 int write_compressed_frame(VFrame *buffer);
64 int read_compressed_frame(VFrame *buffer);
65 int64_t compressed_frame_size();
66 int read_samples(double *buffer, int64_t len);
67 int read_frame(VFrame *frame);
68 static char* vcodec_to_fourcc(const char *input, char *output);
69 static char* fourcc_to_vcodec(char *input, char *output);
70 static char* acodec_to_fourcc(const char *input, char *output);
71 static char* fourcc_to_acodec(char *input, char *output);
72 static int cmodel_bc_to_avi(int input);
74 static void initialize_avifile();
78 static int check_sig_arne2(Asset *asset, int &score);
79 static int check_sig_arne1(Asset *asset, int &score);
80 static int check_sig_lavtools(Asset *asset, int &score);
81 static int check_sig_avifile(Asset *asset, int &score);
83 int open_avifile_in(Asset *asset);
84 int open_arne2_in(Asset *asset);
85 int open_arne1_in(Asset *asset);
86 int open_lavtools_in(Asset *asset);
89 int open_avifile_out(Asset *asset);
90 int open_arne2_out(Asset *asset);
91 int open_arne1_out(Asset *asset);
92 int open_lavtools_out(Asset *asset);
95 IAviWriteFile *out_fd;
98 IAviReadStream *astream_in[MAX_STREAMS];
99 IAviReadStream *vstream_in[MAX_STREAMS];
100 IAviWriteStream *astream_out[MAX_STREAMS];
101 IAviVideoWriteStream *vstream_out[MAX_STREAMS];
103 BitmapInfo *out_bitmap_info;
104 static int avifile_initialized;
114 unsigned char *temp_audio;
115 int64_t temp_allocated;
120 class AVIConfigAudio;
122 class AVIACodecList : public BC_PopupTextBox
125 AVIACodecList(AVIConfigAudio *gui, int x, int y);
133 class AVIConfigAudio : public BC_Window
136 AVIConfigAudio(BC_WindowBase *parent_window, Asset *asset);
139 static int calculate_w(int format);
140 static int calculate_h(int format);
141 void create_objects();
143 int generate_codeclist();
144 void update_codecs();
148 ArrayList<BC_ListBoxItem*> codec_items;
149 ArrayList<BC_ISlider*> attribute_sliders;
150 BC_WindowBase *parent_window;
152 char string[BCTEXTLEN];
155 class AVIConfigVideo;
157 class AVIVCodecList : public BC_PopupTextBox
160 AVIVCodecList(AVIConfigVideo *gui, int x, int y);
168 class AVIVAttributeList : public BC_ListBox
171 AVIVAttributeList(AVIConfigVideo *gui, int x, int y);
173 int selection_changed();
177 class AVIVAttribute : public BC_TextBox
180 AVIVAttribute(AVIConfigVideo *gui, int x, int y);
185 class AVIConfigVideo : public BC_Window
188 AVIConfigVideo(BC_WindowBase *parent_window,
190 const char *locked_compressor);
193 static int calculate_w(int format);
194 static int calculate_h(int format);
195 void create_objects();
197 int generate_codeclist();
198 void generate_attributelist();
199 void update_attribute(int recursive);
200 // Get text associated with current attribute
201 const char* get_current_attribute_text();
202 const char* get_current_attribute_value();
203 void set_current_attribute(const char *text);
207 AVIVAttributeList *attributes;
208 AVIVAttribute *attribute;
209 ArrayList<BC_ListBoxItem*> codec_items;
210 ArrayList<BC_ListBoxItem*> attribute_items[2];
211 BC_WindowBase *parent_window;
213 const char *locked_compressor;
214 char string[BCTEXTLEN];