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(int x, int y, int do_audio, int do_video, int use_brender)
33 : BC_ListBox(x, y, 200, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
35 this->plugindb = plugindb;
36 this->do_audio = do_audio;
37 this->do_video = do_video;
38 this->use_brender = use_brender;
39 set_tooltip(_("Change file format"));
42 void FormatPopup::post_item(int format)
44 if( (do_audio && File::renders_audio(format)) ||
45 (do_video && File::renders_video(format)) )
46 format_items.append(new BC_ListBoxItem(File::formattostr(format)));
49 void FormatPopup::create_objects()
52 post_item(FILE_FFMPEG);
61 post_item(FILE_JPEG_LIST);
66 post_item(FILE_EXR_LIST);
69 post_item(FILE_RAWDV);
70 post_item(FILE_AMPEG);
71 post_item(FILE_VMPEG);
72 post_item(FILE_VORBIS);
79 post_item(FILE_PNG_LIST);
82 post_item(FILE_PPM_LIST);
85 post_item(FILE_TGA_LIST);
88 post_item(FILE_TIFF_LIST);
90 update(&format_items, 0, 0, 1);
93 FormatPopup::~FormatPopup()
95 format_items.remove_all_objects();
98 int FormatPopup::handle_event()
104 FFMPEGPopup::FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y)
105 : BC_ListBox(x, y, 100, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
107 this->plugindb = plugindb;
108 set_tooltip(_("Set ffmpeg file type"));
111 void FFMPEGPopup::create_objects()
113 static const char *dirs[] = { "audio", "video", };
114 for( int i=0; i<(int)(sizeof(dirs)/sizeof(dirs[0])); ++i ) {
116 char option_path[BCTEXTLEN];
117 FFMPEG::set_option_path(option_path, dirs[i]);
118 fs.update(option_path);
119 int total_files = fs.total_files();
120 for( int j=0; j<total_files; ++j ) {
121 const char *name = fs.get_entry(j)->get_name();
122 const char *ext = strrchr(name,'.');
124 if( !strcmp("dfl", ++ext) ) continue;
125 if( !strcmp("opts", ext) ) continue;
126 int k = ffmpeg_types.size();
127 while( --k >= 0 && strcmp(ffmpeg_types[k]->get_text(), ext) );
128 if( k >= 0 ) continue;
129 ffmpeg_types.append(new BC_ListBoxItem(ext));
133 BC_ListBoxItem::sort_items(ffmpeg_types);
134 update(&ffmpeg_types, 0, 0, 1);
137 FFMPEGPopup::~FFMPEGPopup()
139 ffmpeg_types.remove_all_objects();
142 int FFMPEGPopup::handle_event()