no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / formatwindow.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 "assets.h"
23 #include "file.h"
24 #include "formatwindow.h"
25 #include <string.h>
26
27
28 FormatAWindow::FormatAWindow(Asset *asset, int *dither)
29  : BC_Window(_(PROGRAM_NAME ": File format"), xS(410),
30         yS((asset->format == FILE_WAV) ? 115 : 185), 0, 0)
31 { this->asset = asset; this->dither = dither; }
32
33 FormatAWindow::~FormatAWindow()
34 {
35 }
36
37 void FormatAWindow::create_objects()
38 {
39         lock_window("FormatAWindow::create_objects");
40         int x;
41         int init_x;
42         int y = yS(10);
43         File file;
44         x = init_x = xS(10);
45
46         add_subwindow(new BC_Title(x, y, _("Set parameters for this audio format:")));
47         y += yS(30);
48         add_subwindow(new BC_Title(x, y, _("Bits:")));
49         x += yS(45);
50         add_subwindow(new FormatBits(x, y, asset));
51         x += xS(100);
52         add_subwindow(new FormatDither(x, y, this->dither));
53
54         if(asset->format == FILE_PCM)
55         {
56                 x += xS(90);
57                 add_subwindow(new FormatSigned(x, y, asset));
58         }
59         y += yS(40);
60         x = init_x;
61
62         if(asset->format == FILE_PCM)
63         {
64                 add_subwindow(new BC_Title(x, y, _("Byte order:")));
65                 y += yS(25);
66                 add_subwindow(new BC_Title(x, y, _("HiLo:"), SMALLFONT));
67                 add_subwindow(hilo_button = new FormatHILO(x + xS(30), y, asset));
68                 x += xS(50);
69                 add_subwindow(new BC_Title(x, y, _("LoHi:"), SMALLFONT));
70                 add_subwindow(lohi_button = new FormatLOHI(x + xS(30), y, hilo_button, asset));
71                 hilo_button->lohi = lohi_button;
72                 y += yS(30);
73         }
74
75         x = init_x;
76
77         add_subwindow(new BC_OKButton(x + xS(170), y));
78         unlock_window();
79 }
80
81
82 int FormatAWindow::close_event()
83 {
84         set_done(0);
85 }
86
87
88
89 FormatVWindow::FormatVWindow(Asset *asset, int recording)
90  : BC_Window(_(PROGRAM_NAME ": File format"), xS(410), yS(115), 0, 0)
91 {
92         this->asset = asset;
93         this->recording = recording;
94 }
95
96 FormatVWindow::~FormatVWindow()
97 {
98 }
99
100 void FormatVWindow::create_objects()
101 {
102         lock_window("FormatVWindow::create_objects");
103         int x, y = yS(10);
104         int init_x;
105
106         init_x = x = xS(10);
107
108         if(asset->format == FILE_JPEG_LIST)
109         {
110                 add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:")));
111                 y += yS(30);
112                 add_subwindow(new BC_Title(x, y, _("Quality:")));
113                 x += xS(70);
114                 add_subwindow(new FormatQuality(x, y, asset, asset->quality));
115                 y += yS(40);
116                 x = init_x;
117         }
118         else
119         {
120                 add_subwindow(new BC_Title(x, y, _("Video is not supported in this format.")));
121                 y += yS(40);
122         }
123
124         add_subwindow(new BC_OKButton(x + xS(170), y));
125         unlock_window();
126 }
127
128 int FormatVWindow::close_event()
129 {
130         set_done(0);
131 }
132
133
134 FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_)
135  : BC_ISlider(x, y, 0, xS(100), xS(100), 0, 100, default_, 1)
136 {
137         this->asset = asset;
138 }
139 FormatQuality::~FormatQuality()
140 {
141 }
142 int FormatQuality::handle_event()
143 {
144         asset->quality = get_value();
145 }
146
147
148 FormatBits::FormatBits(int x, int y, Asset *asset)
149  : BitsPopup(x, y, asset)
150 { this->asset = asset; }
151 FormatBits::~FormatBits() {}
152 int FormatBits::handle_event()
153 {
154         asset->bits = get_bits();
155 }
156
157
158 FormatDither::FormatDither(int x, int y, int *dither)
159  : BC_CheckBox(x, y, *dither, _("Dither"))
160 { this->dither = dither; }
161 FormatDither::~FormatDither() {}
162 int FormatDither::handle_event()
163 {
164         *dither = get_value();
165 }
166
167
168
169
170 FormatSigned::FormatSigned(int x, int y, Asset *asset)
171  : BC_CheckBox(x, y, asset->signed_, _("Signed"))
172 { this->asset = asset; }
173 FormatSigned::~FormatSigned() {}
174 int FormatSigned::handle_event()
175 {
176         asset->signed_ = get_value();
177 }
178
179
180 FormatHILO::FormatHILO(int x, int y, Asset *asset)
181  : BC_Radial(x, y, asset->byte_order ^ 1)
182 {
183         this->asset = asset;
184 }
185 FormatHILO::~FormatHILO() {}
186
187 int FormatHILO::handle_event()
188 {
189         asset->byte_order = get_value() ^ 1;
190         lohi->update(get_value() ^ 1);
191 }
192
193 FormatLOHI::FormatLOHI(int x, int y, FormatHILO *hilo, Asset *asset)
194  : BC_Radial(x, y, asset->byte_order)
195 {
196         this->hilo = hilo;
197         this->asset = asset;
198 }
199 FormatLOHI::~FormatLOHI() {}
200
201 int FormatLOHI::handle_event()
202 {
203         asset->byte_order = get_value();
204         hilo->update(get_value() ^ 1);
205 }
206