| 1 | /* BoCA - BonkEnc Component Architecture |
| 2 | * Copyright (C) 2007-2022 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include "config.h" |
| 14 | #include "dllinterface.h" |
| 15 | |
| 16 | const String BoCA::ConfigureWMA::ConfigID = "WMA"; |
| 17 | |
| 18 | BoCA::ConfigureWMA::ConfigureWMA() |
| 19 | { |
| 20 | const Config *config = Config::Get(); |
| 21 | |
| 22 | uncompressed = config->GetIntValue(ConfigID, "Uncompressed", False); |
| 23 | autoselect = config->GetIntValue(ConfigID, "AutoSelectFormat", True); |
| 24 | |
| 25 | useVBR = config->GetIntValue(ConfigID, "EnableVBR", True); |
| 26 | use2Pass = config->GetIntValue(ConfigID, "Enable2Pass", False); |
| 27 | |
| 28 | useVBRSetting = useVBR; |
| 29 | use2PassSetting = use2Pass; |
| 30 | |
| 31 | supportCBR1Pass = False; |
| 32 | supportVBR1Pass = False; |
| 33 | supportCBR2Pass = False; |
| 34 | supportVBR2Pass = False; |
| 35 | |
| 36 | quality = config->GetIntValue(ConfigID, "Quality", 90) / 5; |
| 37 | |
| 38 | ex_WMCreateProfileManager(&profileManager); |
| 39 | |
| 40 | I18n *i18n = I18n::Get(); |
| 41 | |
| 42 | i18n->SetContext("Encoders::WMA"); |
| 43 | |
| 44 | group_codec = new GroupBox(i18n->TranslateString("Select codec"), Point(7, 11), Size(426, 67)); |
| 45 | |
| 46 | option_uncompressed = new OptionBox(i18n->TranslateString("Write uncompressed WMA files"), Point(10, 13), Size(406, 0), &uncompressed, 1); |
| 47 | option_uncompressed->onAction.Connect(&ConfigureWMA::OnToggleCodec, this); |
| 48 | |
| 49 | option_codec = new OptionBox(i18n->AddColon(i18n->TranslateString("Use codec")), Point(10, 39), Size(100, 0), &uncompressed, 0); |
| 50 | option_codec->onAction.Connect(&ConfigureWMA::OnToggleCodec, this); |
| 51 | |
| 52 | option_format = new OptionBox(i18n->AddColon(i18n->TranslateString("Use format")), Point(10, 39), Size(100, 0), &autoselect, 0); |
| 53 | option_format->onAction.Connect(&ConfigureWMA::OnToggleFormat, this); |
| 54 | |
| 55 | option_codec->SetWidth(Math::Max(option_codec->GetUnscaledTextWidth(), option_format->GetUnscaledTextWidth()) + 21); |
| 56 | option_format->SetWidth(option_codec->GetWidth()); |
| 57 | |
| 58 | combo_codec = new ComboBox(Point(100, 38), Size(200, 0)); |
| 59 | |
| 60 | group_codec->Add(option_uncompressed); |
| 61 | group_codec->Add(option_codec); |
| 62 | group_codec->Add(combo_codec); |
| 63 | |
| 64 | group_format = new GroupBox(i18n->TranslateString("Select codec format"), Point(7, 90), Size(426, 93)); |
| 65 | |
| 66 | option_autoselect = new OptionBox(i18n->TranslateString("Automatically select format based on settings and input format"), Point(10, 13), Size(406, 0), &autoselect, 1); |
| 67 | option_autoselect->onAction.Connect(&ConfigureWMA::OnToggleFormat, this); |
| 68 | |
| 69 | check_vbr = new CheckBox(i18n->TranslateString("Use VBR encoding"), Point(18 + option_format->GetWidth(), 39), Size(100, 0), &useVBR); |
| 70 | check_vbr->onAction.Connect(&ConfigureWMA::OnToggleVBR, this); |
| 71 | check_2pass = new CheckBox(i18n->TranslateString("Use 2-pass encoding"), Point(225, 39), Size(100, 0), &use2Pass); |
| 72 | check_2pass->onAction.Connect(&ConfigureWMA::OnToggle2Pass, this); |
| 73 | |
| 74 | check_vbr->SetWidth(Math::Max(120, Math::Max(check_vbr->GetUnscaledTextWidth(), check_2pass->GetUnscaledTextWidth()) + 21)); |
| 75 | check_2pass->SetWidth(check_vbr->GetWidth()); |
| 76 | |
| 77 | combo_format = new ComboBox(Point(18 + option_codec->GetWidth(), 64), Size(200, 0)); |
| 78 | combo_codec->SetX(combo_format->GetX()); |
| 79 | |
| 80 | group_format->Add(option_autoselect); |
| 81 | group_format->Add(option_format); |
| 82 | group_format->Add(check_vbr); |
| 83 | group_format->Add(check_2pass); |
| 84 | group_format->Add(combo_format); |
| 85 | |
| 86 | group_settings = new GroupBox(i18n->TranslateString("Codec settings"), Point(7, 195), Size(426, 67)); |
| 87 | |
| 88 | check_vbr_setting = new CheckBox(i18n->TranslateString("Use VBR encoding"), Point(10, 14), Size(200, 0), &useVBRSetting); |
| 89 | check_vbr_setting->onAction.Connect(&ConfigureWMA::OnToggleVBRSetting, this); |
| 90 | |
| 91 | check_2pass_setting = new CheckBox(i18n->TranslateString("Use 2-pass encoding"), Point(10, 40), Size(200, 0), &use2PassSetting); |
| 92 | check_2pass_setting->onAction.Connect(&ConfigureWMA::OnToggle2PassSetting, this); |
| 93 | |
| 94 | check_vbr_setting->SetWidth(Math::Max(check_vbr_setting->GetUnscaledTextWidth(), check_2pass_setting->GetUnscaledTextWidth()) + 21); |
| 95 | check_2pass_setting->SetWidth(check_vbr_setting->GetWidth()); |
| 96 | |
| 97 | text_quality = new Text(i18n->AddColon(i18n->TranslateString("Quality")), Point(check_vbr_setting->GetWidth() + 18, 16)); |
| 98 | text_bitrate = new Text(i18n->AddColon(i18n->TranslateString("Target bitrate")), Point(check_vbr_setting->GetWidth() + 18, 42)); |
| 99 | |
| 100 | Int maxTextSize = Math::Max(text_quality->GetUnscaledTextWidth(), text_bitrate->GetUnscaledTextWidth()); |
| 101 | |
| 102 | text_bitrate_kbps = new Text(i18n->TranslateString("%1 kbps", "Technical").Replace("%1", NIL).Trim(), Point(35, 42)); |
| 103 | text_bitrate_kbps->SetOrientation(OR_UPPERRIGHT); |
| 104 | text_bitrate_kbps->SetX(text_bitrate_kbps->GetUnscaledTextWidth() + 10); |
| 105 | |
| 106 | text_quality_value = new Text(String::FromInt(quality * 5), Point(text_bitrate_kbps->GetX(), 16)); |
| 107 | text_quality_value->SetOrientation(OR_UPPERRIGHT); |
| 108 | |
| 109 | slider_quality = new Slider(Point(text_quality->GetX() + maxTextSize + 7, 13), Size(100, 0), OR_HORZ, &quality, 0, 20); |
| 110 | slider_quality->onValueChange.Connect(&ConfigureWMA::OnSetQuality, this); |
| 111 | |
| 112 | combo_bitrate = new ComboBox(Point(slider_quality->GetX(), 39), Size(100, 0)); |
| 113 | combo_bitrate->AddEntry("32"); |
| 114 | combo_bitrate->AddEntry("48"); |
| 115 | combo_bitrate->AddEntry("64"); |
| 116 | combo_bitrate->AddEntry("80"); |
| 117 | combo_bitrate->AddEntry("96"); |
| 118 | combo_bitrate->AddEntry("128"); |
| 119 | combo_bitrate->AddEntry("160"); |
| 120 | combo_bitrate->AddEntry("192"); |
| 121 | combo_bitrate->SelectEntry(String::FromInt(config->GetIntValue(ConfigID, "Bitrate", 128))); |
| 122 | |
| 123 | group_settings->Add(check_vbr_setting); |
| 124 | group_settings->Add(check_2pass_setting); |
| 125 | group_settings->Add(text_quality); |
| 126 | group_settings->Add(slider_quality); |
| 127 | group_settings->Add(text_quality_value); |
| 128 | group_settings->Add(text_bitrate); |
| 129 | group_settings->Add(combo_bitrate); |
| 130 | group_settings->Add(text_bitrate_kbps); |
| 131 | |
| 132 | Int maxSize = Math::Max(Math::Max(option_uncompressed->GetUnscaledTextWidth(), option_autoselect->GetUnscaledTextWidth()) + 21, |
| 133 | Math::Max(option_format->GetWidth() + check_vbr->GetWidth() + check_2pass->GetWidth() + 16, check_vbr_setting->GetWidth() + maxTextSize + 120)); |
| 134 | |
| 135 | option_uncompressed->SetWidth(maxSize); |
| 136 | option_autoselect->SetWidth(maxSize); |
| 137 | |
| 138 | combo_codec->SetWidth(maxSize - option_codec->GetWidth() - 8); |
| 139 | combo_format->SetWidth(maxSize - option_codec->GetWidth() - 8); |
| 140 | |
| 141 | check_vbr->SetWidth((maxSize - option_format->GetWidth() - 16) / 2); |
| 142 | check_2pass->SetX(check_vbr->GetX() + check_vbr->GetWidth() + 8 + (maxSize - option_format->GetWidth()) % 2); |
| 143 | check_2pass->SetWidth(check_vbr->GetWidth()); |
| 144 | |
| 145 | slider_quality->SetWidth(maxSize - maxTextSize - text_quality->GetX() - text_bitrate_kbps->GetX() + 6); |
| 146 | combo_bitrate->SetWidth(slider_quality->GetWidth()); |
| 147 | |
| 148 | group_codec->SetWidth(maxSize + 20); |
| 149 | group_format->SetWidth(maxSize + 20); |
| 150 | group_settings->SetWidth(maxSize + 20); |
| 151 | |
| 152 | Add(group_codec); |
| 153 | Add(group_format); |
| 154 | Add(group_settings); |
| 155 | |
| 156 | FillCodecComboBox(); |
| 157 | |
| 158 | if (config->GetIntValue(ConfigID, "Codec", -1) >= 0) combo_codec->SelectNthEntry(config->GetIntValue(ConfigID, "Codec", -1)); |
| 159 | |
| 160 | combo_codec->onSelectEntry.Connect(&ConfigureWMA::OnSelectCodec, this); |
| 161 | |
| 162 | OnSelectCodec(); |
| 163 | |
| 164 | combo_format->SelectNthEntry(config->GetIntValue(ConfigID, "CodecFormat", 0)); |
| 165 | |
| 166 | OnToggleFormat(); |
| 167 | OnToggleCodec(); |
| 168 | |
| 169 | /* ToDo: Implement 2-pass encoding. |
| 170 | * |
| 171 | */ |
| 172 | check_2pass->Deactivate(); |
| 173 | check_2pass_setting->Deactivate(); |
| 174 | |
| 175 | SetSize(Size(maxSize + 34, 269)); |
| 176 | } |
| 177 | |
| 178 | BoCA::ConfigureWMA::~ConfigureWMA() |
| 179 | { |
| 180 | DeleteObject(group_codec); |
| 181 | DeleteObject(option_uncompressed); |
| 182 | DeleteObject(option_codec); |
| 183 | DeleteObject(combo_codec); |
| 184 | |
| 185 | DeleteObject(group_format); |
| 186 | DeleteObject(option_autoselect); |
| 187 | DeleteObject(option_format); |
| 188 | DeleteObject(check_vbr); |
| 189 | DeleteObject(check_2pass); |
| 190 | DeleteObject(combo_format); |
| 191 | |
| 192 | DeleteObject(group_settings); |
| 193 | DeleteObject(check_vbr_setting); |
| 194 | DeleteObject(check_2pass_setting); |
| 195 | DeleteObject(text_quality); |
| 196 | DeleteObject(slider_quality); |
| 197 | DeleteObject(text_quality_value); |
| 198 | DeleteObject(text_bitrate); |
| 199 | DeleteObject(combo_bitrate); |
| 200 | DeleteObject(text_bitrate_kbps); |
| 201 | |
| 202 | profileManager->Release(); |
| 203 | } |
| 204 | |
| 205 | Int BoCA::ConfigureWMA::SaveSettings() |
| 206 | { |
| 207 | Config *config = Config::Get(); |
| 208 | |
| 209 | config->SetIntValue(ConfigID, "Uncompressed", uncompressed); |
| 210 | config->SetIntValue(ConfigID, "Codec", combo_codec->GetSelectedEntryNumber()); |
| 211 | |
| 212 | config->SetIntValue(ConfigID, "AutoSelectFormat", autoselect); |
| 213 | config->SetIntValue(ConfigID, "CodecFormat", combo_format->GetSelectedEntryNumber()); |
| 214 | |
| 215 | if (autoselect) |
| 216 | { |
| 217 | config->SetIntValue(ConfigID, "EnableVBR", useVBRSetting); |
| 218 | config->SetIntValue(ConfigID, "Enable2Pass", use2PassSetting); |
| 219 | } |
| 220 | else |
| 221 | { |
| 222 | config->SetIntValue(ConfigID, "EnableVBR", useVBR); |
| 223 | config->SetIntValue(ConfigID, "Enable2Pass", use2Pass); |
| 224 | } |
| 225 | |
| 226 | config->SetIntValue(ConfigID, "Bitrate", combo_bitrate->GetSelectedEntry()->GetText().ToInt()); |
| 227 | config->SetIntValue(ConfigID, "Quality", quality * 5); |
| 228 | |
| 229 | return Success(); |
| 230 | } |
| 231 | |
| 232 | Void BoCA::ConfigureWMA::FillCodecComboBox() |
| 233 | { |
| 234 | combo_codec->RemoveAllEntries(); |
| 235 | |
| 236 | IWMCodecInfo3 *codecInfo = NIL; |
| 237 | HRESULT hr = profileManager->QueryInterface(IID_IWMCodecInfo3, (void **) &codecInfo); |
| 238 | |
| 239 | if (hr == S_OK) |
| 240 | { |
| 241 | DWORD numCodecs = 0; |
| 242 | |
| 243 | hr = codecInfo->GetCodecInfoCount(WMMEDIATYPE_Audio, &numCodecs); |
| 244 | |
| 245 | for (DWORD i = 0; i < numCodecs; i++) |
| 246 | { |
| 247 | DWORD nameLen = 0; |
| 248 | |
| 249 | hr = codecInfo->GetCodecName(WMMEDIATYPE_Audio, i, NIL, &nameLen); |
| 250 | |
| 251 | WCHAR *name = new WCHAR [nameLen]; |
| 252 | |
| 253 | hr = codecInfo->GetCodecName(WMMEDIATYPE_Audio, i, name, &nameLen); |
| 254 | |
| 255 | combo_codec->AddEntry(name); |
| 256 | |
| 257 | if ( String(name).Contains("Windows Media Audio") && |
| 258 | !String(name).Contains("Voice") && |
| 259 | !String(name).Contains("Lossless") && |
| 260 | !String(name).Contains("Pro")) combo_codec->SelectNthEntry(i); |
| 261 | |
| 262 | delete [] name; |
| 263 | } |
| 264 | |
| 265 | codecInfo->Release(); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | Void BoCA::ConfigureWMA::FillFormatComboBox() |
| 270 | { |
| 271 | static UnsignedInt prevCodec = -1; |
| 272 | static Bool prevUseVBR = False; |
| 273 | static Bool prevUse2Pass = False; |
| 274 | |
| 275 | DWORD codecIndex = combo_codec->GetSelectedEntryNumber(); |
| 276 | |
| 277 | if (combo_format->Length() > 0 && |
| 278 | codecIndex == prevCodec && |
| 279 | useVBR == prevUseVBR && |
| 280 | use2Pass == prevUse2Pass) return; |
| 281 | |
| 282 | prevCodec = codecIndex; |
| 283 | prevUseVBR = useVBR; |
| 284 | prevUse2Pass = use2Pass; |
| 285 | |
| 286 | combo_format->RemoveAllEntries(); |
| 287 | |
| 288 | IWMCodecInfo3 *codecInfo = NIL; |
| 289 | HRESULT hr = profileManager->QueryInterface(IID_IWMCodecInfo3, (void **) &codecInfo); |
| 290 | |
| 291 | if (hr == S_OK) |
| 292 | { |
| 293 | BOOL falseValue = FALSE; |
| 294 | BOOL trueValue = TRUE; |
| 295 | DWORD oneValue = 1; |
| 296 | DWORD twoValue = 2; |
| 297 | |
| 298 | if (useVBR) hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *) &trueValue, sizeof(BOOL)); |
| 299 | else hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *) &falseValue, sizeof(BOOL)); |
| 300 | |
| 301 | if (use2Pass) hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &twoValue, sizeof(DWORD)); |
| 302 | else hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &oneValue, sizeof(DWORD)); |
| 303 | |
| 304 | DWORD numFormats = 0; |
| 305 | |
| 306 | hr = codecInfo->GetCodecFormatCount(WMMEDIATYPE_Audio, codecIndex, &numFormats); |
| 307 | |
| 308 | for (DWORD i = 0; i < numFormats; i++) |
| 309 | { |
| 310 | DWORD nameLen = 0; |
| 311 | |
| 312 | hr = codecInfo->GetCodecFormatDesc(WMMEDIATYPE_Audio, codecIndex, i, NIL, NIL, &nameLen); |
| 313 | |
| 314 | WCHAR *name = new WCHAR [nameLen]; |
| 315 | |
| 316 | hr = codecInfo->GetCodecFormatDesc(WMMEDIATYPE_Audio, codecIndex, i, NIL, name, &nameLen); |
| 317 | |
| 318 | combo_format->AddEntry(name); |
| 319 | |
| 320 | delete [] name; |
| 321 | } |
| 322 | |
| 323 | codecInfo->Release(); |
| 324 | } |
| 325 | |
| 326 | combo_format->SelectNthEntry(1); |
| 327 | combo_format->SelectNthEntry(0); |
| 328 | } |
| 329 | |
| 330 | Void BoCA::ConfigureWMA::OnToggleCodec() |
| 331 | { |
| 332 | if (uncompressed) |
| 333 | { |
| 334 | combo_codec->Deactivate(); |
| 335 | |
| 336 | group_format->Deactivate(); |
| 337 | group_settings->Deactivate(); |
| 338 | } |
| 339 | else |
| 340 | { |
| 341 | combo_codec->Activate(); |
| 342 | |
| 343 | group_format->Activate(); |
| 344 | |
| 345 | OnToggleFormat(); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | Void BoCA::ConfigureWMA::OnSelectCodec() |
| 350 | { |
| 351 | IWMCodecInfo3 *codecInfo = NIL; |
| 352 | HRESULT hr = profileManager->QueryInterface(IID_IWMCodecInfo3, (void **) &codecInfo); |
| 353 | |
| 354 | if (hr == S_OK) |
| 355 | { |
| 356 | DWORD codecIndex = combo_codec->GetSelectedEntryNumber(); |
| 357 | |
| 358 | supportCBR1Pass = False; |
| 359 | supportVBR1Pass = False; |
| 360 | supportCBR2Pass = False; |
| 361 | supportVBR2Pass = False; |
| 362 | |
| 363 | /* Check if CBR is supported. |
| 364 | */ |
| 365 | { |
| 366 | BOOL falseValue = FALSE; |
| 367 | DWORD oneValue = 1; |
| 368 | |
| 369 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *) &falseValue, sizeof(BOOL)); |
| 370 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &oneValue, sizeof(DWORD)); |
| 371 | |
| 372 | DWORD numFormats = 0; |
| 373 | |
| 374 | hr = codecInfo->GetCodecFormatCount(WMMEDIATYPE_Audio, codecIndex, &numFormats); |
| 375 | |
| 376 | if (hr == S_OK && numFormats > 0) |
| 377 | { |
| 378 | supportCBR1Pass = True; |
| 379 | |
| 380 | DWORD twoValue = 2; |
| 381 | |
| 382 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &twoValue, sizeof(DWORD)); |
| 383 | |
| 384 | if (hr == S_OK) |
| 385 | { |
| 386 | hr = codecInfo->GetCodecFormatCount(WMMEDIATYPE_Audio, codecIndex, &numFormats); |
| 387 | |
| 388 | if (hr == S_OK && numFormats > 0) supportCBR2Pass = True; |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | /* Check if VBR is supported. |
| 394 | */ |
| 395 | { |
| 396 | WMT_ATTR_DATATYPE valueType = WMT_TYPE_BOOL; |
| 397 | DWORD valueSize = sizeof(BOOL); |
| 398 | BOOL isVBRSupported = FALSE; |
| 399 | |
| 400 | hr = codecInfo->GetCodecProp(WMMEDIATYPE_Audio, codecIndex, g_wszIsVBRSupported, &valueType, (BYTE *) &isVBRSupported, &valueSize); |
| 401 | |
| 402 | if (isVBRSupported) |
| 403 | { |
| 404 | BOOL trueValue = TRUE; |
| 405 | DWORD oneValue = 1; |
| 406 | |
| 407 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszVBREnabled, WMT_TYPE_BOOL, (BYTE *) &trueValue, sizeof(BOOL)); |
| 408 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &oneValue, sizeof(DWORD)); |
| 409 | |
| 410 | if (hr == S_OK) |
| 411 | { |
| 412 | DWORD numFormats = 0; |
| 413 | |
| 414 | hr = codecInfo->GetCodecFormatCount(WMMEDIATYPE_Audio, codecIndex, &numFormats); |
| 415 | |
| 416 | if (hr == S_OK && numFormats > 0) |
| 417 | { |
| 418 | supportVBR1Pass = True; |
| 419 | |
| 420 | DWORD twoValue = 2; |
| 421 | |
| 422 | hr = codecInfo->SetCodecEnumerationSetting(WMMEDIATYPE_Audio, codecIndex, g_wszNumPasses, WMT_TYPE_DWORD, (BYTE *) &twoValue, sizeof(DWORD)); |
| 423 | |
| 424 | if (hr == S_OK) |
| 425 | { |
| 426 | hr = codecInfo->GetCodecFormatCount(WMMEDIATYPE_Audio, codecIndex, &numFormats); |
| 427 | |
| 428 | if (hr == S_OK && numFormats > 0) supportVBR2Pass = True; |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | codecInfo->Release(); |
| 436 | } |
| 437 | |
| 438 | if ( (supportVBR1Pass || supportVBR2Pass) && |
| 439 | !(supportCBR1Pass || supportCBR2Pass)) { check_vbr->SetChecked(True); check_vbr_setting->SetChecked(True); } |
| 440 | |
| 441 | if (!(supportVBR1Pass || supportVBR2Pass) && |
| 442 | (supportCBR1Pass || supportCBR2Pass)) { check_vbr->SetChecked(False); check_vbr_setting->SetChecked(False); } |
| 443 | |
| 444 | OnToggleVBR(); |
| 445 | OnToggle2Pass(); |
| 446 | |
| 447 | OnToggleVBRSetting(); |
| 448 | OnToggle2PassSetting(); |
| 449 | |
| 450 | OnToggleFormat(); |
| 451 | |
| 452 | if ((supportVBR1Pass || supportVBR2Pass) && |
| 453 | (supportCBR1Pass || supportCBR2Pass)) check_vbr_setting->Activate(); |
| 454 | else check_vbr_setting->Deactivate(); |
| 455 | |
| 456 | /* ToDo: Implement 2-pass encoding. |
| 457 | * |
| 458 | */ |
| 459 | /* if ((supportCBR1Pass || supportVBR1Pass) && |
| 460 | (supportCBR2Pass || supportVBR2Pass)) check_2pass_setting->Activate(); |
| 461 | else check_2pass_setting->Deactivate(); |
| 462 | */ |
| 463 | } |
| 464 | |
| 465 | Void BoCA::ConfigureWMA::OnToggleFormat() |
| 466 | { |
| 467 | if (autoselect) |
| 468 | { |
| 469 | check_vbr->Deactivate(); |
| 470 | check_2pass->Deactivate(); |
| 471 | combo_format->Deactivate(); |
| 472 | |
| 473 | if (combo_codec->GetSelectedEntry()->GetText().Contains("Lossless")) group_settings->Deactivate(); |
| 474 | else group_settings->Activate(); |
| 475 | |
| 476 | /* ToDo: Implement 2-pass encoding. |
| 477 | * |
| 478 | */ |
| 479 | check_2pass_setting->Deactivate(); |
| 480 | } |
| 481 | else |
| 482 | { |
| 483 | combo_format->Activate(); |
| 484 | |
| 485 | group_settings->Deactivate(); |
| 486 | |
| 487 | OnToggleVBR(); |
| 488 | OnToggle2Pass(); |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | Void BoCA::ConfigureWMA::OnToggleVBR() |
| 493 | { |
| 494 | /* ToDo: Implement 2-pass encoding. |
| 495 | * |
| 496 | */ |
| 497 | /* if (useVBR) |
| 498 | { |
| 499 | if ( supportVBR1Pass && supportVBR2Pass) check_2pass->Activate(); |
| 500 | else check_2pass->Deactivate(); |
| 501 | } |
| 502 | else |
| 503 | { |
| 504 | if ( supportCBR1Pass && supportCBR2Pass) check_2pass->Activate(); |
| 505 | else check_2pass->Deactivate(); |
| 506 | } |
| 507 | */ |
| 508 | FillFormatComboBox(); |
| 509 | } |
| 510 | |
| 511 | Void BoCA::ConfigureWMA::OnToggle2Pass() |
| 512 | { |
| 513 | if (use2Pass) |
| 514 | { |
| 515 | if ( supportCBR2Pass && supportVBR2Pass) check_vbr->Activate(); |
| 516 | else check_vbr->Deactivate(); |
| 517 | } |
| 518 | else |
| 519 | { |
| 520 | if ( supportCBR1Pass && supportVBR1Pass) check_vbr->Activate(); |
| 521 | else check_vbr->Deactivate(); |
| 522 | } |
| 523 | |
| 524 | FillFormatComboBox(); |
| 525 | } |
| 526 | |
| 527 | Void BoCA::ConfigureWMA::OnToggleVBRSetting() |
| 528 | { |
| 529 | if (useVBRSetting) |
| 530 | { |
| 531 | text_bitrate->Deactivate(); |
| 532 | combo_bitrate->Deactivate(); |
| 533 | text_bitrate_kbps->Deactivate(); |
| 534 | |
| 535 | text_quality->Activate(); |
| 536 | slider_quality->Activate(); |
| 537 | text_quality_value->Activate(); |
| 538 | } |
| 539 | else |
| 540 | { |
| 541 | text_bitrate->Activate(); |
| 542 | combo_bitrate->Activate(); |
| 543 | text_bitrate_kbps->Activate(); |
| 544 | |
| 545 | text_quality->Deactivate(); |
| 546 | slider_quality->Deactivate(); |
| 547 | text_quality_value->Deactivate(); |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | Void BoCA::ConfigureWMA::OnToggle2PassSetting() |
| 552 | { |
| 553 | } |
| 554 | |
| 555 | Void BoCA::ConfigureWMA::OnSetQuality() |
| 556 | { |
| 557 | text_quality_value->SetText(String::FromInt(quality * 5)); |
| 558 | } |