2 #include "edlsession.h"
3 #include "formatpresets.h"
6 #include "interlacemodes.h"
11 FormatPresets::FormatPresets(MWindow *mwindow,
13 SetFormatWindow *format_gui,
17 this->mwindow = mwindow;
18 this->new_gui = new_gui;
19 this->format_gui = format_gui;
20 gui_base = new_gui ? (BC_WindowBase*)new_gui : (BC_WindowBase*)(format_gui);
27 FormatPresets::~FormatPresets()
30 if(pulldown) delete pulldown;
31 for(int i = 0; i < preset_items.total; i++)
32 delete preset_items.values[i];
35 void FormatPresets::create_objects()
37 // Create preset items
38 FormatPresetItem *item;
39 item = new FormatPresetItem(mwindow, this, _("User Defined"));
40 preset_items.append(item);
42 item = new FormatPresetItem(mwindow, this, _("NTSC"));
43 item->edl->session->audio_channels = 2;
44 item->edl->session->audio_tracks = 2;
45 item->edl->session->sample_rate = 48000;
46 item->edl->session->video_channels = 1;
47 item->edl->session->video_tracks = 1;
48 item->edl->session->frame_rate = (double)30000.0 / 1001;
49 item->edl->session->output_w = 720;
50 item->edl->session->output_h = 480;
51 item->edl->session->aspect_w = 4;
52 item->edl->session->aspect_h = 3;
53 item->edl->session->interlace_mode = BC_ILACE_MODE_BOTTOM_FIRST;
54 preset_items.append(item);
56 item = new FormatPresetItem(mwindow, this, _("NTSC Half"));
57 item->edl->session->audio_channels = 2;
58 item->edl->session->audio_tracks = 2;
59 item->edl->session->sample_rate = 48000;
60 item->edl->session->video_channels = 1;
61 item->edl->session->video_tracks = 1;
62 item->edl->session->frame_rate = (double)30000.0 / 1001;
63 item->edl->session->output_w = 360;
64 item->edl->session->output_h = 240;
65 item->edl->session->aspect_w = 4;
66 item->edl->session->aspect_h = 3;
67 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
68 preset_items.append(item);
70 item = new FormatPresetItem(mwindow, this, _("NTSC Progressive"));
71 item->edl->session->audio_channels = 2;
72 item->edl->session->audio_tracks = 2;
73 item->edl->session->sample_rate = 48000;
74 item->edl->session->video_channels = 1;
75 item->edl->session->video_tracks = 1;
76 item->edl->session->frame_rate = (double)60000.0 / 1001;
77 item->edl->session->output_w = 720;
78 item->edl->session->output_h = 480;
79 item->edl->session->aspect_w = 4;
80 item->edl->session->aspect_h = 3;
81 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
82 preset_items.append(item);
85 item = new FormatPresetItem(mwindow, this, _("PAL"));
86 item->edl->session->audio_channels = 2;
87 item->edl->session->audio_tracks = 2;
88 item->edl->session->sample_rate = 48000;
89 item->edl->session->video_channels = 1;
90 item->edl->session->video_tracks = 1;
91 item->edl->session->frame_rate = 25;
92 item->edl->session->output_w = 720;
93 item->edl->session->output_h = 576;
94 item->edl->session->aspect_w = 4;
95 item->edl->session->aspect_h = 3;
96 item->edl->session->interlace_mode = BC_ILACE_MODE_BOTTOM_FIRST;
97 preset_items.append(item);
101 item = new FormatPresetItem(mwindow, this, _("PAL Half"));
102 item->edl->session->audio_channels = 2;
103 item->edl->session->audio_tracks = 2;
104 item->edl->session->sample_rate = 48000;
105 item->edl->session->video_channels = 1;
106 item->edl->session->video_tracks = 1;
107 item->edl->session->frame_rate = 25;
108 item->edl->session->output_w = 360;
109 item->edl->session->output_h = 288;
110 item->edl->session->aspect_w = 4;
111 item->edl->session->aspect_h = 3;
112 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
113 preset_items.append(item);
117 item = new FormatPresetItem(mwindow, this, _("PAL Progressive"));
118 item->edl->session->audio_channels = 2;
119 item->edl->session->audio_tracks = 2;
120 item->edl->session->sample_rate = 48000;
121 item->edl->session->video_channels = 1;
122 item->edl->session->video_tracks = 1;
123 item->edl->session->frame_rate = 50;
124 item->edl->session->output_w = 720;
125 item->edl->session->output_h = 576;
126 item->edl->session->aspect_w = 4;
127 item->edl->session->aspect_h = 3;
128 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
129 preset_items.append(item);
132 item = new FormatPresetItem(mwindow, this, _("1080P/60"));
133 item->edl->session->audio_channels = 2;
134 item->edl->session->audio_tracks = 2;
135 item->edl->session->sample_rate = 48000;
136 item->edl->session->video_channels = 1;
137 item->edl->session->video_tracks = 1;
138 item->edl->session->frame_rate = (double)60000.0 / 1001;
139 // item->edl->session->track_w = 1920;
140 // item->edl->session->track_h = 1080;
141 item->edl->session->output_w = 1920;
142 item->edl->session->output_h = 1080;
143 item->edl->session->aspect_w = 16;
144 item->edl->session->aspect_h = 9;
145 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
146 preset_items.append(item);
148 item = new FormatPresetItem(mwindow, this, _("1080P/24"));
149 item->edl->session->audio_channels = 2;
150 item->edl->session->audio_tracks = 2;
151 item->edl->session->sample_rate = 48000;
152 item->edl->session->video_channels = 1;
153 item->edl->session->video_tracks = 1;
154 item->edl->session->frame_rate = 24;
155 // item->edl->session->track_w = 1920;
156 // item->edl->session->track_h = 1080;
157 item->edl->session->output_w = 1920;
158 item->edl->session->output_h = 1080;
159 item->edl->session->aspect_w = 16;
160 item->edl->session->aspect_h = 9;
161 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
162 preset_items.append(item);
164 item = new FormatPresetItem(mwindow, this, _("1080I"));
165 item->edl->session->audio_channels = 2;
166 item->edl->session->audio_tracks = 2;
167 item->edl->session->sample_rate = 48000;
168 item->edl->session->video_channels = 1;
169 item->edl->session->video_tracks = 1;
170 item->edl->session->frame_rate = (double)30000.0 / 1001;
171 // item->edl->session->track_w = 1920;
172 // item->edl->session->track_h = 1080;
173 item->edl->session->output_w = 1920;
174 item->edl->session->output_h = 1080;
175 item->edl->session->aspect_w = 16;
176 item->edl->session->aspect_h = 9;
177 item->edl->session->interlace_mode = BC_ILACE_MODE_BOTTOM_FIRST;
178 preset_items.append(item);
180 item = new FormatPresetItem(mwindow, this, _("720P/60"));
181 item->edl->session->audio_channels = 2;
182 item->edl->session->audio_tracks = 2;
183 item->edl->session->sample_rate = 48000;
184 item->edl->session->video_channels = 1;
185 item->edl->session->video_tracks = 1;
186 item->edl->session->frame_rate = (double)60000.0 / 1001;
187 item->edl->session->output_w = 1280;
188 item->edl->session->output_h = 720;
189 item->edl->session->aspect_w = 16;
190 item->edl->session->aspect_h = 9;
191 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
192 preset_items.append(item);
197 item = new FormatPresetItem(mwindow, this, _("Internet"));
198 item->edl->session->audio_channels = 1;
199 item->edl->session->audio_tracks = 1;
200 item->edl->session->sample_rate = 22050;
201 item->edl->session->video_channels = 1;
202 item->edl->session->video_tracks = 1;
203 item->edl->session->frame_rate = 15;
204 item->edl->session->output_w = 320;
205 item->edl->session->output_h = 240;
206 item->edl->session->aspect_w = 4;
207 item->edl->session->aspect_h = 3;
208 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
209 preset_items.append(item);
211 item = new FormatPresetItem(mwindow, this, _("CD Audio"));
212 item->edl->session->audio_channels = 2;
213 item->edl->session->audio_tracks = 2;
214 item->edl->session->sample_rate = 44100;
215 item->edl->session->video_channels = 1;
216 item->edl->session->video_tracks = 0;
217 item->edl->session->frame_rate = (double)30000.0 / 1001;
218 item->edl->session->output_w = 720;
219 item->edl->session->output_h = 480;
220 item->edl->session->aspect_w = 4;
221 item->edl->session->aspect_h = 3;
222 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
223 preset_items.append(item);
225 item = new FormatPresetItem(mwindow, this, _("DAT Audio"));
226 item->edl->session->audio_channels = 2;
227 item->edl->session->audio_tracks = 2;
228 item->edl->session->sample_rate = 48000;
229 item->edl->session->video_channels = 1;
230 item->edl->session->video_tracks = 0;
231 item->edl->session->frame_rate = (double)30000.0 / 1001;
232 item->edl->session->output_w = 720;
233 item->edl->session->output_h = 480;
234 item->edl->session->aspect_w = 4;
235 item->edl->session->aspect_h = 3;
236 item->edl->session->interlace_mode = BC_ILACE_MODE_NOTINTERLACED;
237 preset_items.append(item);
241 gui_base->add_subwindow(new BC_Title(x, y, _("Presets:")));
246 gui_base->add_subwindow(text = new FormatPresetsText(mwindow,
251 gui_base->add_subwindow(pulldown = new FormatPresetsPulldown(mwindow,
258 FormatPresetItem* FormatPresets::find_preset(EDL *edl)
260 for(int i = 1; i < preset_items.total; i++)
262 FormatPresetItem *preset = preset_items.values[i];
263 if(edl->session->audio_tracks == preset->edl->session->audio_tracks &&
264 edl->session->audio_channels == preset->edl->session->audio_channels &&
265 edl->session->sample_rate == preset->edl->session->sample_rate &&
266 edl->session->video_tracks == preset->edl->session->video_tracks &&
267 edl->session->frame_rate == preset->edl->session->frame_rate &&
268 edl->session->output_w == preset->edl->session->output_w &&
269 edl->session->output_h == preset->edl->session->output_h &&
270 edl->session->aspect_w == preset->edl->session->aspect_w &&
271 edl->session->aspect_h == preset->edl->session->aspect_h &&
272 edl->session->interlace_mode == preset->edl->session->interlace_mode)
280 char* FormatPresets::get_preset_text(EDL *edl)
282 FormatPresetItem *item = find_preset(edl);
284 return item->get_text();
286 return "User Defined";
290 int FormatPresets::handle_event()
295 EDL* FormatPresets::get_edl()
304 FormatPresetsText::FormatPresetsText(MWindow *mwindow,
312 gui->get_preset_text(gui->get_edl()))
315 this->mwindow = mwindow;
318 int FormatPresetsText::handle_event()
332 FormatPresetsPulldown::FormatPresetsPulldown(MWindow *mwindow,
340 LISTBOX_TEXT, // Display text list or icons
341 (ArrayList<BC_ListBoxItem*>*)&gui->preset_items, // Each column has an ArrayList of BC_ListBoxItems.
342 0, // Titles for columns. Set to 0 for no titles
343 0, // width of each column
345 0, // Pixel of top of window.
348 this->mwindow = mwindow;
352 int FormatPresetsPulldown::handle_event()
355 FormatPresetItem *preset = ((FormatPresetItem*)get_selection(0, 0));
356 gui->get_edl()->copy_all(preset->edl);
357 gui->text->update(preset->get_text());
362 FormatPresetItem::FormatPresetItem(MWindow *mwindow,
365 : BC_ListBoxItem(text)
367 this->mwindow = mwindow;
370 edl->create_objects();
371 edl->copy_all(gui->get_edl());
374 FormatPresetItem::~FormatPresetItem()