Audacity 3.2.0
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
ExportFFmpegOptions Class Referencefinal

Custom FFmpeg export dialog. More...

#include <ExportFFmpegDialogs.h>

Inheritance diagram for ExportFFmpegOptions:
[legend]
Collaboration diagram for ExportFFmpegOptions:
[legend]

Public Member Functions

 ExportFFmpegOptions (wxWindow *parent)
 
 ~ExportFFmpegOptions ()
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnOK (wxCommandEvent &event)
 
void OnGetURL (wxCommandEvent &event)
 
void OnFormatList (wxCommandEvent &event)
 
void DoOnFormatList ()
 
void OnCodecList (wxCommandEvent &event)
 
void DoOnCodecList ()
 
void OnAllFormats (wxCommandEvent &event)
 
void OnAllCodecs (wxCommandEvent &event)
 
void OnSavePreset (wxCommandEvent &event)
 
void OnLoadPreset (wxCommandEvent &event)
 
void OnDeletePreset (wxCommandEvent &event)
 
void OnImportPresets (wxCommandEvent &event)
 
void OnExportPresets (wxCommandEvent &event)
 
bool SavePreset (bool bCheckForOverwrite)
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Attributes

static CompatibilityEntry CompatibilityList []
 
static ExposedFormat fmts []
 List of export types. More...
 
static const int iAACSampleRates []
 
static ApplicableFor apptable []
 

Private Member Functions

void FindSelectedFormat (wxString **name, wxString **longname)
 Finds the format currently selected and returns its name and description. More...
 
void FindSelectedCodec (wxString **name, wxString **longname)
 Finds the codec currently selected and returns its name and description. More...
 
void FetchFormatList ()
 Retrieves format list from libavformat. More...
 
int FetchCompatibleFormatList (AudacityAVCodecID id, wxString *selfmt)
 
void FetchCodecList ()
 Retrieves codec list from libavcodec. More...
 
int FetchCompatibleCodecList (const wxChar *fmt, AudacityAVCodecID id)
 
void FetchPresetList ()
 Retrieves list of presets from configuration file. More...
 
bool ReportIfBadCombination ()
 
void EnableDisableControls (AVCodecWrapper *cdc, wxString *selfmt)
 

Private Attributes

wxArrayString mShownFormatNames
 
wxArrayString mShownFormatLongNames
 
wxArrayString mShownCodecNames
 
wxArrayString mShownCodecLongNames
 
wxArrayStringEx mFormatNames
 
wxArrayString mFormatLongNames
 
wxArrayStringEx mCodecNames
 
wxArrayString mCodecLongNames
 
wxListBox * mFormatList
 
wxListBox * mCodecList
 
wxStaticText * mFormatName
 
wxStaticText * mCodecName
 
wxComboBox * mPresetCombo
 
int mBitRateFromChoice
 
int mSampleRateFromChoice
 
std::unique_ptr< FFmpegPresetsmPresets
 
wxArrayStringEx mPresetNames
 
std::shared_ptr< FFmpegFunctionsmFFmpeg
 

Detailed Description

Custom FFmpeg export dialog.

Options dialog for Custom FFmpeg export format.

Definition at line 206 of file ExportFFmpegDialogs.h.

Constructor & Destructor Documentation

◆ ExportFFmpegOptions()

ExportFFmpegOptions::ExportFFmpegOptions ( wxWindow *  parent)

Definition at line 1719 of file ExportFFmpegDialogs.cpp.

1720: wxDialogWrapper(parent, wxID_ANY,
1721 XO("Configure custom FFmpeg options"))
1722{
1723 SetName();
1726 //FFmpegLibsInst()->LoadLibs(NULL,true); //Loaded at startup or from Prefs now
1727
1728 mPresets = std::make_unique<FFmpegPresets>();
1729 mPresets->GetPresetList(mPresetNames);
1730
1731 if (mFFmpeg)
1732 {
1735
1737
1738 //Select the format that was selected last time this dialog was closed
1739 mFormatList->Select(mFormatList->FindString(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"))));
1741
1742 //Select the codec that was selected last time this dialog was closed
1743 auto codec = mFFmpeg->CreateEncoder(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
1744
1745 if (codec != nullptr)
1746 mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->GetName())));
1747
1748 DoOnCodecList();
1749 }
1750
1751}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
FileConfig * gPrefs
Definition: Prefs.cpp:70
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#define S(N)
Definition: ToChars.cpp:64
void FetchCodecList()
Retrieves codec list from libavcodec.
std::unique_ptr< FFmpegPresets > mPresets
void PopulateOrExchange(ShuttleGui &S)
void FetchFormatList()
Retrieves format list from libavformat.
wxArrayStringEx mPresetNames
std::shared_ptr< FFmpegFunctions > mFFmpeg
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625
std::string ToUTF8(const std::wstring &wstr)
static std::shared_ptr< FFmpegFunctions > Load(bool fromUserPathOnly=false)

References DoOnCodecList(), DoOnFormatList(), eIsCreatingFromPrefs, FetchCodecList(), FetchFormatList(), gPrefs, FFmpegFunctions::Load(), mCodecList, mFFmpeg, mFormatList, mPresetNames, mPresets, PopulateOrExchange(), S, wxDialogWrapper::SetName(), audacity::ToUTF8(), and wxT().

Here is the call graph for this function:

◆ ~ExportFFmpegOptions()

ExportFFmpegOptions::~ExportFFmpegOptions ( )

Definition at line 1715 of file ExportFFmpegDialogs.cpp.

1716{
1717}

Member Function Documentation

◆ DoOnCodecList()

void ExportFFmpegOptions::DoOnCodecList ( )

Definition at line 2519 of file ExportFFmpegDialogs.cpp.

