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
22 #include "bcsignals.h"
24 #include "filesystem.h"
26 #include "formatpopup.h"
28 #include "pluginserver.h"
32 FormatPopup::FormatPopup(ArrayList<PluginServer*> *plugindb,
33 int x, int y, int use_brender)
34 : BC_ListBox(x, y, 200, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
36 this->plugindb = plugindb;
37 this->use_brender = use_brender;
38 set_tooltip(_("Change file format"));
41 void FormatPopup::create_objects()
45 format_items.append(new BC_ListBoxItem(_(AC3_NAME)));
46 format_items.append(new BC_ListBoxItem(_(AIFF_NAME)));
47 format_items.append(new BC_ListBoxItem(_(AU_NAME)));
48 format_items.append(new BC_ListBoxItem(_(FLAC_NAME)));
49 format_items.append(new BC_ListBoxItem(_(JPEG_NAME)));
52 format_items.append(new BC_ListBoxItem(_(JPEG_LIST_NAME)));
56 format_items.append(new BC_ListBoxItem(_(AVI_NAME)));
57 format_items.append(new BC_ListBoxItem(_(EXR_NAME)));
58 format_items.append(new BC_ListBoxItem(_(EXR_LIST_NAME)));
59 format_items.append(new BC_ListBoxItem(_(WAV_NAME)));
60 format_items.append(new BC_ListBoxItem(_(MOV_NAME)));
61 format_items.append(new BC_ListBoxItem(_(FFMPEG_NAME)));
62 format_items.append(new BC_ListBoxItem(_(AMPEG_NAME)));
63 format_items.append(new BC_ListBoxItem(_(VMPEG_NAME)));
64 format_items.append(new BC_ListBoxItem(_(OGG_NAME)));
65 format_items.append(new BC_ListBoxItem(_(PCM_NAME)));
66 format_items.append(new BC_ListBoxItem(_(PNG_NAME)));
69 format_items.append(new BC_ListBoxItem(_(PNG_LIST_NAME)));
73 format_items.append(new BC_ListBoxItem(_(TGA_NAME)));
76 format_items.append(new BC_ListBoxItem(_(TGA_LIST_NAME)));
80 format_items.append(new BC_ListBoxItem(_(TIFF_NAME)));
83 format_items.append(new BC_ListBoxItem(_(TIFF_LIST_NAME)));
84 update(&format_items, 0, 0, 1);
87 FormatPopup::~FormatPopup()
89 format_items.remove_all_objects();
92 int FormatPopup::handle_event()
98 FFMPEGPopup::FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y)
99 : BC_ListBox(x, y, 50, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
101 this->plugindb = plugindb;
102 set_tooltip(_("Set ffmpeg file type"));
105 void FFMPEGPopup::create_objects()
107 static const char *dirs[] = { "audio", "video", };
108 for( int i=0; i<(int)(sizeof(dirs)/sizeof(dirs[0])); ++i ) {
110 char option_path[BCTEXTLEN];
111 FFMPEG::set_option_path(option_path, dirs[i]);
112 fs.update(option_path);
113 int total_files = fs.total_files();
114 for( int j=0; j<total_files; ++j ) {
115 const char *name = fs.get_entry(j)->get_name();
116 const char *ext = strrchr(name,'.');
118 if( !strcmp("dfl", ++ext) ) continue;
119 if( !strcmp("opts", ext) ) continue;
120 int k = ffmpeg_types.size();
121 while( --k >= 0 && strcmp(ffmpeg_types[k]->get_text(), ext) );
122 if( k >= 0 ) continue;
123 ffmpeg_types.append(new BC_ListBoxItem(ext));
127 update(&ffmpeg_types, 0, 0, 1);
130 FFMPEGPopup::~FFMPEGPopup()
132 ffmpeg_types.remove_all_objects();
135 int FFMPEGPopup::handle_event()