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 <ExportFFmpegOptions.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.

Definition at line 73 of file ExportFFmpegOptions.h.

Constructor & Destructor Documentation

◆ ExportFFmpegOptions()

ExportFFmpegOptions::ExportFFmpegOptions ( wxWindow *  parent)

Definition at line 477 of file ExportFFmpegOptions.cpp.

478: wxDialogWrapper(parent, wxID_ANY,
479 XO("Configure custom FFmpeg options"))
480{
481 SetName();
484 //FFmpegLibsInst()->LoadLibs(NULL,true); //Loaded at startup or from Prefs now
485
486 mPresets = std::make_unique<FFmpegPresets>();
487 mPresets->GetPresetList(mPresetNames);
488
489 if (mFFmpeg)
490 {
493
495
496 //Select the format that was selected last time this dialog was closed
497 mFormatList->Select(mFormatList->FindString(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"))));
499
500 //Select the codec that was selected last time this dialog was closed
501 auto codec = mFFmpeg->CreateEncoder(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
502
503 if (codec != nullptr)
504 mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->GetName())));
505
507 }
508
509}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ 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:640
virtual bool Read(const wxString &key, bool *value) const =0
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(), audacity::BasicSettings::Read(), S, wxDialogWrapper::SetName(), audacity::ToUTF8(), and wxT().

Here is the call graph for this function:

◆ ~ExportFFmpegOptions()

ExportFFmpegOptions::~ExportFFmpegOptions ( )

Definition at line 473 of file ExportFFmpegOptions.cpp.

474{
475}

Member Function Documentation

◆ DoOnCodecList()

void ExportFFmpegOptions::DoOnCodecList ( )

Definition at line 1284 of file ExportFFmpegOptions.cpp.

1285{
1286 wxString *selcdc = nullptr;
1287 wxString* selcdclong = nullptr;
1288
1289 FindSelectedCodec(&selcdc, &selcdclong);
1290
1291 if (selcdc == nullptr)
1292 {
1293 return;
1294 }
1295
1296 wxString* selfmt = nullptr;
1297 wxString* selfmtlong = nullptr;
1298
1299 FindSelectedFormat(&selfmt, &selfmtlong);
1300
1301 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
1302 if (cdc == nullptr)
1303 {
1304 //This shouldn't really happen
1305 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1306 mCodecName->SetLabel(wxString(_("Failed to find the codec")));
1307 return;
1308 }
1309
1310 mCodecName->SetLabel(wxString::Format(wxT("[%d] %s"), (int) mFFmpeg->GetAudacityCodecID(cdc->GetId()).value, *selcdclong));
1311
1312 if (selfmt != nullptr)
1313 {
1314 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(), nullptr, nullptr);
1315 if (fmt == nullptr)
1316 {
1317 selfmt = nullptr;
1318 selfmtlong = nullptr;
1319 }
1320 }
1321
1322 int newselfmt = FetchCompatibleFormatList(
1323 mFFmpeg->GetAudacityCodecID(cdc->GetId()), selfmt);
1324
1325 if (newselfmt >= 0)
1326 mFormatList->Select(newselfmt);
1327
1328 EnableDisableControls(cdc.get(), selfmt);
1329 Layout();
1330 Fit();
1331 return;
1332}
#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 1234 of file ExportFFmpegOptions.cpp.

1235{
1236 wxString *selfmt = NULL;
1237 wxString *selfmtlong = NULL;
1238 FindSelectedFormat(&selfmt, &selfmtlong);
1239 if (selfmt == NULL)
1240 {
1241 return;
1242 }
1243
1244 wxString *selcdc = NULL;
1245 wxString *selcdclong = NULL;
1246 FindSelectedCodec(&selcdc, &selcdclong);
1247
1248 auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(),NULL,NULL);
1249 if (fmt == NULL)
1250 {
1251 //This shouldn't really happen
1252 mFormatName->SetLabel(wxString(_("Failed to guess format")));
1253 return;
1254 }
1255 mFormatName->SetLabel(wxString::Format(wxT("%s"), *selfmtlong));
1256
1258
1259 if (selcdc != nullptr)
1260 {
1261 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
1262
1263 if (cdc != nullptr)
1264 {
1265 selcdcid = mFFmpeg->GetAudacityCodecID(cdc->GetId());
1266 }
1267 }
1268 int newselcdc =
1269 FetchCompatibleCodecList(*selfmt, selcdcid);
1270
1271 if (newselcdc >= 0) mCodecList->Select(newselcdc);
1272
1273 std::unique_ptr<AVCodecWrapper> cdc;
1274
1275 if (selcdc != nullptr)
1276 cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
1277
1278 EnableDisableControls(cdc.get(), selfmt);
1279 Layout();
1280 Fit();
1281 return;
1282}
@ 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 1201 of file ExportFFmpegOptions.cpp.

