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 1722 of file ExportFFmpegDialogs.cpp.

1723: wxDialogWrapper(parent, wxID_ANY,
1724 XO("Configure custom FFmpeg options"))
1725{
1726 SetName();
1729 //FFmpegLibsInst()->LoadLibs(NULL,true); //Loaded at startup or from Prefs now
1730
1731 mPresets = std::make_unique<FFmpegPresets>();
1732 mPresets->GetPresetList(mPresetNames);
1733
1734 if (mFFmpeg)
1735 {
1738
1740
1741 //Select the format that was selected last time this dialog was closed
1742 mFormatList->Select(mFormatList->FindString(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"))));
1744
1745 //Select the codec that was selected last time this dialog was closed
1746 auto codec = mFFmpeg->CreateEncoder(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
1747
1748 if (codec != nullptr)
1749 mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->GetName())));
1750
1751 DoOnCodecList();
1752 }
1753
1754}
#define XO(s)
Definition: Internat.h:31
FileConfig * gPrefs
Definition: Prefs.cpp:71
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:48
#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:628
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(), and audacity::ToUTF8().

Here is the call graph for this function:

◆ ~ExportFFmpegOptions()

ExportFFmpegOptions::~ExportFFmpegOptions ( )

Definition at line 1718 of file ExportFFmpegDialogs.cpp.

1719{
1720}

Member Function Documentation

◆ DoOnCodecList()

void ExportFFmpegOptions::DoOnCodecList ( )

Definition at line 2526 of file ExportFFmpegDialogs.cpp.

2527{
2528 wxString *selcdc = nullptr;
2529 wxString* selcdclong = nullptr;
2530
2531 FindSelectedCodec(&selcdc, &selcdclong);
2532
2533 if (selcdc == nullptr)
2534 {
2535 return;
2536 }
2537
2538 wxString* selfmt = nullptr;
2539 wxString* selfmtlong = nullptr;
2540
2541 FindSelectedFormat(&selfmt, &selfmtlong);
2542
2543 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2544 if (cdc == nullptr)
2545 {
2546 //This shouldn't really happen
2547 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2548 mCodecName->SetLabel(wxString(_("Failed to find the codec")));
2549 return;
2550 }
2551
2552 mCodecName->SetLabel(wxString::Format(wxT("[%d] %s"), (int) mFFmpeg->GetAudacityCodecID(cdc->GetId()).value, *selcdclong));
2553
2554 if (selfmt != nullptr)
2555 {
2556 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(), nullptr, nullptr);
2557 if (fmt == nullptr)
2558 {
2559 selfmt = nullptr;
2560 selfmtlong = nullptr;
2561 }
2562 }
2563
2564 int newselfmt = FetchCompatibleFormatList(
2565 mFFmpeg->GetAudacityCodecID(cdc->GetId()), selfmt);
2566
2567 if (newselfmt >= 0)
2568 mFormatList->Select(newselfmt);
2569
2570 EnableDisableControls(cdc.get(), selfmt);
2571 Layout();
2572 Fit();
2573 return;
2574}
#define _(s)
Definition: Internat.h:75
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, and mFormatList.

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 2476 of file ExportFFmpegDialogs.cpp.

2477{
2478 wxString *selfmt = NULL;
2479 wxString *selfmtlong = NULL;
2480 FindSelectedFormat(&selfmt, &selfmtlong);
2481 if (selfmt == NULL)
2482 {
2483 return;
2484 }
2485
2486 wxString *selcdc = NULL;
2487 wxString *selcdclong = NULL;
2488 FindSelectedCodec(&selcdc, &selcdclong);
2489
2490 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(),NULL,NULL);
2491 if (fmt == NULL)
2492 {
2493 //This shouldn't really happen
2494 mFormatName->SetLabel(wxString(_("Failed to guess format")));
2495 return;
2496 }
2497 mFormatName->SetLabel(wxString::Format(wxT("%s"), *selfmtlong));
2498
2500
2501 if (selcdc != nullptr)
2502 {
2503 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2504
2505 if (cdc != nullptr)
2506 {
2507 selcdcid = mFFmpeg->GetAudacityCodecID(cdc->GetId());
2508 }
2509 }
2510 int newselcdc =
2511 FetchCompatibleCodecList(*selfmt, selcdcid);
2512
2513 if (newselcdc >= 0) mCodecList->Select(newselcdc);
2514
2515 std::unique_ptr<AVCodecWrapper> cdc;
2516
2517 if (selcdc != nullptr)
2518 cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2519
2520 EnableDisableControls(cdc.get(), selfmt);
2521 Layout();
2522 Fit();
2523 return;
2524}
@ 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, and mFormatName.

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 2443 of file ExportFFmpegDialogs.cpp.

2444{
2445 int handled = -1;
2446 for (int i = 0; apptable[i].control != 0; i++)
2447 {
2448 if (apptable[i].control != handled)
2449 {
2450 bool codec = false;
2451 bool format = false;
2452 if (apptable[i].codec == AUDACITY_AV_CODEC_ID_NONE)
2453 {
2454 codec = true;
2455 }
2456 else if (
2457 cdc != NULL &&
2458 apptable[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()))
2459 {
2460 codec = true;
2461 }
2462
2463 if (wxString::FromUTF8(apptable[i].format) == wxT("any")) format = true;
2464 else if (selfmt != NULL &&
2465 *selfmt == wxString::FromUTF8(apptable[i].format)) format = true;
2466 if (codec && format)
2467 {
2468 handled = apptable[i].control;
2469 wxWindow *item = FindWindowById(apptable[i].control,this);
2470 if (item != NULL) item->Enable(apptable[i].enable);
2471 }
2472 }
2473 }
2474}
int format
Definition: ExportPCM.cpp:56
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(), and mFFmpeg.

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 1783 of file ExportFFmpegDialogs.cpp.