2520{
2521 wxString *selcdc = nullptr;
2522 wxString* selcdclong = nullptr;
2523
2524 FindSelectedCodec(&selcdc, &selcdclong);
2525
2526 if (selcdc == nullptr)
2527 {
2528 return;
2529 }
2530
2531 wxString* selfmt = nullptr;
2532 wxString* selfmtlong = nullptr;
2533
2534 FindSelectedFormat(&selfmt, &selfmtlong);
2535
2536 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2537 if (cdc == nullptr)
2538 {
2539 //This shouldn't really happen
2540 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2541 mCodecName->SetLabel(wxString(_("Failed to find the codec")));
2542 return;
2543 }
2544
2545 mCodecName->SetLabel(wxString::Format(wxT("[%d] %s"), (int) mFFmpeg->GetAudacityCodecID(cdc->GetId()).value, *selcdclong));
2546
2547 if (selfmt != nullptr)
2548 {
2549 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(), nullptr, nullptr);
2550 if (fmt == nullptr)
2551 {
2552 selfmt = nullptr;
2553 selfmtlong = nullptr;
2554 }
2555 }
2556
2557 int newselfmt = FetchCompatibleFormatList(
2558 mFFmpeg->GetAudacityCodecID(cdc->GetId()), selfmt);
2559
2560 if (newselfmt >= 0)
2561 mFormatList->Select(newselfmt);
2562
2563 EnableDisableControls(cdc.get(), selfmt);
2564 Layout();
2565 Fit();
2566 return;
2567}
#define _(s)
Definition: Internat.h:73
void FindSelectedCodec(wxString **name, wxString **longname)
Finds the codec currently selected and returns its name and description.
int FetchCompatibleFormatList(AudacityAVCodecID id, wxString *selfmt)
void FindSelectedFormat(wxString **name, wxString **longname)
Finds the format currently selected and returns its name and description.
void EnableDisableControls(AVCodecWrapper *cdc, wxString *selfmt)

References _, EnableDisableControls(), FetchCompatibleFormatList(), FindSelectedCodec(), FindSelectedFormat(), mCodecName, mFFmpeg, mFormatList, and wxT().

Referenced by ExportFFmpegOptions(), OnCodecList(), and OnLoadPreset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoOnFormatList()

void ExportFFmpegOptions::DoOnFormatList ( )

Definition at line 2469 of file ExportFFmpegDialogs.cpp.

2470{
2471 wxString *selfmt = NULL;
2472 wxString *selfmtlong = NULL;
2473 FindSelectedFormat(&selfmt, &selfmtlong);
2474 if (selfmt == NULL)
2475 {
2476 return;
2477 }
2478
2479 wxString *selcdc = NULL;
2480 wxString *selcdclong = NULL;
2481 FindSelectedCodec(&selcdc, &selcdclong);
2482
2483 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(),NULL,NULL);
2484 if (fmt == NULL)
2485 {
2486 //This shouldn't really happen
2487 mFormatName->SetLabel(wxString(_("Failed to guess format")));
2488 return;
2489 }
2490 mFormatName->SetLabel(wxString::Format(wxT("%s"), *selfmtlong));
2491
2493
2494 if (selcdc != nullptr)
2495 {
2496 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2497
2498 if (cdc != nullptr)
2499 {
2500 selcdcid = mFFmpeg->GetAudacityCodecID(cdc->GetId());
2501 }
2502 }
2503 int newselcdc =
2504 FetchCompatibleCodecList(*selfmt, selcdcid);
2505
2506 if (newselcdc >= 0) mCodecList->Select(newselcdc);
2507
2508 std::unique_ptr<AVCodecWrapper> cdc;
2509
2510 if (selcdc != nullptr)
2511 cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2512
2513 EnableDisableControls(cdc.get(), selfmt);
2514 Layout();
2515 Fit();
2516 return;
2517}
@ AUDACITY_AV_CODEC_ID_NONE
Definition: AVCodecID.h:14
int FetchCompatibleCodecList(const wxChar *fmt, AudacityAVCodecID id)
wxStaticText * mFormatName

References _, AUDACITY_AV_CODEC_ID_NONE, EnableDisableControls(), FetchCompatibleCodecList(), FindSelectedCodec(), FindSelectedFormat(), mCodecList, mFFmpeg, mFormatName, and wxT().

Referenced by ExportFFmpegOptions(), OnFormatList(), and OnLoadPreset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableDisableControls()

void ExportFFmpegOptions::EnableDisableControls ( AVCodecWrapper cdc,
wxString *  selfmt 
)
private

Definition at line 2436 of file ExportFFmpegDialogs.cpp.

2437{
2438 int handled = -1;
2439 for (int i = 0; apptable[i].control != 0; i++)
2440 {
2441 if (apptable[i].control != handled)
2442 {
2443 bool codec = false;
2444 bool format = false;
2445 if (apptable[i].codec == AUDACITY_AV_CODEC_ID_NONE)
2446 {
2447 codec = true;
2448 }
2449 else if (
2450 cdc != NULL &&
2451 apptable[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()))
2452 {
2453 codec = true;
2454 }
2455
2456 if (wxString::FromUTF8(apptable[i].format) == wxT("any")) format = true;
2457 else if (selfmt != NULL &&
2458 *selfmt == wxString::FromUTF8(apptable[i].format)) format = true;
2459 if (codec && format)
2460 {
2461 handled = apptable[i].control;
2462 wxWindow *item = FindWindowById(apptable[i].control,this);
2463 if (item != NULL) item->Enable(apptable[i].enable);
2464 }
2465 }
2466 }
2467}
int format
Definition: ExportPCM.cpp:53
virtual AVCodecIDFwd GetId() const noexcept=0
static ApplicableFor apptable[]
int control
control ID

References apptable, AUDACITY_AV_CODEC_ID_NONE, ApplicableFor::control, format, AVCodecWrapper::GetId(), mFFmpeg, and wxT().

Referenced by DoOnCodecList(), and DoOnFormatList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FetchCodecList()

void ExportFFmpegOptions::FetchCodecList ( )
private

Retrieves codec list from libavcodec.

Definition at line 1777 of file ExportFFmpegDialogs.cpp.

1778{
1779 if (!mFFmpeg)
1780 return;
1781 // Enumerate all codecs
1782 std::unique_ptr<AVCodecWrapper> codec;
1783 for (auto codec : mFFmpeg->GetCodecs())
1784 {
1785 // We're only interested in audio and only in encoders
1786 if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
1787 {
1788 // MP2 Codec is broken. Don't allow it.
1789 if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2))
1790 continue;
1791
1792 mCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
1793 mCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
1794 }
1795 }
1796 // Show all codecs
1799}
@ AUDACITY_AV_CODEC_ID_MP2
Definition: AVCodecID.h:294
wxArrayStringEx mCodecNames
wxArrayString mShownCodecLongNames
wxArrayString mShownCodecNames
wxArrayString mCodecLongNames