1202{
1203 int handled = -1;
1204 for (int i = 0; apptable[i].control != 0; i++)
1205 {
1206 if (apptable[i].control != handled)
1207 {
1208 bool codec = false;
1209 bool format = false;
1210 if (apptable[i].codec == AUDACITY_AV_CODEC_ID_NONE)
1211 {
1212 codec = true;
1213 }
1214 else if (
1215 cdc != NULL &&
1216 apptable[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()))
1217 {
1218 codec = true;
1219 }
1220
1221 if (wxString::FromUTF8(apptable[i].format) == wxT("any")) format = true;
1222 else if (selfmt != NULL &&
1223 *selfmt == wxString::FromUTF8(apptable[i].format)) format = true;
1224 if (codec && format)
1225 {
1226 handled = apptable[i].control;
1227 wxWindow *item = FindWindowById(apptable[i].control,this);
1228 if (item != NULL) item->Enable(apptable[i].enable);
1229 }
1230 }
1231 }
1232}
virtual AVCodecIDFwd GetId() const noexcept=0
static ApplicableFor apptable[]
int control
control ID

References apptable, AUDACITY_AV_CODEC_ID_NONE, ApplicableFor::control, anonymous_namespace{ExportPCM.cpp}::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 535 of file ExportFFmpegOptions.cpp.

536{
537 if (!mFFmpeg)
538 return;
539 // Enumerate all codecs
540 std::unique_ptr<AVCodecWrapper> codec;
541 for (auto codec : mFFmpeg->GetCodecs())
542 {
543 // We're only interested in audio and only in encoders
544 if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
545 {
546 // MP2 Codec is broken. Don't allow it.
547 if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2))
548 continue;
549
550 mCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
551 mCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
552 }
553 }
554 // Show all codecs
557}
@ 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 803 of file ExportFFmpegOptions.cpp.

804{
805 const auto ffmpegId = mFFmpeg->GetAVCodecID(id);
806
807 // By default assume that id is not in the list
808 int index = -1;
809 // By default no codecs are compatible (yet)
810 mShownCodecNames.clear();
811 mShownCodecLongNames.clear();
812 // Clear the listbox
813 mCodecList->Clear();
814 // Zero - format is not found at all
815 int found = 0;
816 wxString str(fmt);
817 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
818 {
819 if (str == CompatibilityList[i].fmt)
820 {
821 // Format is found in the list
822 found = 1;
823 if (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE)
824 {
825 // Format is found in the list and it is compatible with AUDACITY_AV_CODEC_ID_NONE (means that it is compatible to anything)
826 found = 2;
827 break;
828 }
829 // Find the codec, that is claimed to be compatible
830 std::unique_ptr<AVCodecWrapper> codec = mFFmpeg->CreateEncoder(mFFmpeg->GetAVCodecID(CompatibilityList[i].codec));
831 // If it exists, is audio and has encoder
832 if (codec != NULL && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
833 {
834 // If it was selected - remember its NEW index
835 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
836 index = mShownCodecNames.size();
837
838 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
839 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
840 }
841 }
842 }
843 // All codecs are compatible with this format
844 if (found == 2)
845 {
846 std::unique_ptr<AVCodecWrapper> codec;
847 for (auto codec : mFFmpeg->GetCodecs())
848 {
849 if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
850 {
851 // MP2 is broken.
852 if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2) )
853 continue;
854
856 .contains( wxString::FromUTF8(codec->GetName()) ) )
857 {
858 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
859 index = mShownCodecNames.size();
860
861 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
862 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
863 }
864 }
865 }
866 }
867 // Format is not found - find format in libavformat and add its default audio codec
868 // This allows us to provide limited support for NEW formats without modifying the compatibility list
869 else if (found == 0)
870 {
871 wxCharBuffer buf = str.ToUTF8();
872 auto format = mFFmpeg->GuessOutputFormat(buf, nullptr, nullptr);
873
874 if (format != nullptr)
875 {
876 auto codec = mFFmpeg->CreateEncoder(format->GetAudioCodec());
877
878 if (
879 codec != nullptr && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
880 {
881 if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
882 index = mShownCodecNames.size();
883
884 mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
885 mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
886 }
887 }
888 }
889 // Show NEW codec list
891
892 return index;
893}
#define str(a)
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: IteratorX.h:210
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, anonymous_namespace{ExportPCM.cpp}::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 897 of file ExportFFmpegOptions.cpp.