1784{
1785 if (!mFFmpeg)
1786 return;
1787 // Enumerate all codecs
1788 std::unique_ptr<AVCodecWrapper> codec;
1789 while ((codec = mFFmpeg->GetNextCodec(codec.get()))!=NULL)
1790 {
1791 // We're only interested in audio and only in encoders
1792 if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
1793 {
1794 // MP2 Codec is broken. Don't allow it.
1795 if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2))
1796 continue;
1797
1798 mCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
1799 mCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
1800 }
1801 }
1802 // Show all codecs
1805}
@ 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, and mShownCodecNames.

Referenced by ExportFFmpegOptions().

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 2044 of file ExportFFmpegDialogs.cpp.

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

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 2138 of file ExportFFmpegDialogs.cpp.

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

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

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 1758 of file ExportFFmpegDialogs.cpp.

1759{
1760 if (!mFFmpeg)
1761 return;
1762
1763 // Enumerate all output formats
1764 std::unique_ptr<AVOutputFormatWrapper> ofmt;
1765
1766 while ((ofmt = mFFmpeg->GetNextOutputFormat(ofmt.get()))!=NULL)
1767 {
1768 // Any audio-capable format has default audio codec.
1769 // If it doesn't, then it doesn't supports any audio codecs
1770 if (ofmt->GetAudioCodec() != AUDACITY_AV_CODEC_ID_NONE)
1771 {
1772 mFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
1773 mFormatLongNames.push_back(wxString::Format(wxT("%s - %s"),mFormatNames.back(),wxString::FromUTF8(ofmt->GetLongName())));
1774 }
1775 }
1776 // Show all formats
1779}
wxArrayStringEx mFormatNames
wxArrayString mFormatLongNames

References AUDACITY_AV_CODEC_ID_NONE, mFFmpeg, mFormatLongNames, mFormatNames, mShownFormatLongNames, and mShownFormatNames.

Referenced by ExportFFmpegOptions().

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 2023 of file ExportFFmpegDialogs.cpp.

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

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 2002 of file ExportFFmpegDialogs.cpp.

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

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 2585 of file ExportFFmpegDialogs.cpp.

2586{
2587 DoOnCodecList();
2588}

References DoOnCodecList().

Here is the call graph for this function:

◆ OnDeletePreset()

void ExportFFmpegOptions::OnDeletePreset ( wxCommandEvent &  event)

Definition at line 2218 of file ExportFFmpegDialogs.cpp.

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

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

Here is the call graph for this function:

◆ OnExportPresets()

void ExportFFmpegOptions::OnExportPresets ( wxCommandEvent &  event)

Definition at line 2327 of file ExportFFmpegDialogs.cpp.

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

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

Here is the call graph for this function:

◆ OnFormatList()

void ExportFFmpegOptions::OnFormatList ( wxCommandEvent &  event)

Definition at line 2578 of file ExportFFmpegDialogs.cpp.

2579{
2581}

References DoOnFormatList().

Here is the call graph for this function:

◆ OnGetURL()

void ExportFFmpegOptions::OnGetURL ( wxCommandEvent &  event)

Definition at line 2614 of file ExportFFmpegDialogs.cpp.

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

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnImportPresets()

void ExportFFmpegOptions::OnImportPresets ( wxCommandEvent &  event)

Definition at line 2308 of file ExportFFmpegDialogs.cpp.

2309{
2310 wxString path;
2311 FileDialogWrapper dlg(this,
2312 XO("Select xml file with presets to import"),
2313 gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
2314 wxEmptyString,
2315 FileTypes(),
2316 wxFD_OPEN);
2317 if (dlg.ShowModal() == wxID_CANCEL) return;
2318 path = dlg.GetPath();
2319 mPresets->ImportPresets(path);
2320 mPresets->GetPresetList(mPresetNames);
2321 mPresetCombo->Clear();
2322 mPresetCombo->Append(mPresetNames);
2323}

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

Here is the call graph for this function:

◆ OnLoadPreset()

void ExportFFmpegOptions::OnLoadPreset ( wxCommandEvent &  event)

Definition at line 2278 of file ExportFFmpegDialogs.cpp.

2279{
2280 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2281 wxString presetname = preset->GetValue();
2282
2285 mFormatList->Clear();
2286 mFormatList->Append(mFormatNames);
2287
2290 mCodecList->Clear();
2291 mCodecList->Append(mCodecNames);
2292
2293 mPresets->LoadPreset(this,presetname);
2294
2296 DoOnCodecList();
2297}

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 2593 of file ExportFFmpegDialogs.cpp.

2594{
2596 return;
2597
2598 int selcdc = mCodecList->GetSelection();
2599 int selfmt = mFormatList->GetSelection();
2600 if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),mCodecList->GetString(selcdc));
2601 if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
2602 gPrefs->Flush();
2603
2606
2607 gPrefs->Flush();
2608
2609 EndModal(wxID_OK);
2610
2611 return;
2612}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:49
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

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

Here is the call graph for this function:

◆ OnSavePreset()

void ExportFFmpegOptions::OnSavePreset ( wxCommandEvent &  event)

Definition at line 2246 of file ExportFFmpegDialogs.cpp.

2247{ const bool kCheckForOverwrite = true;
2248 SavePreset(kCheckForOverwrite);
2249}

References SavePreset().

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportFFmpegOptions::PopulateOrExchange ( ShuttleGui S)

Definition at line 1809 of file ExportFFmpegDialogs.cpp.

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

Referenced by ExportFFmpegOptions(), and OnOK().

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 2382 of file ExportFFmpegDialogs.cpp.

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

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

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:72

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: