remove old quicktime, replaced with current ffmpeg
[goodguy/history.git] / cinelerra-5.0 / cinelerra / formatpopup.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "bcsignals.h"
23 #include "file.inc"
24 #include "filesystem.h"
25 #include "ffmpeg.h"
26 #include "formatpopup.h"
27 #include "language.h"
28 #include "pluginserver.h"
29
30
31
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)
35 {
36         this->plugindb = plugindb;
37         this->use_brender = use_brender;
38         set_tooltip(_("Change file format"));
39 }
40
41 void FormatPopup::create_objects()
42 {
43         format_items.append(new BC_ListBoxItem(_(FFMPEG_NAME)));
44
45         if(!use_brender)
46         {
47                 format_items.append(new BC_ListBoxItem(_(AC3_NAME)));
48                 format_items.append(new BC_ListBoxItem(_(AIFF_NAME)));
49                 format_items.append(new BC_ListBoxItem(_(AU_NAME)));
50                 format_items.append(new BC_ListBoxItem(_(FLAC_NAME)));
51                 format_items.append(new BC_ListBoxItem(_(JPEG_NAME)));
52         }
53
54         format_items.append(new BC_ListBoxItem(_(JPEG_LIST_NAME)));
55
56         if(!use_brender)
57         {
58                 format_items.append(new BC_ListBoxItem(_(EXR_NAME)));
59                 format_items.append(new BC_ListBoxItem(_(EXR_LIST_NAME)));
60                 format_items.append(new BC_ListBoxItem(_(WAV_NAME)));
61                 format_items.append(new BC_ListBoxItem(_(AMPEG_NAME)));
62                 format_items.append(new BC_ListBoxItem(_(VMPEG_NAME)));
63                 format_items.append(new BC_ListBoxItem(_(OGG_NAME)));
64                 format_items.append(new BC_ListBoxItem(_(PCM_NAME)));
65                 format_items.append(new BC_ListBoxItem(_(PNG_NAME)));
66         }
67
68         format_items.append(new BC_ListBoxItem(_(PNG_LIST_NAME)));
69
70         if(!use_brender)
71         {
72                 format_items.append(new BC_ListBoxItem(_(TGA_NAME)));
73         }
74
75         format_items.append(new BC_ListBoxItem(_(TGA_LIST_NAME)));
76
77         if(!use_brender)
78         {
79                 format_items.append(new BC_ListBoxItem(_(TIFF_NAME)));
80         }
81
82         format_items.append(new BC_ListBoxItem(_(TIFF_LIST_NAME)));
83         update(&format_items, 0, 0, 1);
84 }
85
86 FormatPopup::~FormatPopup()
87 {
88         format_items.remove_all_objects();
89 }
90
91 int FormatPopup::handle_event()
92 {
93         return 0;
94 }
95
96
97 FFMPEGPopup::FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y)
98  : BC_ListBox(x, y, 50, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
99 {
100         this->plugindb = plugindb;
101         set_tooltip(_("Set ffmpeg file type"));
102 }
103
104 void FFMPEGPopup::create_objects()
105 {
106         static const char *dirs[] = { "audio", "video", };
107         for( int i=0; i<(int)(sizeof(dirs)/sizeof(dirs[0])); ++i ) {
108                 FileSystem fs;
109                 char option_path[BCTEXTLEN];
110                 FFMPEG::set_option_path(option_path, dirs[i]);
111                 fs.update(option_path);
112                 int total_files = fs.total_files();
113                 for( int j=0; j<total_files; ++j ) {
114                         const char *name = fs.get_entry(j)->get_name();
115                         const char *ext = strrchr(name,'.');
116                         if( !ext ) continue;
117                         if( !strcmp("dfl", ++ext) ) continue;
118                         if( !strcmp("opts", ext) ) continue;
119                         int k = ffmpeg_types.size();
120                         while( --k >= 0 && strcmp(ffmpeg_types[k]->get_text(), ext) );
121                         if( k >= 0 ) continue;
122                         ffmpeg_types.append(new BC_ListBoxItem(ext));
123                 }
124         }
125
126         update(&ffmpeg_types, 0, 0, 1);
127 }
128
129 FFMPEGPopup::~FFMPEGPopup()
130 {
131         ffmpeg_types.remove_all_objects();
132 }
133
134 int FFMPEGPopup::handle_event()
135 {
136         return 0;
137 }
138
139