899{
900 int index = -1;
901 mShownFormatNames.clear();
902 mShownFormatLongNames.clear();
903 mFormatList->Clear();
904
905 wxArrayString FromList;
906 // Find all formats compatible to this codec in compatibility list
907 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
908 {
909 if (CompatibilityList[i].codec == id || (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE) )
910 {
911 if ((selfmt != NULL) && (*selfmt == CompatibilityList[i].fmt)) index = mShownFormatNames.size();
912 FromList.push_back(CompatibilityList[i].fmt);
913 mShownFormatNames.push_back(CompatibilityList[i].fmt);
914 auto tofmt = mFFmpeg->GuessOutputFormat(
915 wxString(CompatibilityList[i].fmt).ToUTF8(), nullptr, nullptr);
916
917 if (tofmt != NULL)
918 {
919 mShownFormatLongNames.push_back(wxString::Format(
920 wxT("%s - %s"), CompatibilityList[i].fmt,
921 wxString::FromUTF8(tofmt->GetLongName())));
922 }
923 }
924 }
925 bool found = false;
926 if (selfmt != NULL)
927 {
928 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
929 {
930 if (*selfmt == CompatibilityList[i].fmt)
931 {
932 found = true;
933 break;
934 }
935 }
936 }
937 // Format was in the compatibility list
938 if (found)
939 {
940 // Find all formats which have this codec as default and which are not in the list yet and add them too
941 for (auto ofmt : mFFmpeg->GetOutputFormats())
942 {
943 if (ofmt->GetAudioCodec() == mFFmpeg->GetAVCodecID(id))
944 {
945 wxString ofmtname = wxString::FromUTF8(ofmt->GetName());
946 found = false;
947 for (unsigned int i = 0; i < FromList.size(); i++)
948 {
949 if (ofmtname == FromList[i])
950 {
951 found = true;
952 break;
953 }
954 }
955 if (!found)
956 {
957 if ((selfmt != NULL) &&
958 (*selfmt == wxString::FromUTF8(ofmt->GetName())))
959 index = mShownFormatNames.size();
960
961 mShownFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
962
963 mShownFormatLongNames.push_back(wxString::Format(
964 wxT("%s - %s"), mShownFormatNames.back(),
965 wxString::FromUTF8(ofmt->GetLongName())));
966 }
967 }
968 }
969 }
971 return index;
972}
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 513 of file ExportFFmpegOptions.cpp.

514{
515 if (!mFFmpeg)
516 return;
517
518 for (auto ofmt : mFFmpeg->GetOutputFormats())
519 {
520 // Any audio-capable format has default audio codec.
521 // If it doesn't, then it doesn't supports any audio codecs
522 if (ofmt->GetAudioCodec() != AUDACITY_AV_CODEC_ID_NONE)
523 {
524 mFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
525 mFormatLongNames.push_back(wxString::Format(wxT("%s - %s"),mFormatNames.back(),wxString::FromUTF8(ofmt->GetLongName())));
526 }
527 }
528 // Show all formats
531}
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 782 of file ExportFFmpegOptions.cpp.