References AUDACITY_AV_CODEC_ID_MP2, mCodecLongNames, mCodecNames, mFFmpeg, mShownCodecLongNames, mShownCodecNames, and wxT().

Referenced by ExportFFmpegOptions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FetchCompatibleCodecList()

int ExportFFmpegOptions::FetchCompatibleCodecList ( const wxChar *  fmt,
AudacityAVCodecID  id 
)
private

Retrieves a list of codecs compatible to format

Parameters
fmtFormat short name
idid of the codec selected at the moment
Returns
index of the id in NEW codec list or -1 if it is not in the list

Definition at line 2038 of file ExportFFmpegDialogs.cpp.

2039{
2040 const auto ffmpegId = mFFmpeg->GetAVCodecID(id);
2041
2042 // By default assume that id is not in the list
2043 int index = -1;
2044 // By default no codecs are compatible (yet)
2045 mShownCodecNames.clear();
2046 mShownCodecLongNames.clear();
2047 // Clear the listbox
2048 mCodecList->Clear();
2049 // Zero - format is not found at all
2050 int found = 0;
2051 wxString str(fmt);
2052 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2053 {
2054 if (str == CompatibilityList[i].fmt)
2055 {
2056 // Format is found in the list
2057 found = 1;
2058 if (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE)
2059 {
2060 // Format is found in the list and it is compatible with AUDACITY_AV_CODEC_ID_NONE (means that it is compatible to anything)
2061 found = 2;
2062 break;
2063 }
2064 // Find the codec, that is claimed to be compatible
2065 std::unique_ptr<AVCodecWrapper> codec = mFFmpeg->CreateEncoder(mFFmpeg->GetAVCodecID(CompatibilityList[i].codec));
2066 // If it exists, is audio and has encoder
2067 if (codec != NULL && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2068 {
2069 // If it was selected - remember its NEW index
2070 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2071 index = mShownCodecNames.size();
2072
2073 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2074 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2075 }
2076 }
2077 }
2078 // All codecs are compatible with this format
2079 if (found == 2)
2080 {
2081 std::unique_ptr<AVCodecWrapper> codec;
2082 for (auto codec : mFFmpeg->GetCodecs())
2083 {
2084 if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2085 {
2086 // MP2 is broken.
2087 if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2) )
2088 continue;
2089
2091 .contains( wxString::FromUTF8(codec->GetName()) ) )
2092 {
2093 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2094 index = mShownCodecNames.size();
2095
2096 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2097 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2098 }
2099 }
2100 }
2101 }
2102 // Format is not found - find format in libavformat and add its default audio codec
2103 // This allows us to provide limited support for NEW formats without modifying the compatibility list
2104 else if (found == 0)
2105 {
2106 wxCharBuffer buf = str.ToUTF8();
2107 auto format = mFFmpeg->GuessOutputFormat(buf, nullptr, nullptr);
2108
2109 if (format != nullptr)
2110 {
2111 auto codec = mFFmpeg->CreateEncoder(format->GetAudioCodec());
2112
2113 if (
2114 codec != nullptr && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2115 {
2116 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2117 index = mShownCodecNames.size();
2118
2119 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2120 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2121 }
2122 }
2123 }
2124 // Show NEW codec list
2126
2127 return index;
2128}
#define str(a)
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:448
static CompatibilityEntry CompatibilityList[]
const wxChar * fmt
format, recognizable by guess_format()
AudacityAVCodecID codec
codec ID

References AUDACITY_AV_CODEC_ID_MP2, AUDACITY_AV_CODEC_ID_NONE, CompatibilityEntry::codec, CompatibilityList, CompatibilityEntry::fmt, format, make_iterator_range(), mCodecList, mFFmpeg, mShownCodecLongNames, mShownCodecNames, str, and wxT().

Referenced by DoOnFormatList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FetchCompatibleFormatList()

int ExportFFmpegOptions::FetchCompatibleFormatList ( AudacityAVCodecID  id,
wxString *  selfmt 
)
private

Retrieves a list of formats compatible to codec

Parameters
idCodec ID
selfmtformat selected at the moment
Returns
index of the selfmt in NEW format list or -1 if it is not in the list

Definition at line 2132 of file ExportFFmpegDialogs.cpp.

2134{
2135 int index = -1;
2136 mShownFormatNames.clear();
2137 mShownFormatLongNames.clear();
2138 mFormatList->Clear();
2139
2140 wxArrayString FromList;
2141 // Find all formats compatible to this codec in compatibility list
2142 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2143 {
2144 if (CompatibilityList[i].codec == id || (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE) )
2145 {
2146 if ((selfmt != NULL) && (*selfmt == CompatibilityList[i].fmt)) index = mShownFormatNames.size();
2147 FromList.push_back(CompatibilityList[i].fmt);
2148 mShownFormatNames.push_back(CompatibilityList[i].fmt);
2149 auto tofmt = mFFmpeg->GuessOutputFormat(
2150 wxString(CompatibilityList[i].fmt).ToUTF8(), nullptr, nullptr);
2151
2152 if (tofmt != NULL)
2153 {
2154 mShownFormatLongNames.push_back(wxString::Format(
2155 wxT("%s - %s"), CompatibilityList[i].fmt,
2156 wxString::FromUTF8(tofmt->GetLongName())));
2157 }
2158 }
2159 }
2160 bool found = false;
2161 if (selfmt != NULL)
2162 {
2163 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2164 {
2165 if (*selfmt == CompatibilityList[i].fmt)
2166 {
2167 found = true;
2168 break;
2169 }
2170 }
2171 }
2172 // Format was in the compatibility list
2173 if (found)
2174 {
2175 // Find all formats which have this codec as default and which are not in the list yet and add them too
2176 for (auto ofmt : mFFmpeg->GetOutputFormats())
2177 {
2178 if (ofmt->GetAudioCodec() == mFFmpeg->GetAVCodecID(id))
2179 {
2180 wxString ofmtname = wxString::FromUTF8(ofmt->GetName());
2181 found = false;
2182 for (unsigned int i = 0; i < FromList.size(); i++)
2183 {
2184 if (ofmtname == FromList[i])
2185 {
2186 found = true;
2187 break;
2188 }
2189 }
2190 if (!found)
2191 {
2192 if ((selfmt != NULL) &&
2193 (*selfmt == wxString::FromUTF8(ofmt->GetName())))
2194 index = mShownFormatNames.size();
2195
2196 mShownFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
2197
2198 mShownFormatLongNames.push_back(wxString::Format(
2199 wxT("%s - %s"), mShownFormatNames.back(),
2200 wxString::FromUTF8(ofmt->GetLongName())));
2201 }
2202 }
2203 }
2204 }
2206 return index;
2207}
wxArrayString mShownFormatLongNames
wxArrayString mShownFormatNames

