1 #ifndef __FILEFFMPEG_H__
2 #define __FILEFFMPEG_H__
5 #include "bcwindowbase.inc"
6 #include "bitspopup.inc"
8 #include "fileffmpeg.inc"
9 #include "indexfile.inc"
10 #include "mainprogress.inc"
22 class FFMpegConfigNum;
27 class FFMPEGConfigAudio;
29 class FFMPEGConfigAudioPopup;
30 class FFMPEGConfigAudioToggle;
31 class FFMPEGConfigVideo;
33 class FFMPEGConfigVideoPopup;
34 class FFMPEGConfigVideoToggle;
36 class FileFFMPEG : public FileBase
41 FileFFMPEG(Asset *asset, File *file);
43 static void ff_lock(const char *cp=0);
44 static void ff_unlock();
46 static void get_parameters(BC_WindowBase *parent_window,Asset *asset,
47 BC_WindowBase *&format_window,int audio_options,int video_options);
48 static int check_sig(Asset *asset);
49 int get_video_info(int track, int &pid, double &framerate,
50 int &width, int &height, char *title=0);
51 int get_audio_for_video(int vstream, int astream, int64_t &channel_mask);
52 static void get_info(char *path,char *text,int len);
53 int open_file(int rd,int wr);
54 int get_index(IndexFile *index_file, MainProgressBar *progress_bar);
56 int write_samples(double **buffer,int64_t len);
57 int write_frames(VFrame ***frames,int len);
58 int read_samples(double *buffer,int64_t len);
59 int read_frame(VFrame *frame);
60 int64_t get_memory_usage(void);
61 int colormodel_supported(int colormodel);
62 int get_best_colormodel(Asset *asset,int driver);
63 int select_video_stream(Asset *asset, int vstream);
64 int select_audio_stream(Asset *asset, int astream);
67 class FFMpegConfigNum : public BC_TumbleTextBox
70 FFMpegConfigNum(BC_Window *window, int x, int y,
71 char *title_text, int *output);
74 void create_objects();
83 class FFMpegAudioNum : public FFMpegConfigNum
86 FFMpegAudioNum(BC_Window *window, int x, int y, char *title_text, int *output);
89 FFMPEGConfigAudio *window() { return (FFMPEGConfigAudio *)FFMpegConfigNum::window; }
92 class FFMpegAudioBitrate : public FFMpegAudioNum
95 FFMpegAudioBitrate(BC_Window *window, int x, int y, char *title_text, int *output)
96 : FFMpegAudioNum(window, x, y, title_text, output) {}
100 class FFMpegVideoNum : public FFMpegConfigNum
103 FFMpegVideoNum(BC_Window *window, int x, int y, char *title_text, int *output);
106 FFMPEGConfigVideo *window() { return (FFMPEGConfigVideo *)FFMpegConfigNum::window; }
109 class FFMpegVideoBitrate : public FFMpegVideoNum
112 FFMpegVideoBitrate(BC_Window *window, int x, int y, char *title_text, int *output)
113 : FFMpegVideoNum(window, x, y, title_text, output) {}
117 class FFMpegVideoQuality : public FFMpegVideoNum
120 FFMpegVideoQuality(BC_Window *window, int x, int y, char *title_text, int *output)
121 : FFMpegVideoNum(window, x, y, title_text, output) {}
125 class FFMPEGConfigAudio : public BC_Window
128 FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset);
129 ~FFMPEGConfigAudio();
131 void create_objects();
134 ArrayList<BC_ListBoxItem*> presets;
135 FFMPEGConfigAudioPopup *preset_popup;
136 FFMpegAudioBitrate *bitrate;
137 FFAudioOptions *audio_options;
138 BC_WindowBase *parent_window;
142 class FFAudioOptions : public BC_TextBox
145 FFAudioOptions(FFMPEGConfigAudio *audio_popup,
146 int x, int y, int w, int rows, int size, char *text);
149 FFMPEGConfigAudio *audio_popup;
153 class FFMPEGConfigAudioPopup : public BC_PopupTextBox
156 FFMPEGConfigAudioPopup(FFMPEGConfigAudio *popup, int x, int y);
158 FFMPEGConfigAudio *popup;
162 class FFMPEGConfigAudioToggle : public BC_CheckBox
165 FFMPEGConfigAudioToggle(FFMPEGConfigAudio *popup,
166 char *title_text, int x, int y, int *output);
169 FFMPEGConfigAudio *popup;
172 class FFMPEGConfigVideo : public BC_Window
175 FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset);
176 ~FFMPEGConfigVideo();
178 void create_objects();
181 ArrayList<BC_ListBoxItem*> presets;
182 FFMPEGConfigVideoPopup *preset_popup;
183 BC_WindowBase *parent_window;
184 FFMpegVideoBitrate *bitrate;
185 FFMpegVideoQuality *quality;
186 FFVideoOptions *video_options;
190 class FFVideoOptions : public BC_TextBox
193 FFVideoOptions(FFMPEGConfigVideo *video_popup,
194 int x, int y, int w, int rows, int size, char *text);
197 FFMPEGConfigVideo *video_popup;
200 class FFMPEGConfigVideoPopup : public BC_PopupTextBox
203 FFMPEGConfigVideoPopup(FFMPEGConfigVideo *popup, int x, int y);
205 FFMPEGConfigVideo *popup;
208 class FFMPEGConfigVideoToggle : public BC_CheckBox
211 FFMPEGConfigVideoToggle(FFMPEGConfigVideo *popup,
212 char *title_text, int x, int y, int *output);
215 FFMPEGConfigVideo *popup;
218 class FFMPEGScanProgress : public Thread
221 IndexFile *index_file;
222 MainProgressBar *progress_bar;
223 char progress_title[BCTEXTLEN];
224 int64_t length, *position;
227 FFMPEGScanProgress(IndexFile *index_file, MainProgressBar *progress_bar,
228 const char *title, int64_t length, int64_t *position, int *canceled);
229 ~FFMPEGScanProgress();