783{
784 // Get current selection
785 wxArrayInt selections;
786 int n = mCodecList->GetSelections(selections);
787 if (n <= 0) return;
788
789 // Get selected codec short name
790 wxString selcdc = mCodecList->GetString(selections[0]);
791
792 // Find its index
793 int nCodec = make_iterator_range( mCodecNames ).index( selcdc );
794 if (nCodec == wxNOT_FOUND) return;
795
796 // Return short name and description
797 if (name != NULL) *name = &mCodecNames[nCodec];
798 if (longname != NULL) *longname = &mCodecLongNames[nCodec];
799}
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 761 of file ExportFFmpegOptions.cpp.

762{
763 // Get current selection
764 wxArrayInt selections;
765 int n = mFormatList->GetSelections(selections);
766 if (n <= 0) return;
767
768 // Get selected format short name
769 wxString selfmt = mFormatList->GetString(selections[0]);
770
771 // Find its index
772 int nFormat = make_iterator_range( mFormatNames ).index( selfmt );
773 if (nFormat == wxNOT_FOUND) return;
774
775 // Return short name and description
776 if (name != NULL) *name = &mFormatNames[nFormat];
777 if (longname != NULL) *longname = &mFormatLongNames[nFormat];
778 return;
779}

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 1343 of file ExportFFmpegOptions.cpp.

1344{
1345 DoOnCodecList();
1346}

References DoOnCodecList().

Here is the call graph for this function:

◆ OnDeletePreset()

void ExportFFmpegOptions::OnDeletePreset ( wxCommandEvent &  event)

Definition at line 976 of file ExportFFmpegOptions.cpp.

977{
978 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
979 wxString presetname = preset->GetValue();
980 if (presetname.empty())
981 {
982 AudacityMessageBox( XO("You can't delete a preset without name") );
983 return;
984 }
985
986 auto query = XO("Delete preset '%s'?").Format( presetname );
987 int action = AudacityMessageBox(
988 query,
989 XO("Confirm Deletion"),
990 wxYES_NO | wxCENTRE);
991 if (action == wxNO) return;
992
993 mPresets->DeletePreset(presetname);
994 long index = preset->FindString(presetname);
995 preset->SetValue(wxEmptyString);
996 preset->Delete(index);
997 mPresetNames.erase(
998 std::find( mPresetNames.begin(), mPresetNames.end(), presetname )
999 );
1000}
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 1085 of file ExportFFmpegOptions.cpp.

1086{
1087 const bool kCheckForOverwrite = true;
1088 // Bug 1180 save any pending preset before exporting the lot.
1089 // If saving fails, don't try to export.
1090 if( !SavePreset(!kCheckForOverwrite) )
1091 return;
1092
1093 wxArrayString presets;
1094 mPresets->GetPresetList( presets);
1095 if( presets.Count() < 1)
1096 {
1097 AudacityMessageBox( XO("No presets to export") );
1098 return;
1099 }
1100
1101 wxString path;
1102 FileDialogWrapper dlg(this,
1103 XO("Select xml file to export presets into"),
1104 gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
1105 wxEmptyString,
1106 FileTypes(),
1107 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
1108 if (dlg.ShowModal() == wxID_CANCEL) return;
1109 path = dlg.GetPath();
1110 mPresets->ExportPresets(path);
1111}
static const FileNames::FileTypes & FileTypes()
bool SavePreset(bool bCheckForOverwrite)

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

Here is the call graph for this function:

◆ OnFormatList()

void ExportFFmpegOptions::OnFormatList ( wxCommandEvent &  event)

Definition at line 1336 of file ExportFFmpegOptions.cpp.

1337{
1339}

References DoOnFormatList().

Here is the call graph for this function:

◆ OnGetURL()

void ExportFFmpegOptions::OnGetURL ( wxCommandEvent &  event)

Definition at line 1372 of file ExportFFmpegOptions.cpp.

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

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnImportPresets()

void ExportFFmpegOptions::OnImportPresets ( wxCommandEvent &  event)

Definition at line 1066 of file ExportFFmpegOptions.cpp.

1067{
1068 wxString path;
1069 FileDialogWrapper dlg(this,
1070 XO("Select xml file with presets to import"),
1071 gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
1072 wxEmptyString,
1073 FileTypes(),
1074 wxFD_OPEN);
1075 if (dlg.ShowModal() == wxID_CANCEL) return;
1076 path = dlg.GetPath();
1077 mPresets->ImportPresets(path);
1078 mPresets->GetPresetList(mPresetNames);
1079 mPresetCombo->Clear();
1080 mPresetCombo->Append(mPresetNames);
1081}

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

Here is the call graph for this function:

◆ OnLoadPreset()

void ExportFFmpegOptions::OnLoadPreset ( wxCommandEvent &  event)

Definition at line 1036 of file ExportFFmpegOptions.cpp.

1037{
1038 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
1039 wxString presetname = preset->GetValue();
1040
1043 mFormatList->Clear();
1044 mFormatList->Append(mFormatNames);
1045
1048 mCodecList->Clear();
1049 mCodecList->Append(mCodecNames);
1050
1051 mPresets->LoadPreset(this,presetname);
1052
1054 DoOnCodecList();
1055}

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 1351 of file ExportFFmpegOptions.cpp.

1352{
1354 return;
1355
1356 int selcdc = mCodecList->GetSelection();
1357 int selfmt = mFormatList->GetSelection();
1358 if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),mCodecList->GetString(selcdc));
1359 if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
1360 gPrefs->Flush();
1361
1364
1365 gPrefs->Flush();
1366
1367 EndModal(wxID_OK);
1368
1369 return;
1370}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

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