References AUDACITY_AV_CODEC_ID_NONE, CompatibilityList, CompatibilityEntry::fmt, mFFmpeg, mFormatList, mShownFormatLongNames, mShownFormatNames, audacity::ToUTF8(), and wxT().

Referenced by DoOnCodecList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FetchFormatList()

void ExportFFmpegOptions::FetchFormatList ( )
private

Retrieves format list from libavformat.

Definition at line 1755 of file ExportFFmpegDialogs.cpp.

1756{
1757 if (!mFFmpeg)
1758 return;
1759
1760 for (auto ofmt : mFFmpeg->GetOutputFormats())
1761 {
1762 // Any audio-capable format has default audio codec.
1763 // If it doesn't, then it doesn't supports any audio codecs
1764 if (ofmt->GetAudioCodec() != AUDACITY_AV_CODEC_ID_NONE)
1765 {
1766 mFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
1767 mFormatLongNames.push_back(wxString::Format(wxT("%s - %s"),mFormatNames.back(),wxString::FromUTF8(ofmt->GetLongName())));
1768 }
1769 }
1770 // Show all formats
1773}
wxArrayStringEx mFormatNames
wxArrayString mFormatLongNames

References AUDACITY_AV_CODEC_ID_NONE, mFFmpeg, mFormatLongNames, mFormatNames, mShownFormatLongNames, mShownFormatNames, and wxT().

Referenced by ExportFFmpegOptions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FetchPresetList()

void ExportFFmpegOptions::FetchPresetList ( )
private

Retrieves list of presets from configuration file.

◆ FindSelectedCodec()

void ExportFFmpegOptions::FindSelectedCodec ( wxString **  name,
wxString **  longname 
)
private

Finds the codec currently selected and returns its name and description.

Definition at line 2017 of file ExportFFmpegDialogs.cpp.

2018{
2019 // Get current selection
2020 wxArrayInt selections;
2021 int n = mCodecList->GetSelections(selections);
2022 if (n <= 0) return;
2023
2024 // Get selected codec short name
2025 wxString selcdc = mCodecList->GetString(selections[0]);
2026
2027 // Find its index
2028 int nCodec = make_iterator_range( mCodecNames ).index( selcdc );
2029 if (nCodec == wxNOT_FOUND) return;
2030
2031 // Return short name and description
2032 if (name != NULL) *name = &mCodecNames[nCodec];
2033 if (longname != NULL) *longname = &mCodecLongNames[nCodec];
2034}
const TranslatableString name
Definition: Distortion.cpp:76

References make_iterator_range(), mCodecList, mCodecLongNames, mCodecNames, and name.

Referenced by DoOnCodecList(), DoOnFormatList(), and ReportIfBadCombination().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindSelectedFormat()

void ExportFFmpegOptions::FindSelectedFormat ( wxString **  name,
wxString **  longname 
)
private

Finds the format currently selected and returns its name and description.

Definition at line 1996 of file ExportFFmpegDialogs.cpp.

1997{
1998 // Get current selection
1999 wxArrayInt selections;
2000 int n = mFormatList->GetSelections(selections);
2001 if (n <= 0) return;
2002
2003 // Get selected format short name
2004 wxString selfmt = mFormatList->GetString(selections[0]);
2005
2006 // Find its index
2007 int nFormat = make_iterator_range( mFormatNames ).index( selfmt );
2008 if (nFormat == wxNOT_FOUND) return;
2009
2010 // Return short name and description
2011 if (name != NULL) *name = &mFormatNames[nFormat];
2012 if (longname != NULL) *longname = &mFormatLongNames[nFormat];
2013 return;
2014}

References make_iterator_range(), mFormatList, mFormatLongNames, mFormatNames, and name.

Referenced by DoOnCodecList(), DoOnFormatList(), and ReportIfBadCombination().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnAllCodecs()

void ExportFFmpegOptions::OnAllCodecs ( wxCommandEvent &  event)

◆ OnAllFormats()

void ExportFFmpegOptions::OnAllFormats ( wxCommandEvent &  event)

◆ OnCodecList()

void ExportFFmpegOptions::OnCodecList ( wxCommandEvent &  event)

Definition at line 2578 of file ExportFFmpegDialogs.cpp.

2579{
2580 DoOnCodecList();
2581}

References DoOnCodecList().

Here is the call graph for this function:

◆ OnDeletePreset()

void ExportFFmpegOptions::OnDeletePreset ( wxCommandEvent &  event)

Definition at line 2211 of file ExportFFmpegDialogs.cpp.

2212{
2213 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2214 wxString presetname = preset->GetValue();
2215 if (presetname.empty())
2216 {
2217 AudacityMessageBox( XO("You can't delete a preset without name") );
2218 return;
2219 }
2220
2221 auto query = XO("Delete preset '%s'?").Format( presetname );
2222 int action = AudacityMessageBox(
2223 query,
2224 XO("Confirm Deletion"),
2225 wxYES_NO | wxCENTRE);
2226 if (action == wxNO) return;
2227
2228 mPresets->DeletePreset(presetname);
2229 long index = preset->FindString(presetname);
2230 preset->SetValue(wxEmptyString);
2231 preset->Delete(index);
2232 mPresetNames.erase(
2233 std::find( mPresetNames.begin(), mPresetNames.end(), presetname )
2234 );
2235}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
EffectReverbSettings preset
Definition: Reverb.cpp:44

