Audacity  3.0.3
ExportFFmpegDialogs.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ExportFFmpegDialogs.cpp
6 
7  Audacity(R) is copyright (c) 1999-2010 Audacity Team.
8  License: GPL v2. See License.txt.
9 
10  LRN
11 
12 ******************************************************************//***************************************************************//***************************************************************//***************************************************************//***************************************************************//***************************************************************//*******************************************************************/
43 
44 
45 #include "ExportFFmpegDialogs.h"
46 
47 #include "../FFmpeg.h"
48 #include "FFmpegFunctions.h"
49 
50 #include <wx/app.h>
51 #include <wx/checkbox.h>
52 #include <wx/choice.h>
53 #include <wx/intl.h>
54 #include <wx/timer.h>
55 #include <wx/string.h>
56 #include <wx/textctrl.h>
57 #include <wx/listbox.h>
58 #include <wx/window.h>
59 #include <wx/spinctrl.h>
60 #include <wx/combobox.h>
61 #include <wx/stattext.h>
62 
63 #include "../widgets/FileDialog/FileDialog.h"
64 
65 #include "../Mix.h"
66 #include "../Tags.h"
67 #include "../widgets/AudacityMessageBox.h"
68 #include "../widgets/HelpSystem.h"
69 
70 #include "Export.h"
71 #include "FFmpeg.h"
72 
73 #if defined(USE_FFMPEG)
74 
79 #define FFMPEG_EXPORT_CTRL_ID_ENTRIES \
80  FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY(FEFirstID, 20000), \
81  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEFormatID), \
82  FFMPEG_EXPORT_CTRL_ID_ENTRY(FECodecID), \
83  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEBitrateID), \
84  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEQualityID), \
85  FFMPEG_EXPORT_CTRL_ID_ENTRY(FESampleRateID), \
86  FFMPEG_EXPORT_CTRL_ID_ENTRY(FELanguageID), \
87  FFMPEG_EXPORT_CTRL_ID_ENTRY(FETagID), \
88  FFMPEG_EXPORT_CTRL_ID_ENTRY(FECutoffID), \
89  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEFrameSizeID), \
90  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEBufSizeID), \
91  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEProfileID), \
92  FFMPEG_EXPORT_CTRL_ID_ENTRY(FECompLevelID), \
93  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEUseLPCID), \
94  FFMPEG_EXPORT_CTRL_ID_ENTRY(FELPCCoeffsID), \
95  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEMinPredID), \
96  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEMaxPredID), \
97  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEPredOrderID), \
98  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEMinPartOrderID), \
99  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEMaxPartOrderID), \
100  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEMuxRateID), \
101  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEPacketSizeID), \
102  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEBitReservoirID), \
103  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEVariableBlockLenID), \
104  FFMPEG_EXPORT_CTRL_ID_ENTRY(FELastID), \
105  \
106  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEFormatLabelID), \
107  FFMPEG_EXPORT_CTRL_ID_ENTRY(FECodecLabelID), \
108  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEFormatNameID), \
109  FFMPEG_EXPORT_CTRL_ID_ENTRY(FECodecNameID), \
110  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEPresetID), \
111  FFMPEG_EXPORT_CTRL_ID_ENTRY(FESavePresetID), \
112  FFMPEG_EXPORT_CTRL_ID_ENTRY(FELoadPresetID), \
113  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEDeletePresetID), \
114  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEAllFormatsID), \
115  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEAllCodecsID), \
116  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEImportPresetsID), \
117  FFMPEG_EXPORT_CTRL_ID_ENTRY(FEExportPresetsID) \
118 
119 // First the enumeration
120 #define FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY(name, num) name = num
121 #define FFMPEG_EXPORT_CTRL_ID_ENTRY(name) name
122 
125 };
126 
127 // Now the string representations
128 #undef FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY
129 #define FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY(name, num) wxT(#name)
130 #undef FFMPEG_EXPORT_CTRL_ID_ENTRY
131 #define FFMPEG_EXPORT_CTRL_ID_ENTRY(name) wxT(#name)
132 static const wxChar *FFmpegExportCtrlIDNames[] = {
134 };
135 
136 #undef FFMPEG_EXPORT_CTRL_ID_ENTRIES
137 #undef FFMPEG_EXPORT_CTRL_ID_ENTRY
138 #undef FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY
139 
140 //----------------------------------------------------------------------------
141 // ExportFFmpegAC3Options Class
142 //----------------------------------------------------------------------------
143 
144 namespace
145 {
146 
147 // i18n-hint kbps abbreviates "thousands of bits per second"
148 inline TranslatableString n_kbps(int n) { return XO("%d kbps").Format( n ); }
149 
151  n_kbps( 32 ),
152  n_kbps( 40 ),
153  n_kbps( 48 ),
154  n_kbps( 56 ),
155  n_kbps( 64 ),
156  n_kbps( 80 ),
157  n_kbps( 96 ),
158  n_kbps( 112 ),
159  n_kbps( 128 ),
160  n_kbps( 160 ),
161  n_kbps( 192 ),
162  n_kbps( 224 ),
163  n_kbps( 256 ),
164  n_kbps( 320 ),
165  n_kbps( 384 ),
166  n_kbps( 448 ),
167  n_kbps( 512 ),
168  n_kbps( 576 ),
169  n_kbps( 640 ),
170 };
171 
172 const std::vector< int > AC3BitRateValues{
173  32000,
174  40000,
175  48000,
176  56000,
177  64000,
178  80000,
179  96000,
180  112000,
181  128000,
182  160000,
183  192000,
184  224000,
185  256000,
186  320000,
187  384000,
188  448000,
189  512000,
190  576000,
191  640000,
192 };
193 
194 }
195 
196 const int ExportFFmpegAC3Options::iAC3SampleRates[] = { 32000, 44100, 48000, 0 };
197 
199 : wxPanelWrapper(parent, wxID_ANY)
200 {
203 
205 }
206 
208 {
210 }
211 
215 {
216  S.StartVerticalLay();
217  {
218  S.StartHorizontalLay(wxCENTER);
219  {
220  S.StartMultiColumn(2, wxCENTER);
221  {
223  XXO("Bit Rate:"),
224  {wxT("/FileFormats/AC3BitRate"),
225  160000},
228  );
229  }
230  S.EndMultiColumn();
231  }
232  S.EndHorizontalLay();
233  }
234  S.EndVerticalLay();
235 }
236 
240 {
241  return true;
242 }
243 
247 {
248  ShuttleGui S(this, eIsSavingToPrefs);
250 
251  gPrefs->Flush();
252 
253  return true;
254 }
255 
256 //----------------------------------------------------------------------------
257 // ExportFFmpegAACOptions Class
258 //----------------------------------------------------------------------------
259 
261 : wxPanelWrapper(parent, wxID_ANY)
262 {
265 
267 }
268 
270 {
272 }
273 
277 {
278  S.StartVerticalLay();
279  {
280  S.StartHorizontalLay(wxEXPAND);
281  {
282  S.SetSizerProportion(1);
283  S.StartMultiColumn(2, wxCENTER);
284  {
285  S.SetStretchyCol(1);
286  S.Prop(1).TieSlider(
287  XXO("Quality (kbps):"),
288  {wxT("/FileFormats/AACQuality"), 160},320, 98);
289  }
290  S.EndMultiColumn();
291  }
292  S.EndHorizontalLay();
293  }
294  S.EndVerticalLay();
295 }
296 
300 {
301  return true;
302 }
303 
307 {
308  ShuttleGui S(this, eIsSavingToPrefs);
310 
311  gPrefs->Flush();
312 
313  return true;
314 }
315 
316 //----------------------------------------------------------------------------
317 // ExportFFmpegAMRNBOptions Class
318 //----------------------------------------------------------------------------
319 
320 namespace {
321 
322 // i18n-hint kbps abbreviates "thousands of bits per second"
323 inline TranslatableString f_kbps( double d ) { return XO("%.2f kbps").Format( d ); }
324 
328 {
329  f_kbps( 4.75 ),
330  f_kbps( 5.15 ),
331  f_kbps( 5.90 ),
332  f_kbps( 6.70 ),
333  f_kbps( 7.40 ),
334  f_kbps( 7.95 ),
335  f_kbps( 10.20 ),
336  f_kbps( 12.20 ),
337 };
338 
339 const std::vector< int > AMRNBBitRateValues
340 {
341  4750,
342  5150,
343  5900,
344  6700,
345  7400,
346  7950,
347  10200,
348  12200,
349 };
350 
351 }
352 
354 : wxPanelWrapper(parent, wxID_ANY)
355 {
358 
360 }
361 
363 {
365 }
366 
370 {
371  S.StartVerticalLay();
372  {
373  S.StartHorizontalLay(wxCENTER);
374  {
375  S.StartMultiColumn(2, wxCENTER);
376  {
378  XXO("Bit Rate:"),
379  {wxT("/FileFormats/AMRNBBitRate"),
380  12200},
383  );
384  }
385  S.EndMultiColumn();
386  }
387  S.EndHorizontalLay();
388  }
389  S.EndVerticalLay();
390 }
391 
395 {
396  return true;
397 }
398 
402 {
403  ShuttleGui S(this, eIsSavingToPrefs);
405 
406  gPrefs->Flush();
407 
408  return true;
409 }
410 
411 //----------------------------------------------------------------------------
412 // ExportFFmpegOPUSOptions Class
413 //----------------------------------------------------------------------------
414 
415 namespace {
416 
419  {
420  wxT("/FileFormats/OPUSBitrate"),
421  {
422  ByColumns,
423  {
424  n_kbps( 6 ),
425  n_kbps( 8 ),
426  n_kbps( 16 ),
427  n_kbps( 24 ),
428  n_kbps( 32 ),
429  n_kbps( 40 ),
430  n_kbps( 48 ),
431  n_kbps( 64 ),
432  n_kbps( 80 ),
433  n_kbps( 96 ),
434  n_kbps( 128 ),
435  n_kbps( 160 ),
436  n_kbps( 192 ),
437  n_kbps( 256 ),
438  },
439  {
440  wxT("6000"),
441  wxT("8000"),
442  wxT("16000"),
443  wxT("24000"),
444  wxT("32000"),
445  wxT("40000"),
446  wxT("48000"),
447  wxT("64000"),
448  wxT("80000"),
449  wxT("96000"),
450  wxT("128000"),
451  wxT("160000"),
452  wxT("192000"),
453  wxT("256000"),
454  }
455  },
456  7 // "128 kbps"
457  };
458 
460  {
461  wxT("/FileFormats/OPUSCompression"),
462  {
463  ByColumns,
464  {
465  XO("0"),
466  XO("1"),
467  XO("2"),
468  XO("3"),
469  XO("4"),
470  XO("5"),
471  XO("6"),
472  XO("7"),
473  XO("8"),
474  XO("9"),
475  XO("10"),
476  },
477  {
478  wxT("0"),
479  wxT("1"),
480  wxT("2"),
481  wxT("3"),
482  wxT("4"),
483  wxT("5"),
484  wxT("6"),
485  wxT("7"),
486  wxT("8"),
487  wxT("9"),
488  wxT("10"),
489  }
490  },
491  10 // "10"
492  };
493 
494 
496  {
497  wxT("/FileFormats/OPUSVbrMode"),
498  {
499  ByColumns,
500  {
501  XO("Off"),
502  XO("On"),
503  XO("Constrained"),
504  },
505  {
506  wxT("off"),
507  wxT("on"),
508  wxT("constrained"),
509  }
510  },
511  1 // "On"
512  };
513 
515  {
516  wxT("/FileFormats/OPUSApplication"),
517  {
518  ByColumns,
519  {
520  XO("VOIP"),
521  XO("Audio"),
522  XO("Low Delay"),
523  },
524  {
525  wxT("voip"),
526  wxT("audio"),
527  wxT("lowdelay"),
528  }
529  },
530  1 // "Audio"
531  };
532 
534  {
535  wxT("/FileFormats/OPUSFrameDuration"),
536  {
537  ByColumns,
538  {
539  XO("2.5 ms"),
540  XO("5 ms"),
541  XO("10 ms"),
542  XO("20 ms"),
543  XO("40 ms"),
544  XO("60 ms"),
545  },
546  {
547  wxT("2.5"),
548  wxT("5"),
549  wxT("10"),
550  wxT("20"),
551  wxT("40"),
552  wxT("60"),
553  }
554  },
555  3 // "20"
556  };
557 
559  {
560  wxT("/FileFormats/OPUSCutoff"),
561  {
562  ByColumns,
563  {
564  XO("Disabled"),
565  XO("Narrowband"),
566  XO("Mediumband"),
567  XO("Wideband"),
568  XO("Super Wideband"),
569  XO("Fullband"),
570  },
571  {
572  wxT("0"),
573  wxT("4000"),
574  wxT("6000"),
575  wxT("8000"),
576  wxT("12000"),
577  wxT("20000"),
578  }
579  },
580  0 // "Disabled"
581  };
582 }
583 
585 : wxPanelWrapper(parent, wxID_ANY)
586 {
589 
591 }
592 
594 {
596 }
597 
601 {
602  S.SetSizerProportion(1);
603  S.SetBorder(4);
604  S.StartVerticalLay();
605  {
606  S.StartHorizontalLay(wxCENTER);
607  {
608  S.StartMultiColumn(2, wxCENTER);
609  {
610  S.StartMultiColumn(2, wxCENTER);
611  {
612  S.TieChoice(
613  XXO("Bit Rate:"),
614  OPUSBitrate);
615 
616  S.TieChoice(
617  XXO("Compression"),
619 
620  S.TieChoice(
621  XXO("Frame Duration:"),
623  }
624  S.EndMultiColumn();
625 
626  S.StartMultiColumn(2, wxCENTER);
627  {
628  S.TieChoice(
629  XXO("Vbr Mode:"),
630  OPUSVbrMode);
631 
632  S.TieChoice(
633  XXO("Application:"),
635 
636  S.TieChoice(
637  XXO("Cutoff:"),
638  OPUSCutoff);
639 
640  }
641  S.EndMultiColumn();
642  }
643  S.EndMultiColumn();
644  }
645  S.EndHorizontalLay();
646  }
647  S.EndVerticalLay();
648 }
649 
653 {
654  return true;
655 }
656 
660 {
661  ShuttleGui S(this, eIsSavingToPrefs);
663 
664  gPrefs->Flush();
665 
666  return true;
667 }
668 
669 //----------------------------------------------------------------------------
670 // ExportFFmpegWMAOptions Class
671 //----------------------------------------------------------------------------
672 
674 { 8000, 11025, 16000, 22050, 44100, 0};
675 
676 namespace {
677 
680 {
681  n_kbps(24),
682  n_kbps(32),
683  n_kbps(40),
684  n_kbps(48),
685  n_kbps(64),
686  n_kbps(80),
687  n_kbps(96),
688  n_kbps(128),
689  n_kbps(160),
690  n_kbps(192),
691  n_kbps(256),
692  n_kbps(320),
693 };
694 
695 const std::vector< int > WMABitRateValues{
696  24000,
697  32000,
698  40000,
699  48000,
700  64000,
701  80000,
702  96000,
703  128000,
704  160000,
705  192000,
706  256000,
707  320000,
708 };
709 
710 }
711 
713 : wxPanelWrapper(parent, wxID_ANY)
714 {
717 
719 }
720 
722 {
724 }
725 
729 {
730  S.StartVerticalLay();
731  {
732  S.StartHorizontalLay(wxCENTER);
733  {
734  S.StartMultiColumn(2, wxCENTER);
735  {
737  XXO("Bit Rate:"),
738  {wxT("/FileFormats/WMABitRate"),
739  128000},
742  );
743  }
744  S.EndMultiColumn();
745  }
746  S.EndHorizontalLay();
747  }
748  S.EndVerticalLay();
749 }
750 
754 {
755  return true;
756 }
757 
761 {
762  ShuttleGui S(this, eIsSavingToPrefs);
764 
765  gPrefs->Flush();
766 
767  return true;
768 }
769 
770 //----------------------------------------------------------------------------
771 // ExportFFmpegCustomOptions Class
772 //----------------------------------------------------------------------------
773 
774 #define OpenID 9000
775 
776 BEGIN_EVENT_TABLE(ExportFFmpegCustomOptions, wxPanelWrapper)
779 
781 : wxPanelWrapper(parent, wxID_ANY),
782  mFormat(NULL),
783  mCodec(NULL)
784 {
786  PopulateOrExchange(S);
787 
788  TransferDataToWindow();
789 }
790 
792 {
794 }
795 
799 {
800  S.StartHorizontalLay(wxCENTER);
801  {
802  S.StartVerticalLay(wxCENTER, 0);
803  {
804  S.Id(OpenID).AddButton(XXO("Open custom FFmpeg format options"));
805  S.StartMultiColumn(2, wxCENTER);
806  {
807  S.AddPrompt(XXO("Current Format:"));
808  mFormat = S.Style(wxTE_READONLY).AddTextBox({}, wxT(""), 25);
809  S.AddPrompt(XXO("Current Codec:"));
810  mCodec = S.Style(wxTE_READONLY).AddTextBox({}, wxT(""), 25);
811  }
812  S.EndMultiColumn();
813  }
814  S.EndHorizontalLay();
815  }
816  S.EndHorizontalLay();
817 }
818 
822 {
823  if (mFormat)
824  {
825  mFormat->SetValue(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"), wxT("")));
826  mCodec->SetValue(gPrefs->Read(wxT("/FileFormats/FFmpegCodec"), wxT("")));
827  }
828  return true;
829 }
830 
834 {
835  return true;
836 }
837 
840 void ExportFFmpegCustomOptions::OnOpen(wxCommandEvent & WXUNUSED(evt))
841 {
842  // Show "Locate FFmpeg" dialog
843  auto ffmpeg = FFmpegFunctions::Load();
844  if (!ffmpeg)
845  {
846  FindFFmpegLibs();
847  if (!LoadFFmpeg(true))
848  {
849  return;
850  }
851  }
852 
853 #ifdef __WXMAC__
854  // Bug 2077 Must be a parent window on OSX or we will appear behind.
855  auto pWin = wxGetTopLevelParent( this );
856 #else
857  // Use GetTopWindow on windows as there is no hWnd with top level parent.
858  auto pWin = wxTheApp->GetTopWindow();
859 #endif
860 
861  ExportFFmpegOptions od(pWin);
862  od.ShowModal();
863 
865 }
866 
868 {
869  mControlState.resize(FELastID - FEFirstID);
870 }
871 
873 {
874 }
875 
877 {
878  mPreset = NULL;
879  mAbortImport = false;
880 
881  XMLFileReader xmlfile;
882  wxFileName xmlFileName(FileNames::DataDir(), wxT("ffmpeg_presets.xml"));
883  xmlfile.Parse(this,xmlFileName.GetFullPath());
884 }
885 
887 {
888  // We're in a destructor! Don't let exceptions out!
889  GuardedCall( [&] {
890  wxFileName xmlFileName{ FileNames::DataDir(), wxT("ffmpeg_presets.xml") };
891  XMLFileWriter writer{
892  xmlFileName.GetFullPath(), XO("Error Saving FFmpeg Presets") };
893  WriteXMLHeader(writer);
894  WriteXML(writer);
895  writer.Commit();
896  } );
897 }
898 
899 void FFmpegPresets::ImportPresets(wxString &filename)
900 {
901  mPreset = NULL;
902  mAbortImport = false;
903 
904  FFmpegPresetMap savePresets = mPresets;
905 
906  XMLFileReader xmlfile;
907  bool success = xmlfile.Parse(this,filename);
908  if (!success || mAbortImport) {
909  mPresets = savePresets;
910  }
911 }
912 
913 void FFmpegPresets::ExportPresets(wxString &filename)
914 {
915  GuardedCall( [&] {
916  XMLFileWriter writer{ filename, XO("Error Saving FFmpeg Presets") };
917  WriteXMLHeader(writer);
918  WriteXML(writer);
919  writer.Commit();
920  } );
921 }
922 
923 void FFmpegPresets::GetPresetList(wxArrayString &list)
924 {
925  list.clear();
926  FFmpegPresetMap::iterator iter;
927  for (iter = mPresets.begin(); iter != mPresets.end(); ++iter)
928  {
929  list.push_back(iter->second.mPresetName);
930  }
931 
932  std::sort( list.begin(), list.end() );
933 }
934 
936 {
937  FFmpegPresetMap::iterator iter = mPresets.find(name);
938  if (iter != mPresets.end())
939  {
940  mPresets.erase(iter);
941  }
942 }
943 
945 {
946  FFmpegPresetMap::iterator iter = mPresets.find(name);
947  if (iter != mPresets.end())
948  {
949  return &iter->second;
950  }
951 
952  return NULL;
953 }
954 
955 // return false if overwrite was not allowed.
957 {
958  FFmpegPreset *preset = FindPreset(name);
959  if (preset)
960  {
961  auto query = XO("Overwrite preset '%s'?").Format(name);
962  int action = AudacityMessageBox(
963  query,
964  XO("Confirm Overwrite"),
965  wxYES_NO | wxCENTRE);
966  if (action == wxNO) return false;
967  }
968  return true;
969 }
970 
971 
973 {
974  wxString format;
975  wxString codec;
976  FFmpegPreset *preset;
977 
978  {
979  wxWindow *wnd;
980  wxListBox *lb;
981 
982  wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FEFormatID,parent);
983  lb = dynamic_cast<wxListBox*>(wnd);
984  if (lb->GetSelection() < 0)
985  {
986  AudacityMessageBox( XO("Please select format before saving a profile") );
987  return false;
988  }
989  format = lb->GetStringSelection();
990 
991  wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(FECodecID,parent);
992  lb = dynamic_cast<wxListBox*>(wnd);
993  if (lb->GetSelection() < 0)
994  {
995  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
996  AudacityMessageBox( XO("Please select codec before saving a profile") );
997  return false;
998  }
999  codec = lb->GetStringSelection();
1000  }
1001 
1002  preset = &mPresets[name];
1003  preset->mPresetName = name;
1004 
1005  wxSpinCtrl *sc;
1006  wxTextCtrl *tc;
1007  wxCheckBox *cb;
1008  wxChoice *ch;
1009 
1010  for (int id = FEFirstID; id < FELastID; id++)
1011  {
1012  wxWindow *wnd = dynamic_cast<wxWindow*>(parent)->FindWindowById(id,parent);
1013  if (wnd != NULL)
1014  {
1015  switch(id)
1016  {
1017  case FEFormatID:
1018  preset->mControlState[id - FEFirstID] = format;
1019  break;
1020  case FECodecID:
1021  preset->mControlState[id - FEFirstID] = codec;
1022  break;
1023  // Spin control
1024  case FEBitrateID:
1025  case FEQualityID:
1026  case FESampleRateID:
1027  case FECutoffID:
1028  case FEFrameSizeID:
1029  case FEBufSizeID:
1030  case FECompLevelID:
1031  case FELPCCoeffsID:
1032  case FEMinPredID:
1033  case FEMaxPredID:
1034  case FEMinPartOrderID:
1035  case FEMaxPartOrderID:
1036  case FEMuxRateID:
1037  case FEPacketSizeID:
1038  sc = dynamic_cast<wxSpinCtrl*>(wnd);
1039  preset->mControlState[id - FEFirstID] = wxString::Format(wxT("%d"),sc->GetValue());
1040  break;
1041  // Text control
1042  case FELanguageID:
1043  case FETagID:
1044  tc = dynamic_cast<wxTextCtrl*>(wnd);
1045  preset->mControlState[id - FEFirstID] = tc->GetValue();
1046  break;
1047  // Choice
1048  case FEProfileID:
1049  case FEPredOrderID:
1050  ch = dynamic_cast<wxChoice*>(wnd);
1051  preset->mControlState[id - FEFirstID] = wxString::Format(wxT("%d"),ch->GetSelection());
1052  break;
1053  // Check box
1054  case FEUseLPCID:
1055  case FEBitReservoirID:
1056  case FEVariableBlockLenID:
1057  cb = dynamic_cast<wxCheckBox*>(wnd);
1058  preset->mControlState[id - FEFirstID] = wxString::Format(wxT("%d"),cb->GetValue());
1059  break;
1060  }
1061  }
1062  }
1063  return true;
1064 }
1065 
1067 {
1068  FFmpegPreset *preset = FindPreset(name);
1069  if (!preset)
1070  {
1071  AudacityMessageBox( XO("Preset '%s' does not exist." ).Format(name));
1072  return;
1073  }
1074 
1075  wxListBox *lb;
1076  wxSpinCtrl *sc;
1077  wxTextCtrl *tc;
1078  wxCheckBox *cb;
1079  wxChoice *ch;
1080 
1081  for (int id = FEFirstID; id < FELastID; id++)
1082  {
1083  wxWindow *wnd = parent->FindWindowById(id,parent);
1084  if (wnd != NULL)
1085  {
1086  wxString readstr;
1087  long readlong;
1088  bool readbool;
1089  switch(id)
1090  {
1091  // Listbox
1092  case FEFormatID:
1093  case FECodecID:
1094  lb = dynamic_cast<wxListBox*>(wnd);
1095  readstr = preset->mControlState[id - FEFirstID];
1096  readlong = lb->FindString(readstr);
1097  if (readlong > -1) lb->Select(readlong);
1098  break;
1099  // Spin control
1100  case FEBitrateID:
1101  case FEQualityID:
1102  case FESampleRateID:
1103  case FECutoffID:
1104  case FEFrameSizeID:
1105  case FEBufSizeID:
1106  case FECompLevelID:
1107  case FELPCCoeffsID:
1108  case FEMinPredID:
1109  case FEMaxPredID:
1110  case FEMinPartOrderID:
1111  case FEMaxPartOrderID:
1112  case FEMuxRateID:
1113  case FEPacketSizeID:
1114  sc = dynamic_cast<wxSpinCtrl*>(wnd);
1115  preset->mControlState[id - FEFirstID].ToLong(&readlong);
1116  sc->SetValue(readlong);
1117  break;
1118  // Text control
1119  case FELanguageID:
1120  case FETagID:
1121  tc = dynamic_cast<wxTextCtrl*>(wnd);
1122  tc->SetValue(preset->mControlState[id - FEFirstID]);
1123  break;
1124  // Choice
1125  case FEProfileID:
1126  case FEPredOrderID:
1127  ch = dynamic_cast<wxChoice*>(wnd);
1128  preset->mControlState[id - FEFirstID].ToLong(&readlong);
1129  if (readlong > -1) ch->Select(readlong);
1130  break;
1131  // Check box
1132  case FEUseLPCID:
1133  case FEBitReservoirID:
1134  case FEVariableBlockLenID:
1135  cb = dynamic_cast<wxCheckBox*>(wnd);
1136  preset->mControlState[id - FEFirstID].ToLong(&readlong);
1137  if (readlong) readbool = true; else readbool = false;
1138  cb->SetValue(readbool);
1139  break;
1140  }
1141  }
1142  }
1143 }
1144 
1145 bool FFmpegPresets::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
1146 {
1147  if (mAbortImport)
1148  {
1149  return false;
1150  }
1151 
1152  if (!wxStrcmp(tag,wxT("ffmpeg_presets")))
1153  {
1154  return true;
1155  }
1156 
1157  if (!wxStrcmp(tag,wxT("preset")))
1158  {
1159  while (*attrs)
1160  {
1161  const wxChar *attr = *attrs++;
1162  wxString value = *attrs++;
1163 
1164  if (!value)
1165  break;
1166 
1167  if (!wxStrcmp(attr,wxT("name")))
1168  {
1169  mPreset = FindPreset(value);
1170  if (mPreset)
1171  {
1172  auto query = XO("Replace preset '%s'?").Format( value );
1173  int action = AudacityMessageBox(
1174  query,
1175  XO("Confirm Overwrite"),
1176  wxYES_NO | wxCANCEL | wxCENTRE);
1177  if (action == wxCANCEL)
1178  {
1179  mAbortImport = true;
1180  return false;
1181  }
1182  if (action == wxNO)
1183  {
1184  mPreset = NULL;
1185  return false;
1186  }
1187  *mPreset = FFmpegPreset();
1188  }
1189  else
1190  {
1191  mPreset = &mPresets[value];
1192  }
1193  mPreset->mPresetName = value;
1194  }
1195  }
1196  return true;
1197  }
1198 
1199  if (!wxStrcmp(tag,wxT("setctrlstate")) && mPreset)
1200  {
1201  long id = -1;
1202  while (*attrs)
1203  {
1204  const wxChar *attr = *attrs++;
1205  const wxChar *value = *attrs++;
1206 
1207  if (!value)
1208  break;
1209 
1210  if (!wxStrcmp(attr,wxT("id")))
1211  {
1212  for (long i = FEFirstID; i < FELastID; i++)
1213  if (!wxStrcmp(FFmpegExportCtrlIDNames[i - FEFirstID],value))
1214  id = i;
1215  }
1216  else if (!wxStrcmp(attr,wxT("state")))
1217  {
1218  if (id > FEFirstID && id < FELastID)
1219  mPreset->mControlState[id - FEFirstID] = wxString(value);
1220  }
1221  }
1222  return true;
1223  }
1224 
1225  return false;
1226 }
1227 
1229 {
1230  if (mAbortImport)
1231  {
1232  return NULL;
1233  }
1234 
1235  if (!wxStrcmp(tag, wxT("preset")))
1236  {
1237  return this;
1238  }
1239  else if (!wxStrcmp(tag, wxT("setctrlstate")))
1240  {
1241  return this;
1242  }
1243  return NULL;
1244 }
1245 
1247 // may throw
1248 {
1249  xmlFile.Write(wxT("<?xml "));
1250  xmlFile.Write(wxT("version=\"1.0\" "));
1251  xmlFile.Write(wxT("standalone=\"no\" "));
1252  xmlFile.Write(wxT("?>\n"));
1253 
1254  wxString dtdName = wxT("-//audacityffmpegpreset-1.0.0//DTD//EN");
1255  wxString dtdURI =
1256  wxT("http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd");
1257 
1258  xmlFile.Write(wxT("<!DOCTYPE "));
1259  xmlFile.Write(wxT("project "));
1260  xmlFile.Write(wxT("PUBLIC "));
1261  xmlFile.Write(wxT("\"-//audacityffmpegpreset-1.0.0//DTD//EN\" "));
1262  xmlFile.Write(wxT("\"http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd\" "));
1263  xmlFile.Write(wxT(">\n"));
1264 }
1265 
1267 // may throw
1268 {
1269  xmlFile.StartTag(wxT("ffmpeg_presets"));
1270  xmlFile.WriteAttr(wxT("version"),wxT("1.0"));
1271  FFmpegPresetMap::const_iterator iter;
1272  for (iter = mPresets.begin(); iter != mPresets.end(); ++iter)
1273  {
1274  auto preset = &iter->second;
1275  xmlFile.StartTag(wxT("preset"));
1276  xmlFile.WriteAttr(wxT("name"),preset->mPresetName);
1277  for (long i = FEFirstID + 1; i < FELastID; i++)
1278  {
1279  xmlFile.StartTag(wxT("setctrlstate"));
1280  xmlFile.WriteAttr(wxT("id"),wxString(FFmpegExportCtrlIDNames[i - FEFirstID]));
1281  xmlFile.WriteAttr(wxT("state"),preset->mControlState[i - FEFirstID]);
1282  xmlFile.EndTag(wxT("setctrlstate"));
1283  }
1284  xmlFile.EndTag(wxT("preset"));
1285  }
1286  xmlFile.EndTag(wxT("ffmpeg_presets"));
1287 }
1288 
1289 //----------------------------------------------------------------------------
1290 // ExportFFmpegOptions Class
1291 //----------------------------------------------------------------------------
1292 
1293 BEGIN_EVENT_TABLE(ExportFFmpegOptions, wxDialogWrapper)
1296  EVT_LISTBOX(FEFormatID,ExportFFmpegOptions::OnFormatList)
1297  EVT_LISTBOX(FECodecID,ExportFFmpegOptions::OnCodecList)
1306 
1307 CompatibilityEntry ExportFFmpegOptions::CompatibilityList[] =
1310 {
1311  { wxT("adts"), AUDACITY_AV_CODEC_ID_AAC },
1312 
1313  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1314  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_S8 },
1315  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_S24BE },
1316  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_S32BE },
1317  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1318  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1319  { wxT("aiff"), AUDACITY_AV_CODEC_ID_MACE3 },
1320  { wxT("aiff"), AUDACITY_AV_CODEC_ID_MACE6 },
1321  { wxT("aiff"), AUDACITY_AV_CODEC_ID_GSM },
1322  { wxT("aiff"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1323  { wxT("aiff"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1324  { wxT("aiff"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_QT },
1325  { wxT("aiff"), AUDACITY_AV_CODEC_ID_QDM2 },
1326 
1327  { wxT("amr"), AUDACITY_AV_CODEC_ID_AMR_NB },
1328  { wxT("amr"), AUDACITY_AV_CODEC_ID_AMR_WB },
1329 
1330  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1331  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1332  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1333  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1334  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_MS },
1335  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1336  { wxT("asf"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1337  { wxT("asf"), AUDACITY_AV_CODEC_ID_WMAVOICE },
1338  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV },
1339  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1340  { wxT("asf"), AUDACITY_AV_CODEC_ID_TRUESPEECH },
1341  { wxT("asf"), AUDACITY_AV_CODEC_ID_GSM_MS },
1342  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1343  //{ wxT("asf"), AUDACITY_AV_CODEC_ID_MP2 }, Bug 59
1344  { wxT("asf"), AUDACITY_AV_CODEC_ID_MP3 },
1345 #if LIBAVCODEC_VERSION_MAJOR < 58
1346  { wxT("asf"), AUDACITY_AV_CODEC_ID_VOXWARE },
1347 #endif
1348  { wxT("asf"), AUDACITY_AV_CODEC_ID_AAC },
1349  { wxT("asf"), AUDACITY_AV_CODEC_ID_WMAV1 },
1350  { wxT("asf"), AUDACITY_AV_CODEC_ID_WMAV2 },
1351  { wxT("asf"), AUDACITY_AV_CODEC_ID_WMAPRO },
1352  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_CT },
1353  { wxT("asf"), AUDACITY_AV_CODEC_ID_ATRAC3 },
1354  { wxT("asf"), AUDACITY_AV_CODEC_ID_IMC },
1355  { wxT("asf"), AUDACITY_AV_CODEC_ID_AC3 },
1356  { wxT("asf"), AUDACITY_AV_CODEC_ID_DTS },
1357  { wxT("asf"), AUDACITY_AV_CODEC_ID_FLAC },
1358  { wxT("asf"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1359  { wxT("asf"), AUDACITY_AV_CODEC_ID_VORBIS },
1360 
1361  { wxT("au"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1362  { wxT("au"), AUDACITY_AV_CODEC_ID_PCM_S8 },
1363  { wxT("au"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1364  { wxT("au"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1365 
1366  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1367  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1368  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1369  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1370  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_MS },
1371  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1372  { wxT("avi"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1373  { wxT("avi"), AUDACITY_AV_CODEC_ID_WMAVOICE },
1374  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV },
1375  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1376  { wxT("avi"), AUDACITY_AV_CODEC_ID_TRUESPEECH },
1377  { wxT("avi"), AUDACITY_AV_CODEC_ID_GSM_MS },
1378  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1379  // { wxT("avi"), AUDACITY_AV_CODEC_ID_MP2 }, //Bug 59
1380  { wxT("avi"), AUDACITY_AV_CODEC_ID_MP3 },
1381 #if LIBAVCODEC_VERSION_MAJOR < 58
1382  { wxT("avi"), AUDACITY_AV_CODEC_ID_VOXWARE },
1383 #endif
1384  { wxT("avi"), AUDACITY_AV_CODEC_ID_AAC },
1385  { wxT("avi"), AUDACITY_AV_CODEC_ID_WMAV1 },
1386  { wxT("avi"), AUDACITY_AV_CODEC_ID_WMAV2 },
1387  { wxT("avi"), AUDACITY_AV_CODEC_ID_WMAPRO },
1388  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_CT },
1389  { wxT("avi"), AUDACITY_AV_CODEC_ID_ATRAC3 },
1390  { wxT("avi"), AUDACITY_AV_CODEC_ID_IMC },
1391  { wxT("avi"), AUDACITY_AV_CODEC_ID_AC3 },
1392  { wxT("avi"), AUDACITY_AV_CODEC_ID_DTS },
1393  { wxT("avi"), AUDACITY_AV_CODEC_ID_FLAC },
1394  { wxT("avi"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1395  { wxT("avi"), AUDACITY_AV_CODEC_ID_VORBIS },
1396 
1397  { wxT("crc"), AUDACITY_AV_CODEC_ID_NONE },
1398 
1399  { wxT("dv"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1400 
1401  { wxT("ffm"), AUDACITY_AV_CODEC_ID_NONE },
1402 
1403  { wxT("flv"), AUDACITY_AV_CODEC_ID_MP3 },
1404  { wxT("flv"), AUDACITY_AV_CODEC_ID_PCM_S8 },
1405  { wxT("flv"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1406  { wxT("flv"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1407  { wxT("flv"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1408  { wxT("flv"), AUDACITY_AV_CODEC_ID_AAC },
1409  { wxT("flv"), AUDACITY_AV_CODEC_ID_NELLYMOSER },
1410 
1411  { wxT("framecrc"), AUDACITY_AV_CODEC_ID_NONE },
1412 
1413  { wxT("gxf"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1414 
1415  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1416  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1417  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1418  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1419  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_MS },
1420  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1421  { wxT("matroska"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1422  { wxT("matroska"), AUDACITY_AV_CODEC_ID_WMAVOICE },
1423  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV },
1424  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1425  { wxT("matroska"), AUDACITY_AV_CODEC_ID_TRUESPEECH },
1426  { wxT("matroska"), AUDACITY_AV_CODEC_ID_GSM_MS },
1427  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1428  // { wxT("matroska"), AUDACITY_AV_CODEC_ID_MP2 }, // Bug 59
1429  { wxT("matroska"), AUDACITY_AV_CODEC_ID_MP3 },
1430 #if LIBAVCODEC_VERSION_MAJOR < 58
1431  { wxT("matroska"), AUDACITY_AV_CODEC_ID_VOXWARE },
1432 #endif
1433  { wxT("matroska"), AUDACITY_AV_CODEC_ID_AAC },
1434  { wxT("matroska"), AUDACITY_AV_CODEC_ID_WMAV1 },
1435  { wxT("matroska"), AUDACITY_AV_CODEC_ID_WMAV2 },
1436  { wxT("matroska"), AUDACITY_AV_CODEC_ID_WMAPRO },
1437  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_CT },
1438  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ATRAC3 },
1439  { wxT("matroska"), AUDACITY_AV_CODEC_ID_IMC },
1440  { wxT("matroska"), AUDACITY_AV_CODEC_ID_AC3 },
1441  { wxT("matroska"), AUDACITY_AV_CODEC_ID_DTS },
1442  { wxT("matroska"), AUDACITY_AV_CODEC_ID_FLAC },
1443  { wxT("matroska"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1444  { wxT("matroska"), AUDACITY_AV_CODEC_ID_VORBIS },
1445 
1446  { wxT("mmf"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1447 
1448  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S32BE }, //mov
1449  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1450  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S24BE },
1451  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1452  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1453  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1454  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_S8 },
1455  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1456  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1457  { wxT("mov"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1458  { wxT("mov"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_QT },
1459  { wxT("mov"), AUDACITY_AV_CODEC_ID_MACE3 },
1460  { wxT("mov"), AUDACITY_AV_CODEC_ID_MACE6 },
1461  { wxT("mov"), AUDACITY_AV_CODEC_ID_MP3 },
1462  { wxT("mov"), AUDACITY_AV_CODEC_ID_AAC },
1463  { wxT("mov"), AUDACITY_AV_CODEC_ID_AMR_NB },
1464  { wxT("mov"), AUDACITY_AV_CODEC_ID_AMR_WB },
1465  { wxT("mov"), AUDACITY_AV_CODEC_ID_GSM },
1466  { wxT("mov"), AUDACITY_AV_CODEC_ID_ALAC },
1467  { wxT("mov"), AUDACITY_AV_CODEC_ID_QCELP },
1468  { wxT("mov"), AUDACITY_AV_CODEC_ID_QDM2 },
1469  { wxT("mov"), AUDACITY_AV_CODEC_ID_DVAUDIO },
1470  { wxT("mov"), AUDACITY_AV_CODEC_ID_WMAV2 },
1471  { wxT("mov"), AUDACITY_AV_CODEC_ID_ALAC },
1472 
1473  { wxT("mp4"), AUDACITY_AV_CODEC_ID_AAC },
1474  { wxT("mp4"), AUDACITY_AV_CODEC_ID_QCELP },
1475  { wxT("mp4"), AUDACITY_AV_CODEC_ID_MP3 },
1476  { wxT("mp4"), AUDACITY_AV_CODEC_ID_VORBIS },
1477 
1478  { wxT("psp"), AUDACITY_AV_CODEC_ID_AAC },
1479  { wxT("psp"), AUDACITY_AV_CODEC_ID_QCELP },
1480  { wxT("psp"), AUDACITY_AV_CODEC_ID_MP3 },
1481  { wxT("psp"), AUDACITY_AV_CODEC_ID_VORBIS },
1482 
1483  { wxT("ipod"), AUDACITY_AV_CODEC_ID_AAC },
1484  { wxT("ipod"), AUDACITY_AV_CODEC_ID_QCELP },
1485  { wxT("ipod"), AUDACITY_AV_CODEC_ID_MP3 },
1486  { wxT("ipod"), AUDACITY_AV_CODEC_ID_VORBIS },
1487 
1488  { wxT("3gp"), AUDACITY_AV_CODEC_ID_AAC },
1489  { wxT("3gp"), AUDACITY_AV_CODEC_ID_AMR_NB },
1490  { wxT("3gp"), AUDACITY_AV_CODEC_ID_AMR_WB },
1491 
1492  { wxT("3g2"), AUDACITY_AV_CODEC_ID_AAC },
1493  { wxT("3g2"), AUDACITY_AV_CODEC_ID_AMR_NB },
1494  { wxT("3g2"), AUDACITY_AV_CODEC_ID_AMR_WB },
1495 
1496  { wxT("mp3"), AUDACITY_AV_CODEC_ID_MP3 },
1497 
1498  { wxT("mpeg"), AUDACITY_AV_CODEC_ID_AC3 },
1499  { wxT("mpeg"), AUDACITY_AV_CODEC_ID_DTS },
1500  { wxT("mpeg"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1501  //{ wxT("mpeg"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1502 
1503  { wxT("vcd"), AUDACITY_AV_CODEC_ID_AC3 },
1504  { wxT("vcd"), AUDACITY_AV_CODEC_ID_DTS },
1505  { wxT("vcd"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1506  //{ wxT("vcd"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1507 
1508  { wxT("vob"), AUDACITY_AV_CODEC_ID_AC3 },
1509  { wxT("vob"), AUDACITY_AV_CODEC_ID_DTS },
1510  { wxT("vob"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1511  //{ wxT("vob"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1512 
1513  { wxT("svcd"), AUDACITY_AV_CODEC_ID_AC3 },
1514  { wxT("svcd"), AUDACITY_AV_CODEC_ID_DTS },
1515  { wxT("svcd"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1516  //{ wxT("svcd"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1517 
1518  { wxT("dvd"), AUDACITY_AV_CODEC_ID_AC3 },
1519  { wxT("dvd"), AUDACITY_AV_CODEC_ID_DTS },
1520  { wxT("dvd"), AUDACITY_AV_CODEC_ID_PCM_S16BE },
1521  //{ wxT("dvd"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1522 
1523  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1524  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1525  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1526  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1527  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_MS },
1528  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1529  { wxT("nut"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1530  { wxT("nut"), AUDACITY_AV_CODEC_ID_WMAVOICE },
1531  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV },
1532  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1533  { wxT("nut"), AUDACITY_AV_CODEC_ID_TRUESPEECH },
1534  { wxT("nut"), AUDACITY_AV_CODEC_ID_GSM_MS },
1535  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1536  //{ wxT("nut"), AUDACITY_AV_CODEC_ID_MP2 },// Bug 59
1537  { wxT("nut"), AUDACITY_AV_CODEC_ID_MP3 },
1538  #if LIBAVCODEC_VERSION_MAJOR < 58
1539  { wxT("nut"), AUDACITY_AV_CODEC_ID_VOXWARE },
1540  #endif
1541  { wxT("nut"), AUDACITY_AV_CODEC_ID_AAC },
1542  { wxT("nut"), AUDACITY_AV_CODEC_ID_WMAV1 },
1543  { wxT("nut"), AUDACITY_AV_CODEC_ID_WMAV2 },
1544  { wxT("nut"), AUDACITY_AV_CODEC_ID_WMAPRO },
1545  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_CT },
1546  { wxT("nut"), AUDACITY_AV_CODEC_ID_ATRAC3 },
1547  { wxT("nut"), AUDACITY_AV_CODEC_ID_IMC },
1548  { wxT("nut"), AUDACITY_AV_CODEC_ID_AC3 },
1549  { wxT("nut"), AUDACITY_AV_CODEC_ID_DTS },
1550  { wxT("nut"), AUDACITY_AV_CODEC_ID_FLAC },
1551  { wxT("nut"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1552  { wxT("nut"), AUDACITY_AV_CODEC_ID_VORBIS },
1553 
1554  { wxT("ogg"), AUDACITY_AV_CODEC_ID_VORBIS },
1555  { wxT("ogg"), AUDACITY_AV_CODEC_ID_FLAC },
1556 
1557  { wxT("ac3"), AUDACITY_AV_CODEC_ID_AC3 },
1558 
1559  { wxT("dts"), AUDACITY_AV_CODEC_ID_DTS },
1560 
1561  { wxT("flac"), AUDACITY_AV_CODEC_ID_FLAC },
1562 
1563  { wxT("RoQ"), AUDACITY_AV_CODEC_ID_ROQ_DPCM },
1564 
1565  { wxT("rm"), AUDACITY_AV_CODEC_ID_AC3 },
1566 
1567  { wxT("swf"), AUDACITY_AV_CODEC_ID_MP3 },
1568 
1569  { wxT("avm2"), AUDACITY_AV_CODEC_ID_MP3 },
1570 
1571  { wxT("voc"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1572 
1573  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_S16LE },
1574  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_U8 },
1575  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_S24LE },
1576  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_S32LE },
1577  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_MS },
1578  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_ALAW },
1579  { wxT("wav"), AUDACITY_AV_CODEC_ID_PCM_MULAW },
1580  { wxT("wav"), AUDACITY_AV_CODEC_ID_WMAVOICE },
1581  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV },
1582  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA },
1583  { wxT("wav"), AUDACITY_AV_CODEC_ID_TRUESPEECH },
1584  { wxT("wav"), AUDACITY_AV_CODEC_ID_GSM_MS },
1585  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_G726 },
1586  //{ wxT("wav"), AUDACITY_AV_CODEC_ID_MP2 }, Bug 59 - It crashes.
1587  { wxT("wav"), AUDACITY_AV_CODEC_ID_MP3 },
1588 #if LIBAVCODEC_VERSION_MAJOR < 58
1589  { wxT("wav"), AUDACITY_AV_CODEC_ID_VOXWARE },
1590 #endif
1591  { wxT("wav"), AUDACITY_AV_CODEC_ID_AAC },
1592  // { wxT("wav"), AUDACITY_AV_CODEC_ID_WMAV1 },
1593  // { wxT("wav"), AUDACITY_AV_CODEC_ID_WMAV2 },
1594  { wxT("wav"), AUDACITY_AV_CODEC_ID_WMAPRO },
1595  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_CT },
1596  { wxT("wav"), AUDACITY_AV_CODEC_ID_ATRAC3 },
1597  { wxT("wav"), AUDACITY_AV_CODEC_ID_IMC },
1598  { wxT("wav"), AUDACITY_AV_CODEC_ID_AC3 },
1599  //{ wxT("wav"), AUDACITY_AV_CODEC_ID_DTS },
1600  { wxT("wav"), AUDACITY_AV_CODEC_ID_FLAC },
1601  { wxT("wav"), AUDACITY_AV_CODEC_ID_ADPCM_SWF },
1602  { wxT("wav"), AUDACITY_AV_CODEC_ID_VORBIS },
1603 
1604  { NULL, AUDACITY_AV_CODEC_ID_NONE }
1605 };
1606 
1608 // The FF_PROFILE_* enumeration is defined in the ffmpeg library
1609 // PRL: I cant find where this preference is used!
1610 ChoiceSetting AACProfiles { wxT("/FileFormats/FFmpegAACProfile"),
1611  {
1612  {wxT("1") /*FF_PROFILE_AAC_LOW*/, XO("LC")},
1613  {wxT("0") /*FF_PROFILE_AAC_MAIN*/, XO("Main")},
1614  // {wxT("2") /*FF_PROFILE_AAC_SSR*/, XO("SSR")}, //SSR is not supported
1615  {wxT("3") /*FF_PROFILE_AAC_LTP*/, XO("LTP")},
1616  },
1617  0, // "1"
1618 };
1619 
1622 {
1623  {FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_CANMETA, true, XO("M4A (AAC) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_AAC, true},
1624  {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},
1625  {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},
1626  {FMT_OPUS, wxT("OPUS"), wxT("opus"), wxT("opus"), 255, AV_CANMETA, true, XO("Opus (OggOpus) Files (FFmpeg)"), AUDACITY_AV_CODEC_ID_OPUS, true},
1627  {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},
1628  {FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_CANMETA, true, XO("Custom FFmpeg Export"), AUDACITY_AV_CODEC_ID_NONE, true}
1629 };
1630 
1639 {
1640  {TRUE,FEQualityID,AUDACITY_AV_CODEC_ID_AAC,"any"},
1641  {TRUE,FEQualityID,AUDACITY_AV_CODEC_ID_MP3,"any"},
1642  {TRUE,FEQualityID,AUDACITY_AV_CODEC_ID_VORBIS,"any"},
1643  {FALSE,FEQualityID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1644 
1645  {TRUE,FECutoffID,AUDACITY_AV_CODEC_ID_AC3,"any"},
1646  {TRUE,FECutoffID,AUDACITY_AV_CODEC_ID_AAC,"any"},
1647  {TRUE,FECutoffID,AUDACITY_AV_CODEC_ID_VORBIS,"any"},
1648  {FALSE,FECutoffID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1649 
1650  {TRUE,FEFrameSizeID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1651  {FALSE,FEFrameSizeID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1652 
1653  {TRUE,FEProfileID,AUDACITY_AV_CODEC_ID_AAC,"any"},
1654  {FALSE,FEProfileID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1655 
1656  {TRUE,FECompLevelID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1657  {FALSE,FECompLevelID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1658 
1659  {TRUE,FEUseLPCID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1660  {FALSE,FEUseLPCID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1661 
1662  {TRUE,FELPCCoeffsID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1663  {FALSE,FELPCCoeffsID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1664 
1665  {TRUE,FEMinPredID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1666  {FALSE,FEMinPredID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1667 
1668  {TRUE,FEMaxPredID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1669  {FALSE,FEMaxPredID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1670 
1671  {TRUE,FEPredOrderID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1672  {FALSE,FEPredOrderID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1673 
1674  {TRUE,FEMinPartOrderID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1675  {FALSE,FEMinPartOrderID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1676 
1677  {TRUE,FEMaxPartOrderID,AUDACITY_AV_CODEC_ID_FLAC,"any"},
1678  {FALSE,FEMaxPartOrderID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1679 
1680  {TRUE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"mpeg"},
1681  {TRUE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"vcd"},
1682  {TRUE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"vob"},
1683  {TRUE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"svcd"},
1684  {TRUE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"dvd"},
1685  {FALSE,FEMuxRateID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1686 
1687  {TRUE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"mpeg"},
1688  {TRUE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"vcd"},
1689  {TRUE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"vob"},
1690  {TRUE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"svcd"},
1691  {TRUE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"dvd"},
1692  {FALSE,FEPacketSizeID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1693 
1694  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"matroska"},
1695  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"mov"},
1696  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"3gp"},
1697  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"mp4"},
1698  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"psp"},
1699  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"3g2"},
1700  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"ipod"},
1701  {TRUE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"mpegts"},
1702  {FALSE,FELanguageID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1703 
1704  {TRUE,FEBitReservoirID,AUDACITY_AV_CODEC_ID_MP3,"any"},
1705  {TRUE,FEBitReservoirID,AUDACITY_AV_CODEC_ID_WMAV1,"any"},
1706  {TRUE,FEBitReservoirID,AUDACITY_AV_CODEC_ID_WMAV2,"any"},
1707  {FALSE,FEBitReservoirID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1708 
1709  {TRUE,FEVariableBlockLenID,AUDACITY_AV_CODEC_ID_WMAV1,"any"},
1710  {TRUE,FEVariableBlockLenID,AUDACITY_AV_CODEC_ID_WMAV2,"any"},
1711  {FALSE,FEVariableBlockLenID,AUDACITY_AV_CODEC_ID_NONE,"any"},
1712 
1714 };
1715 
1716 namespace {
1717 
1720  XO("Estimate"),
1721  XO("2-level"),
1722  XO("4-level"),
1723  XO("8-level"),
1724  XO("Full search"),
1725  XO("Log search"),
1726 };
1727 
1728 }
1729 
1730 
1731 
1733 {
1734 }
1735 
1737 : wxDialogWrapper(parent, wxID_ANY,
1738  XO("Configure custom FFmpeg options"))
1739 {
1740  SetName();
1743  //FFmpegLibsInst()->LoadLibs(NULL,true); //Loaded at startup or from Prefs now
1744 
1745  mPresets = std::make_unique<FFmpegPresets>();
1746  mPresets->GetPresetList(mPresetNames);
1747 
1748  if (mFFmpeg)
1749  {
1750  FetchFormatList();
1751  FetchCodecList();
1752 
1753  PopulateOrExchange(S);
1754 
1755  //Select the format that was selected last time this dialog was closed
1756  mFormatList->Select(mFormatList->FindString(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"))));
1757  DoOnFormatList();
1758 
1759  //Select the codec that was selected last time this dialog was closed
1760  auto codec = mFFmpeg->CreateEncoder(gPrefs->Read(wxT("/FileFormats/FFmpegCodec")).ToUTF8());
1761 
1762  if (codec != nullptr)
1763  mCodecList->Select(mCodecList->FindString(wxString::FromUTF8(codec->GetName())));
1764 
1765  DoOnCodecList();
1766  }
1767 
1768 }
1769 
1773 {
1774  if (!mFFmpeg)
1775  return;
1776 
1777  // Enumerate all output formats
1778  std::unique_ptr<AVOutputFormatWrapper> ofmt;
1779 
1780  while ((ofmt = mFFmpeg->GetNextOutputFormat(ofmt.get()))!=NULL)
1781  {
1782  // Any audio-capable format has default audio codec.
1783  // If it doesn't, then it doesn't supports any audio codecs
1785  {
1786  mFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
1787  mFormatLongNames.push_back(wxString::Format(wxT("%s - %s"),mFormatNames.back(),wxString::FromUTF8(ofmt->GetLongName())));
1788  }
1789  }
1790  // Show all formats
1793 }
1794 
1798 {
1799  if (!mFFmpeg)
1800  return;
1801  // Enumerate all codecs
1802  std::unique_ptr<AVCodecWrapper> codec;
1803  while ((codec = mFFmpeg->GetNextCodec(codec.get()))!=NULL)
1804  {
1805  // We're only interested in audio and only in encoders
1806  if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
1807  {
1808  // MP2 Codec is broken. Don't allow it.
1809  if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2))
1810  continue;
1811 
1812  mCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
1813  mCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
1814  }
1815  }
1816  // Show all codecs
1819 }
1820 
1824 {
1825  S.StartVerticalLay(1);
1826  S.StartMultiColumn(1, wxEXPAND);
1827  {
1828  S.SetStretchyRow(3);
1829  S.StartMultiColumn(7, wxEXPAND);
1830  {
1831  S.SetStretchyCol(1);
1832  mPresetCombo = S.Id(FEPresetID).AddCombo(XXO("Preset:"), gPrefs->Read(wxT("/FileFormats/FFmpegPreset"),wxEmptyString), mPresetNames);
1833  S.Id(FELoadPresetID).AddButton(XXO("Load Preset"));
1834  S.Id(FESavePresetID).AddButton(XXO("Save Preset"));
1835  S.Id(FEDeletePresetID).AddButton(XXO("Delete Preset"));
1836  S.Id(FEImportPresetsID).AddButton(XXO("Import Presets"));
1837  S.Id(FEExportPresetsID).AddButton(XXO("Export Presets"));
1838  }
1839  S.EndMultiColumn();
1840  S.StartMultiColumn(4, wxALIGN_LEFT);
1841  {
1842  S.SetStretchyCol(1);
1843  S.SetStretchyCol(3);
1844  S.Id(FEFormatLabelID).AddFixedText(XO("Format:"));
1845  mFormatName = S.Id(FEFormatNameID).AddVariableText( {} );
1846  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1847  S.Id(FECodecLabelID).AddFixedText(XO("Codec:"));
1848  mCodecName = S.Id(FECodecNameID).AddVariableText( {} );
1849  }
1850  S.EndMultiColumn();
1851  S.AddVariableText(XO(
1852 "Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs."),
1853  false);
1854  S.StartMultiColumn(2, wxEXPAND);
1855  {
1856  S.StartMultiColumn(2, wxEXPAND);
1857  {
1858  S.SetStretchyRow(1);
1859  S.Id(FEAllFormatsID).AddButton(XXO("Show All Formats"));
1860  S.Id(FEAllCodecsID).AddButton(XXO("Show All Codecs"));
1861  mFormatList = S.Id(FEFormatID).AddListBox(mFormatNames);
1862  mFormatList->DeselectAll();
1863  mCodecList = S.Id(FECodecID).AddListBox(mCodecNames);
1864  mCodecList->DeselectAll();
1865  }
1866  S.EndMultiColumn();
1867  S.StartVerticalLay();
1868  {
1869  //S.StartScroller( );
1870  S.SetBorder( 3 );
1871  S.StartStatic(XO("General Options"), 0);
1872  {
1873  S.StartMultiColumn(8, wxEXPAND);
1874  {
1875  S.Id(FELanguageID)
1876  .ToolTip(XO("ISO 639 3-letter language code\nOptional\nempty - automatic"))
1877  .TieTextBox(XXO("Language:"), {wxT("/FileFormats/FFmpegLanguage"), wxEmptyString}, 9);
1878 
1879  S.AddSpace( 20,0 );
1880  S.AddVariableText(XO("Bit Reservoir"));
1881  S.Id(FEBitReservoirID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegBitReservoir"), true});
1882 
1883  S.AddSpace( 20,0 );
1884  S.AddVariableText(XO("VBL"));
1885  S.Id(FEVariableBlockLenID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegVariableBlockLen"), true});
1886  }
1887  S.EndMultiColumn();
1888  S.StartMultiColumn(4, wxALIGN_LEFT);
1889  {
1890  S.Id(FETagID)
1891  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
1892  .ToolTip(XO("Codec tag (FOURCC)\nOptional\nempty - automatic"))
1893  .TieTextBox(XXO("Tag:"), {wxT("/FileFormats/FFmpegTag"), wxEmptyString}, 4);
1894 
1895  S.Id(FEBitrateID)
1896  .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"))
1897  .TieSpinCtrl(XXO("Bit Rate:"), {wxT("/FileFormats/FFmpegBitRate"), 0}, 1000000, 0);
1898 
1899  S.Id(FEQualityID)
1900  .ToolTip(XO("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)"))
1901  .TieSpinCtrl(XXO("Quality:"), {wxT("/FileFormats/FFmpegQuality"), 0}, 500, -1);
1902 
1903  S.Id(FESampleRateID)
1904  .ToolTip(XO("Sample rate (Hz)\n0 - don't change sample rate"))
1905  .TieSpinCtrl(XXO("Sample Rate:"), {wxT("/FileFormats/FFmpegSampleRate"), 0}, 200000, 0);
1906 
1907  S.Id(FECutoffID)
1908  .ToolTip(XO("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic"))
1909  .TieSpinCtrl(XXO("Cutoff:"), {wxT("/FileFormats/FFmpegCutOff"), 0}, 10000000, 0);
1910 
1911  // PRL: As commented elsewhere, this preference does nothing
1912  S.Id(FEProfileID)
1913  .ToolTip(XO("AAC Profile\nLow Complexity - default\nMost players won't play anything other than LC"))
1914  .MinSize( { 100, -1 } )
1915  .TieChoice(XXO("Profile:"), AACProfiles);
1916  }
1917  S.EndMultiColumn();
1918  }
1919  S.EndStatic();
1920  S.StartStatic(XO("FLAC options"),0);
1921  {
1922  S.StartMultiColumn(4, wxALIGN_LEFT);
1923  {
1924  S
1925  .ToolTip(XO("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)"))
1926  .Id(FECompLevelID).TieSpinCtrl(XXO("Compression:"), {wxT("/FileFormats/FFmpegCompLevel"), 0}, 10, -1);
1927 
1928  S.Id(FEFrameSizeID)
1929  .ToolTip(XO("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535"))
1930  .TieSpinCtrl(XXO("Frame:"), {wxT("/FileFormats/FFmpegFrameSize"), 0}, 65535, 0);
1931 
1932  S.Id(FELPCCoeffsID)
1933  .ToolTip(XO("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15"))
1934  .TieSpinCtrl(XXO("LPC"), {wxT("/FileFormats/FFmpegLPCCoefPrec"), 0}, 15, 0);
1935 
1936  S.Id(FEPredOrderID)
1937  .ToolTip(XO("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"))
1938  .MinSize( { 100, -1 } )
1939  .TieNumberAsChoice(
1940  XXO("PdO Method:"),
1941  {wxT("/FileFormats/FFmpegPredOrderMethod"),
1942  4}, // Full search
1944  );
1945 
1946  S.Id(FEMinPredID)
1947  .ToolTip(XO("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
1948  .TieSpinCtrl(XXO("Min. PdO"), {wxT("/FileFormats/FFmpegMinPredOrder"), -1}, 32, -1);
1949 
1950  S.Id(FEMaxPredID)
1951  .ToolTip(XO("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"))
1952  .TieSpinCtrl(XXO("Max. PdO"), {wxT("/FileFormats/FFmpegMaxPredOrder"), -1}, 32, -1);
1953 
1954  S.Id(FEMinPartOrderID)
1955  .ToolTip(XO("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
1956  .TieSpinCtrl(XXO("Min. PtO"), {wxT("/FileFormats/FFmpegMinPartOrder"), -1}, 8, -1);
1957 
1958  S.Id(FEMaxPartOrderID)
1959  .ToolTip(XO("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"))
1960  .TieSpinCtrl(XXO("Max. PtO"), {wxT("/FileFormats/FFmpegMaxPartOrder"), -1}, 8, -1);
1961 
1962  /* i18n-hint: Abbreviates "Linear Predictive Coding",
1963  but this text needs to be kept very short */
1964  S.AddVariableText(XO("Use LPC"));
1965  // PRL: This preference is not used anywhere!
1966  S.Id(FEUseLPCID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegUseLPC"), true});
1967  }
1968  S.EndMultiColumn();
1969  }
1970  S.EndStatic();
1971  S.StartStatic(XO("MPEG container options"),0);
1972  {
1973  S.StartMultiColumn(4, wxALIGN_LEFT);
1974  {
1975  S.Id(FEMuxRateID)
1976  .ToolTip(XO("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"))
1977  /* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
1978  'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG
1979  it has a hard to predict effect on the degree of compression */
1980  .TieSpinCtrl(XXO("Mux Rate:"), {wxT("/FileFormats/FFmpegMuxRate"), 0}, 10000000, 0);
1981 
1982  S.Id(FEPacketSizeID)
1983  /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
1984  compression. It measures how big a chunk of audio is compressed in one piece. */
1985  .ToolTip(XO("Packet size\nOptional\n0 - default"))
1986  /* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
1987  compression. It measures how big a chunk of audio is compressed in one piece. */
1988  .TieSpinCtrl(XXO("Packet Size:"), {wxT("/FileFormats/FFmpegPacketSize"), 0}, 10000000, 0);
1989  }
1990  S.EndMultiColumn();
1991  }
1992  S.EndStatic();
1993  //S.EndScroller();
1994  S.SetBorder( 5 );
1996  }
1997  S.EndVerticalLay();
1998  }
1999  S.EndMultiColumn();
2000  }
2001  S.EndMultiColumn();
2002  S.EndVerticalLay();
2003 
2004  Layout();
2005  Fit();
2006  SetMinSize(GetSize());
2007  Center();
2008 
2009  return;
2010 }
2011 
2014 void ExportFFmpegOptions::FindSelectedFormat(wxString **name, wxString **longname)
2015 {
2016  // Get current selection
2017  wxArrayInt selections;
2018  int n = mFormatList->GetSelections(selections);
2019  if (n <= 0) return;
2020 
2021  // Get selected format short name
2022  wxString selfmt = mFormatList->GetString(selections[0]);
2023 
2024  // Find its index
2025  int nFormat = make_iterator_range( mFormatNames ).index( selfmt );
2026  if (nFormat == wxNOT_FOUND) return;
2027 
2028  // Return short name and description
2029  if (name != NULL) *name = &mFormatNames[nFormat];
2030  if (longname != NULL) *longname = &mFormatLongNames[nFormat];
2031  return;
2032 }
2035 void ExportFFmpegOptions::FindSelectedCodec(wxString **name, wxString **longname)
2036 {
2037  // Get current selection
2038  wxArrayInt selections;
2039  int n = mCodecList->GetSelections(selections);
2040  if (n <= 0) return;
2041 
2042  // Get selected codec short name
2043  wxString selcdc = mCodecList->GetString(selections[0]);
2044 
2045  // Find its index
2046  int nCodec = make_iterator_range( mCodecNames ).index( selcdc );
2047  if (nCodec == wxNOT_FOUND) return;
2048 
2049  // Return short name and description
2050  if (name != NULL) *name = &mCodecNames[nCodec];
2051  if (longname != NULL) *longname = &mCodecLongNames[nCodec];
2052 }
2053 
2057 {
2058  const auto ffmpegId = mFFmpeg->GetAVCodecID(id);
2059 
2060  // By default assume that id is not in the list
2061  int index = -1;
2062  // By default no codecs are compatible (yet)
2063  mShownCodecNames.clear();
2064  mShownCodecLongNames.clear();
2065  // Clear the listbox
2066  mCodecList->Clear();
2067  // Zero - format is not found at all
2068  int found = 0;
2069  wxString str(fmt);
2070  for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2071  {
2072  if (str == CompatibilityList[i].fmt)
2073  {
2074  // Format is found in the list
2075  found = 1;
2076  if (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE)
2077  {
2078  // Format is found in the list and it is compatible with AUDACITY_AV_CODEC_ID_NONE (means that it is compatible to anything)
2079  found = 2;
2080  break;
2081  }
2082  // Find the codec, that is claimed to be compatible
2083  std::unique_ptr<AVCodecWrapper> codec = mFFmpeg->CreateEncoder(mFFmpeg->GetAVCodecID(CompatibilityList[i].codec));
2084  // If it exists, is audio and has encoder
2085  if (codec != NULL && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2086  {
2087  // If it was selected - remember its NEW index
2088  if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2089  index = mShownCodecNames.size();
2090 
2091  mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2092  mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2093  }
2094  }
2095  }
2096  // All codecs are compatible with this format
2097  if (found == 2)
2098  {
2099  std::unique_ptr<AVCodecWrapper> codec;
2100  while ((codec = mFFmpeg->GetNextCodec(codec.get()))!=NULL)
2101  {
2102  if (codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2103  {
2104  // MP2 is broken.
2105  if( codec->GetId() == mFFmpeg->GetAVCodecID(AUDACITY_AV_CODEC_ID_MP2) )
2106  continue;
2107 
2109  .contains( wxString::FromUTF8(codec->GetName()) ) )
2110  {
2111  if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2112  index = mShownCodecNames.size();
2113 
2114  mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2115  mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2116  }
2117  }
2118  }
2119  }
2120  // Format is not found - find format in libavformat and add its default audio codec
2121  // This allows us to provide limited support for NEW formats without modifying the compatibility list
2122  else if (found == 0)
2123  {
2124  wxCharBuffer buf = str.ToUTF8();
2125  auto format = mFFmpeg->GuessOutputFormat(buf, nullptr, nullptr);
2126 
2127  if (format != nullptr)
2128  {
2129  auto codec = mFFmpeg->CreateEncoder(format->GetAudioCodec());
2130 
2131  if (
2132  codec != nullptr && codec->IsAudio() && mFFmpeg->av_codec_is_encoder(codec->GetWrappedValue()))
2133  {
2134  if ((ffmpegId >= 0) && codec->GetId() == ffmpegId)
2135  index = mShownCodecNames.size();
2136 
2137  mShownCodecNames.push_back(wxString::FromUTF8(codec->GetName()));
2138  mShownCodecLongNames.push_back(wxString::Format(wxT("%s - %s"),mShownCodecNames.back(),wxString::FromUTF8(codec->GetLongName())));
2139  }
2140  }
2141  }
2142  // Show NEW codec list
2143  mCodecList->Append(mShownCodecNames);
2144 
2145  return index;
2146 }
2147 
2151  AudacityAVCodecID id, wxString* selfmt)
2152 {
2153  int index = -1;
2154  mShownFormatNames.clear();
2155  mShownFormatLongNames.clear();
2156  mFormatList->Clear();
2157  std::unique_ptr<AVOutputFormatWrapper> ofmt;
2158 
2159  wxArrayString FromList;
2160  // Find all formats compatible to this codec in compatibility list
2161  for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2162  {
2163  if (CompatibilityList[i].codec == id || (CompatibilityList[i].codec.value == AUDACITY_AV_CODEC_ID_NONE) )
2164  {
2165  if ((selfmt != NULL) && (*selfmt == CompatibilityList[i].fmt)) index = mShownFormatNames.size();
2166  FromList.push_back(CompatibilityList[i].fmt);
2167  mShownFormatNames.push_back(CompatibilityList[i].fmt);
2168  auto tofmt = mFFmpeg->GuessOutputFormat(
2169  wxString(CompatibilityList[i].fmt).ToUTF8(), nullptr, nullptr);
2170 
2171  if (tofmt != NULL)
2172  {
2173  mShownFormatLongNames.push_back(wxString::Format(
2174  wxT("%s - %s"), CompatibilityList[i].fmt,
2175  wxString::FromUTF8(tofmt->GetLongName())));
2176  }
2177  }
2178  }
2179  bool found = false;
2180  if (selfmt != NULL)
2181  {
2182  for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2183  {
2184  if (*selfmt == CompatibilityList[i].fmt)
2185  {
2186  found = true;
2187  break;
2188  }
2189  }
2190  }
2191  // Format was in the compatibility list
2192  if (found)
2193  {
2194  // Find all formats which have this codec as default and which are not in the list yet and add them too
2195  while ((ofmt = mFFmpeg->GetNextOutputFormat(ofmt.get()))!=NULL)
2196  {
2197  if (ofmt->GetAudioCodec() == mFFmpeg->GetAVCodecID(id))
2198  {
2199  wxString ofmtname = wxString::FromUTF8(ofmt->GetName());
2200  found = false;
2201  for (unsigned int i = 0; i < FromList.size(); i++)
2202  {
2203  if (ofmtname == FromList[i])
2204  {
2205  found = true;
2206  break;
2207  }
2208  }
2209  if (!found)
2210  {
2211  if ((selfmt != NULL) &&
2212  (*selfmt == wxString::FromUTF8(ofmt->GetName())))
2213  index = mShownFormatNames.size();
2214 
2215  mShownFormatNames.push_back(wxString::FromUTF8(ofmt->GetName()));
2216 
2217  mShownFormatLongNames.push_back(wxString::Format(
2218  wxT("%s - %s"), mShownFormatNames.back(),
2219  wxString::FromUTF8(ofmt->GetLongName())));
2220  }
2221  }
2222  }
2223  }
2224  mFormatList->Append(mShownFormatNames);
2225  return index;
2226 }
2227 
2230 void ExportFFmpegOptions::OnDeletePreset(wxCommandEvent& WXUNUSED(event))
2231 {
2232  wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2233  wxString presetname = preset->GetValue();
2234  if (presetname.empty())
2235  {
2236  AudacityMessageBox( XO("You can't delete a preset without name") );
2237  return;
2238  }
2239 
2240  auto query = XO("Delete preset '%s'?").Format( presetname );
2241  int action = AudacityMessageBox(
2242  query,
2243  XO("Confirm Deletion"),
2244  wxYES_NO | wxCENTRE);
2245  if (action == wxNO) return;
2246 
2247  mPresets->DeletePreset(presetname);
2248  long index = preset->FindString(presetname);
2249  preset->SetValue(wxEmptyString);
2250  preset->Delete(index);
2251  mPresetNames.erase(
2252  std::find( mPresetNames.begin(), mPresetNames.end(), presetname )
2253  );
2254 }
2255 
2258 void ExportFFmpegOptions::OnSavePreset(wxCommandEvent& WXUNUSED(event))
2259 { const bool kCheckForOverwrite = true;
2260  SavePreset(kCheckForOverwrite);
2261 }
2262 
2263 // Return false if failed to save.
2264 bool ExportFFmpegOptions::SavePreset(bool bCheckForOverwrite)
2265 {
2266  wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2267  wxString name = preset->GetValue();
2268  if (name.empty())
2269  {
2270  AudacityMessageBox( XO("You can't save a preset without a name") );
2271  return false;
2272  }
2273  if( bCheckForOverwrite && !mPresets->OverwriteIsOk(name))
2274  return false;
2275  if( !mPresets->SavePreset(this,name) )
2276  return false;
2277  int index = mPresetNames.Index(name,false);
2278  if (index == -1)
2279  {
2280  mPresetNames.push_back(name);
2281  mPresetCombo->Clear();
2282  mPresetCombo->Append(mPresetNames);
2283  mPresetCombo->Select(mPresetNames.Index(name,false));
2284  }
2285  return true;
2286 }
2287 
2290 void ExportFFmpegOptions::OnLoadPreset(wxCommandEvent& WXUNUSED(event))
2291 {
2292  wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this));
2293  wxString presetname = preset->GetValue();
2294 
2297  mFormatList->Clear();
2298  mFormatList->Append(mFormatNames);
2299 
2302  mCodecList->Clear();
2303  mCodecList->Append(mCodecNames);
2304 
2305  mPresets->LoadPreset(this,presetname);
2306 
2307  DoOnFormatList();
2308  DoOnCodecList();
2309 }
2310 
2312 {
2313  static const FileNames::FileTypes result{
2315  return result;
2316 };
2317 
2320 void ExportFFmpegOptions::OnImportPresets(wxCommandEvent& WXUNUSED(event))
2321 {
2322  wxString path;
2323  FileDialogWrapper dlg(this,
2324  XO("Select xml file with presets to import"),
2325  gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
2326  wxEmptyString,
2327  FileTypes(),
2328  wxFD_OPEN);
2329  if (dlg.ShowModal() == wxID_CANCEL) return;
2330  path = dlg.GetPath();
2331  mPresets->ImportPresets(path);
2332  mPresets->GetPresetList(mPresetNames);
2333  mPresetCombo->Clear();
2334  mPresetCombo->Append(mPresetNames);
2335 }
2336 
2339 void ExportFFmpegOptions::OnExportPresets(wxCommandEvent& WXUNUSED(event))
2340 {
2341  const bool kCheckForOverwrite = true;
2342  // Bug 1180 save any pending preset before exporting the lot.
2343  // If saving fails, don't try to export.
2344  if( !SavePreset(!kCheckForOverwrite) )
2345  return;
2346 
2347  wxArrayString presets;
2348  mPresets->GetPresetList( presets);
2349  if( presets.Count() < 1)
2350  {
2351  AudacityMessageBox( XO("No presets to export") );
2352  return;
2353  }
2354 
2355  wxString path;
2356  FileDialogWrapper dlg(this,
2357  XO("Select xml file to export presets into"),
2358  gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
2359  wxEmptyString,
2360  FileTypes(),
2361  wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
2362  if (dlg.ShowModal() == wxID_CANCEL) return;
2363  path = dlg.GetPath();
2364  mPresets->ExportPresets(path);
2365 }
2366 
2369 void ExportFFmpegOptions::OnAllFormats(wxCommandEvent& WXUNUSED(event))
2370 {
2373  mFormatList->Clear();
2374  mFormatList->Append(mFormatNames);
2375 }
2376 
2379 void ExportFFmpegOptions::OnAllCodecs(wxCommandEvent& WXUNUSED(event))
2380 {
2383  mCodecList->Clear();
2384  mCodecList->Append(mCodecNames);
2385 }
2386 
2395 {
2396  wxString *selcdc = nullptr;
2397  wxString* selcdclong = nullptr;
2398 
2399  FindSelectedCodec(&selcdc, &selcdclong);
2400 
2401  if (selcdc == nullptr)
2402  return false; // unrecognised codec. Treated as OK
2403 
2404  auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2405 
2406  if (cdc == nullptr)
2407  return false; // unrecognised codec. Treated as OK
2408 
2409  wxString* selfmt = nullptr;
2410  wxString* selfmtlong = nullptr;
2411 
2412  FindSelectedFormat(&selfmt, &selfmtlong);
2413 
2414  if (selfmt == nullptr)
2415  return false; // unrecognised format; Treated as OK
2416 
2417  // This is intended to test for illegal combinations.
2418  // However, the list updating now seems to be working correctly
2419  // making it impossible to select illegal combinations
2420  bool bFound = false;
2421  for (int i = 0; CompatibilityList[i].fmt != NULL; i++)
2422  {
2423  if (*selfmt == CompatibilityList[i].fmt)
2424  {
2425  if (CompatibilityList[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()) || (CompatibilityList[i].codec == AUDACITY_AV_CODEC_ID_NONE) ){
2426  bFound = true;
2427  break;
2428  }
2429  }
2430  }
2431 
2432  // We can put extra code in here, to disallow combinations
2433  // We could also test for illegal parameters, and deliver
2434  // custom error messages in that case.
2435  // The below would make AAC codec disallowed.
2436  //if( cdc->id == AUDACITY_AV_CODEC_ID_AAC)
2437  // bFound = false;
2438 
2439  // Valid combination was found, so no reporting.
2440  if( bFound )
2441  return false;
2442 
2444  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2445  XO("Format %s is not compatible with codec %s.")
2446  .Format( *selfmt, *selcdc ),
2447  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2448  XO("Incompatible format and codec"));
2449 
2450  return true;
2451 }
2452 
2453 
2454 
2456 {
2457  int handled = -1;
2458  for (int i = 0; apptable[i].control != 0; i++)
2459  {
2460  if (apptable[i].control != handled)
2461  {
2462  bool codec = false;
2463  bool format = false;
2464  if (apptable[i].codec == AUDACITY_AV_CODEC_ID_NONE)
2465  {
2466  codec = true;
2467  }
2468  else if (
2469  cdc != NULL &&
2470  apptable[i].codec == mFFmpeg->GetAudacityCodecID(cdc->GetId()))
2471  {
2472  codec = true;
2473  }
2474 
2475  if (wxString::FromUTF8(apptable[i].format) == wxT("any")) format = true;
2476  else if (selfmt != NULL &&
2477  *selfmt == wxString::FromUTF8(apptable[i].format)) format = true;
2478  if (codec && format)
2479  {
2480  handled = apptable[i].control;
2481  wxWindow *item = FindWindowById(apptable[i].control,this);
2482  if (item != NULL) item->Enable(apptable[i].enable);
2483  }
2484  }
2485  }
2486 }
2487 
2489 {
2490  wxString *selfmt = NULL;
2491  wxString *selfmtlong = NULL;
2492  FindSelectedFormat(&selfmt, &selfmtlong);
2493  if (selfmt == NULL)
2494  {
2495  return;
2496  }
2497 
2498  wxString *selcdc = NULL;
2499  wxString *selcdclong = NULL;
2500  FindSelectedCodec(&selcdc, &selcdclong);
2501 
2502  auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(),NULL,NULL);
2503  if (fmt == NULL)
2504  {
2505  //This shouldn't really happen
2506  mFormatName->SetLabel(wxString(_("Failed to guess format")));
2507  return;
2508  }
2509  mFormatName->SetLabel(wxString::Format(wxT("%s"), *selfmtlong));
2510 
2512 
2513  if (selcdc != nullptr)
2514  {
2515  auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2516 
2517  if (cdc != nullptr)
2518  {
2519  selcdcid = mFFmpeg->GetAudacityCodecID(cdc->GetId());
2520  }
2521  }
2522  int newselcdc =
2523  FetchCompatibleCodecList(*selfmt, selcdcid);
2524 
2525  if (newselcdc >= 0) mCodecList->Select(newselcdc);
2526 
2527  std::unique_ptr<AVCodecWrapper> cdc;
2528 
2529  if (selcdc != nullptr)
2530  cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2531 
2532  EnableDisableControls(cdc.get(), selfmt);
2533  Layout();
2534  Fit();
2535  return;
2536 }
2537 
2539 {
2540  wxString *selcdc = nullptr;
2541  wxString* selcdclong = nullptr;
2542 
2543  FindSelectedCodec(&selcdc, &selcdclong);
2544 
2545  if (selcdc == nullptr)
2546  {
2547  return;
2548  }
2549 
2550  wxString* selfmt = nullptr;
2551  wxString* selfmtlong = nullptr;
2552 
2553  FindSelectedFormat(&selfmt, &selfmtlong);
2554 
2555  auto cdc = mFFmpeg->CreateEncoder(selcdc->ToUTF8());
2556  if (cdc == nullptr)
2557  {
2558  //This shouldn't really happen
2559  /* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2560  mCodecName->SetLabel(wxString(_("Failed to find the codec")));
2561  return;
2562  }
2563 
2564  mCodecName->SetLabel(wxString::Format(wxT("[%d] %s"), (int) mFFmpeg->GetAudacityCodecID(cdc->GetId()).value, *selcdclong));
2565 
2566  if (selfmt != nullptr)
2567  {
2568  auto fmt = mFFmpeg->GuessOutputFormat(selfmt->ToUTF8(), nullptr, nullptr);
2569  if (fmt == nullptr)
2570  {
2571  selfmt = nullptr;
2572  selfmtlong = nullptr;
2573  }
2574  }
2575 
2576  int newselfmt = FetchCompatibleFormatList(
2577  mFFmpeg->GetAudacityCodecID(cdc->GetId()), selfmt);
2578 
2579  if (newselfmt >= 0)
2580  mFormatList->Select(newselfmt);
2581 
2582  EnableDisableControls(cdc.get(), selfmt);
2583  Layout();
2584  Fit();
2585  return;
2586 }
2587 
2590 void ExportFFmpegOptions::OnFormatList(wxCommandEvent& WXUNUSED(event))
2591 {
2592  DoOnFormatList();
2593 }
2594 
2597 void ExportFFmpegOptions::OnCodecList(wxCommandEvent& WXUNUSED(event))
2598 {
2599  DoOnCodecList();
2600 }
2601 
2602 
2605 void ExportFFmpegOptions::OnOK(wxCommandEvent& WXUNUSED(event))
2606 {
2607  if( ReportIfBadCombination() )
2608  return;
2609 
2610  int selcdc = mCodecList->GetSelection();
2611  int selfmt = mFormatList->GetSelection();
2612  if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),mCodecList->GetString(selcdc));
2613  if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
2614  gPrefs->Flush();
2615 
2616  ShuttleGui S(this, eIsSavingToPrefs);
2617  PopulateOrExchange(S);
2618 
2619  gPrefs->Flush();
2620 
2621  EndModal(wxID_OK);
2622 
2623  return;
2624 }
2625 
2626 void ExportFFmpegOptions::OnGetURL(wxCommandEvent & WXUNUSED(event))
2627 {
2628  HelpSystem::ShowHelp(this, L"Custom_FFmpeg_Export_Options");
2629 }
2630 
2631 
2632 #endif
XMLWriter
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:23
ApplicableFor
Entry for the Applicability table.
Definition: ExportFFmpegDialogs.h:196
EVT_BUTTON
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
ExportFFmpegOptions::mShownCodecNames
wxArrayString mShownCodecNames
Definition: ExportFFmpegDialogs.h:239
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
AUDACITY_AV_CODEC_ID_PCM_S24LE
@ AUDACITY_AV_CODEC_ID_PCM_S24LE
Definition: AVCodecID.h:229
FFmpegPresets::WriteXML
void WriteXML(XMLWriter &xmlFile) const
Definition: ExportFFmpegDialogs.cpp:1266
ExportFFmpegAC3Options::ExportFFmpegAC3Options
ExportFFmpegAC3Options(wxWindow *parent, int format)
Definition: ExportFFmpegDialogs.cpp:198
AUDACITY_AV_CODEC_ID_WMAV1
@ AUDACITY_AV_CODEC_ID_WMAV1
Definition: AVCodecID.h:301
ExportFFmpegOptions::FindSelectedCodec
void FindSelectedCodec(wxString **name, wxString **longname)
Finds the codec currently selected and returns its name and description.
Definition: ExportFFmpegDialogs.cpp:2035
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
ExportFFmpegWMAOptions::iWMASampleRates
static const int iWMASampleRates[]
Definition: ExportFFmpegDialogs.h:166
ExportFFmpegWMAOptions::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:760
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
GuardedCall
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), std::function< void(AudacityException *)> delayedHandler=DefaultDelayedHandlerAction{})
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread...
Definition: AudacityException.h:202
AUDACITY_AV_CODEC_ID_PCM_U8
@ AUDACITY_AV_CODEC_ID_PCM_U8
Definition: AVCodecID.h:222
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:551
ExportFFmpegAMRNBOptions::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:401
ExportFFmpegOptions::OnExportPresets
void OnExportPresets(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2339
ExportFFmpegOptions::OnAllCodecs
void OnAllCodecs(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2379
AV_VERSION_INT
#define AV_VERSION_INT(a, b, c)
Definition: FFmpegTypes.h:72
AVCodecWrapper
Definition: AVCodecWrapper.h:21
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
ExportFFmpegAACOptions::ExportFFmpegAACOptions
ExportFFmpegAACOptions(wxWindow *parent, int format)
Definition: ExportFFmpegDialogs.cpp:260
ExportFFmpegOPUSOptions::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:652
ExportFFmpegOptions::OnSavePreset
void OnSavePreset(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2258
ExportFFmpegAACOptions::~ExportFFmpegAACOptions
virtual ~ExportFFmpegAACOptions()
Definition: ExportFFmpegDialogs.cpp:269
CompatibilityEntry::fmt
const wxChar * fmt
format, recognizable by guess_format()
Definition: ExportFFmpegDialogs.h:65
ExportFFmpegAC3Options::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:239
ExportFFmpegOptions::FetchFormatList
void FetchFormatList()
Retrieves format list from libavformat.
Definition: ExportFFmpegDialogs.cpp:1772
FFmpegPresets::mPreset
FFmpegPreset * mPreset
Definition: ExportFFmpegDialogs.h:342
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
ExportFFmpegAACOptions::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:299
FFmpeg.h
anonymous_namespace{ExportFFmpegDialogs.cpp}::WMABitRateValues
const std::vector< int > WMABitRateValues
Definition: ExportFFmpegDialogs.cpp:695
TranslatableStrings
std::vector< TranslatableString > TranslatableStrings
Definition: TranslatableString.h:295
ExportFFmpegOptions::OnAllFormats
void OnAllFormats(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2369
ShuttleGui::ToolTip
ShuttleGui & ToolTip(const TranslatableString &tip)
Definition: ShuttleGui.h:656
FMT_AC3
@ FMT_AC3
Definition: ExportFFmpegDialogs.h:36
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
str
#define str(a)
Definition: DBConnection.cpp:30
anonymous_namespace{ExportFFmpegDialogs.cpp}::f_kbps
TranslatableString f_kbps(double d)
Definition: ExportFFmpegDialogs.cpp:323
wxPanelWrapper
Definition: wxPanelWrapper.h:41
ExportFFmpegOptions::FetchCodecList
void FetchCodecList()
Retrieves codec list from libavcodec.
Definition: ExportFFmpegDialogs.cpp:1797
FFmpegPresets::mPresets
FFmpegPresetMap mPresets
Definition: ExportFFmpegDialogs.h:341
FileTypes
static const FileNames::FileTypes & FileTypes()
Definition: ExportFFmpegDialogs.cpp:2311
ExportFFmpegOptions::FindSelectedFormat
void FindSelectedFormat(wxString **name, wxString **longname)
Finds the format currently selected and returns its name and description.
Definition: ExportFFmpegDialogs.cpp:2014
ShuttleGuiBase::TieCheckBox
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, bool &Var)
Definition: ShuttleGui.cpp:1629
AVCodecWrapper::GetWrappedValue
AVCodec * GetWrappedValue() noexcept
Definition: AVCodecWrapper.cpp:20
FFmpegPresets::HandleXMLTag
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override
Definition: ExportFFmpegDialogs.cpp:1145
ExportFFmpegOptions::OnGetURL
void OnGetURL(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2626
OpenID
#define OpenID
Definition: ExportFFmpegDialogs.cpp:774
ExportFFmpegAMRNBOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:369
Format
Abstract base class used in importing a file.
AUDACITY_AV_CODEC_ID_PCM_MULAW
@ AUDACITY_AV_CODEC_ID_PCM_MULAW
Definition: AVCodecID.h:223
ExportFFmpegCustomOptions
Definition: ExportFFmpegDialogs.h:175
AVCodecWrapper::IsAudio
virtual bool IsAudio() const noexcept=0
ExportFFmpegOptions::EnableDisableControls
void EnableDisableControls(AVCodecWrapper *cdc, wxString *selfmt)
Definition: ExportFFmpegDialogs.cpp:2455
ShuttleGuiBase::TieSlider
wxSlider * TieSlider(const TranslatableString &Prompt, int &pos, const int max, const int min=0)
Definition: ShuttleGui.cpp:1687
FFmpegPreset::FFmpegPreset
FFmpegPreset()
Definition: ExportFFmpegDialogs.cpp:867
FFmpegPresets::SavePreset
bool SavePreset(ExportFFmpegOptions *parent, wxString &name)
Definition: ExportFFmpegDialogs.cpp:972
FFMPEG_EXPORT_CTRL_ID_ENTRIES
#define FFMPEG_EXPORT_CTRL_ID_ENTRIES
Definition: ExportFFmpegDialogs.cpp:79
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
AUDACITY_AV_CODEC_ID_ATRAC3
@ AUDACITY_AV_CODEC_ID_ATRAC3
Definition: AVCodecID.h:325
ExportFFmpegAC3Options::iAC3SampleRates
static const int iAC3SampleRates[]
Definition: ExportFFmpegDialogs.h:84
AVCodecWrapper::GetName
virtual const char * GetName() const noexcept=0
ExportFFmpegOPUSOptions::ExportFFmpegOPUSOptions
ExportFFmpegOPUSOptions(wxWindow *parent, int format)
Definition: ExportFFmpegDialogs.cpp:584
FFmpegPresets::FFmpegPresets
FFmpegPresets()
Definition: ExportFFmpegDialogs.cpp:876
ExportFFmpegOptions::SavePreset
bool SavePreset(bool bCheckForOverwrite)
Definition: ExportFFmpegDialogs.cpp:2264
XO
#define XO(s)
Definition: Internat.h:31
AUDACITY_AV_CODEC_ID_MP2
@ AUDACITY_AV_CODEC_ID_MP2
Definition: AVCodecID.h:294
ExportFFmpegOptions::mPresetCombo
wxComboBox * mPresetCombo
Definition: ExportFFmpegDialogs.h:252
ShuttleGuiBase::TieNumberAsChoice
virtual wxChoice * TieNumberAsChoice(const TranslatableString &Prompt, const IntSetting &Setting, const TranslatableStrings &Choices, const std::vector< int > *pInternalChoices=nullptr, int iNoMatchSelector=0)
Definition: ShuttleGui.cpp:2011
AUDACITY_AV_CODEC_ID_AAC
@ AUDACITY_AV_CODEC_ID_AAC
Definition: AVCodecID.h:296
FileNames::XMLFiles
FILES_API const FileType XMLFiles
Definition: FileNames.h:74
FFmpegPresets::ExportPresets
void ExportPresets(wxString &filename)
Definition: ExportFFmpegDialogs.cpp:913
AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV
@ AUDACITY_AV_CODEC_ID_ADPCM_IMA_WAV
Definition: AVCodecID.h:251
AUDACITY_AV_CODEC_ID_AC3
@ AUDACITY_AV_CODEC_ID_AC3
Definition: AVCodecID.h:297
ExportFFmpegCustomOptions::OnOpen
void OnOpen(wxCommandEvent &evt)
Definition: ExportFFmpegDialogs.cpp:840
anonymous_namespace{ExportFFmpegDialogs.cpp}::AMRNBBitRateNames
const TranslatableStrings AMRNBBitRateNames
Definition: ExportFFmpegDialogs.cpp:328
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSFrameDuration
ChoiceSetting OPUSFrameDuration
Definition: ExportFFmpegDialogs.cpp:534
AVOutputFormatWrapper::GetName
virtual const char * GetName() const noexcept=0
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
ExportFFmpegOptions::OnOK
void OnOK(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2605
ExportFFmpegWMAOptions::~ExportFFmpegWMAOptions
~ExportFFmpegWMAOptions()
Definition: ExportFFmpegDialogs.cpp:721
AUDACITY_AV_CODEC_ID_AMR_WB
@ AUDACITY_AV_CODEC_ID_AMR_WB
Definition: AVCodecID.h:287
AUDACITY_AV_CODEC_ID_PCM_S32LE
@ AUDACITY_AV_CODEC_ID_PCM_S32LE
Definition: AVCodecID.h:225
AUDACITY_AV_CODEC_ID_TRUESPEECH
@ AUDACITY_AV_CODEC_ID_TRUESPEECH
Definition: AVCodecID.h:315
ExportFFmpegCustomOptions::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:821
FileNames::AllFiles
FILES_API const FileType AllFiles
Definition: FileNames.h:71
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
AUDACITY_AV_CODEC_ID_PCM_S16BE
@ AUDACITY_AV_CODEC_ID_PCM_S16BE
Definition: AVCodecID.h:218
ExportFFmpegOptions::apptable
static ApplicableFor apptable[]
Definition: ExportFFmpegDialogs.h:233
ExportFFmpegOptions::FetchCompatibleCodecList
int FetchCompatibleCodecList(const wxChar *fmt, AudacityAVCodecID id)
Definition: ExportFFmpegDialogs.cpp:2056
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
ShuttleGuiBase::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Caption, wxString &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1652
FFmpegPreset::mPresetName
wxString mPresetName
Definition: ExportFFmpegDialogs.h:311
XMLFileReader::Parse
bool Parse(XMLTagHandler *baseHandler, const FilePath &fname)
Definition: XMLFileReader.cpp:42
LoadFFmpeg
bool LoadFFmpeg(bool showerror)
Definition: FFmpeg.cpp:46
AV_CANMETA
#define AV_CANMETA
Definition: ExportFFmpegDialogs.h:44
FileNames::DataDir
FILES_API FilePath DataDir()
Audacity user data directory.
ExposedFormat
Describes export type.
Definition: ExportFFmpegDialogs.h:48
FFmpegPresets::~FFmpegPresets
~FFmpegPresets()
Definition: ExportFFmpegDialogs.cpp:886
AUDACITY_AV_CODEC_ID_ADPCM_G726
@ AUDACITY_AV_CODEC_ID_ADPCM_G726
Definition: AVCodecID.h:261
CompatibilityEntry
Describes format-codec compatibility.
Definition: ExportFFmpegDialogs.h:64
ShuttleGui::Style
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:727
ExportFFmpegOptions::mPresetNames
wxArrayStringEx mPresetNames
Definition: ExportFFmpegDialogs.h:259
AUDACITY_AV_CODEC_ID_OPUS
@ AUDACITY_AV_CODEC_ID_OPUS
Definition: AVCodecID.h:363
ChoiceSetting
Definition: Prefs.h:270
ExportFFmpegOptions::mFFmpeg
std::shared_ptr< FFmpegFunctions > mFFmpeg
Definition: ExportFFmpegDialogs.h:261
ExportFFmpegOptions::ReportIfBadCombination
bool ReportIfBadCombination()
Definition: ExportFFmpegDialogs.cpp:2394
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSCompression
ChoiceSetting OPUSCompression
Definition: ExportFFmpegDialogs.cpp:460
ShuttleGuiBase::SetSizerProportion
void SetSizerProportion(int iProp)
Definition: ShuttleGui.h:491
ExportFFmpegOPUSOptions::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:659
ExportFFmpegCustomOptions::mFormat
wxTextCtrl * mFormat
Definition: ExportFFmpegDialogs.h:188
XXO
#define XXO(s)
Definition: Internat.h:44
eCancelButton
@ eCancelButton
Definition: ShuttleGui.h:601
ExportFFmpegOptions::OnFormatList
void OnFormatList(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2590
FFmpegPresets::ImportPresets
void ImportPresets(wxString &filename)
Definition: ExportFFmpegDialogs.cpp:899
ExportFFmpegWMAOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:728
ExportFFmpegOptions::DoOnFormatList
void DoOnFormatList()
Definition: ExportFFmpegDialogs.cpp:2488
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
ExportFFmpegOptions::mCodecList
wxListBox * mCodecList
Definition: ExportFFmpegDialogs.h:247
ExportFFmpegWMAOptions::ExportFFmpegWMAOptions
ExportFFmpegWMAOptions(wxWindow *parent, int format)
Definition: ExportFFmpegDialogs.cpp:712
AUDACITY_AV_CODEC_ID_GSM
@ AUDACITY_AV_CODEC_ID_GSM
Definition: AVCodecID.h:312
ExportFFmpegOPUSOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:600
ExportFFmpegOptions::OnDeletePreset
void OnDeletePreset(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2230
ExportFFmpegOptions::OnCodecList
void OnCodecList(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2597
FFmpegPresetMap
std::unordered_map< wxString, FFmpegPreset > FFmpegPresetMap
Definition: ExportFFmpegDialogs.h:316
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
ShuttleGuiBase::AddTextBox
wxTextCtrl * AddTextBox(const TranslatableString &Caption, const wxString &Value, const int nChars)
Definition: ShuttleGui.cpp:638
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
FileDialog::GetPath
virtual wxString GetPath() const
Definition: gtk/FileDialogPrivate.cpp:514
AUDACITY_AV_CODEC_ID_IMC
@ AUDACITY_AV_CODEC_ID_IMC
Definition: AVCodecID.h:321
ExportFFmpegOptions::OnLoadPreset
void OnLoadPreset(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2290
AUDACITY_AV_CODEC_ID_WMAVOICE
@ AUDACITY_AV_CODEC_ID_WMAVOICE
Definition: AVCodecID.h:331
FFmpegExportCtrlIDNames
static const wxChar * FFmpegExportCtrlIDNames[]
Definition: ExportFFmpegDialogs.cpp:132
FMT_OTHER
@ FMT_OTHER
Definition: ExportFFmpegDialogs.h:40
ExportFFmpegOptions::mFormatList
wxListBox * mFormatList
Definition: ExportFFmpegDialogs.h:246
CompatibilityEntry::codec
AudacityAVCodecID codec
codec ID
Definition: ExportFFmpegDialogs.h:66
anonymous_namespace{ExportFFmpegDialogs.cpp}::WMABitRateNames
const TranslatableStrings WMABitRateNames
Bit Rates supported by WMA encoder. Setting bit rate to other values will not result in different fil...
Definition: ExportFFmpegDialogs.cpp:680
AUDACITY_AV_CODEC_ID_ADPCM_SWF
@ AUDACITY_AV_CODEC_ID_ADPCM_SWF
Definition: AVCodecID.h:263
ExportFFmpegOptions::CompatibilityList
static CompatibilityEntry CompatibilityList[]
Definition: ExportFFmpegDialogs.h:230
ShuttleGuiBase::AddFixedText
void AddFixedText(const TranslatableString &Str, bool bCenter=false, int wrapWidth=0)
Definition: ShuttleGui.cpp:440
ExportFFmpegAMRNBOptions::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:394
FMT_AMRNB
@ FMT_AMRNB
Definition: ExportFFmpegDialogs.h:37
AUDACITY_AV_CODEC_ID_AMR_NB
@ AUDACITY_AV_CODEC_ID_AMR_NB
Definition: AVCodecID.h:286
AACProfiles
ChoiceSetting AACProfiles
AAC profiles.
Definition: ExportFFmpegDialogs.cpp:1610
name
const TranslatableString name
Definition: Distortion.cpp:98
ExportFFmpegOptions
Custom FFmpeg export dialog.
Definition: ExportFFmpegDialogs.h:207
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSApplication
ChoiceSetting OPUSApplication
Definition: ExportFFmpegDialogs.cpp:515
AUDACITY_AV_CODEC_ID_QCELP
@ AUDACITY_AV_CODEC_ID_QCELP
Definition: AVCodecID.h:318
ExportFFmpegOptions::mCodecName
wxStaticText * mCodecName
Definition: ExportFFmpegDialogs.h:250
ExportFFmpegAC3Options::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:214
AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA
@ AUDACITY_AV_CODEC_ID_ADPCM_YAMAHA
Definition: AVCodecID.h:264
format
int format
Definition: ExportPCM.cpp:56
FFmpegPresets::HandleXMLChild
XMLTagHandler * HandleXMLChild(const wxChar *tag) override
Definition: ExportFFmpegDialogs.cpp:1228
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSCutoff
ChoiceSetting OPUSCutoff
Definition: ExportFFmpegDialogs.cpp:559
AUDACITY_AV_CODEC_ID_VORBIS
@ AUDACITY_AV_CODEC_ID_VORBIS
Definition: AVCodecID.h:299
FFmpegPresets::DeletePreset
void DeletePreset(wxString &name)
Definition: ExportFFmpegDialogs.cpp:935
Export.h
AUDACITY_AV_CODEC_ID_DVAUDIO
@ AUDACITY_AV_CODEC_ID_DVAUDIO
Definition: AVCodecID.h:300
FindFFmpegLibs
bool FindFFmpegLibs(wxWindow *parent)
Definition: FFmpeg.cpp:306
AUDACITY_AV_CODEC_ID_ADPCM_CT
@ AUDACITY_AV_CODEC_ID_ADPCM_CT
Definition: AVCodecID.h:262
FFmpegPresets::OverwriteIsOk
bool OverwriteIsOk(wxString &name)
Definition: ExportFFmpegDialogs.cpp:956
AUDACITY_AV_CODEC_ID_VOXWARE
@ AUDACITY_AV_CODEC_ID_VOXWARE
Definition: AVCodecID.h:326
ExportFFmpegWMAOptions::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ExportFFmpegDialogs.cpp:753
FFmpegExportCtrlID
FFmpegExportCtrlID
Definition: ExportFFmpegDialogs.cpp:123
ExportFFmpegAACOptions::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:306
anonymous_namespace{ExportFFmpegDialogs.cpp}::PredictionOrderMethodNames
const TranslatableStrings PredictionOrderMethodNames
Prediction order method - names.
Definition: ExportFFmpegDialogs.cpp:1719
FFmpegPreset::~FFmpegPreset
~FFmpegPreset()
Definition: ExportFFmpegDialogs.cpp:872
AUDACITY_AV_CODEC_ID_PCM_S8
@ AUDACITY_AV_CODEC_ID_PCM_S8
Definition: AVCodecID.h:221
AUDACITY_AV_CODEC_ID_GSM_MS
@ AUDACITY_AV_CODEC_ID_GSM_MS
Definition: AVCodecID.h:324
AUDACITY_AV_CODEC_ID_WMAV2
@ AUDACITY_AV_CODEC_ID_WMAV2
Definition: AVCodecID.h:302
ExportFFmpegOptions::mShownFormatNames
wxArrayString mShownFormatNames
Definition: ExportFFmpegDialogs.h:237
ShuttleGui::Prop
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:725
FFmpegPresets::WriteXMLHeader
void WriteXMLHeader(XMLWriter &xmlFile) const
Definition: ExportFFmpegDialogs.cpp:1246
ShuttleGuiBase::TieSpinCtrl
wxSpinCtrl * TieSpinCtrl(const TranslatableString &Prompt, int &Value, const int max, const int min=0)
Definition: ShuttleGui.cpp:1645
XMLTagHandler
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:62
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
AUDACITY_AV_CODEC_ID_ADPCM_IMA_QT
@ AUDACITY_AV_CODEC_ID_ADPCM_IMA_QT
Definition: AVCodecID.h:250
AUDACITY_AV_CODEC_ID_WMAPRO
@ AUDACITY_AV_CODEC_ID_WMAPRO
Definition: AVCodecID.h:332
FFmpegPreset
Definition: ExportFFmpegDialogs.h:306
FFmpegPresets::GetPresetList
void GetPresetList(wxArrayString &list)
Definition: ExportFFmpegDialogs.cpp:923
ExportFFmpegOptions::fmts
static ExposedFormat fmts[]
List of export types.
Definition: ExportFFmpegDialogs.h:231
AUDACITY_AV_CODEC_ID_FLAC
@ AUDACITY_AV_CODEC_ID_FLAC
Definition: AVCodecID.h:306
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
AUDACITY_AV_CODEC_ID_ROQ_DPCM
@ AUDACITY_AV_CODEC_ID_ROQ_DPCM
Definition: AVCodecID.h:290
AUDACITY_AV_CODEC_ID_MP3
@ AUDACITY_AV_CODEC_ID_MP3
Definition: AVCodecID.h:295
eIsSavingToPrefs
@ eIsSavingToPrefs
Definition: ShuttleGui.h:48
ExportFFmpegDialogs.h
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSVbrMode
ChoiceSetting OPUSVbrMode
Definition: ExportFFmpegDialogs.cpp:496
wxDialogWrapper
Definition: wxPanelWrapper.h:81
FFmpegPresets::FindPreset
FFmpegPreset * FindPreset(wxString &name)
Definition: ExportFFmpegDialogs.cpp:944
ExportFFmpegOptions::mShownFormatLongNames
wxArrayString mShownFormatLongNames
Definition: ExportFFmpegDialogs.h:238
ExportFFmpegOptions::mShownCodecLongNames
wxArrayString mShownCodecLongNames
Definition: ExportFFmpegDialogs.h:240
AUDACITY_AV_CODEC_ID_PCM_ALAW
@ AUDACITY_AV_CODEC_ID_PCM_ALAW
Definition: AVCodecID.h:224
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
ExportFFmpegCustomOptions::mCodec
wxTextCtrl * mCodec
Definition: ExportFFmpegDialogs.h:189
XMLFileReader
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:18
FileDialogWrapper
Definition: wxPanelWrapper.h:165
AVCodecWrapper::GetId
virtual AVCodecIDFwd GetId() const noexcept=0
_
#define _(s)
Definition: Internat.h:75
ExportFFmpegAMRNBOptions::ExportFFmpegAMRNBOptions
ExportFFmpegAMRNBOptions(wxWindow *parent, int format)
Definition: ExportFFmpegDialogs.cpp:353
ExportFFmpegAACOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:276
ExportFFmpegOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:1823
ExportFFmpegOptions::OnImportPresets
void OnImportPresets(wxCommandEvent &event)
Definition: ExportFFmpegDialogs.cpp:2320
ExportFFmpegOptions::mFormatLongNames
wxArrayString mFormatLongNames
Definition: ExportFFmpegDialogs.h:242
XMLFileWriter
Wrapper to output XML data to files.
Definition: XMLWriter.h:81
FFmpegFunctions::Load
static std::shared_ptr< FFmpegFunctions > Load()
Definition: FFmpegFunctions.cpp:262
ApplicableFor::control
int control
control ID
Definition: ExportFFmpegDialogs.h:198
AVOutputFormatWrapper::GetLongName
virtual const char * GetLongName() const noexcept=0
AUDACITY_AV_CODEC_ID_PCM_S16LE
@ AUDACITY_AV_CODEC_ID_PCM_S16LE
Definition: AVCodecID.h:217
AUDACITY_AV_CODEC_ID_ALAC
@ AUDACITY_AV_CODEC_ID_ALAC
Definition: AVCodecID.h:310
n_kbps
TranslatableString n_kbps(int n)
Definition: ExportMP3.cpp:129
ExportFFmpegAC3Options::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:246
AUDACITY_AV_CODEC_ID_DTS
@ AUDACITY_AV_CODEC_ID_DTS
Definition: AVCodecID.h:298
ExportFFmpegAC3Options::~ExportFFmpegAC3Options
virtual ~ExportFFmpegAC3Options()
Definition: ExportFFmpegDialogs.cpp:207
AUDACITY_AV_CODEC_ID_PCM_S32BE
@ AUDACITY_AV_CODEC_ID_PCM_S32BE
Definition: AVCodecID.h:226
anonymous_namespace{ExportFFmpegDialogs.cpp}::AC3BitRateValues
const std::vector< int > AC3BitRateValues
Definition: ExportFFmpegDialogs.cpp:172
ExportFFmpegOptions::FetchCompatibleFormatList
int FetchCompatibleFormatList(AudacityAVCodecID id, wxString *selfmt)
Definition: ExportFFmpegDialogs.cpp:2150
ExportFFmpegCustomOptions::~ExportFFmpegCustomOptions
~ExportFFmpegCustomOptions()
Definition: ExportFFmpegDialogs.cpp:791
ExportFFmpegAMRNBOptions::~ExportFFmpegAMRNBOptions
virtual ~ExportFFmpegAMRNBOptions()
Definition: ExportFFmpegDialogs.cpp:362
anonymous_namespace{ExportFFmpegDialogs.cpp}::AC3BitRateNames
const TranslatableStrings AC3BitRateNames
Definition: ExportFFmpegDialogs.cpp:150
ExportFFmpegOptions::mCodecLongNames
wxArrayString mCodecLongNames
Definition: ExportFFmpegDialogs.h:244
FFmpegPreset::mControlState
wxArrayString mControlState
Definition: ExportFFmpegDialogs.h:312
ExportFFmpegOPUSOptions::~ExportFFmpegOPUSOptions
~ExportFFmpegOPUSOptions()
Definition: ExportFFmpegDialogs.cpp:593
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
FileNames::FileTypes
std::vector< FileType > FileTypes
Definition: FileNames.h:76
AUDACITY_AV_CODEC_ID_MACE3
@ AUDACITY_AV_CODEC_ID_MACE3
Definition: AVCodecID.h:303
ExportFFmpegOptions::mFormatName
wxStaticText * mFormatName
Definition: ExportFFmpegDialogs.h:249
AUDACITY_AV_CODEC_ID_NELLYMOSER
@ AUDACITY_AV_CODEC_ID_NELLYMOSER
Definition: AVCodecID.h:328
ShuttleGuiBase::AddPrompt
void AddPrompt(const TranslatableString &Prompt, int wrapWidth=0)
Right aligned text string.
Definition: ShuttleGui.cpp:238
ShuttleGuiBase::SetBorder
void SetBorder(int Border)
Definition: ShuttleGui.h:489
ByColumns
ByColumns_t ByColumns
Definition: Prefs.cpp:420
AVOutputFormatWrapper::GetAudioCodec
virtual AVCodecIDFwd GetAudioCodec() const noexcept=0
FFmpegFunctions.h
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
ExportFFmpegOptions::mFormatNames
wxArrayStringEx mFormatNames
Definition: ExportFFmpegDialogs.h:241
eIsCreatingFromPrefs
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:47
FFmpegPresets::LoadPreset
void LoadPreset(ExportFFmpegOptions *parent, wxString &name)
Definition: ExportFFmpegDialogs.cpp:1066
FMT_OPUS
@ FMT_OPUS
Definition: ExportFFmpegDialogs.h:38
ShuttleGuiBase::AddVariableText
wxStaticText * AddVariableText(const TranslatableString &Str, bool bCenter=false, int PositionFlags=0, int wrapWidth=0)
Definition: ShuttleGui.cpp:463
AUDACITY_AV_CODEC_ID_PCM_S24BE
@ AUDACITY_AV_CODEC_ID_PCM_S24BE
Definition: AVCodecID.h:230
AudacityAVCodecID
Definition: AVCodecID.h:411
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
audacity::ToUTF8
std::string ToUTF8(const std::wstring &wstr)
Definition: CodeConversions.cpp:19
ExportFFmpegOptions::~ExportFFmpegOptions
~ExportFFmpegOptions()
Definition: ExportFFmpegDialogs.cpp:1732
ShuttleGuiBase::SetStretchyCol
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:202
anonymous_namespace{ExportFFmpegDialogs.cpp}::OPUSBitrate
ChoiceSetting OPUSBitrate
Bit Rates supported by OPUS encoder. Setting bit rate to other values will not result in different fi...
Definition: ExportFFmpegDialogs.cpp:419
FileDialog::ShowModal
virtual int ShowModal()
Definition: gtk/FileDialogPrivate.cpp:445
ExportFFmpegOptions::DoOnCodecList
void DoOnCodecList()
Definition: ExportFFmpegDialogs.cpp:2538
ShuttleGuiBase::AddListBox
wxListBox * AddListBox(const wxArrayStringEx &choices)
Definition: ShuttleGui.cpp:753
AUDACITY_AV_CODEC_ID_NONE
@ AUDACITY_AV_CODEC_ID_NONE
Definition: AVCodecID.h:14
ExportFFmpegOptions::mCodecNames
wxArrayStringEx mCodecNames
Definition: ExportFFmpegDialogs.h:243
AVCodecWrapper::GetLongName
virtual const char * GetLongName() const noexcept=0
END_EVENT_TABLE
END_EVENT_TABLE()
ExportFFmpegOptions::ExportFFmpegOptions
ExportFFmpegOptions(wxWindow *parent)
Definition: ExportFFmpegDialogs.cpp:1736
ShuttleGuiBase::TieChoice
wxChoice * TieChoice(const TranslatableString &Prompt, TranslatableString &Selected, const TranslatableStrings &choices)
Definition: ShuttleGui.cpp:1727
ShuttleGuiBase::SetStretchyRow
void SetStretchyRow(int i)
Used to modify an already placed FlexGridSizer to make a row stretchy.
Definition: ShuttleGui.cpp:212
ShuttleGuiBase::AddCombo
wxComboBox * AddCombo(const TranslatableString &Prompt, const wxString &Selected, const wxArrayStringEx &choices)
Definition: ShuttleGui.cpp:517
ExportFFmpegCustomOptions::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportFFmpegDialogs.cpp:798
AUDACITY_AV_CODEC_ID_MACE6
@ AUDACITY_AV_CODEC_ID_MACE6
Definition: AVCodecID.h:304
AUDACITY_AV_CODEC_ID_ADPCM_MS
@ AUDACITY_AV_CODEC_ID_ADPCM_MS
Definition: AVCodecID.h:256
FMT_M4A
@ FMT_M4A
Definition: ExportFFmpegDialogs.h:35
FFmpegPresets::mAbortImport
bool mAbortImport
Definition: ExportFFmpegDialogs.h:343
ExportFFmpegCustomOptions::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ExportFFmpegDialogs.cpp:833
anonymous_namespace{ExportFFmpegDialogs.cpp}::AMRNBBitRateValues
const std::vector< int > AMRNBBitRateValues
Definition: ExportFFmpegDialogs.cpp:340
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
ExportFFmpegOptions::mPresets
std::unique_ptr< FFmpegPresets > mPresets
Definition: ExportFFmpegDialogs.h:257
AUDACITY_AV_CODEC_ID_QDM2
@ AUDACITY_AV_CODEC_ID_QDM2
Definition: AVCodecID.h:313
FMT_WMA2
@ FMT_WMA2
Definition: ExportFFmpegDialogs.h:39