Here is the call graph for this function:

◆ OnSavePreset()

void ExportFFmpegOptions::OnSavePreset ( wxCommandEvent &  event)

Definition at line 1004 of file ExportFFmpegOptions.cpp.

1005{ const bool kCheckForOverwrite = true;
1006 SavePreset(kCheckForOverwrite);
1007}

References SavePreset().

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportFFmpegOptions::PopulateOrExchange ( ShuttleGui S)

Definition at line 561 of file ExportFFmpegOptions.cpp.

562{
563 IntSetting PredictionOrderSetting{ L"/FileFormats/FFmpegPredOrderMethod",
564 4 }; // defaults to Full search
565
566 S.StartVerticalLay(1);
567 S.StartMultiColumn(1, wxEXPAND);
568 {
569 S.SetStretchyRow(3);
570 S.StartMultiColumn(7, wxEXPAND);
571 {
572 S.SetStretchyCol(1);
573 mPresetCombo = S.Id(FEPresetID).AddCombo(XXO("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames);
574 S.Id(FELoadPresetID).AddButton(XXO("Load Preset"));
575 S.Id(FESavePresetID).AddButton(XXO("Save Preset"));
576 S.Id(FEDeletePresetID).AddButton(XXO("Delete Preset"));
577 S.Id(FEImportPresetsID).AddButton(XXO("Import Presets"));
578 S.Id(FEExportPresetsID).AddButton(XXO("Export Presets"));
579 }
580 S.EndMultiColumn();
581 S.StartMultiColumn(4, wxALIGN_LEFT);
582 {
583 S.SetStretchyCol(1);
584 S.SetStretchyCol(3);
585 S.Id(FEFormatLabelID).AddFixedText(XO("Format:"));
586 mFormatName = S.Id(FEFormatNameID).AddVariableText( {} );
587 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
588 S.Id(FECodecLabelID).AddFixedText(XO("Codec:"));
589 mCodecName = S.Id(FECodecNameID).AddVariableText( {} );
590 }
591 S.EndMultiColumn();
592 S.AddVariableText(XO(
593"Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs."),
594 false);
595 S.StartMultiColumn(2, wxEXPAND);
596 {
597 S.StartMultiColumn(2, wxEXPAND);
598 {
599 S.SetStretchyRow(1);
600 S.Id(FEAllFormatsID).AddButton(XXO("Show All Formats"));
601 S.Id(FEAllCodecsID).AddButton(XXO("Show All Codecs"));
602 mFormatList = S.Id(FEFormatID).Name(XO("Formats")).
603 AddListBox(mFormatNames);
604 mFormatList->DeselectAll();
605 mCodecList = S.Id(FECodecID).Name(XO("Codecs")).
606 AddListBox(mCodecNames);
607 mCodecList->DeselectAll();
608#if wxUSE_ACCESSIBILITY
609 // so that names can be set on standard controls
612#endif
613 }
614 S.EndMultiColumn();
615 S.StartVerticalLay();
616 {
617 //S.StartScroller( );
618 S.SetBorder( 3 );
619 S.StartStatic(XO("General Options"), 0);
620 {
621 S.StartMultiColumn(8, wxEXPAND);
622 {
623 S.Id(FELanguageID)
624 .ToolTip(XO("ISO 639 3-letter language code\nOptional\nempty - automatic"))
625 .TieTextBox(XXO("Language:"), {wxT("/FileFormats/FFmpegLanguage"), wxEmptyString}, 9);
626
627 S.AddSpace( 20,0 );
628 S.AddVariableText(XO("Bit Reservoir"));
629 S.Id(FEBitReservoirID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegBitReservoir"), true});
630
631 S.AddSpace( 20,0 );
632 S.AddVariableText(XO("VBL"));
633 S.Id(FEVariableBlockLenID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegVariableBlockLen"), true});
634 }
635 S.EndMultiColumn();
636 S.StartMultiColumn(4, wxALIGN_LEFT);
637 {
638 S.Id(FETagID)
639 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
640 .ToolTip(XO("Codec tag (FOURCC)\nOptional\nempty - automatic"))
641 .TieTextBox(XXO("Tag:"), {wxT("/FileFormats/FFmpegTag"), wxEmptyString}, 4);
642
643 S.Id(FEBitrateID)
644 .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"))
645 .TieSpinCtrl(XXO("Bit Rate:"), {wxT("/FileFormats/FFmpegBitRate"), 0}, 1000000, 0);
646
647 S.Id(FEQualityID)
648 .ToolTip(XO("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)"))
649 .TieSpinCtrl(XXO("Quality:"), {wxT("/FileFormats/FFmpegQuality"), 0}, 500, -1);
650
651 S.Id(FESampleRateID)
652 .ToolTip(XO("Sample rate (Hz)\n0 - don't change sample rate"))
653 .TieSpinCtrl(XXO("Sample Rate:"), {wxT("/FileFormats/FFmpegSampleRate"), 0}, 200000, 0);
654
655 S.Id(FECutoffID)
656 .ToolTip(XO("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic"))
657 .TieSpinCtrl(XXO("Cutoff:"), {wxT("/FileFormats/FFmpegCutOff"), 0}, 10000000, 0);
658
659 // PRL: As commented elsewhere, this preference does nothing
660 S.Id(FEProfileID)
661 .ToolTip(XO("AAC Profile\nLow Complexity - default\nMost players won't play anything other than LC"))
662 .MinSize( { 100, -1 } )
663 .TieChoice(XXO("Profile:"), AACProfiles);
664 }
665 S.EndMultiColumn();
666 }
667 S.EndStatic();
668 S.StartStatic(XO("FLAC options"),0);
669 {
670 S.StartMultiColumn(4, wxALIGN_LEFT);
671 {
672 S
673 .ToolTip(XO("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)"))
674 .Id(FECompLevelID).TieSpinCtrl(XXO("Compression:"), {wxT("/FileFormats/FFmpegCompLevel"), 0}, 10, -1);
675
676 S.Id(FEFrameSizeID)
677 .ToolTip(XO("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535"))
678 .TieSpinCtrl(XXO("Frame:"), {wxT("/FileFormats/FFmpegFrameSize"), 0}, 65535, 0);
679
680 S.Id(FELPCCoeffsID)
681 .ToolTip(XO("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15"))
682 .TieSpinCtrl(XXO("LPC"), {wxT("/FileFormats/FFmpegLPCCoefPrec"), 0}, 15, 0);
683
684 S.Id(FEPredOrderID)
685 .ToolTip(XO("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"))
686 .MinSize( { 100, -1 } )
687 .TieNumberAsChoice(
688 XXO("PdO Method:"),
689 PredictionOrderSetting,
691 );
692
693 S.Id(FEMinPredID)
694 .ToolTip(XO("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
695 .TieSpinCtrl(XXO("Min. PdO"), {wxT("/FileFormats/FFmpegMinPredOrder"), -1}, 32, -1);
696
697 S.Id(FEMaxPredID)
698 .ToolTip(XO("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
699 .TieSpinCtrl(XXO("Max. PdO"), {wxT("/FileFormats/FFmpegMaxPredOrder"), -1}, 32, -1);
700
701 S.Id(FEMinPartOrderID)
702 .ToolTip(XO("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
703 .TieSpinCtrl(XXO("Min. PtO"), {wxT("/FileFormats/FFmpegMinPartOrder"), -1}, 8, -1);
704
705 S.Id(FEMaxPartOrderID)
706 .ToolTip(XO("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
707 .TieSpinCtrl(XXO("Max. PtO"), {wxT("/FileFormats/FFmpegMaxPartOrder"), -1}, 8, -1);
708
709 /* i18n-hint: Abbreviates "Linear Predictive Coding",
710 but this text needs to be kept very short */
711 S.AddVariableText(XO("Use LPC"));
712 // PRL: This preference is not used anywhere!
713 S.Id(FEUseLPCID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegUseLPC"), true});
714 }
715 S.EndMultiColumn();
716 }
717 S.EndStatic();
718 S.StartStatic(XO("MPEG container options"),0);
719 {
720 S.StartMultiColumn(4, wxALIGN_LEFT);
721 {
722 S.Id(FEMuxRateID)
723 .ToolTip(XO("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"))
724 /* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
725 'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG
726 it has a hard to predict effect on the degree of compression */
727 .TieSpinCtrl(XXO("Mux Rate:"), {wxT("/FileFormats/FFmpegMuxRate"), 0}, 10000000, 0);
728
729 S.Id(FEPacketSizeID)
730 /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
731 compression. It measures how big a chunk of audio is compressed in one piece. */
732 .ToolTip(XO("Packet size\nOptional\n0 - default"))
733 /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
734 compression. It measures how big a chunk of audio is compressed in one piece. */
735 .TieSpinCtrl(XXO("Packet Size:"), {wxT("/FileFormats/FFmpegPacketSize"), 0}, 10000000, 0);
736 }
737 S.EndMultiColumn();
738 }
739 S.EndStatic();
740 //S.EndScroller();
741 S.SetBorder( 5 );
742 S.AddStandardButtons(eOkButton | eCancelButton | eHelpButton );
743 }
744 S.EndVerticalLay();
745 }
746 S.EndMultiColumn();
747 }
748 S.EndMultiColumn();
749 S.EndVerticalLay();
750
751 Layout();
752 Fit();
753 SetMinSize(GetSize());
754 Center();
755
756 return;
757}
ChoiceSetting AACProfiles
AAC profiles.
XXO("&Cut/Copy/Paste Toolbar")
#define safenew
Definition: MemoryX.h:9
@ eOkButton
Definition: ShuttleGui.h:609
@ eCancelButton
Definition: ShuttleGui.h:610
@ eHelpButton
Definition: ShuttleGui.h:613
Specialization of Setting for int.
Definition: Prefs.h:356
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
const TranslatableStrings PredictionOrderMethodNames
Prediction order method - names.

References AACProfiles, eCancelButton, eHelpButton, eOkButton, gPrefs, mCodecList, mCodecName, mCodecNames, mFormatList, mFormatName, mFormatNames, mPresetCombo, mPresetNames, anonymous_namespace{ExportFFmpegOptions.cpp}::PredictionOrderMethodNames, audacity::BasicSettings::Read(), S, safenew, 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 1140 of file ExportFFmpegOptions.cpp.

1141{
1142 wxString *selcdc = nullptr;
1143 wxString* selcdclong = nullptr;
1144
1145 FindSelectedCodec(&selcdc, &selcdclong);
1146
1147 if (selcdc == nullptr)
1148 return false; // unrecognised codec. Treated as OK
1149
1150 auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
1151
1152 if (cdc == nullptr)
1153 return false; // unrecognised codec. Treated as OK
1154
1155 wxString* selfmt = nullptr;
1156 wxString* selfmtlong = nullptr;
1157
1158 FindSelectedFormat(&selfmt, &selfmtlong);
1159
1160 if (selfmt == nullptr)
1161 return false; // unrecognised format; Treated as OK
1162
1163 // This is intended to test for illegal combinations.
1164 // However, the list updating now seems to be working correctly
1165 // making it impossible to select illegal combinations
1166 bool bFound = false;
1167 for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
1168 {
1169 if (*selfmt == CompatibilityList[i].fmt)
1170 {
1171 if (CompatibilityList[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()) || (CompatibilityList[i].codec == AUDACITY_AV_CODEC_ID_NONE) ){
1172 bFound = true;
1173 break;
1174 }
1175 }
1176 }
1177
1178 // We can put extra code in here, to disallow combinations
1179 // We could also test for illegal parameters, and deliver
1180 // custom error messages in that case.
1181 // The below would make AAC codec disallowed.
1182 //if( cdc->id == AUDACITY_AV_CODEC_ID_AAC)
1183 // bFound = false;
1184
1185 // Valid combination was found, so no reporting.
1186 if( bFound )
1187 return false;
1188
1190 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1191 XO("Format %s is not compatible with codec %s.")
1192 .Format( *selfmt, *selcdc ),
1193 /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1194 XO("Incompatible format and codec"));
1195
1196 return true;
1197}
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 1010 of file ExportFFmpegOptions.cpp.

1011{
1012 wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
1013 wxString name = preset->GetValue();
1014 if (name.empty())
1015 {
1016 AudacityMessageBox( XO("You can't save a preset without a name") );
1017 return false;
1018 }
1019 if( bCheckForOverwrite && !mPresets->OverwriteIsOk(name))
1020 return false;
1021 if( !mPresets->SavePreset(this,name) )
1022 return false;
1023 int index = mPresetNames.Index(name,false);
1024 if (index == -1)
1025 {
1026 mPresetNames.push_back(name);
1027 mPresetCombo->Clear();
1028 mPresetCombo->Append(mPresetNames);
1029 mPresetCombo->Select(mPresetNames.Index(name,false));
1030 }
1031 return true;
1032}

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 100 of file ExportFFmpegOptions.h.

Referenced by EnableDisableControls().

◆ CompatibilityList

CompatibilityEntry ExportFFmpegOptions::CompatibilityList
static

Format-codec compatibility list Must end with NULL entry

Definition at line 97 of file ExportFFmpegOptions.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_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_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
@ FMT_M4A
@ FMT_OTHER
@ FMT_AC3
@ FMT_WMA2
@ FMT_AMRNB
#define AV_CANMETA
Definition: FFmpegDefines.h:20
#define AV_VERSION_INT(a, b, c)
Definition: FFmpegTypes.h:77

List of export types.

Definition at line 98 of file ExportFFmpegOptions.h.

Referenced by AdjustFormatIndex(), ExportFFmpeg::ExportFFmpeg(), FFmpegExporter::Init(), FFmpegExporter::InitCodecs(), and FFmpegExportProcessor::Initialize().

◆ iAACSampleRates

const int ExportFFmpegOptions::iAACSampleRates[]
static

Definition at line 99 of file ExportFFmpegOptions.h.

◆ mBitRateFromChoice

int ExportFFmpegOptions::mBitRateFromChoice
private

Definition at line 121 of file ExportFFmpegOptions.h.

◆ mCodecList

wxListBox* ExportFFmpegOptions::mCodecList
private

◆ mCodecLongNames

wxArrayString ExportFFmpegOptions::mCodecLongNames
private

◆ mCodecName

wxStaticText* ExportFFmpegOptions::mCodecName
private

Definition at line 117 of file ExportFFmpegOptions.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 116 of file ExportFFmpegOptions.h.

Referenced by DoOnFormatList(), and PopulateOrExchange().

◆ mFormatNames

wxArrayStringEx ExportFFmpegOptions::mFormatNames
private

◆ mPresetCombo

wxComboBox* ExportFFmpegOptions::mPresetCombo
private

Definition at line 119 of file ExportFFmpegOptions.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 122 of file ExportFFmpegOptions.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: