remove file ogg/vorbis
[goodguy/cinelerra.git] / cinelerra-5.1 / 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.h"
24 #include "filesystem.h"
25 #include "ffmpeg.h"
26 #include "formatpopup.h"
27 #include "language.h"
28
29
30 FormatPopup::FormatPopup(int x, int y, int do_audio, int do_video, int use_brender)
31  : BC_ListBox(x, y, 200, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
32 {
33         this->do_audio = do_audio;
34         this->do_video = do_video;
35         this->use_brender = use_brender;
36         set_tooltip(_("Change file format"));
37 }
38
39 void FormatPopup::post_item(int format)
40 {
41         if( (do_audio && File::renders_audio(format)) ||
42             (do_video && File::renders_video(format)) )
43                 format_items.append(new BC_ListBoxItem(File::formattostr(format)));
44 }
45
46 void FormatPopup::create_objects()
47 {
48         if(!use_brender) {
49                 post_item(FILE_FFMPEG);
50 #ifdef HAVE_LIBZMPEG
51                 post_item(FILE_AC3);
52 #endif
53                 post_item(FILE_AIFF);
54                 post_item(FILE_AU);
55                 post_item(FILE_FLAC);
56         }
57
58         if(!use_brender)
59                 post_item(FILE_JPEG);
60         post_item(FILE_JPEG_LIST);
61
62         if(!use_brender) {
63 #ifdef HAVE_OPENEXR
64                 post_item(FILE_EXR);
65                 post_item(FILE_EXR_LIST);
66 #endif
67                 post_item(FILE_WAV);
68                 post_item(FILE_RAWDV);
69 #ifdef HAVE_LIBZMPEG
70                 post_item(FILE_AMPEG);
71                 post_item(FILE_VMPEG);
72 #endif
73                 post_item(FILE_PCM);
74         }
75
76         if(!use_brender)
77                 post_item(FILE_PNG);
78         post_item(FILE_PNG_LIST);
79         if(!use_brender)
80                 post_item(FILE_PPM);
81         post_item(FILE_PPM_LIST);
82         if(!use_brender)
83                 post_item(FILE_TGA);
84         post_item(FILE_TGA_LIST);
85         if(!use_brender)
86                 post_item(FILE_TIFF);
87         post_item(FILE_TIFF_LIST);
88
89         update(&format_items, 0, 0, 1);
90 }
91
92 FormatPopup::~FormatPopup()
93 {
94         format_items.remove_all_objects();
95 }
96
97 int FormatPopup::handle_event()
98 {
99         return 1;
100 }
101
102
103 FFMPEGPopup::FFMPEGPopup(int x, int y)
104  : BC_ListBox(x, y, 100, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
105 {
106         set_tooltip(_("Set ffmpeg file type"));
107 }
108
109 void FFMPEGPopup::create_objects()
110 {
111         static const char *dirs[] = { "audio", "video", };
112         for( int i=0; i<(int)(sizeof(dirs)/sizeof(dirs[0])); ++i ) {
113                 FileSystem fs;
114                 char option_path[BCTEXTLEN];
115                 FFMPEG::set_option_path(option_path, dirs[i]);
116                 fs.update(option_path);
117                 int total_files = fs.total_files();
118                 for( int j=0; j<total_files; ++j ) {
119                         const char *name = fs.get_entry(j)->get_name();
120                         const char *ext = strrchr(name,'.');
121                         if( !ext ) continue;
122                         if( !strcmp("dfl", ++ext) ) continue;
123                         if( !strcmp("opts", ext) ) continue;
124                         int k = ffmpeg_types.size();
125                         while( --k >= 0 && strcmp(ffmpeg_types[k]->get_text(), ext) );
126                         if( k >= 0 ) continue;
127                         ffmpeg_types.append(new BC_ListBoxItem(ext));
128                 }
129         }
130
131         BC_ListBoxItem::sort_items(ffmpeg_types);
132         update(&ffmpeg_types, 0, 0, 1);
133 }
134
135 FFMPEGPopup::~FFMPEGPopup()
136 {
137         ffmpeg_types.remove_all_objects();
138 }
139
140 int FFMPEGPopup::handle_event()
141 {
142         return 0;
143 }
144
145