References AudacityMessageBox(), mPresetNames, mPresets, preset, and XO().

Here is the call graph for this function:

◆ OnExportPresets()

void ExportFFmpegOptions::OnExportPresets ( wxCommandEvent &  event)

Definition at line 2320 of file ExportFFmpegDialogs.cpp.

2321{
2322 const bool kCheckForOverwrite = true;
2323 // Bug 1180 save any pending preset before exporting the lot.
2324 // If saving fails, don't try to export.
2325 if( !SavePreset(!kCheckForOverwrite) )
2326 return;
2327
2328 wxArrayString presets;
2329 mPresets->GetPresetList( presets);
2330 if( presets.Count() < 1)
2331 {
2332 AudacityMessageBox( XO("No presets to export") );
2333 return;
2334 }
2335
2336 wxString path;
2337 FileDialogWrapper dlg(this,
2338 XO("Select xml file to export presets into"),
2339 gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
2340 wxEmptyString,
2341 FileTypes(),
2342 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
2343 if (dlg.ShowModal() == wxID_CANCEL) return;
2344 path = dlg.GetPath();
2345 mPresets->ExportPresets(path);
2346}
static const FileNames::FileTypes & FileTypes()
bool SavePreset(bool bCheckForOverwrite)

References AudacityMessageBox(), FileTypes(), FileDialog::GetPath(), gPrefs, mPresets, SavePreset(), FileDialog::ShowModal(), wxT(), and XO().

Here is the call graph for this function:

◆ OnFormatList()

void ExportFFmpegOptions::OnFormatList ( wxCommandEvent &  event)

Definition at line 2571 of file ExportFFmpegDialogs.cpp.

2572{
2574}

References DoOnFormatList().

Here is the call graph for this function:

◆ OnGetURL()

void ExportFFmpegOptions::OnGetURL ( wxCommandEvent &  event)

Definition at line 2607 of file ExportFFmpegDialogs.cpp.

2608{
2609 HelpSystem::ShowHelp(this, L"Custom_FFmpeg_Export_Options");
2610}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:233

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnImportPresets()

void ExportFFmpegOptions::OnImportPresets ( wxCommandEvent &  event)

Definition at line 2301 of file ExportFFmpegDialogs.cpp.

2302{
2303 wxString path;
2304 FileDialogWrapper dlg(this,
2305 XO("Select xml file with presets to import"),
2306 gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
2307 wxEmptyString,
2308 FileTypes(),
2309 wxFD_OPEN);
2310 if (dlg.ShowModal() == wxID_CANCEL) return;
2311 path = dlg.GetPath();
2312 mPresets->ImportPresets(path);
2313 mPresets->GetPresetList(mPresetNames);
2314 mPresetCombo->Clear();
2315 mPresetCombo->Append(mPresetNames);
2316}

References FileTypes(), FileDialog::GetPath(), gPrefs, mPresetCombo, mPresetNames, mPresets, FileDialog::ShowModal(), wxT(), and XO().

Here is the call graph for this function:

◆ OnLoadPreset()

void ExportFFmpegOptions::OnLoadPreset ( wxCommandEvent &  event)

Definition at line 2271 of file ExportFFmpegDialogs.cpp.

2272{
2273 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2274 wxString presetname = preset->GetValue();
2275
2278 mFormatList->Clear();
2279 mFormatList->Append(mFormatNames);
2280
2283 mCodecList->Clear();
2284 mCodecList->Append(mCodecNames);
2285
2286 mPresets->LoadPreset(this,presetname);
2287
2289 DoOnCodecList();
2290}

References DoOnCodecList(), DoOnFormatList(), mCodecList, mCodecLongNames, mCodecNames, mFormatList, mFormatLongNames, mFormatNames, mPresets, mShownCodecLongNames, mShownCodecNames, mShownFormatLongNames, mShownFormatNames, and preset.

Here is the call graph for this function:

◆ OnOK()

void ExportFFmpegOptions::OnOK ( wxCommandEvent &  event)

Definition at line 2586 of file ExportFFmpegDialogs.cpp.

2587{
2589 return;
2590
2591 int selcdc = mCodecList->GetSelection();
2592 int selfmt = mFormatList->GetSelection();
2593 if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),mCodecList->GetString(selcdc));
2594 if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
2595 gPrefs->Flush();
2596
2599
2600 gPrefs->Flush();
2601
2602 EndModal(wxID_OK);
2603
2604 return;
2605}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

References eIsSavingToPrefs, FileConfig::Flush(), gPrefs, mCodecList, mFormatList, PopulateOrExchange(), ReportIfBadCombination(), S, and wxT().

Here is the call graph for this function:

◆ OnSavePreset()

void ExportFFmpegOptions::OnSavePreset ( wxCommandEvent &  event)

Definition at line 2239 of file ExportFFmpegDialogs.cpp.

2240{ const bool kCheckForOverwrite = true;
2241 SavePreset(kCheckForOverwrite);
2242}

References SavePreset().

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportFFmpegOptions::PopulateOrExchange ( ShuttleGui S)

Definition at line 1803 of file ExportFFmpegDialogs.cpp.

