1 #ifndef __FILEFFMPEG_H__
2 #define __FILEFFMPEG_H__
5 #include "bcwindowbase.inc"
6 #include "bcprogressbox.inc"
7 #include "bitspopup.inc"
9 #include "fileffmpeg.inc"
21 class FFMpegConfigNum;
26 class FFMPEGConfigAudio;
28 class FFMPEGConfigAudioPopup;
29 class FFMPEGConfigAudioToggle;
30 class FFMPEGConfigVideo;
32 class FFMPEGConfigVideoPopup;
33 class FFMPEGConfigVideoToggle;
35 class FileFFMPEG : public FileBase
40 FileFFMPEG(Asset *asset, File *file);
42 static void ff_lock(const char *cp=0);
43 static void ff_unlock();
45 static void get_parameters(BC_WindowBase *parent_window,Asset *asset,
46 BC_WindowBase *&format_window,int audio_options,int video_options);
47 static int check_sig(Asset *asset);
48 int get_video_info(int track, int &pid, double &framerate,
49 int &width, int &height, char *title=0);
50 int get_audio_for_video(int vstream, int astream, int64_t &channel_mask);
51 static void get_info(char *path,char *text,int len);
52 int open_file(int rd,int wr);
53 int get_index(char *index_filename);
55 int set_video_position(int64_t pos);
56 int set_audio_position(int64_t pos);
57 int write_samples(double **buffer,int64_t len);
58 int write_frames(VFrame ***frames,int len);
59 int read_samples(double *buffer,int64_t len);
60 int read_frame(VFrame *frame);
61 int64_t get_memory_usage(void);
62 int colormodel_supported(int colormodel);
63 int get_best_colormodel(Asset *asset,int driver);
64 int select_video_stream(Asset *asset, int vstream);
65 int select_audio_stream(Asset *asset, int astream);
68 class FFMpegConfigNum : public BC_TumbleTextBox
71 FFMpegConfigNum(BC_Window *window, int x, int y,
72 char *title_text, int *output);
75 void create_objects();
84 class FFMpegAudioNum : public FFMpegConfigNum
87 FFMpegAudioNum(BC_Window *window, int x, int y, char *title_text, int *output);
90 FFMPEGConfigAudio *window() { return (FFMPEGConfigAudio *)FFMpegConfigNum::window; }
93 class FFMpegAudioBitrate : public FFMpegAudioNum
96 FFMpegAudioBitrate(BC_Window *window, int x, int y, char *title_text, int *output)
97 : FFMpegAudioNum(window, x, y, title_text, output) {}
101 class FFMpegVideoNum : public FFMpegConfigNum
104 FFMpegVideoNum(BC_Window *window, int x, int y, char *title_text, int *output);
107 FFMPEGConfigVideo *window() { return (FFMPEGConfigVideo *)FFMpegConfigNum::window; }
110 class FFMpegVideoBitrate : public FFMpegVideoNum
113 FFMpegVideoBitrate(BC_Window *window, int x, int y, char *title_text, int *output)
114 : FFMpegVideoNum(window, x, y, title_text, output) {}
118 class FFMpegVideoQuality : public FFMpegVideoNum
121 FFMpegVideoQuality(BC_Window *window, int x, int y, char *title_text, int *output)
122 : FFMpegVideoNum(window, x, y, title_text, output) {}
126 class FFMPEGConfigAudio : public BC_Window
129 FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset);
130 ~FFMPEGConfigAudio();
132 void create_objects();
135 ArrayList<BC_ListBoxItem*> presets;
136 FFMPEGConfigAudioPopup *preset_popup;
137 FFMpegAudioBitrate *bitrate;
138 FFAudioOptions *audio_options;
139 BC_WindowBase *parent_window;
143 class FFAudioOptions : public BC_TextBox
146 FFAudioOptions(FFMPEGConfigAudio *audio_popup,
147 int x, int y, int w, int rows, int size, char *text);
150 FFMPEGConfigAudio *audio_popup;
154 class FFMPEGConfigAudioPopup : public BC_PopupTextBox
157 FFMPEGConfigAudioPopup(FFMPEGConfigAudio *popup, int x, int y);
159 FFMPEGConfigAudio *popup;
163 class FFMPEGConfigAudioToggle : public BC_CheckBox
166 FFMPEGConfigAudioToggle(FFMPEGConfigAudio *popup,
167 char *title_text, int x, int y, int *output);
170 FFMPEGConfigAudio *popup;
173 class FFMPEGConfigVideo : public BC_Window
176 FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset);
177 ~FFMPEGConfigVideo();
179 void create_objects();
182 ArrayList<BC_ListBoxItem*> presets;
183 FFMPEGConfigVideoPopup *preset_popup;
184 BC_WindowBase *parent_window;
185 FFMpegVideoBitrate *bitrate;
186 FFMpegVideoQuality *quality;
187 FFVideoOptions *video_options;
191 class FFVideoOptions : public BC_TextBox
194 FFVideoOptions(FFMPEGConfigVideo *video_popup,
195 int x, int y, int w, int rows, int size, char *text);
198 FFMPEGConfigVideo *video_popup;
201 class FFMPEGConfigVideoPopup : public BC_PopupTextBox
204 FFMPEGConfigVideoPopup(FFMPEGConfigVideo *popup, int x, int y);
206 FFMPEGConfigVideo *popup;
209 class FFMPEGConfigVideoToggle : public BC_CheckBox
212 FFMPEGConfigVideoToggle(FFMPEGConfigVideo *popup,
213 char *title_text, int x, int y, int *output);
216 FFMPEGConfigVideo *popup;
219 class FFMPEGScanProgress : public Thread
222 char progress_title[BCTEXTLEN];
223 BC_ProgressBox *progress;
224 int64_t length, *position;
227 FFMPEGScanProgress(const char *title, int64_t length, int64_t *position, int *canceled);
228 ~FFMPEGScanProgress();