1804{
1805 IntSetting PredictionOrderSetting{ L"/FileFormats/FFmpegPredOrderMethod",
1806 4 }; // defaults to Full search
1807
1808 S.StartVerticalLay(1);
1809 S.StartMultiColumn(1, wxEXPAND);
1810 {
1811 S.SetStretchyRow(3);
1812 S.StartMultiColumn(7, wxEXPAND);
1813 {
1814 S.SetStretchyCol(1);
1815 mPresetCombo = S.Id(FEPresetID).AddCombo(XXO("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames);
1816 S.Id(FELoadPresetID).AddButton(XXO("Load Preset"));
1817 S.Id(FESavePresetID).AddButton(XXO("Save Preset"));
1818 S.Id(FEDeletePresetID).AddButton(XXO("Delete Preset"));
1819 S.Id(FEImportPresetsID).AddButton(XXO("Import Presets"));
1820 S.Id(FEExportPresetsID).AddButton(XXO("Export Presets"));
1821 }
1822 S.EndMultiColumn();
1823 S.StartMultiColumn(4, wxALIGN_LEFT);
1824 {
1825 S.SetStretchyCol(1);
1826 S.SetStretchyCol(3);
1827 S.Id(FEFormatLabelID).AddFixedText(XO("Format:"));
1828 mFormatName = S.Id(FEFormatNameID).AddVariableText( {} );
1829 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1830 S.Id(FECodecLabelID).AddFixedText(XO("Codec:"));
1831 mCodecName = S.Id(FECodecNameID).AddVariableText( {} );
1832 }
1833 S.EndMultiColumn();
1834 S.AddVariableText(XO(
1835"Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs."),
1836 false);
1837 S.StartMultiColumn(2, wxEXPAND);
1838 {
1839 S.StartMultiColumn(2, wxEXPAND);
1840 {
1841 S.SetStretchyRow(1);
1842 S.Id(FEAllFormatsID).AddButton(XXO("Show All Formats"));
1843 S.Id(FEAllCodecsID).AddButton(XXO("Show All Codecs"));
1844 mFormatList = S.Id(FEFormatID).AddListBox(mFormatNames);
1845 mFormatList->DeselectAll();
1846 mCodecList = S.Id(FECodecID).AddListBox(mCodecNames);
1847 mCodecList->DeselectAll();
1848 }
1849 S.EndMultiColumn();
1850 S.StartVerticalLay();
1851 {
1852 //S.StartScroller( );
1853 S.SetBorder( 3 );
1854 S.StartStatic(XO("General Options"), 0);
1855 {
1856 S.StartMultiColumn(8, wxEXPAND);
1857 {
1858 S.Id(FELanguageID)
1859 .ToolTip(XO("ISO 639 3-letter language code\nOptional\nempty - automatic"))
1860 .TieTextBox(XXO("Language:"), {wxT("/FileFormats/FFmpegLanguage"), wxEmptyString}, 9);
1861
1862 S.AddSpace( 20,0 );
1863 S.AddVariableText(XO("Bit Reservoir"));
1864 S.Id(FEBitReservoirID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegBitReservoir"), true});
1865
1866 S.AddSpace( 20,0 );
1867 S.AddVariableText(XO("VBL"));
1868 S.Id(FEVariableBlockLenID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegVariableBlockLen"), true});
1869 }
1870 S.EndMultiColumn();
1871 S.StartMultiColumn(4, wxALIGN_LEFT);
1872 {
1873 S.Id(FETagID)
1874 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1875 .ToolTip(XO("Codec tag (FOURCC)\nOptional\nempty - automatic"))
1876 .TieTextBox(XXO("Tag:"), {wxT("/FileFormats/FFmpegTag"), wxEmptyString}, 4);
1877
1878 S.Id(FEBitrateID)
1879 .ToolTip(XO("Bit Rate (bits/second) - influences the resulting file size and quality\nSome codecs may only accept specific values (128k, 192k, 256k etc)\n0 - automatic\nRecommended - 192000"))
1880 .TieSpinCtrl(XXO("Bit Rate:"), {wxT("/FileFormats/FFmpegBitRate"), 0}, 1000000, 0);
1881
1882 S.Id(FEQualityID)
1883 .ToolTip(XO("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)"))
1884 .TieSpinCtrl(XXO("Quality:"), {wxT("/FileFormats/FFmpegQuality"), 0}, 500, -1);
1885
1886 S.Id(FESampleRateID)
1887 .ToolTip(XO("Sample rate (Hz)\n0 - don't change sample rate"))
1888 .TieSpinCtrl(XXO("Sample Rate:"), {wxT("/FileFormats/FFmpegSampleRate"), 0}, 200000, 0);
1889
1890 S.Id(FECutoffID)
1891 .ToolTip(XO("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic"))
1892 .TieSpinCtrl(XXO("Cutoff:"), {wxT("/FileFormats/FFmpegCutOff"), 0}, 10000000, 0);
1893
1894 // PRL: As commented elsewhere, this preference does nothing
1895 S.Id(FEProfileID)
1896 .ToolTip(XO("AAC Profile\nLow Complexity - default\nMost players won't play anything other than LC"))
1897 .MinSize( { 100, -1 } )
1898 .TieChoice(XXO("Profile:"), AACProfiles);
1899 }
1900 S.EndMultiColumn();
1901 }
1902 S.EndStatic();
1903 S.StartStatic(XO("FLAC options"),0);
1904 {
1905 S.StartMultiColumn(4, wxALIGN_LEFT);
1906 {
1907 S
1908 .ToolTip(XO("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)"))
1909 .Id(FECompLevelID).TieSpinCtrl(XXO("Compression:"), {wxT("/FileFormats/FFmpegCompLevel"), 0}, 10, -1);
1910
1911 S.Id(FEFrameSizeID)
1912 .ToolTip(XO("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535"))
1913 .TieSpinCtrl(XXO("Frame:"), {wxT("/FileFormats/FFmpegFrameSize"), 0}, 65535, 0);
1914
1915 S.Id(FELPCCoeffsID)
1916 .ToolTip(XO("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15"))
1917 .TieSpinCtrl(XXO("LPC"), {wxT("/FileFormats/FFmpegLPCCoefPrec"), 0}, 15, 0);
1918
1919 S.Id(FEPredOrderID)
1920 .ToolTip(XO("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"))
1921 .MinSize( { 100, -1 } )
1922 .TieNumberAsChoice(
1923 XXO("PdO Method:"),
1924 PredictionOrderSetting,
1926 );
1927
1928 S.Id(FEMinPredID)
1929 .ToolTip(XO("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
1930 .TieSpinCtrl(XXO("Min. PdO"), {wxT("/FileFormats/FFmpegMinPredOrder"), -1}, 32, -1);
1931
1932 S.Id(FEMaxPredID)
1933 .ToolTip(XO("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
1934 .TieSpinCtrl(XXO("Max. PdO"), {wxT("/FileFormats/FFmpegMaxPredOrder"), -1}, 32, -1);
1935
1936 S.Id(FEMinPartOrderID)
1937 .ToolTip(XO("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
1938 .TieSpinCtrl(XXO("Min. PtO"), {wxT("/FileFormats/FFmpegMinPartOrder"), -1}, 8, -1);
1939
1940 S.Id(FEMaxPartOrderID)
1941 .ToolTip(XO("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
1942 .TieSpinCtrl(XXO("Max. PtO"), {wxT("/FileFormats/FFmpegMaxPartOrder"), -1}, 8, -1);
1943
1944 /* i18n-hint: Abbreviates "Linear Predictive Coding",
1945 but this text needs to be kept very short */
1946 S.AddVariableText(XO("Use LPC"));
1947 // PRL: This preference is not used anywhere!
1948 S.Id(FEUseLPCID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegUseLPC"), true});
1949 }
1950 S.EndMultiColumn();
1951 }
1952 S.EndStatic();
1953 S.StartStatic(XO("MPEG container options"),0);
1954 {
1955 S.StartMultiColumn(4, wxALIGN_LEFT);
1956 {
1957 S.Id(FEMuxRateID)
1958 .ToolTip(XO("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"))
1959 /* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
1960 'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG
1961 it has a hard to predict effect on the degree of compression */
1962 .TieSpinCtrl(XXO("Mux Rate:"), {wxT("/FileFormats/FFmpegMuxRate"), 0}, 10000000, 0);
1963
1964 S.Id(FEPacketSizeID)
1965 /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
1966 compression. It measures how big a chunk of audio is compressed in one piece. */
1967 .ToolTip(XO("Packet size\nOptional\n0 - default"))
1968 /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
1969 compression. It measures how big a chunk of audio is compressed in one piece. */
1970 .TieSpinCtrl(XXO("Packet Size:"), {wxT("/FileFormats/FFmpegPacketSize"), 0}, 10000000, 0);
1971 }
1972 S.EndMultiColumn();
1973 }
1974 S.EndStatic();
1975 //S.EndScroller();
1976 S.SetBorder( 5 );
1977 S.AddStandardButtons(eOkButton | eCancelButton | eHelpButton );
1978 }
1979 S.EndVerticalLay();
1980 }
1981 S.EndMultiColumn();
1982 }
1983 S.EndMultiColumn();
1984 S.EndVerticalLay();
1985
1986 Layout();
1987 Fit();
1988 SetMinSize(GetSize());
1989 Center();
1990
1991 return;
1992}
ChoiceSetting AACProfiles
AAC profiles.
XXO("&Cut/Copy/Paste Toolbar")
@ eOkButton
Definition: ShuttleGui.h:594
@ eCancelButton
Definition: ShuttleGui.h:595
@ eHelpButton
Definition: ShuttleGui.h:598
Specialization of Setting for int.
Definition: Prefs.h:349
const TranslatableStrings PredictionOrderMethodNames
Prediction order method - names.

References AACProfiles, eCancelButton, eHelpButton, eOkButton, gPrefs, mCodecList, mCodecName, mCodecNames, mFormatList, mFormatName, mFormatNames, mPresetCombo, mPresetNames, anonymous_namespace{ExportFFmpegDialogs.cpp}::PredictionOrderMethodNames, S, wxT(), XO(), and XXO().

Referenced by ExportFFmpegOptions(), and OnOK().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReportIfBadCombination()

bool ExportFFmpegOptions::ReportIfBadCombination ( )
private

ReportIfBadCombination will trap bad combinations of format and codec and report using a message box. We may later extend it to catch bad parameters too.

Returns
true iff a bad combination was reported At the moment we don't trap unrecognised format or codec. (We do not expect them to happen ever).

Definition at line 2375 of file ExportFFmpegDialogs.cpp.

2376{
2377 wxString *selcdc = nullptr;
2378 wxString* selcdclong = nullptr;
2379
2380 FindSelectedCodec(&selcdc, &selcdclong);
2381
2382 if (selcdc == nullptr)
2383 return false; // unrecognised codec. Treated as OK
2384
2385 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2386
2387 if (cdc == nullptr)
2388 return false; // unrecognised codec. Treated as OK
2389
2390 wxString* selfmt = nullptr;
2391 wxString* selfmtlong = nullptr;
2392
2393 FindSelectedFormat(&selfmt, &selfmtlong);
2394
2395 if (selfmt == nullptr)
2396 return false; // unrecognised format; Treated as OK
2397
2398 // This is intended to test for illegal combinations.
2399 // However, the list updating now seems to be working correctly
2400 // making it impossible to select illegal combinations
2401 bool bFound = false;
2402 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2403 {
2404 if (*selfmt == CompatibilityList[i].fmt)
2405 {
2406 if (CompatibilityList[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()) || (CompatibilityList[i].codec == AUDACITY_AV_CODEC_ID_NONE) ){
2407 bFound = true;
2408 break;
2409 }
2410 }
2411 }
2412
2413 // We can put extra code in here, to disallow combinations
2414 // We could also test for illegal parameters, and deliver
2415 // custom error messages in that case.
2416 // The below would make AAC codec disallowed.
2417 //if( cdc->id == AUDACITY_AV_CODEC_ID_AAC)
2418 // bFound = false;
2419
2420 // Valid combination was found, so no reporting.
2421 if( bFound )
2422 return false;
2423
2425 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2426 XO("Format %s is not compatible with codec %s.")
2427 .Format( *selfmt, *selcdc ),
2428 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2429 XO("Incompatible format and codec"));
2430
2431 return true;
2432}
Abstract base class used in importing a file.

References AUDACITY_AV_CODEC_ID_NONE, AudacityMessageBox(), CompatibilityEntry::codec, CompatibilityList, FindSelectedCodec(), FindSelectedFormat(), CompatibilityEntry::fmt, mFFmpeg, and XO().

Referenced by OnOK().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SavePreset()

bool ExportFFmpegOptions::SavePreset ( bool  bCheckForOverwrite)

Definition at line 2245 of file ExportFFmpegDialogs.cpp.

2246{
2247 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2248 wxString name = preset->GetValue();
2249 if (name.empty())
2250 {
2251 AudacityMessageBox( XO("You can't save a preset without a name") );
2252 return false;
2253 }
2254 if( bCheckForOverwrite && !mPresets->OverwriteIsOk(name))
2255 return false;
2256 if( !mPresets->SavePreset(this,name) )
2257 return false;
2258 int index = mPresetNames.Index(name,false);
2259 if (index == -1)
2260 {
2261 mPresetNames.push_back(name);
2262 mPresetCombo->Clear();
2263 mPresetCombo->Append(mPresetNames);
2264 mPresetCombo->Select(mPresetNames.Index(name,false));
2265 }
2266 return true;
2267}

References AudacityMessageBox(), TranslatableString::empty(), mPresetCombo, mPresetNames, mPresets, name, preset, and XO().

Referenced by OnExportPresets(), and OnSavePreset().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ apptable

ApplicableFor ExportFFmpegOptions::apptable
static

Some controls (parameters they represent) are only applicable to a number of codecs and/or formats. Syntax: first, enable a control for each applicable format-codec combination then disable it for anything else "any" - any format AUDACITY_AV_CODEC_ID_NONE - any codec This list must end with {FALSE,FFmpegExportCtrlID(0),AUDACITY_AV_CODEC_ID_NONE,NULL}

Definition at line 233 of file ExportFFmpegDialogs.h.

Referenced by EnableDisableControls().

◆ CompatibilityList

CompatibilityEntry ExportFFmpegOptions::CompatibilityList
static

Format-codec compatibility list Must end with NULL entry

Definition at line 230 of file ExportFFmpegDialogs.h.

Referenced by FetchCompatibleCodecList(), FetchCompatibleFormatList(), and ReportIfBadCombination().

◆ fmts

ExposedFormat ExportFFmpegOptions::fmts
static
Initial value:
=
{
{FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_CANMETA, true, XO("M4A (AAC) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_AAC, true},
{FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7, AV_VERSION_INT(0,0,0), false, XO("AC3 Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_AC3, true},
{FMT_AMRNB, wxT("AMRNB"), wxT("amr"), wxT("amr"), 1, AV_VERSION_INT(0,0,0), false, XO("AMR (narrow band) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_AMR_NB, true},
{FMT_OPUS, wxT("OPUS"), wxT("opus"), wxT("opus"), 255, AV_CANMETA, true, XO("Opus (OggOpus) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_OPUS, true},
{FMT_WMA2, wxT("WMA"), wxT("wma"), wxT("asf"), 2, AV_VERSION_INT(52,53,0), false, XO("WMA (version 2) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_WMAV2, true},
{FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_CANMETA, true, XO("Custom FFmpeg Export"), AUDACITY_AV_CODEC_ID_NONE, true}
}
@ AUDACITY_AV_CODEC_ID_OPUS
Definition: AVCodecID.h:363
@ AUDACITY_AV_CODEC_ID_AC3
Definition: AVCodecID.h:297
@ AUDACITY_AV_CODEC_ID_WMAV2
Definition: AVCodecID.h:302
@ AUDACITY_AV_CODEC_ID_AMR_NB
Definition: AVCodecID.h:286
@ AUDACITY_AV_CODEC_ID_AAC
Definition: AVCodecID.h:296
#define AV_CANMETA
@ FMT_OPUS
@ FMT_M4A
@ FMT_OTHER
@ FMT_AC3
@ FMT_WMA2
@ FMT_AMRNB
#define AV_VERSION_INT(a, b, c)
Definition: FFmpegTypes.h:77

List of export types.

Definition at line 231 of file ExportFFmpegDialogs.h.

Referenced by AdjustFormatIndex(), ExportFFmpeg::Export(), ExportFFmpeg::ExportFFmpeg(), ExportFFmpeg::Init(), and ExportFFmpeg::InitCodecs().

◆ iAACSampleRates

const int ExportFFmpegOptions::iAACSampleRates[]
static

Definition at line 232 of file ExportFFmpegDialogs.h.

◆ mBitRateFromChoice

int ExportFFmpegOptions::mBitRateFromChoice
private

Definition at line 254 of file ExportFFmpegDialogs.h.

◆ mCodecList

wxListBox* ExportFFmpegOptions::mCodecList
private

◆ mCodecLongNames

wxArrayString ExportFFmpegOptions::mCodecLongNames
private

◆ mCodecName

wxStaticText* ExportFFmpegOptions::mCodecName
private

Definition at line 250 of file ExportFFmpegDialogs.h.

Referenced by DoOnCodecList(), and PopulateOrExchange().

◆ mCodecNames

wxArrayStringEx ExportFFmpegOptions::mCodecNames
private

◆ mFFmpeg

std::shared_ptr<FFmpegFunctions> ExportFFmpegOptions::mFFmpeg
private

◆ mFormatList

wxListBox* ExportFFmpegOptions::mFormatList
private

◆ mFormatLongNames

wxArrayString ExportFFmpegOptions::mFormatLongNames
private

◆ mFormatName

wxStaticText* ExportFFmpegOptions::mFormatName
private

Definition at line 249 of file ExportFFmpegDialogs.h.

Referenced by DoOnFormatList(), and PopulateOrExchange().

◆ mFormatNames

wxArrayStringEx ExportFFmpegOptions::mFormatNames
private

◆ mPresetCombo

wxComboBox* ExportFFmpegOptions::mPresetCombo
private

Definition at line 252 of file ExportFFmpegDialogs.h.

Referenced by OnImportPresets(), PopulateOrExchange(), and SavePreset().

◆ mPresetNames

wxArrayStringEx ExportFFmpegOptions::mPresetNames
private

◆ mPresets

std::unique_ptr<FFmpegPresets> ExportFFmpegOptions::mPresets
private

◆ mSampleRateFromChoice

int ExportFFmpegOptions::mSampleRateFromChoice
private

Definition at line 255 of file ExportFFmpegDialogs.h.

◆ mShownCodecLongNames

wxArrayString ExportFFmpegOptions::mShownCodecLongNames
private

◆ mShownCodecNames

wxArrayString ExportFFmpegOptions::mShownCodecNames
private

◆ mShownFormatLongNames

wxArrayString ExportFFmpegOptions::mShownFormatLongNames
private

◆ mShownFormatNames

wxArrayString ExportFFmpegOptions::mShownFormatNames
private

The documentation for this class was generated from the following files: