2010-01-23 19:44:49 +00:00
/**********************************************************************
Audacity : A Digital Audio Editor
ExportFFmpegDialogs . cpp
2010-02-05 15:10:15 +00:00
Audacity ( R ) is copyright ( c ) 1999 - 2010 Audacity Team .
2010-01-23 19:44:49 +00:00
License : GPL v2 . See License . txt .
LRN
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /**
\ class ExportFFmpegAC3Options
\ brief Options dialog for FFmpeg exporting of AC3 format .
*/ /***************************************************************/ /**
\ class ExportFFmpegAACOptions
\ brief Options dialog for FFmpeg exporting of AAC format .
*/ /***************************************************************/ /**
\ class ExportFFmpegAMRNBOptions
\ brief Options dialog for FFmpeg exporting of AMRNB format .
*/ /***************************************************************/ /**
\ class ExportFFmpegWMAOptions
\ brief Options dialog for FFmpeg exporting of WMA format .
*/ /***************************************************************/ /**
\ class ExportFFmpegOptions
\ brief Options dialog for Custom FFmpeg export format .
*/ /*******************************************************************/
2019-03-22 15:01:00 +00:00
# include "../Audacity.h" // keep ffmpeg before wx because they interact // for USE_* macros
2018-11-10 19:47:12 +00:00
# include "ExportFFmpegDialogs.h"
2018-11-11 02:40:37 +00:00
2010-01-23 19:44:49 +00:00
# include "../FFmpeg.h" // and Audacity.h before FFmpeg for config*.h
2018-11-11 22:37:25 +00:00
# include <wx/checkbox.h>
2010-01-23 19:44:49 +00:00
# include <wx/choice.h>
# include <wx/intl.h>
# include <wx/timer.h>
# include <wx/progdlg.h>
# include <wx/string.h>
# include <wx/textctrl.h>
# include <wx/listbox.h>
# include <wx/window.h>
# include <wx/spinctrl.h>
# include <wx/combobox.h>
2018-11-11 21:41:45 +00:00
# include <wx/stattext.h>
2017-08-02 16:41:29 +00:00
# include <FileDialog.h>
2010-01-23 19:44:49 +00:00
# include "../FileFormats.h"
# include "../Mix.h"
# include "../Tags.h"
2017-09-30 00:14:37 +00:00
# include "../TranslatableStringArray.h"
2019-05-20 18:27:11 +00:00
# include "../widgets/AudacityMessageBox.h"
2019-07-15 09:52:22 +00:00
# include "../widgets/HelpSystem.h"
2010-01-23 19:44:49 +00:00
# include "Export.h"
# if defined(USE_FFMPEG)
2016-08-01 15:44:49 +00:00
extern FFmpegLibs * FFmpegLibsInst ( ) ;
2010-01-23 19:44:49 +00:00
2010-02-13 01:39:38 +00:00
/// This construction defines a enumeration of UI element IDs, and a static
/// array of their string representations (this way they're always synchronized).
/// Do not store the enumerated values in external files, as they may change;
/// the strings may be stored.
# define FFMPEG_EXPORT_CTRL_ID_ENTRIES \
FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY ( FEFirstID , 20000 ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEFormatID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FECodecID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEBitrateID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEQualityID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FESampleRateID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FELanguageID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FETagID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FECutoffID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEFrameSizeID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEBufSizeID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEProfileID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FECompLevelID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEUseLPCID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FELPCCoeffsID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEMinPredID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEMaxPredID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEPredOrderID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEMinPartOrderID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEMaxPartOrderID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEMuxRateID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEPacketSizeID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEBitReservoirID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEVariableBlockLenID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FELastID ) , \
\
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEFormatLabelID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FECodecLabelID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEFormatNameID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FECodecNameID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEPresetID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FESavePresetID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FELoadPresetID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEDeletePresetID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEAllFormatsID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEAllCodecsID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEImportPresetsID ) , \
FFMPEG_EXPORT_CTRL_ID_ENTRY ( FEExportPresetsID ) \
// First the enumeration
# define FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY(name, num) name = num
# define FFMPEG_EXPORT_CTRL_ID_ENTRY(name) name
enum FFmpegExportCtrlID {
FFMPEG_EXPORT_CTRL_ID_ENTRIES
} ;
// Now the string representations
# undef FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY
# define FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY(name, num) wxT(#name)
# undef FFMPEG_EXPORT_CTRL_ID_ENTRY
# define FFMPEG_EXPORT_CTRL_ID_ENTRY(name) wxT(#name)
static const wxChar * FFmpegExportCtrlIDNames [ ] = {
FFMPEG_EXPORT_CTRL_ID_ENTRIES
} ;
# undef FFMPEG_EXPORT_CTRL_ID_ENTRIES
# undef FFMPEG_EXPORT_CTRL_ID_ENTRY
# undef FFMPEG_EXPORT_CTRL_ID_FIRST_ENTRY
2010-01-23 19:44:49 +00:00
//----------------------------------------------------------------------------
// ExportFFmpegAC3Options Class
//----------------------------------------------------------------------------
2019-02-23 20:13:46 +00:00
namespace
{
2019-11-30 22:56:51 +00:00
const TranslatableStrings AC3BitRateNames {
2019-02-23 20:13:46 +00:00
// i18n-hint kbps abbreviates "thousands of bits per second"
XO ( " 32 kbps " ) ,
XO ( " 40 kbps " ) ,
XO ( " 48 kbps " ) ,
XO ( " 56 kbps " ) ,
XO ( " 64 kbps " ) ,
XO ( " 80 kbps " ) ,
XO ( " 96 kbps " ) ,
XO ( " 112 kbps " ) ,
XO ( " 128 kbps " ) ,
XO ( " 160 kbps " ) ,
XO ( " 192 kbps " ) ,
XO ( " 224 kbps " ) ,
XO ( " 256 kbps " ) ,
XO ( " 320 kbps " ) ,
XO ( " 384 kbps " ) ,
XO ( " 448 kbps " ) ,
XO ( " 512 kbps " ) ,
XO ( " 576 kbps " ) ,
XO ( " 640 kbps " ) ,
} ;
const std : : vector < int > AC3BitRateValues {
32000 ,
40000 ,
48000 ,
56000 ,
64000 ,
80000 ,
96000 ,
112000 ,
128000 ,
160000 ,
192000 ,
224000 ,
256000 ,
320000 ,
384000 ,
448000 ,
512000 ,
576000 ,
640000 ,
} ;
}
2010-01-23 19:44:49 +00:00
const int ExportFFmpegAC3Options : : iAC3SampleRates [ ] = { 32000 , 44100 , 48000 , 0 } ;
2015-07-13 17:36:40 +00:00
ExportFFmpegAC3Options : : ExportFFmpegAC3Options ( wxWindow * parent , int WXUNUSED ( format ) )
2016-06-25 18:18:23 +00:00
: wxPanelWrapper ( parent , wxID_ANY )
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
PopulateOrExchange ( S ) ;
2015-08-05 07:28:42 +00:00
TransferDataToWindow ( ) ;
2015-07-13 17:36:40 +00:00
}
ExportFFmpegAC3Options : : ~ ExportFFmpegAC3Options ( )
{
2015-08-05 07:28:42 +00:00
TransferDataFromWindow ( ) ;
2010-01-23 19:44:49 +00:00
}
2014-05-27 22:06:58 +00:00
///
///
2010-01-23 19:44:49 +00:00
void ExportFFmpegAC3Options : : PopulateOrExchange ( ShuttleGui & S )
{
2015-07-13 17:36:40 +00:00
S . StartVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartHorizontalLay ( wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartMultiColumn ( 2 , wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2019-02-23 20:13:46 +00:00
S . TieNumberAsChoice (
_ ( " Bit Rate: " ) ,
2019-04-03 14:57:59 +00:00
{ wxT ( " /FileFormats/AC3BitRate " ) ,
160000 } ,
2019-02-23 20:13:46 +00:00
AC3BitRateNames ,
& AC3BitRateValues
) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndMultiColumn ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndHorizontalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-08-05 07:28:42 +00:00
///
///
bool ExportFFmpegAC3Options : : TransferDataToWindow ( )
{
return true ;
}
///
///
bool ExportFFmpegAC3Options : : TransferDataFromWindow ( )
{
ShuttleGui S ( this , eIsSavingToPrefs ) ;
PopulateOrExchange ( S ) ;
gPrefs - > Flush ( ) ;
return true ;
}
2010-01-23 19:44:49 +00:00
//----------------------------------------------------------------------------
// ExportFFmpegAACOptions Class
//----------------------------------------------------------------------------
2015-07-13 17:36:40 +00:00
ExportFFmpegAACOptions : : ExportFFmpegAACOptions ( wxWindow * parent , int WXUNUSED ( format ) )
2016-06-25 18:18:23 +00:00
: wxPanelWrapper ( parent , wxID_ANY )
2010-01-23 19:44:49 +00:00
{
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
2015-07-13 17:36:40 +00:00
PopulateOrExchange ( S ) ;
2015-08-05 07:28:42 +00:00
TransferDataToWindow ( ) ;
2015-07-13 17:36:40 +00:00
}
2010-01-23 19:44:49 +00:00
2015-07-13 17:36:40 +00:00
ExportFFmpegAACOptions : : ~ ExportFFmpegAACOptions ( )
{
2015-08-05 07:28:42 +00:00
TransferDataFromWindow ( ) ;
2010-01-23 19:44:49 +00:00
}
2014-05-27 22:06:58 +00:00
///
///
2010-01-23 19:44:49 +00:00
void ExportFFmpegAACOptions : : PopulateOrExchange ( ShuttleGui & S )
{
2015-07-13 17:36:40 +00:00
S . StartVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartHorizontalLay ( wxEXPAND ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . SetSizerProportion ( 1 ) ;
S . StartMultiColumn ( 2 , wxCENTER ) ;
{
S . SetStretchyCol ( 1 ) ;
2019-04-03 14:57:59 +00:00
S . Prop ( 1 ) . TieSlider ( _ ( " Quality (kbps): " ) , { wxT ( " /FileFormats/AACQuality " ) , 160 } , 320 , 98 ) ;
2015-07-13 17:36:40 +00:00
}
S . EndMultiColumn ( ) ;
2011-03-14 02:26:00 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndHorizontalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-08-05 07:28:42 +00:00
///
///
bool ExportFFmpegAACOptions : : TransferDataToWindow ( )
{
return true ;
}
///
///
bool ExportFFmpegAACOptions : : TransferDataFromWindow ( )
{
ShuttleGui S ( this , eIsSavingToPrefs ) ;
PopulateOrExchange ( S ) ;
gPrefs - > Flush ( ) ;
return true ;
}
2010-01-23 19:44:49 +00:00
//----------------------------------------------------------------------------
// ExportFFmpegAMRNBOptions Class
//----------------------------------------------------------------------------
2019-02-23 20:13:46 +00:00
namespace {
2010-02-13 01:39:38 +00:00
/// Bit Rates supported by libAMR-NB encoder
/// Sample Rate is always 8 kHz
2019-11-30 22:56:51 +00:00
const TranslatableStrings AMRNBBitRateNames
2019-02-23 20:13:46 +00:00
{
// i18n-hint kbps abbreviates "thousands of bits per second"
XO ( " 4.75 kbps " ) ,
XO ( " 5.15 kbps " ) ,
XO ( " 5.90 kbps " ) ,
XO ( " 6.70 kbps " ) ,
XO ( " 7.40 kbps " ) ,
XO ( " 7.95 kbps " ) ,
XO ( " 10.20 kbps " ) ,
XO ( " 12.20 kbps " ) ,
} ;
const std : : vector < int > AMRNBBitRateValues
{
4750 ,
5150 ,
5900 ,
6700 ,
7400 ,
7950 ,
10200 ,
12200 ,
} ;
}
2010-02-13 01:39:38 +00:00
2015-07-13 17:36:40 +00:00
ExportFFmpegAMRNBOptions : : ExportFFmpegAMRNBOptions ( wxWindow * parent , int WXUNUSED ( format ) )
2016-06-25 18:18:23 +00:00
: wxPanelWrapper ( parent , wxID_ANY )
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
PopulateOrExchange ( S ) ;
2015-08-05 07:28:42 +00:00
TransferDataToWindow ( ) ;
2015-07-13 17:36:40 +00:00
}
ExportFFmpegAMRNBOptions : : ~ ExportFFmpegAMRNBOptions ( )
{
2015-08-05 07:28:42 +00:00
TransferDataFromWindow ( ) ;
2010-01-23 19:44:49 +00:00
}
2014-05-27 22:06:58 +00:00
///
///
2010-01-23 19:44:49 +00:00
void ExportFFmpegAMRNBOptions : : PopulateOrExchange ( ShuttleGui & S )
{
2015-07-13 17:36:40 +00:00
S . StartVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartHorizontalLay ( wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartMultiColumn ( 2 , wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2019-02-23 20:13:46 +00:00
S . TieNumberAsChoice (
_ ( " Bit Rate: " ) ,
2019-04-03 14:57:59 +00:00
{ wxT ( " /FileFormats/AMRNBBitRate " ) ,
12200 } ,
2019-02-23 20:13:46 +00:00
AMRNBBitRateNames ,
& AMRNBBitRateValues
) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndMultiColumn ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndHorizontalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-08-05 07:28:42 +00:00
///
///
bool ExportFFmpegAMRNBOptions : : TransferDataToWindow ( )
{
return true ;
}
///
///
bool ExportFFmpegAMRNBOptions : : TransferDataFromWindow ( )
{
ShuttleGui S ( this , eIsSavingToPrefs ) ;
PopulateOrExchange ( S ) ;
gPrefs - > Flush ( ) ;
return true ;
}
2010-01-23 19:44:49 +00:00
//----------------------------------------------------------------------------
// ExportFFmpegWMAOptions Class
//----------------------------------------------------------------------------
2010-02-13 01:39:38 +00:00
const int ExportFFmpegWMAOptions : : iWMASampleRates [ ] =
{ 8000 , 11025 , 16000 , 22050 , 44100 , 0 } ;
2019-02-23 20:13:46 +00:00
namespace {
2010-02-13 01:39:38 +00:00
/// Bit Rates supported by WMA encoder. Setting bit rate to other values will not result in different file size.
2019-11-30 22:56:51 +00:00
const TranslatableStrings WMABitRateNames
2019-02-23 20:13:46 +00:00
{
// i18n-hint kbps abbreviates "thousands of bits per second"
XO ( " 24 kbps " ) ,
XO ( " 32 kbps " ) ,
XO ( " 40 kbps " ) ,
XO ( " 48 kbps " ) ,
XO ( " 64 kbps " ) ,
XO ( " 80 kbps " ) ,
XO ( " 96 kbps " ) ,
XO ( " 128 kbps " ) ,
XO ( " 160 kbps " ) ,
XO ( " 192 kbps " ) ,
XO ( " 256 kbps " ) ,
XO ( " 320 kbps " ) ,
} ;
const std : : vector < int > WMABitRateValues {
24000 ,
32000 ,
40000 ,
48000 ,
64000 ,
80000 ,
96000 ,
128000 ,
160000 ,
192000 ,
256000 ,
320000 ,
} ;
}
2010-02-13 01:39:38 +00:00
2015-07-13 17:36:40 +00:00
ExportFFmpegWMAOptions : : ExportFFmpegWMAOptions ( wxWindow * parent , int WXUNUSED ( format ) )
2016-06-25 18:18:23 +00:00
: wxPanelWrapper ( parent , wxID_ANY )
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
PopulateOrExchange ( S ) ;
2015-08-05 07:28:42 +00:00
TransferDataToWindow ( ) ;
2015-07-13 17:36:40 +00:00
}
ExportFFmpegWMAOptions : : ~ ExportFFmpegWMAOptions ( )
{
2015-08-05 07:28:42 +00:00
TransferDataFromWindow ( ) ;
2010-01-23 19:44:49 +00:00
}
2014-05-27 22:06:58 +00:00
///
///
2010-01-23 19:44:49 +00:00
void ExportFFmpegWMAOptions : : PopulateOrExchange ( ShuttleGui & S )
{
2015-07-13 17:36:40 +00:00
S . StartVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartHorizontalLay ( wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2015-07-13 17:36:40 +00:00
S . StartMultiColumn ( 2 , wxCENTER ) ;
2010-01-23 19:44:49 +00:00
{
2019-02-23 20:13:46 +00:00
S . TieNumberAsChoice (
_ ( " Bit Rate: " ) ,
2019-04-03 14:57:59 +00:00
{ wxT ( " /FileFormats/WMABitRate " ) ,
128000 } ,
2019-02-23 20:13:46 +00:00
WMABitRateNames ,
& WMABitRateValues
) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndMultiColumn ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndHorizontalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-07-13 17:36:40 +00:00
S . EndVerticalLay ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-08-05 07:28:42 +00:00
///
///
bool ExportFFmpegWMAOptions : : TransferDataToWindow ( )
{
return true ;
}
///
///
bool ExportFFmpegWMAOptions : : TransferDataFromWindow ( )
{
ShuttleGui S ( this , eIsSavingToPrefs ) ;
PopulateOrExchange ( S ) ;
gPrefs - > Flush ( ) ;
return true ;
}
//----------------------------------------------------------------------------
// ExportFFmpegCustomOptions Class
//----------------------------------------------------------------------------
# define OpenID 9000
2016-06-25 18:18:23 +00:00
BEGIN_EVENT_TABLE ( ExportFFmpegCustomOptions , wxPanelWrapper )
2015-08-05 07:28:42 +00:00
EVT_BUTTON ( OpenID , ExportFFmpegCustomOptions : : OnOpen )
END_EVENT_TABLE ( )
ExportFFmpegCustomOptions : : ExportFFmpegCustomOptions ( wxWindow * parent , int WXUNUSED ( format ) )
2016-06-25 18:18:23 +00:00
: wxPanelWrapper ( parent , wxID_ANY )
2015-08-05 07:28:42 +00:00
{
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
PopulateOrExchange ( S ) ;
TransferDataToWindow ( ) ;
}
ExportFFmpegCustomOptions : : ~ ExportFFmpegCustomOptions ( )
{
TransferDataFromWindow ( ) ;
}
///
///
void ExportFFmpegCustomOptions : : PopulateOrExchange ( ShuttleGui & S )
{
S . StartHorizontalLay ( wxCENTER ) ;
{
S . StartHorizontalLay ( wxCENTER , 0 ) ;
{
S . Id ( OpenID ) . AddButton ( _ ( " Open custom FFmpeg format options " ) ) ;
}
S . EndHorizontalLay ( ) ;
}
S . EndHorizontalLay ( ) ;
}
///
///
bool ExportFFmpegCustomOptions : : TransferDataToWindow ( )
{
return true ;
}
///
///
bool ExportFFmpegCustomOptions : : TransferDataFromWindow ( )
{
return true ;
}
///
///
void ExportFFmpegCustomOptions : : OnOpen ( wxCommandEvent & WXUNUSED ( evt ) )
{
2015-08-26 19:11:37 +00:00
// Show "Locate FFmpeg" dialog
PickFFmpegLibs ( ) ;
2016-08-01 15:44:49 +00:00
if ( ! FFmpegLibsInst ( ) - > ValidLibsLoaded ( ) )
2015-08-26 19:11:37 +00:00
{
2016-08-01 15:44:49 +00:00
FFmpegLibsInst ( ) - > FindLibs ( NULL ) ;
FFmpegLibsInst ( ) - > FreeLibs ( ) ;
2015-08-26 19:11:37 +00:00
if ( ! LoadFFmpeg ( true ) )
{
return ;
}
}
DropFFmpegLibs ( ) ;
2019-08-30 18:00:37 +00:00
# ifdef __WXMAC__
// Bug 2077 Must be a parent window on OSX or we will appear behind.
2019-08-28 15:54:17 +00:00
auto pWin = wxGetTopLevelParent ( this ) ;
2019-08-30 18:00:37 +00:00
# else
// Use GetTopWindow on windows as there is no hWnd with top level parent.
auto pWin = wxTheApp - > GetTopWindow ( ) ;
# endif
2018-08-29 12:25:18 +00:00
ExportFFmpegOptions od ( pWin ) ;
2015-08-05 07:28:42 +00:00
od . ShowModal ( ) ;
}
2015-08-26 16:18:55 +00:00
FFmpegPreset : : FFmpegPreset ( )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
mControlState . resize ( FELastID - FEFirstID ) ;
2010-01-23 19:44:49 +00:00
}
FFmpegPreset : : ~ FFmpegPreset ( )
{
}
FFmpegPresets : : FFmpegPresets ( )
{
2015-08-26 16:18:55 +00:00
mPreset = NULL ;
mAbortImport = false ;
2010-01-23 19:44:49 +00:00
XMLFileReader xmlfile ;
wxFileName xmlFileName ( FileNames : : DataDir ( ) , wxT ( " ffmpeg_presets.xml " ) ) ;
xmlfile . Parse ( this , xmlFileName . GetFullPath ( ) ) ;
}
FFmpegPresets : : ~ FFmpegPresets ( )
{
2016-12-02 01:40:05 +00:00
// We're in a destructor! Don't let exceptions out!
2018-01-13 06:32:41 +00:00
GuardedCall ( [ & ] {
2016-12-02 01:40:05 +00:00
wxFileName xmlFileName { FileNames : : DataDir ( ) , wxT ( " ffmpeg_presets.xml " ) } ;
XMLFileWriter writer {
2019-12-19 19:36:37 +00:00
xmlFileName . GetFullPath ( ) , XO ( " Error Saving FFmpeg Presets " ) } ;
2016-12-02 01:40:05 +00:00
WriteXMLHeader ( writer ) ;
WriteXML ( writer ) ;
writer . Commit ( ) ;
} ) ;
2010-01-23 19:44:49 +00:00
}
void FFmpegPresets : : ImportPresets ( wxString & filename )
{
2015-05-17 06:57:40 +00:00
mPreset = NULL ;
2015-08-26 16:18:55 +00:00
mAbortImport = false ;
FFmpegPresetMap savePresets = mPresets ;
2015-05-17 06:57:40 +00:00
2010-01-23 19:44:49 +00:00
XMLFileReader xmlfile ;
2015-08-26 16:18:55 +00:00
bool success = xmlfile . Parse ( this , filename ) ;
if ( ! success | | mAbortImport ) {
mPresets = savePresets ;
}
2010-01-23 19:44:49 +00:00
}
void FFmpegPresets : : ExportPresets ( wxString & filename )
{
2018-01-13 06:32:41 +00:00
GuardedCall ( [ & ] {
2019-12-19 19:36:37 +00:00
XMLFileWriter writer { filename , XO ( " Error Saving FFmpeg Presets " ) } ;
2016-12-02 01:40:05 +00:00
WriteXMLHeader ( writer ) ;
WriteXML ( writer ) ;
writer . Commit ( ) ;
} ) ;
2010-01-23 19:44:49 +00:00
}
2016-04-09 20:09:19 +00:00
void FFmpegPresets : : GetPresetList ( wxArrayString & list )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
list . clear ( ) ;
2015-08-26 16:18:55 +00:00
FFmpegPresetMap : : iterator iter ;
for ( iter = mPresets . begin ( ) ; iter ! = mPresets . end ( ) ; + + iter )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
list . push_back ( iter - > second . mPresetName ) ;
2014-05-27 22:06:58 +00:00
}
2015-08-26 16:18:55 +00:00
2019-02-12 00:10:48 +00:00
std : : sort ( list . begin ( ) , list . end ( ) ) ;
2010-01-23 19:44:49 +00:00
}
void FFmpegPresets : : DeletePreset ( wxString & name )
{
2015-08-26 16:18:55 +00:00
FFmpegPresetMap : : iterator iter = mPresets . find ( name ) ;
if ( iter ! = mPresets . end ( ) )
2010-01-23 19:44:49 +00:00
{
2015-08-26 16:18:55 +00:00
mPresets . erase ( iter ) ;
2010-01-23 19:44:49 +00:00
}
}
FFmpegPreset * FFmpegPresets : : FindPreset ( wxString & name )
{
2015-08-26 16:18:55 +00:00
FFmpegPresetMap : : iterator iter = mPresets . find ( name ) ;
if ( iter ! = mPresets . end ( ) )
2010-01-23 19:44:49 +00:00
{
2015-08-26 16:18:55 +00:00
return & iter - > second ;
2010-01-23 19:44:49 +00:00
}
2015-08-26 16:18:55 +00:00
return NULL ;
2010-01-23 19:44:49 +00:00
}
2019-07-15 09:52:22 +00:00
// return false if overwrite was not allowed.
bool FFmpegPresets : : OverwriteIsOk ( wxString & name )
2010-01-23 19:44:49 +00:00
{
FFmpegPreset * preset = FindPreset ( name ) ;
if ( preset )
{
2019-12-07 19:30:07 +00:00
auto query = XO ( " Overwrite preset '%s'? " ) . Format ( name ) ;
int action = AudacityMessageBox (
query ,
XO ( " Confirm Overwrite " ) ,
wxYES_NO | wxCENTRE ) ;
2019-07-15 09:52:22 +00:00
if ( action = = wxNO ) return false ;
2010-01-23 19:44:49 +00:00
}
2019-07-15 09:52:22 +00:00
return true ;
}
bool FFmpegPresets : : SavePreset ( ExportFFmpegOptions * parent , wxString & name )
{
wxString format ;
wxString codec ;
FFmpegPreset * preset ;
2010-01-23 19:44:49 +00:00
2015-08-26 16:18:55 +00:00
{
2018-10-10 16:28:50 +00:00
wxWindow * wnd ;
wxListBox * lb ;
2015-05-17 06:57:40 +00:00
2018-10-10 16:28:50 +00:00
wnd = dynamic_cast < wxWindow * > ( parent ) - > FindWindowById ( FEFormatID , parent ) ;
lb = dynamic_cast < wxListBox * > ( wnd ) ;
if ( lb - > GetSelection ( ) < 0 )
{
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " Please select format before saving a profile " ) ) ;
2019-07-15 09:52:22 +00:00
return false ;
2018-10-10 16:28:50 +00:00
}
format = lb - > GetStringSelection ( ) ;
wnd = dynamic_cast < wxWindow * > ( parent ) - > FindWindowById ( FECodecID , parent ) ;
lb = dynamic_cast < wxListBox * > ( wnd ) ;
if ( lb - > GetSelection ( ) < 0 )
{
2019-12-19 19:49:42 +00:00
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " Please select codec before saving a profile " ) ) ;
2019-07-15 09:52:22 +00:00
return false ;
2018-10-10 16:28:50 +00:00
}
codec = lb - > GetStringSelection ( ) ;
2010-01-23 19:44:49 +00:00
}
2015-08-26 16:18:55 +00:00
preset = & mPresets [ name ] ;
preset - > mPresetName = name ;
2010-01-23 19:44:49 +00:00
wxSpinCtrl * sc ;
wxTextCtrl * tc ;
wxCheckBox * cb ;
wxChoice * ch ;
for ( int id = FEFirstID ; id < FELastID ; id + + )
{
wxWindow * wnd = dynamic_cast < wxWindow * > ( parent ) - > FindWindowById ( id , parent ) ;
if ( wnd ! = NULL )
{
switch ( id )
{
case FEFormatID :
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = format ;
2010-01-23 19:44:49 +00:00
break ;
case FECodecID :
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = codec ;
2010-01-23 19:44:49 +00:00
break ;
// Spin control
case FEBitrateID :
case FEQualityID :
2014-05-27 22:06:58 +00:00
case FESampleRateID :
2010-01-23 19:44:49 +00:00
case FECutoffID :
case FEFrameSizeID :
case FEBufSizeID :
case FECompLevelID :
case FELPCCoeffsID :
case FEMinPredID :
case FEMaxPredID :
case FEMinPartOrderID :
case FEMaxPartOrderID :
case FEMuxRateID :
case FEPacketSizeID :
sc = dynamic_cast < wxSpinCtrl * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = wxString : : Format ( wxT ( " %d " ) , sc - > GetValue ( ) ) ;
2010-01-23 19:44:49 +00:00
break ;
// Text control
case FELanguageID :
case FETagID :
tc = dynamic_cast < wxTextCtrl * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = tc - > GetValue ( ) ;
2010-01-23 19:44:49 +00:00
break ;
// Choice
case FEProfileID :
case FEPredOrderID :
ch = dynamic_cast < wxChoice * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = wxString : : Format ( wxT ( " %d " ) , ch - > GetSelection ( ) ) ;
2010-01-23 19:44:49 +00:00
break ;
// Check box
case FEUseLPCID :
case FEBitReservoirID :
case FEVariableBlockLenID :
cb = dynamic_cast < wxCheckBox * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] = wxString : : Format ( wxT ( " %d " ) , cb - > GetValue ( ) ) ;
2010-01-23 19:44:49 +00:00
break ;
}
}
}
2019-07-15 09:52:22 +00:00
return true ;
2010-01-23 19:44:49 +00:00
}
void FFmpegPresets : : LoadPreset ( ExportFFmpegOptions * parent , wxString & name )
{
FFmpegPreset * preset = FindPreset ( name ) ;
if ( ! preset )
{
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " Preset '%s' does not exist. " ) . Format ( name ) ) ;
2010-01-23 19:44:49 +00:00
return ;
}
wxListBox * lb ;
wxSpinCtrl * sc ;
wxTextCtrl * tc ;
wxCheckBox * cb ;
wxChoice * ch ;
for ( int id = FEFirstID ; id < FELastID ; id + + )
{
wxWindow * wnd = parent - > FindWindowById ( id , parent ) ;
if ( wnd ! = NULL )
{
wxString readstr ;
long readlong ;
bool readbool ;
switch ( id )
{
// Listbox
case FEFormatID :
case FECodecID :
lb = dynamic_cast < wxListBox * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
readstr = preset - > mControlState [ id - FEFirstID ] ;
2010-01-23 19:44:49 +00:00
readlong = lb - > FindString ( readstr ) ;
if ( readlong > - 1 ) lb - > Select ( readlong ) ;
break ;
// Spin control
case FEBitrateID :
case FEQualityID :
case FESampleRateID :
case FECutoffID :
case FEFrameSizeID :
case FEBufSizeID :
case FECompLevelID :
case FELPCCoeffsID :
case FEMinPredID :
case FEMaxPredID :
2014-05-27 22:06:58 +00:00
case FEMinPartOrderID :
2010-01-23 19:44:49 +00:00
case FEMaxPartOrderID :
case FEMuxRateID :
case FEPacketSizeID :
sc = dynamic_cast < wxSpinCtrl * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] . ToLong ( & readlong ) ;
2010-01-23 19:44:49 +00:00
sc - > SetValue ( readlong ) ;
break ;
// Text control
case FELanguageID :
case FETagID :
tc = dynamic_cast < wxTextCtrl * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
tc - > SetValue ( preset - > mControlState [ id - FEFirstID ] ) ;
2010-01-23 19:44:49 +00:00
break ;
// Choice
case FEProfileID :
case FEPredOrderID :
ch = dynamic_cast < wxChoice * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] . ToLong ( & readlong ) ;
2010-01-23 19:44:49 +00:00
if ( readlong > - 1 ) ch - > Select ( readlong ) ;
break ;
// Check box
case FEUseLPCID :
case FEBitReservoirID :
case FEVariableBlockLenID :
cb = dynamic_cast < wxCheckBox * > ( wnd ) ;
2019-02-12 00:10:48 +00:00
preset - > mControlState [ id - FEFirstID ] . ToLong ( & readlong ) ;
2010-01-23 19:44:49 +00:00
if ( readlong ) readbool = true ; else readbool = false ;
cb - > SetValue ( readbool ) ;
break ;
}
}
}
}
bool FFmpegPresets : : HandleXMLTag ( const wxChar * tag , const wxChar * * attrs )
{
2015-08-26 16:18:55 +00:00
if ( mAbortImport )
{
return false ;
}
2010-01-23 19:44:49 +00:00
if ( ! wxStrcmp ( tag , wxT ( " ffmpeg_presets " ) ) )
{
return true ;
}
2015-08-26 16:18:55 +00:00
if ( ! wxStrcmp ( tag , wxT ( " preset " ) ) )
2010-01-23 19:44:49 +00:00
{
while ( * attrs )
{
const wxChar * attr = * attrs + + ;
wxString value = * attrs + + ;
if ( ! value )
break ;
if ( ! wxStrcmp ( attr , wxT ( " name " ) ) )
{
2015-05-17 06:57:40 +00:00
mPreset = FindPreset ( value ) ;
2015-08-26 16:18:55 +00:00
if ( mPreset )
{
2019-12-07 19:30:07 +00:00
auto query = XO ( " Replace preset '%s'? " ) . Format ( value ) ;
int action = AudacityMessageBox (
query ,
XO ( " Confirm Overwrite " ) ,
wxYES_NO | wxCANCEL | wxCENTRE ) ;
2015-08-26 16:18:55 +00:00
if ( action = = wxCANCEL )
{
mAbortImport = true ;
return false ;
}
if ( action = = wxNO )
{
mPreset = NULL ;
return false ;
}
* mPreset = FFmpegPreset ( ) ;
}
else
2010-01-23 19:44:49 +00:00
{
2015-08-26 16:18:55 +00:00
mPreset = & mPresets [ value ] ;
2010-01-23 19:44:49 +00:00
}
2015-08-26 16:18:55 +00:00
mPreset - > mPresetName = value ;
2010-01-23 19:44:49 +00:00
}
}
return true ;
}
2015-08-26 16:18:55 +00:00
if ( ! wxStrcmp ( tag , wxT ( " setctrlstate " ) ) & & mPreset )
2010-01-23 19:44:49 +00:00
{
long id = - 1 ;
while ( * attrs )
{
const wxChar * attr = * attrs + + ;
const wxChar * value = * attrs + + ;
if ( ! value )
break ;
if ( ! wxStrcmp ( attr , wxT ( " id " ) ) )
{
for ( long i = FEFirstID ; i < FELastID ; i + + )
if ( ! wxStrcmp ( FFmpegExportCtrlIDNames [ i - FEFirstID ] , value ) )
id = i ;
}
else if ( ! wxStrcmp ( attr , wxT ( " state " ) ) )
{
if ( id > FEFirstID & & id < FELastID )
2019-02-12 00:10:48 +00:00
mPreset - > mControlState [ id - FEFirstID ] = wxString ( value ) ;
2010-01-23 19:44:49 +00:00
}
}
return true ;
}
2015-08-26 16:18:55 +00:00
2010-01-23 19:44:49 +00:00
return false ;
}
XMLTagHandler * FFmpegPresets : : HandleXMLChild ( const wxChar * tag )
{
2015-08-26 16:18:55 +00:00
if ( mAbortImport )
{
return NULL ;
}
2010-01-23 19:44:49 +00:00
if ( ! wxStrcmp ( tag , wxT ( " preset " ) ) )
{
return this ;
}
else if ( ! wxStrcmp ( tag , wxT ( " setctrlstate " ) ) )
{
return this ;
}
return NULL ;
}
2017-02-22 19:23:35 +00:00
void FFmpegPresets : : WriteXMLHeader ( XMLWriter & xmlFile ) const
2016-12-01 22:03:40 +00:00
// may throw
2010-01-23 19:44:49 +00:00
{
xmlFile . Write ( wxT ( " <?xml " ) ) ;
xmlFile . Write ( wxT ( " version= \" 1.0 \" " ) ) ;
xmlFile . Write ( wxT ( " standalone= \" no \" " ) ) ;
xmlFile . Write ( wxT ( " ?> \n " ) ) ;
wxString dtdName = wxT ( " -//audacityffmpegpreset-1.0.0//DTD//EN " ) ;
wxString dtdURI =
wxT ( " http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd " ) ;
xmlFile . Write ( wxT ( " <!DOCTYPE " ) ) ;
xmlFile . Write ( wxT ( " project " ) ) ;
xmlFile . Write ( wxT ( " PUBLIC " ) ) ;
xmlFile . Write ( wxT ( " \" -//audacityffmpegpreset-1.0.0//DTD//EN \" " ) ) ;
xmlFile . Write ( wxT ( " \" http://audacity.sourceforge.net/xml/audacityffmpegpreset-1.0.0.dtd \" " ) ) ;
xmlFile . Write ( wxT ( " > \n " ) ) ;
}
2017-02-22 19:23:35 +00:00
void FFmpegPresets : : WriteXML ( XMLWriter & xmlFile ) const
2016-12-01 22:03:40 +00:00
// may throw
2010-01-23 19:44:49 +00:00
{
xmlFile . StartTag ( wxT ( " ffmpeg_presets " ) ) ;
xmlFile . WriteAttr ( wxT ( " version " ) , wxT ( " 1.0 " ) ) ;
2017-02-22 19:23:35 +00:00
FFmpegPresetMap : : const_iterator iter ;
2015-08-26 16:18:55 +00:00
for ( iter = mPresets . begin ( ) ; iter ! = mPresets . end ( ) ; + + iter )
2010-01-23 19:44:49 +00:00
{
2017-02-22 19:23:35 +00:00
auto preset = & iter - > second ;
2010-01-23 19:44:49 +00:00
xmlFile . StartTag ( wxT ( " preset " ) ) ;
2015-05-17 06:57:40 +00:00
xmlFile . WriteAttr ( wxT ( " name " ) , preset - > mPresetName ) ;
2010-01-23 19:44:49 +00:00
for ( long i = FEFirstID + 1 ; i < FELastID ; i + + )
{
xmlFile . StartTag ( wxT ( " setctrlstate " ) ) ;
xmlFile . WriteAttr ( wxT ( " id " ) , wxString ( FFmpegExportCtrlIDNames [ i - FEFirstID ] ) ) ;
2019-02-12 00:10:48 +00:00
xmlFile . WriteAttr ( wxT ( " state " ) , preset - > mControlState [ i - FEFirstID ] ) ;
2010-01-23 19:44:49 +00:00
xmlFile . EndTag ( wxT ( " setctrlstate " ) ) ;
}
xmlFile . EndTag ( wxT ( " preset " ) ) ;
}
xmlFile . EndTag ( wxT ( " ffmpeg_presets " ) ) ;
}
//----------------------------------------------------------------------------
// ExportFFmpegOptions Class
//----------------------------------------------------------------------------
2016-07-10 21:10:50 +00:00
BEGIN_EVENT_TABLE ( ExportFFmpegOptions , wxDialogWrapper )
2010-01-23 19:44:49 +00:00
EVT_BUTTON ( wxID_OK , ExportFFmpegOptions : : OnOK )
2019-07-15 09:52:22 +00:00
EVT_BUTTON ( wxID_HELP , ExportFFmpegOptions : : OnGetURL )
2010-01-23 19:44:49 +00:00
EVT_LISTBOX ( FEFormatID , ExportFFmpegOptions : : OnFormatList )
EVT_LISTBOX ( FECodecID , ExportFFmpegOptions : : OnCodecList )
EVT_BUTTON ( FEAllFormatsID , ExportFFmpegOptions : : OnAllFormats )
EVT_BUTTON ( FEAllCodecsID , ExportFFmpegOptions : : OnAllCodecs )
EVT_BUTTON ( FESavePresetID , ExportFFmpegOptions : : OnSavePreset )
EVT_BUTTON ( FELoadPresetID , ExportFFmpegOptions : : OnLoadPreset )
EVT_BUTTON ( FEDeletePresetID , ExportFFmpegOptions : : OnDeletePreset )
EVT_BUTTON ( FEImportPresetsID , ExportFFmpegOptions : : OnImportPresets )
EVT_BUTTON ( FEExportPresetsID , ExportFFmpegOptions : : OnExportPresets )
END_EVENT_TABLE ( )
2010-02-13 01:39:38 +00:00
/// Format-codec compatibility list
/// Must end with NULL entry
2014-05-27 22:06:58 +00:00
CompatibilityEntry ExportFFmpegOptions : : CompatibilityList [ ] =
2010-02-13 01:39:38 +00:00
{
2014-05-29 16:02:46 +00:00
{ wxT ( " adts " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_S16BE } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_S8 } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_S24BE } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_S32BE } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_MACE3 } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_MACE6 } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_GSM } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_ADPCM_G726 } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_ADPCM_IMA_QT } ,
{ wxT ( " aiff " ) , AV_CODEC_ID_QDM2 } ,
{ wxT ( " amr " ) , AV_CODEC_ID_AMR_NB } ,
{ wxT ( " amr " ) , AV_CODEC_ID_AMR_WB } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_MS } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " asf " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " asf " ) , AV_CODEC_ID_WMAVOICE } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_IMA_WAV } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " asf " ) , AV_CODEC_ID_TRUESPEECH } ,
{ wxT ( " asf " ) , AV_CODEC_ID_GSM_MS } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_G726 } ,
2019-08-28 12:14:14 +00:00
//{ wxT("asf"), AV_CODEC_ID_MP2 }, Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " asf " ) , AV_CODEC_ID_MP3 } ,
2018-01-26 17:13:54 +00:00
# if LIBAVCODEC_VERSION_MAJOR < 58
2014-05-29 16:02:46 +00:00
{ wxT ( " asf " ) , AV_CODEC_ID_VOXWARE } ,
2018-01-26 17:13:54 +00:00
# endif
2014-05-29 16:02:46 +00:00
{ wxT ( " asf " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " asf " ) , AV_CODEC_ID_WMAV1 } ,
{ wxT ( " asf " ) , AV_CODEC_ID_WMAV2 } ,
{ wxT ( " asf " ) , AV_CODEC_ID_WMAPRO } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_CT } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ATRAC3 } ,
{ wxT ( " asf " ) , AV_CODEC_ID_IMC } ,
{ wxT ( " asf " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " asf " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " asf " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " asf " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " asf " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " au " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " au " ) , AV_CODEC_ID_PCM_S8 } ,
{ wxT ( " au " ) , AV_CODEC_ID_PCM_S16BE } ,
{ wxT ( " au " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_MS } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " avi " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " avi " ) , AV_CODEC_ID_WMAVOICE } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_IMA_WAV } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " avi " ) , AV_CODEC_ID_TRUESPEECH } ,
{ wxT ( " avi " ) , AV_CODEC_ID_GSM_MS } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_G726 } ,
2019-08-28 12:14:14 +00:00
// { wxT("avi"), AV_CODEC_ID_MP2 }, //Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " avi " ) , AV_CODEC_ID_MP3 } ,
2018-01-26 17:13:54 +00:00
# if LIBAVCODEC_VERSION_MAJOR < 58
2014-05-29 16:02:46 +00:00
{ wxT ( " avi " ) , AV_CODEC_ID_VOXWARE } ,
2018-01-26 17:13:54 +00:00
# endif
2014-05-29 16:02:46 +00:00
{ wxT ( " avi " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " avi " ) , AV_CODEC_ID_WMAV1 } ,
{ wxT ( " avi " ) , AV_CODEC_ID_WMAV2 } ,
{ wxT ( " avi " ) , AV_CODEC_ID_WMAPRO } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_CT } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ATRAC3 } ,
{ wxT ( " avi " ) , AV_CODEC_ID_IMC } ,
{ wxT ( " avi " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " avi " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " avi " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " avi " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " avi " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " crc " ) , AV_CODEC_ID_NONE } ,
{ wxT ( " dv " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " ffm " ) , AV_CODEC_ID_NONE } ,
{ wxT ( " flv " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " flv " ) , AV_CODEC_ID_PCM_S8 } ,
{ wxT ( " flv " ) , AV_CODEC_ID_PCM_S16BE } ,
{ wxT ( " flv " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " flv " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " flv " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " flv " ) , AV_CODEC_ID_NELLYMOSER } ,
{ wxT ( " framecrc " ) , AV_CODEC_ID_NONE } ,
{ wxT ( " gxf " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_MS } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_WMAVOICE } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_IMA_WAV } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_TRUESPEECH } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_GSM_MS } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_G726 } ,
2019-08-28 12:14:14 +00:00
// { wxT("matroska"), AV_CODEC_ID_MP2 }, // Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " matroska " ) , AV_CODEC_ID_MP3 } ,
2018-01-26 17:13:54 +00:00
# if LIBAVCODEC_VERSION_MAJOR < 58
2014-05-29 16:02:46 +00:00
{ wxT ( " matroska " ) , AV_CODEC_ID_VOXWARE } ,
2018-01-26 17:13:54 +00:00
# endif
2014-05-29 16:02:46 +00:00
{ wxT ( " matroska " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_WMAV1 } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_WMAV2 } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_WMAPRO } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_CT } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ATRAC3 } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_IMC } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " matroska " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " mmf " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S32BE } , //mov
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S24BE } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S16BE } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_S8 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " mov " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " mov " ) , AV_CODEC_ID_ADPCM_IMA_QT } ,
{ wxT ( " mov " ) , AV_CODEC_ID_MACE3 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_MACE6 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " mov " ) , AV_CODEC_ID_AMR_NB } ,
{ wxT ( " mov " ) , AV_CODEC_ID_AMR_WB } ,
{ wxT ( " mov " ) , AV_CODEC_ID_GSM } ,
{ wxT ( " mov " ) , AV_CODEC_ID_ALAC } ,
{ wxT ( " mov " ) , AV_CODEC_ID_QCELP } ,
{ wxT ( " mov " ) , AV_CODEC_ID_QDM2 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_DVAUDIO } ,
{ wxT ( " mov " ) , AV_CODEC_ID_WMAV2 } ,
{ wxT ( " mov " ) , AV_CODEC_ID_ALAC } ,
{ wxT ( " mp4 " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " mp4 " ) , AV_CODEC_ID_QCELP } ,
{ wxT ( " mp4 " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " mp4 " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " psp " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " psp " ) , AV_CODEC_ID_QCELP } ,
{ wxT ( " psp " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " psp " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " ipod " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " ipod " ) , AV_CODEC_ID_QCELP } ,
{ wxT ( " ipod " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " ipod " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " 3gp " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " 3gp " ) , AV_CODEC_ID_AMR_NB } ,
{ wxT ( " 3gp " ) , AV_CODEC_ID_AMR_WB } ,
{ wxT ( " 3g2 " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " 3g2 " ) , AV_CODEC_ID_AMR_NB } ,
{ wxT ( " 3g2 " ) , AV_CODEC_ID_AMR_WB } ,
{ wxT ( " mp3 " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " mpeg " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " mpeg " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " mpeg " ) , AV_CODEC_ID_PCM_S16BE } ,
2019-08-28 12:14:14 +00:00
//{ wxT("mpeg"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " vcd " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " vcd " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " vcd " ) , AV_CODEC_ID_PCM_S16BE } ,
2019-08-28 12:14:14 +00:00
//{ wxT("vcd"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " vob " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " vob " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " vob " ) , AV_CODEC_ID_PCM_S16BE } ,
2019-08-28 12:14:14 +00:00
//{ wxT("vob"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " svcd " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " svcd " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " svcd " ) , AV_CODEC_ID_PCM_S16BE } ,
2019-08-28 12:14:14 +00:00
//{ wxT("svcd"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " dvd " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " dvd " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " dvd " ) , AV_CODEC_ID_PCM_S16BE } ,
2019-08-28 12:14:14 +00:00
//{ wxT("dvd"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_MS } ,
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " nut " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " nut " ) , AV_CODEC_ID_WMAVOICE } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_IMA_WAV } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " nut " ) , AV_CODEC_ID_TRUESPEECH } ,
{ wxT ( " nut " ) , AV_CODEC_ID_GSM_MS } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_G726 } ,
2019-08-28 12:14:14 +00:00
//{ wxT("nut"), AV_CODEC_ID_MP2 },// Bug 59
2014-05-29 16:02:46 +00:00
{ wxT ( " nut " ) , AV_CODEC_ID_MP3 } ,
2018-01-26 17:13:54 +00:00
# if LIBAVCODEC_VERSION_MAJOR < 58
2014-05-29 16:02:46 +00:00
{ wxT ( " nut " ) , AV_CODEC_ID_VOXWARE } ,
2018-01-26 17:13:54 +00:00
# endif
2014-05-29 16:02:46 +00:00
{ wxT ( " nut " ) , AV_CODEC_ID_AAC } ,
{ wxT ( " nut " ) , AV_CODEC_ID_WMAV1 } ,
{ wxT ( " nut " ) , AV_CODEC_ID_WMAV2 } ,
{ wxT ( " nut " ) , AV_CODEC_ID_WMAPRO } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_CT } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ATRAC3 } ,
{ wxT ( " nut " ) , AV_CODEC_ID_IMC } ,
{ wxT ( " nut " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " nut " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " nut " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " nut " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " nut " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " ogg " ) , AV_CODEC_ID_VORBIS } ,
{ wxT ( " ogg " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " ac3 " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " dts " ) , AV_CODEC_ID_DTS } ,
{ wxT ( " flac " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " RoQ " ) , AV_CODEC_ID_ROQ_DPCM } ,
{ wxT ( " rm " ) , AV_CODEC_ID_AC3 } ,
{ wxT ( " swf " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " avm2 " ) , AV_CODEC_ID_MP3 } ,
{ wxT ( " voc " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_S16LE } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_U8 } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_S24LE } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_S32LE } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_MS } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_ALAW } ,
{ wxT ( " wav " ) , AV_CODEC_ID_PCM_MULAW } ,
{ wxT ( " wav " ) , AV_CODEC_ID_WMAVOICE } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_IMA_WAV } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_YAMAHA } ,
{ wxT ( " wav " ) , AV_CODEC_ID_TRUESPEECH } ,
{ wxT ( " wav " ) , AV_CODEC_ID_GSM_MS } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_G726 } ,
2019-08-28 12:14:14 +00:00
//{ wxT("wav"), AV_CODEC_ID_MP2 }, Bug 59 - It crashes.
2014-05-29 16:02:46 +00:00
{ wxT ( " wav " ) , AV_CODEC_ID_MP3 } ,
2018-01-26 17:13:54 +00:00
# if LIBAVCODEC_VERSION_MAJOR < 58
2014-05-29 16:02:46 +00:00
{ wxT ( " wav " ) , AV_CODEC_ID_VOXWARE } ,
2018-01-26 17:13:54 +00:00
# endif
2014-05-29 16:02:46 +00:00
{ wxT ( " wav " ) , AV_CODEC_ID_AAC } ,
2019-08-28 12:14:14 +00:00
// { wxT("wav"), AV_CODEC_ID_WMAV1 },
// { wxT("wav"), AV_CODEC_ID_WMAV2 },
2014-05-29 16:02:46 +00:00
{ wxT ( " wav " ) , AV_CODEC_ID_WMAPRO } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_CT } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ATRAC3 } ,
{ wxT ( " wav " ) , AV_CODEC_ID_IMC } ,
{ wxT ( " wav " ) , AV_CODEC_ID_AC3 } ,
2019-08-28 12:14:14 +00:00
//{ wxT("wav"), AV_CODEC_ID_DTS },
2014-05-29 16:02:46 +00:00
{ wxT ( " wav " ) , AV_CODEC_ID_FLAC } ,
{ wxT ( " wav " ) , AV_CODEC_ID_ADPCM_SWF } ,
{ wxT ( " wav " ) , AV_CODEC_ID_VORBIS } ,
2010-02-13 01:39:38 +00:00
2014-05-29 16:02:46 +00:00
{ NULL , AV_CODEC_ID_NONE }
2010-02-13 01:39:38 +00:00
} ;
/// AAC profiles
2019-02-23 20:13:46 +00:00
// The FF_PROFILE_* enumeration is defined in the ffmpeg library
// PRL: I cant find where this preference is used!
ChoiceSetting AACProfiles { wxT ( " /FileFormats/FFmpegAACProfile " ) ,
2017-09-30 00:14:37 +00:00
{
2019-02-23 20:13:46 +00:00
{ wxT ( " 1 " ) /*FF_PROFILE_AAC_LOW*/ , XO ( " LC " ) } ,
{ wxT ( " 0 " ) /*FF_PROFILE_AAC_MAIN*/ , XO ( " Main " ) } ,
// {wxT("2") /*FF_PROFILE_AAC_SSR*/, XO("SSR")}, //SSR is not supported
{ wxT ( " 3 " ) /*FF_PROFILE_AAC_LTP*/ , XO ( " LTP " ) } ,
} ,
0 , // "1"
} ;
2010-02-13 01:39:38 +00:00
/// List of export types
ExposedFormat ExportFFmpegOptions : : fmts [ ] =
{
2017-10-12 03:02:10 +00:00
{ FMT_M4A , wxT ( " M4A " ) , wxT ( " m4a " ) , wxT ( " ipod " ) , 48 , AV_CANMETA , true , XO ( " M4A (AAC) Files (FFmpeg) " ) , AV_CODEC_ID_AAC , true } ,
2017-09-30 00:14:37 +00:00
{ FMT_AC3 , wxT ( " AC3 " ) , wxT ( " ac3 " ) , wxT ( " ac3 " ) , 7 , AV_VERSION_INT ( 0 , 0 , 0 ) , false , XO ( " AC3 Files (FFmpeg) " ) , AV_CODEC_ID_AC3 , true } ,
{ FMT_AMRNB , wxT ( " AMRNB " ) , wxT ( " amr " ) , wxT ( " amr " ) , 1 , AV_VERSION_INT ( 0 , 0 , 0 ) , false , XO ( " AMR (narrow band) Files (FFmpeg) " ) , AV_CODEC_ID_AMR_NB , true } ,
{ FMT_WMA2 , wxT ( " WMA " ) , wxT ( " wma " ) , wxT ( " asf " ) , 2 , AV_VERSION_INT ( 52 , 53 , 0 ) , false , XO ( " WMA (version 2) Files (FFmpeg) " ) , AV_CODEC_ID_WMAV2 , true } ,
2017-10-12 03:02:10 +00:00
{ FMT_OTHER , wxT ( " FFMPEG " ) , wxT ( " " ) , wxT ( " " ) , 255 , AV_CANMETA , true , XO ( " Custom FFmpeg Export " ) , AV_CODEC_ID_NONE , true }
2010-02-13 01:39:38 +00:00
} ;
/// Sample rates supported by AAC encoder (must end with zero-element)
const int ExportFFmpegOptions : : iAACSampleRates [ ] = { 7350 , 8000 , 11025 , 12000 , 16000 , 22050 , 24000 , 32000 , 44100 , 48000 , 64000 , 88200 , 0 } ;
/// Some controls (parameters they represent) are only applicable to a number
/// of codecs and/or formats.
/// Syntax: first, enable a control for each applicable format-codec combination
/// then disable it for anything else
/// "any" - any format
2014-05-29 16:02:46 +00:00
/// AV_CODEC_ID_NONE - any codec
/// This list must end with {FALSE,FFmpegExportCtrlID(0),AV_CODEC_ID_NONE,NULL}
2014-05-27 22:06:58 +00:00
ApplicableFor ExportFFmpegOptions : : apptable [ ] =
2010-02-13 01:39:38 +00:00
{
2014-05-29 16:02:46 +00:00
{ TRUE , FEQualityID , AV_CODEC_ID_AAC , " any " } ,
{ TRUE , FEQualityID , AV_CODEC_ID_MP3 , " any " } ,
{ TRUE , FEQualityID , AV_CODEC_ID_VORBIS , " any " } ,
{ FALSE , FEQualityID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FECutoffID , AV_CODEC_ID_AC3 , " any " } ,
{ TRUE , FECutoffID , AV_CODEC_ID_AAC , " any " } ,
{ TRUE , FECutoffID , AV_CODEC_ID_VORBIS , " any " } ,
{ FALSE , FECutoffID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEFrameSizeID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEFrameSizeID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEProfileID , AV_CODEC_ID_AAC , " any " } ,
{ FALSE , FEProfileID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FECompLevelID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FECompLevelID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEUseLPCID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEUseLPCID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FELPCCoeffsID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FELPCCoeffsID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEMinPredID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEMinPredID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEMaxPredID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEMaxPredID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEPredOrderID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEPredOrderID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEMinPartOrderID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEMinPartOrderID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEMaxPartOrderID , AV_CODEC_ID_FLAC , " any " } ,
{ FALSE , FEMaxPartOrderID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEMuxRateID , AV_CODEC_ID_NONE , " mpeg " } ,
{ TRUE , FEMuxRateID , AV_CODEC_ID_NONE , " vcd " } ,
{ TRUE , FEMuxRateID , AV_CODEC_ID_NONE , " vob " } ,
{ TRUE , FEMuxRateID , AV_CODEC_ID_NONE , " svcd " } ,
{ TRUE , FEMuxRateID , AV_CODEC_ID_NONE , " dvd " } ,
{ FALSE , FEMuxRateID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEPacketSizeID , AV_CODEC_ID_NONE , " mpeg " } ,
{ TRUE , FEPacketSizeID , AV_CODEC_ID_NONE , " vcd " } ,
{ TRUE , FEPacketSizeID , AV_CODEC_ID_NONE , " vob " } ,
{ TRUE , FEPacketSizeID , AV_CODEC_ID_NONE , " svcd " } ,
{ TRUE , FEPacketSizeID , AV_CODEC_ID_NONE , " dvd " } ,
{ FALSE , FEPacketSizeID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " matroska " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " mov " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " 3gp " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " mp4 " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " psp " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " 3g2 " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " ipod " } ,
{ TRUE , FELanguageID , AV_CODEC_ID_NONE , " mpegts " } ,
{ FALSE , FELanguageID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEBitReservoirID , AV_CODEC_ID_MP3 , " any " } ,
{ TRUE , FEBitReservoirID , AV_CODEC_ID_WMAV1 , " any " } ,
{ TRUE , FEBitReservoirID , AV_CODEC_ID_WMAV2 , " any " } ,
{ FALSE , FEBitReservoirID , AV_CODEC_ID_NONE , " any " } ,
{ TRUE , FEVariableBlockLenID , AV_CODEC_ID_WMAV1 , " any " } ,
{ TRUE , FEVariableBlockLenID , AV_CODEC_ID_WMAV2 , " any " } ,
{ FALSE , FEVariableBlockLenID , AV_CODEC_ID_NONE , " any " } ,
{ FALSE , FFmpegExportCtrlID ( 0 ) , AV_CODEC_ID_NONE , NULL }
2010-02-13 01:39:38 +00:00
} ;
2019-02-23 20:13:46 +00:00
namespace {
2017-09-30 00:14:37 +00:00
2019-02-23 20:13:46 +00:00
/// Prediction order method - names.
2019-11-30 22:56:51 +00:00
const TranslatableStrings PredictionOrderMethodNames {
2019-02-23 20:13:46 +00:00
XO ( " Estimate " ) ,
XO ( " 2-level " ) ,
XO ( " 4-level " ) ,
XO ( " 8-level " ) ,
XO ( " Full search " ) ,
XO ( " Log search " ) ,
} ;
2017-09-30 00:14:37 +00:00
}
2010-02-13 01:39:38 +00:00
2010-01-23 19:44:49 +00:00
ExportFFmpegOptions : : ~ ExportFFmpegOptions ( )
{
DropFFmpegLibs ( ) ;
}
ExportFFmpegOptions : : ExportFFmpegOptions ( wxWindow * parent )
2016-07-10 21:10:50 +00:00
: wxDialogWrapper ( parent , wxID_ANY ,
2019-12-08 05:25:47 +00:00
XO ( " Configure custom FFmpeg options " ) )
2010-01-23 19:44:49 +00:00
{
2019-12-08 05:25:47 +00:00
SetName ( ) ;
2010-01-23 19:44:49 +00:00
ShuttleGui S ( this , eIsCreatingFromPrefs ) ;
PickFFmpegLibs ( ) ;
2016-08-01 15:44:49 +00:00
//FFmpegLibsInst()->LoadLibs(NULL,true); //Loaded at startup or from Prefs now
2010-01-23 19:44:49 +00:00
2016-04-09 20:09:19 +00:00
mPresets = std : : make_unique < FFmpegPresets > ( ) ;
mPresets - > GetPresetList ( mPresetNames ) ;
2010-01-23 19:44:49 +00:00
2016-08-01 15:44:49 +00:00
if ( FFmpegLibsInst ( ) - > ValidLibsLoaded ( ) )
2010-01-23 19:44:49 +00:00
{
FetchFormatList ( ) ;
FetchCodecList ( ) ;
PopulateOrExchange ( S ) ;
//Select the format that was selected last time this dialog was closed
mFormatList - > Select ( mFormatList - > FindString ( gPrefs - > Read ( wxT ( " /FileFormats/FFmpegFormat " ) ) ) ) ;
DoOnFormatList ( ) ;
//Select the codec that was selected last time this dialog was closed
2014-05-27 21:36:01 +00:00
AVCodec * codec = avcodec_find_encoder_by_name ( gPrefs - > Read ( wxT ( " /FileFormats/FFmpegCodec " ) ) . ToUTF8 ( ) ) ;
2010-01-23 19:44:49 +00:00
if ( codec ! = NULL ) mCodecList - > Select ( mCodecList - > FindString ( wxString : : FromUTF8 ( codec - > name ) ) ) ;
DoOnCodecList ( ) ;
}
}
///
///
void ExportFFmpegOptions : : FetchFormatList ( )
{
// Enumerate all output formats
AVOutputFormat * ofmt = NULL ;
2014-10-09 22:12:51 +00:00
while ( ( ofmt = av_oformat_next ( ofmt ) ) ! = NULL )
2010-01-23 19:44:49 +00:00
{
// Any audio-capable format has default audio codec.
// If it doesn't, then it doesn't supports any audio codecs
2014-05-29 16:02:46 +00:00
if ( ofmt - > audio_codec ! = AV_CODEC_ID_NONE )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
mFormatNames . push_back ( wxString : : FromUTF8 ( ofmt - > name ) ) ;
mFormatLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mFormatNames . back ( ) , wxString : : FromUTF8 ( ofmt - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
// Show all formats
mShownFormatNames = mFormatNames ;
mShownFormatLongNames = mFormatLongNames ;
}
///
///
void ExportFFmpegOptions : : FetchCodecList ( )
{
// Enumerate all codecs
AVCodec * codec = NULL ;
2014-10-09 22:12:51 +00:00
while ( ( codec = av_codec_next ( codec ) ) ! = NULL )
2010-01-23 19:44:49 +00:00
{
// We're only interested in audio and only in encoders
2014-05-25 21:08:58 +00:00
if ( codec - > type = = AVMEDIA_TYPE_AUDIO & & av_codec_is_encoder ( codec ) )
2010-01-23 19:44:49 +00:00
{
2019-09-01 11:41:24 +00:00
// MP2 Codec is broken. Don't allow it.
if ( codec - > id = = AV_CODEC_ID_MP2 )
continue ;
2019-02-12 00:10:48 +00:00
mCodecNames . push_back ( wxString : : FromUTF8 ( codec - > name ) ) ;
mCodecLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mCodecNames . back ( ) , wxString : : FromUTF8 ( codec - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
// Show all codecs
mShownCodecNames = mCodecNames ;
mShownCodecLongNames = mCodecLongNames ;
}
2014-05-27 22:06:58 +00:00
///
///
2010-01-23 19:44:49 +00:00
void ExportFFmpegOptions : : PopulateOrExchange ( ShuttleGui & S )
{
S . StartVerticalLay ( 1 ) ;
S . StartMultiColumn ( 1 , wxEXPAND ) ;
{
2014-05-27 22:06:58 +00:00
S . SetStretchyRow ( 3 ) ;
S . StartMultiColumn ( 7 , wxEXPAND ) ;
{
S . SetStretchyCol ( 1 ) ;
2018-02-02 00:23:02 +00:00
mPresetCombo = S . Id ( FEPresetID ) . AddCombo ( _ ( " Preset: " ) , gPrefs - > Read ( wxT ( " /FileFormats/FFmpegPreset " ) , wxEmptyString ) , mPresetNames ) ;
2014-05-27 22:06:58 +00:00
mLoadPreset = S . Id ( FELoadPresetID ) . AddButton ( _ ( " Load Preset " ) ) ;
mSavePreset = S . Id ( FESavePresetID ) . AddButton ( _ ( " Save Preset " ) ) ;
mDeletePreset = S . Id ( FEDeletePresetID ) . AddButton ( _ ( " Delete Preset " ) ) ;
mImportPresets = S . Id ( FEImportPresetsID ) . AddButton ( _ ( " Import Presets " ) ) ;
mExportPresets = S . Id ( FEExportPresetsID ) . AddButton ( _ ( " Export Presets " ) ) ;
}
S . EndMultiColumn ( ) ;
S . StartMultiColumn ( 4 , wxALIGN_LEFT ) ;
{
S . SetStretchyCol ( 1 ) ;
S . SetStretchyCol ( 3 ) ;
S . Id ( FEFormatLabelID ) . AddFixedText ( _ ( " Format: " ) ) ;
2017-09-28 01:20:14 +00:00
mFormatName = S . Id ( FEFormatNameID ) . AddVariableText ( { } ) ;
2019-12-19 19:49:42 +00:00
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2014-05-27 22:06:58 +00:00
S . Id ( FECodecLabelID ) . AddFixedText ( _ ( " Codec: " ) ) ;
2017-09-28 01:20:14 +00:00
mCodecName = S . Id ( FECodecNameID ) . AddVariableText ( { } ) ;
2014-05-27 22:06:58 +00:00
}
S . EndMultiColumn ( ) ;
S . AddVariableText ( _ ( " Not all formats and codecs are compatible. Nor are all option combinations compatible with all codecs. " ) , false ) ;
S . StartMultiColumn ( 2 , wxEXPAND ) ;
{
S . StartMultiColumn ( 2 , wxEXPAND ) ;
{
S . SetStretchyRow ( 1 ) ;
S . Id ( FEAllFormatsID ) . AddButton ( _ ( " Show All Formats " ) ) ;
S . Id ( FEAllCodecsID ) . AddButton ( _ ( " Show All Codecs " ) ) ;
2018-02-02 00:23:02 +00:00
mFormatList = S . Id ( FEFormatID ) . AddListBox ( mFormatNames ) ;
2014-05-27 22:06:58 +00:00
mFormatList - > DeselectAll ( ) ;
2018-02-02 00:23:02 +00:00
mCodecList = S . Id ( FECodecID ) . AddListBox ( mCodecNames ) ;
2014-05-27 22:06:58 +00:00
mCodecList - > DeselectAll ( ) ;
}
S . EndMultiColumn ( ) ;
S . StartVerticalLay ( ) ;
{
//S.StartScroller( );
S . SetBorder ( 3 ) ;
S . StartStatic ( _ ( " General Options " ) , 0 ) ;
{
S . StartMultiColumn ( 8 , wxEXPAND ) ;
{
2017-10-29 00:29:20 +00:00
mLanguageText = S . Id ( FELanguageID )
. ToolTip ( XO ( " ISO 639 3-letter language code \n Optional \n empty - automatic " ) )
. TieTextBox ( _ ( " Language: " ) , { wxT ( " /FileFormats/FFmpegLanguage " ) , wxEmptyString } , 9 ) ;
2014-05-27 22:06:58 +00:00
S . AddSpace ( 20 , 0 ) ;
S . AddVariableText ( _ ( " Bit Reservoir " ) ) ;
2019-04-03 14:57:59 +00:00
S . Id ( FEBitReservoirID ) . TieCheckBox ( { } , { wxT ( " /FileFormats/FFmpegBitReservoir " ) , true } ) ;
2014-05-27 22:06:58 +00:00
S . AddSpace ( 20 , 0 ) ;
S . AddVariableText ( _ ( " VBL " ) ) ;
2019-04-03 14:57:59 +00:00
S . Id ( FEVariableBlockLenID ) . TieCheckBox ( { } , { wxT ( " /FileFormats/FFmpegVariableBlockLen " ) , true } ) ;
2014-05-27 22:06:58 +00:00
}
S . EndMultiColumn ( ) ;
S . StartMultiColumn ( 4 , wxALIGN_LEFT ) ;
{
2017-10-29 00:29:20 +00:00
mTag = S . Id ( FETagID )
2019-12-19 19:49:42 +00:00
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2017-10-29 00:29:20 +00:00
. ToolTip ( XO ( " Codec tag (FOURCC) \n Optional \n empty - automatic " ) )
. TieTextBox ( _ ( " Tag: " ) , { wxT ( " /FileFormats/FFmpegTag " ) , wxEmptyString } , 4 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mBitrateSpin = S . Id ( FEBitrateID )
. ToolTip ( XO ( " Bit Rate (bits/second) - influences the resulting file size and quality \n Some codecs may only accept specific values (128k, 192k, 256k etc) \n 0 - automatic \n Recommended - 192000 " ) )
. TieSpinCtrl ( _ ( " Bit Rate: " ) , { wxT ( " /FileFormats/FFmpegBitRate " ) , 0 } , 1000000 , 0 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mQualitySpin = S . Id ( FEQualityID )
. ToolTip ( XO ( " Overall quality, used differently by different codecs \n Required for vorbis \n 0 - automatic \n -1 - off (use bitrate instead) " ) )
. TieSpinCtrl ( _ ( " Quality: " ) , { wxT ( " /FileFormats/FFmpegQuality " ) , 0 } , 500 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mSampleRateSpin = S . Id ( FESampleRateID )
. ToolTip ( XO ( " Sample rate (Hz) \n 0 - don't change sample rate " ) )
. TieSpinCtrl ( _ ( " Sample Rate: " ) , { wxT ( " /FileFormats/FFmpegSampleRate " ) , 0 } , 200000 , 0 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mCutoffSpin = S . Id ( FECutoffID )
. ToolTip ( XO ( " Audio cutoff bandwidth (Hz) \n Optional \n 0 - automatic " ) )
. TieSpinCtrl ( _ ( " Cutoff: " ) , { wxT ( " /FileFormats/FFmpegCutOff " ) , 0 } , 10000000 , 0 ) ;
2014-05-27 22:06:58 +00:00
2019-02-23 20:13:46 +00:00
mProfileChoice = S . Id ( FEProfileID )
2017-10-29 00:29:20 +00:00
. ToolTip ( XO ( " AAC Profile \n Low Complexity - default \n Most players won't play anything other than LC " ) )
2018-01-31 20:31:22 +00:00
. MinSize ( { 100 , - 1 } )
2019-02-23 20:13:46 +00:00
. TieChoice ( _ ( " Profile: " ) , AACProfiles ) ;
2014-05-27 22:06:58 +00:00
}
S . EndMultiColumn ( ) ;
}
S . EndStatic ( ) ;
S . StartStatic ( _ ( " FLAC options " ) , 0 ) ;
{
S . StartMultiColumn ( 4 , wxALIGN_LEFT ) ;
{
2017-10-29 00:29:20 +00:00
mCompressionLevelSpin = S
. ToolTip ( XO ( " Compression level \n Required for FLAC \n -1 - automatic \n min - 0 (fast encoding, large output file) \n max - 10 (slow encoding, small output file) " ) )
. Id ( FECompLevelID ) . TieSpinCtrl ( _ ( " Compression: " ) , { wxT ( " /FileFormats/FFmpegCompLevel " ) , 0 } , 10 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mFrameSizeSpin = S . Id ( FEFrameSizeID )
. ToolTip ( XO ( " Frame size \n Optional \n 0 - default \n min - 16 \n max - 65535 " ) )
. TieSpinCtrl ( _ ( " Frame: " ) , { wxT ( " /FileFormats/FFmpegFrameSize " ) , 0 } , 65535 , 0 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mLPCCoeffsPrecisionSpin = S . Id ( FELPCCoeffsID )
. ToolTip ( XO ( " LPC coefficients precision \n Optional \n 0 - default \n min - 1 \n max - 15 " ) )
. TieSpinCtrl ( _ ( " LPC " ) , { wxT ( " /FileFormats/FFmpegLPCCoefPrec " ) , 0 } , 15 , 0 ) ;
2014-05-27 22:06:58 +00:00
2019-02-23 20:13:46 +00:00
mPredictionOrderMethodChoice = S . Id ( FEPredOrderID )
2017-10-29 00:29:20 +00:00
. ToolTip ( XO ( " Prediction Order Method \n Estimate - fastest, lower compression \n Log search - slowest, best compression \n Full search - default " ) )
2018-01-31 20:31:22 +00:00
. MinSize ( { 100 , - 1 } )
2019-02-23 20:13:46 +00:00
. TieNumberAsChoice (
_ ( " PdO Method: " ) ,
2019-04-03 14:57:59 +00:00
{ wxT ( " /FileFormats/FFmpegPredOrderMethod " ) ,
4 } , // Full search
2019-02-23 20:13:46 +00:00
PredictionOrderMethodNames
) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mMinPredictionOrderSpin = S . Id ( FEMinPredID )
. ToolTip ( XO ( " Minimal prediction order \n Optional \n -1 - default \n min - 0 \n max - 32 (with LPC) or 4 (without LPC) " ) )
. TieSpinCtrl ( _ ( " Min. PdO " ) , { wxT ( " /FileFormats/FFmpegMinPredOrder " ) , - 1 } , 32 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mMaxPredictionOrderSpin = S . Id ( FEMaxPredID )
. ToolTip ( XO ( " Maximal prediction order \n Optional \n -1 - default \n min - 0 \n max - 32 (with LPC) or 4 (without LPC) " ) )
. TieSpinCtrl ( _ ( " Max. PdO " ) , { wxT ( " /FileFormats/FFmpegMaxPredOrder " ) , - 1 } , 32 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mMinPartitionOrderSpin = S . Id ( FEMinPartOrderID )
. ToolTip ( XO ( " Minimal partition order \n Optional \n -1 - default \n min - 0 \n max - 8 " ) )
. TieSpinCtrl ( _ ( " Min. PtO " ) , { wxT ( " /FileFormats/FFmpegMinPartOrder " ) , - 1 } , 8 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2017-10-29 00:29:20 +00:00
mMaxPartitionOrderSpin = S . Id ( FEMaxPartOrderID )
. ToolTip ( XO ( " Maximal partition order \n Optional \n -1 - default \n min - 0 \n max - 8 " ) )
. TieSpinCtrl ( _ ( " Max. PtO " ) , { wxT ( " /FileFormats/FFmpegMaxPartOrder " ) , - 1 } , 8 , - 1 ) ;
2014-05-27 22:06:58 +00:00
2019-04-06 15:07:28 +00:00
/* i18n-hint: Abbreviates "Linear Predictive Coding",
but this text needs to be kept very short */
2014-05-27 22:06:58 +00:00
S . AddVariableText ( _ ( " Use LPC " ) ) ;
2019-04-06 15:07:28 +00:00
// PRL: This preference is not used anywhere!
2019-04-03 14:57:59 +00:00
S . Id ( FEUseLPCID ) . TieCheckBox ( { } , { wxT ( " /FileFormats/FFmpegUseLPC " ) , true } ) ;
2014-05-27 22:06:58 +00:00
}
S . EndMultiColumn ( ) ;
}
S . EndStatic ( ) ;
S . StartStatic ( _ ( " MPEG container options " ) , 0 ) ;
{
S . StartMultiColumn ( 4 , wxALIGN_LEFT ) ;
{
/* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
' Mux Rate ' is a parameter that has some bearing on compression ratio for MPEG
it has a hard to predict effect on the degree of compression */
2017-10-29 00:29:20 +00:00
mMuxRate = S . Id ( FEMuxRateID )
. ToolTip ( XO ( " Maximum bit rate of the multiplexed stream \n Optional \n 0 - default " ) )
. TieSpinCtrl ( _ ( " Mux Rate: " ) , { wxT ( " /FileFormats/FFmpegMuxRate " ) , 0 } , 10000000 , 0 ) ;
2014-05-27 22:06:58 +00:00
/* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
compression . It measures how big a chunk of audio is compressed in one piece . */
2017-10-29 00:29:20 +00:00
mPacketSize = S . Id ( FEPacketSizeID )
. ToolTip ( XO ( " Packet size \n Optional \n 0 - default " ) )
. TieSpinCtrl ( _ ( " Packet Size: " ) , { wxT ( " /FileFormats/FFmpegPacketSize " ) , 0 } , 10000000 , 0 ) ;
2014-05-27 22:06:58 +00:00
}
S . EndMultiColumn ( ) ;
}
S . EndStatic ( ) ;
//S.EndScroller();
S . SetBorder ( 5 ) ;
2019-07-15 09:52:22 +00:00
S . AddStandardButtons ( eOkButton | eCancelButton | eHelpButton ) ;
2014-05-27 22:06:58 +00:00
}
S . EndVerticalLay ( ) ;
}
S . EndMultiColumn ( ) ;
2010-01-23 19:44:49 +00:00
}
S . EndMultiColumn ( ) ;
S . EndVerticalLay ( ) ;
Layout ( ) ;
Fit ( ) ;
SetMinSize ( GetSize ( ) ) ;
Center ( ) ;
return ;
}
///
///
void ExportFFmpegOptions : : FindSelectedFormat ( wxString * * name , wxString * * longname )
{
// Get current selection
wxArrayInt selections ;
int n = mFormatList - > GetSelections ( selections ) ;
if ( n < = 0 ) return ;
// Get selected format short name
wxString selfmt = mFormatList - > GetString ( selections [ 0 ] ) ;
// Find it's index
2019-03-04 07:13:40 +00:00
int nFormat = make_iterator_range ( mFormatNames ) . index ( selfmt ) ;
2010-01-23 19:44:49 +00:00
if ( nFormat = = wxNOT_FOUND ) return ;
// Return short name and description
if ( name ! = NULL ) * name = & mFormatNames [ nFormat ] ;
if ( longname ! = NULL ) * longname = & mFormatLongNames [ nFormat ] ;
return ;
}
///
///
void ExportFFmpegOptions : : FindSelectedCodec ( wxString * * name , wxString * * longname )
{
// Get current selection
wxArrayInt selections ;
int n = mCodecList - > GetSelections ( selections ) ;
if ( n < = 0 ) return ;
// Get selected codec short name
wxString selcdc = mCodecList - > GetString ( selections [ 0 ] ) ;
// Find it's index
2019-03-04 07:13:40 +00:00
int nCodec = make_iterator_range ( mCodecNames ) . index ( selcdc ) ;
2010-01-23 19:44:49 +00:00
if ( nCodec = = wxNOT_FOUND ) return ;
// Return short name and description
if ( name ! = NULL ) * name = & mCodecNames [ nCodec ] ;
if ( longname ! = NULL ) * longname = & mCodecLongNames [ nCodec ] ;
}
///
///
2014-05-23 20:25:50 +00:00
int ExportFFmpegOptions : : FetchCompatibleCodecList ( const wxChar * fmt , AVCodecID id )
2010-01-23 19:44:49 +00:00
{
// By default assume that id is not in the list
int index = - 1 ;
// By default no codecs are compatible (yet)
2019-02-12 00:10:48 +00:00
mShownCodecNames . clear ( ) ;
mShownCodecLongNames . clear ( ) ;
2010-01-23 19:44:49 +00:00
// Clear the listbox
mCodecList - > Clear ( ) ;
// Zero - format is not found at all
int found = 0 ;
wxString str ( fmt ) ;
for ( int i = 0 ; CompatibilityList [ i ] . fmt ! = NULL ; i + + )
{
2019-03-10 18:12:35 +00:00
if ( str = = CompatibilityList [ i ] . fmt )
2010-01-23 19:44:49 +00:00
{
// Format is found in the list
found = 1 ;
2014-05-29 16:02:46 +00:00
if ( CompatibilityList [ i ] . codec = = AV_CODEC_ID_NONE )
2010-01-23 19:44:49 +00:00
{
2014-05-29 16:02:46 +00:00
// Format is found in the list and it is compatible with AV_CODEC_ID_NONE (means that it is compatible to anything)
2010-01-23 19:44:49 +00:00
found = 2 ;
break ;
}
// Find the codec, that is claimed to be compatible
2011-04-02 02:10:50 +00:00
AVCodec * codec = avcodec_find_encoder ( CompatibilityList [ i ] . codec ) ;
2010-01-23 19:44:49 +00:00
// If it exists, is audio and has encoder
2014-05-25 21:08:58 +00:00
if ( codec ! = NULL & & ( codec - > type = = AVMEDIA_TYPE_AUDIO ) & & av_codec_is_encoder ( codec ) )
2010-01-23 19:44:49 +00:00
{
2016-02-13 15:43:16 +00:00
// If it was selected - remember it's NEW index
2019-02-12 00:10:48 +00:00
if ( ( id > = 0 ) & & codec - > id = = id ) index = mShownCodecNames . size ( ) ;
mShownCodecNames . push_back ( wxString : : FromUTF8 ( codec - > name ) ) ;
mShownCodecLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mShownCodecNames . back ( ) , wxString : : FromUTF8 ( codec - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
}
// All codecs are compatible with this format
if ( found = = 2 )
{
AVCodec * codec = NULL ;
2014-10-09 22:12:51 +00:00
while ( ( codec = av_codec_next ( codec ) ) ! = NULL )
2010-01-23 19:44:49 +00:00
{
2014-05-25 21:08:58 +00:00
if ( codec - > type = = AVMEDIA_TYPE_AUDIO & & av_codec_is_encoder ( codec ) )
2010-01-23 19:44:49 +00:00
{
2019-09-01 11:41:24 +00:00
// MP2 is broken.
if ( codec - > id = = AV_CODEC_ID_MP2 )
continue ;
2019-03-04 07:13:40 +00:00
if ( ! make_iterator_range ( mShownCodecNames )
. contains ( wxString : : FromUTF8 ( codec - > name ) ) )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
if ( ( id > = 0 ) & & codec - > id = = id ) index = mShownCodecNames . size ( ) ;
mShownCodecNames . push_back ( wxString : : FromUTF8 ( codec - > name ) ) ;
mShownCodecLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mShownCodecNames . back ( ) , wxString : : FromUTF8 ( codec - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
}
}
// Format is not found - find format in libavformat and add it's default audio codec
2016-02-13 15:43:16 +00:00
// This allows us to provide limited support for NEW formats without modifying the compatibility list
2010-01-23 19:44:49 +00:00
else if ( found = = 0 )
{
wxCharBuffer buf = str . ToUTF8 ( ) ;
2011-04-02 02:10:50 +00:00
AVOutputFormat * format = av_guess_format ( buf , NULL , NULL ) ;
2010-01-23 19:44:49 +00:00
if ( format ! = NULL )
{
2011-04-02 02:10:50 +00:00
AVCodec * codec = avcodec_find_encoder ( format - > audio_codec ) ;
2014-05-25 21:08:58 +00:00
if ( codec ! = NULL & & ( codec - > type = = AVMEDIA_TYPE_AUDIO ) & & av_codec_is_encoder ( codec ) )
2010-01-23 19:44:49 +00:00
{
2019-02-12 00:10:48 +00:00
if ( ( id > = 0 ) & & codec - > id = = id ) index = mShownCodecNames . size ( ) ;
mShownCodecNames . push_back ( wxString : : FromUTF8 ( codec - > name ) ) ;
mShownCodecLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mShownCodecNames . back ( ) , wxString : : FromUTF8 ( codec - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
}
2016-02-13 15:43:16 +00:00
// Show NEW codec list
2010-01-23 19:44:49 +00:00
mCodecList - > Append ( mShownCodecNames ) ;
return index ;
}
///
///
2014-05-23 20:25:50 +00:00
int ExportFFmpegOptions : : FetchCompatibleFormatList ( AVCodecID id , wxString * selfmt )
2010-01-23 19:44:49 +00:00
{
int index = - 1 ;
2019-02-12 00:10:48 +00:00
mShownFormatNames . clear ( ) ;
mShownFormatLongNames . clear ( ) ;
2010-01-23 19:44:49 +00:00
mFormatList - > Clear ( ) ;
AVOutputFormat * ofmt = NULL ;
ofmt = NULL ;
wxArrayString FromList ;
// Find all formats compatible to this codec in compatibility list
for ( int i = 0 ; CompatibilityList [ i ] . fmt ! = NULL ; i + + )
{
2019-08-28 12:14:14 +00:00
if ( CompatibilityList [ i ] . codec = = id | | ( CompatibilityList [ i ] . codec = = AV_CODEC_ID_NONE ) )
2010-01-23 19:44:49 +00:00
{
2019-03-10 18:12:35 +00:00
if ( ( selfmt ! = NULL ) & & ( * selfmt = = CompatibilityList [ i ] . fmt ) ) index = mShownFormatNames . size ( ) ;
2019-02-12 00:10:48 +00:00
FromList . push_back ( CompatibilityList [ i ] . fmt ) ;
mShownFormatNames . push_back ( CompatibilityList [ i ] . fmt ) ;
2011-04-02 02:10:50 +00:00
AVOutputFormat * tofmt = av_guess_format ( wxString ( CompatibilityList [ i ] . fmt ) . ToUTF8 ( ) , NULL , NULL ) ;
2019-02-12 00:10:48 +00:00
if ( tofmt ! = NULL ) mShownFormatLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , CompatibilityList [ i ] . fmt , wxString : : FromUTF8 ( tofmt - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
bool found = false ;
if ( selfmt ! = NULL )
{
for ( int i = 0 ; CompatibilityList [ i ] . fmt ! = NULL ; i + + )
{
2019-03-10 18:12:35 +00:00
if ( * selfmt = = CompatibilityList [ i ] . fmt )
2010-01-23 19:44:49 +00:00
{
found = true ;
break ;
}
}
}
// Format was in the compatibility list
if ( found )
{
// Find all formats which have this codec as default and which are not in the list yet and add them too
2014-10-09 22:12:51 +00:00
while ( ( ofmt = av_oformat_next ( ofmt ) ) ! = NULL )
2010-01-23 19:44:49 +00:00
{
if ( ofmt - > audio_codec = = id )
{
wxString ofmtname = wxString : : FromUTF8 ( ofmt - > name ) ;
2018-10-10 18:09:10 +00:00
found = false ;
2019-02-12 00:10:48 +00:00
for ( unsigned int i = 0 ; i < FromList . size ( ) ; i + + )
2010-01-23 19:44:49 +00:00
{
2019-03-10 18:12:35 +00:00
if ( ofmtname = = FromList [ i ] )
2010-01-23 19:44:49 +00:00
{
found = true ;
break ;
}
}
if ( ! found )
{
2019-03-10 18:12:35 +00:00
if ( ( selfmt ! = NULL ) & &
( * selfmt = = wxString : : FromUTF8 ( ofmt - > name ) ) )
index = mShownFormatNames . size ( ) ;
2019-02-12 00:10:48 +00:00
mShownFormatNames . push_back ( wxString : : FromUTF8 ( ofmt - > name ) ) ;
mShownFormatLongNames . push_back ( wxString : : Format ( wxT ( " %s - %s " ) , mShownFormatNames . back ( ) , wxString : : FromUTF8 ( ofmt - > long_name ) ) ) ;
2010-01-23 19:44:49 +00:00
}
}
}
}
mFormatList - > Append ( mShownFormatNames ) ;
return index ;
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnDeletePreset ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
wxComboBox * preset = dynamic_cast < wxComboBox * > ( FindWindowById ( FEPresetID , this ) ) ;
wxString presetname = preset - > GetValue ( ) ;
2019-02-12 00:10:48 +00:00
if ( presetname . empty ( ) )
2010-01-23 19:44:49 +00:00
{
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " You can't delete a preset without name " ) ) ;
2010-01-23 19:44:49 +00:00
return ;
}
2019-12-07 19:30:07 +00:00
auto query = XO ( " Delete preset '%s'? " ) . Format ( presetname ) ;
int action = AudacityMessageBox (
query ,
XO ( " Confirm Deletion " ) ,
wxYES_NO | wxCENTRE ) ;
2010-01-23 19:44:49 +00:00
if ( action = = wxNO ) return ;
mPresets - > DeletePreset ( presetname ) ;
long index = preset - > FindString ( presetname ) ;
preset - > SetValue ( wxEmptyString ) ;
preset - > Delete ( index ) ;
2019-02-28 13:54:36 +00:00
mPresetNames . erase (
std : : find ( mPresetNames . begin ( ) , mPresetNames . end ( ) , presetname )
) ;
2010-01-23 19:44:49 +00:00
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnSavePreset ( wxCommandEvent & WXUNUSED ( event ) )
2019-07-15 09:52:22 +00:00
{ const bool kCheckForOverwrite = true ;
SavePreset ( kCheckForOverwrite ) ;
}
// Return false if failed to save.
bool ExportFFmpegOptions : : SavePreset ( bool bCheckForOverwrite )
2010-01-23 19:44:49 +00:00
{
wxComboBox * preset = dynamic_cast < wxComboBox * > ( FindWindowById ( FEPresetID , this ) ) ;
wxString name = preset - > GetValue ( ) ;
2019-02-12 00:10:48 +00:00
if ( name . empty ( ) )
2010-01-23 19:44:49 +00:00
{
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " You can't save a preset without a name " ) ) ;
2019-07-15 09:52:22 +00:00
return false ;
2010-01-23 19:44:49 +00:00
}
2019-07-15 09:52:22 +00:00
if ( bCheckForOverwrite & & ! mPresets - > OverwriteIsOk ( name ) )
return false ;
if ( ! mPresets - > SavePreset ( this , name ) )
return false ;
2017-10-09 05:03:14 +00:00
int index = mPresetNames . Index ( name , false ) ;
2010-01-23 19:44:49 +00:00
if ( index = = - 1 )
{
2019-02-12 00:10:48 +00:00
mPresetNames . push_back ( name ) ;
2010-01-23 19:44:49 +00:00
mPresetCombo - > Clear ( ) ;
2016-04-09 20:09:19 +00:00
mPresetCombo - > Append ( mPresetNames ) ;
mPresetCombo - > Select ( mPresetNames . Index ( name , false ) ) ;
2010-01-23 19:44:49 +00:00
}
2019-07-15 09:52:22 +00:00
return true ;
2010-01-23 19:44:49 +00:00
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnLoadPreset ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
wxComboBox * preset = dynamic_cast < wxComboBox * > ( FindWindowById ( FEPresetID , this ) ) ;
wxString presetname = preset - > GetValue ( ) ;
mShownFormatNames = mFormatNames ;
mShownFormatLongNames = mFormatLongNames ;
mFormatList - > Clear ( ) ;
mFormatList - > Append ( mFormatNames ) ;
mShownCodecNames = mCodecNames ;
mShownCodecLongNames = mCodecLongNames ;
mCodecList - > Clear ( ) ;
mCodecList - > Append ( mCodecNames ) ;
mPresets - > LoadPreset ( this , presetname ) ;
2015-09-04 15:01:09 +00:00
DoOnFormatList ( ) ;
DoOnCodecList ( ) ;
2010-01-23 19:44:49 +00:00
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnImportPresets ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
wxString path ;
2017-10-12 19:41:52 +00:00
FileDialogWrapper dlg ( this ,
2019-12-20 17:13:39 +00:00
XO ( " Select xml file with presets to import " ) ,
gPrefs - > Read ( wxT ( " /FileFormats/FFmpegPresetDir " ) ) ,
wxEmptyString ,
wxString ( _ ( " XML files (*.xml)|*.xml|All files|* " ) ) ,
wxFD_OPEN ) ;
2010-01-23 19:44:49 +00:00
if ( dlg . ShowModal ( ) = = wxID_CANCEL ) return ;
path = dlg . GetPath ( ) ;
mPresets - > ImportPresets ( path ) ;
2016-04-09 20:09:19 +00:00
mPresets - > GetPresetList ( mPresetNames ) ;
2010-01-23 19:44:49 +00:00
mPresetCombo - > Clear ( ) ;
2016-04-09 20:09:19 +00:00
mPresetCombo - > Append ( mPresetNames ) ;
2010-01-23 19:44:49 +00:00
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnExportPresets ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
2019-07-15 09:52:22 +00:00
const bool kCheckForOverwrite = true ;
// Bug 1180 save any pending preset before exporting the lot.
// If saving fails, don't try to export.
if ( ! SavePreset ( ! kCheckForOverwrite ) )
return ;
wxArrayString presets ;
mPresets - > GetPresetList ( presets ) ;
if ( presets . Count ( ) < 1 )
{
2019-12-07 19:30:07 +00:00
AudacityMessageBox ( XO ( " No presets to export " ) ) ;
2019-07-15 09:52:22 +00:00
return ;
}
2010-01-23 19:44:49 +00:00
wxString path ;
2017-10-12 19:41:52 +00:00
FileDialogWrapper dlg ( this ,
2019-12-20 17:13:39 +00:00
XO ( " Select xml file to export presets into " ) ,
gPrefs - > Read ( wxT ( " /FileFormats/FFmpegPresetDir " ) ) ,
wxEmptyString ,
wxString ( _ ( " XML files (*.xml)|*.xml|All files|* " ) ) ,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ) ;
2010-01-23 19:44:49 +00:00
if ( dlg . ShowModal ( ) = = wxID_CANCEL ) return ;
path = dlg . GetPath ( ) ;
mPresets - > ExportPresets ( path ) ;
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnAllFormats ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
mShownFormatNames = mFormatNames ;
mShownFormatLongNames = mFormatLongNames ;
mFormatList - > Clear ( ) ;
mFormatList - > Append ( mFormatNames ) ;
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnAllCodecs ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
mShownCodecNames = mCodecNames ;
mShownCodecLongNames = mCodecLongNames ;
mCodecList - > Clear ( ) ;
mCodecList - > Append ( mCodecNames ) ;
}
2019-09-01 11:41:24 +00:00
/// ReportIfBadCombination will trap
/// bad combinations of format and codec and report
/// using a message box.
/// We may later extend it to catch bad parameters too.
/// @return true iff a bad combination was reported
/// At the moment we don't trap unrecognised format
/// or codec. (We do not expect them to happen ever).
bool ExportFFmpegOptions : : ReportIfBadCombination ( )
{
wxString * selcdc = NULL ;
wxString * selcdclong = NULL ;
FindSelectedCodec ( & selcdc , & selcdclong ) ;
if ( selcdc = = NULL )
return false ; // unrecognised codec. Treated as OK
AVCodec * cdc = avcodec_find_encoder_by_name ( selcdc - > ToUTF8 ( ) ) ;
if ( cdc = = NULL )
return false ; // unrecognised codec. Treated as OK
wxString * selfmt = NULL ;
wxString * selfmtlong = NULL ;
FindSelectedFormat ( & selfmt , & selfmtlong ) ;
if ( selfmt = = NULL )
return false ; // unrecognised format; Treated as OK
// This is intended to test for illegal combinations.
// However, the list updating now seems to be working correctly
// making it impossible to select illegal combinations
bool bFound = false ;
for ( int i = 0 ; CompatibilityList [ i ] . fmt ! = NULL ; i + + )
{
if ( * selfmt = = CompatibilityList [ i ] . fmt )
{
if ( CompatibilityList [ i ] . codec = = cdc - > id | | ( CompatibilityList [ i ] . codec = = AV_CODEC_ID_NONE ) ) {
bFound = true ;
break ;
}
}
}
// We can put extra code in here, to disallow combinations
// We could also test for illegal parameters, and deliver
// custom error messages in that case.
// The below would make AAC codec disallowed.
//if( cdc->id == AV_CODEC_ID_AAC)
// bFound = false;
// Valid combination was found, so no reporting.
if ( bFound )
return false ;
2019-12-19 19:49:42 +00:00
AudacityMessageBox (
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2019-12-07 19:30:07 +00:00
XO ( " Format %s is not compatible with codec %s. " )
. Format ( * selfmt , * selcdc ) ,
2019-12-19 19:49:42 +00:00
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2019-12-07 19:30:07 +00:00
XO ( " Incompatible format and codec " ) ) ;
2019-09-01 11:41:24 +00:00
return true ;
}
2010-01-23 19:44:49 +00:00
void ExportFFmpegOptions : : EnableDisableControls ( AVCodec * cdc , wxString * selfmt )
{
int handled = - 1 ;
for ( int i = 0 ; apptable [ i ] . control ! = 0 ; i + + )
{
if ( apptable [ i ] . control ! = handled )
{
bool codec = false ;
bool format = false ;
2014-05-29 16:02:46 +00:00
if ( apptable [ i ] . codec = = AV_CODEC_ID_NONE ) codec = true ;
2010-01-23 19:44:49 +00:00
else if ( cdc ! = NULL & & apptable [ i ] . codec = = cdc - > id ) codec = true ;
2019-03-10 18:12:35 +00:00
if ( wxString : : FromUTF8 ( apptable [ i ] . format ) = = wxT ( " any " ) ) format = true ;
else if ( selfmt ! = NULL & &
* selfmt = = wxString : : FromUTF8 ( apptable [ i ] . format ) ) format = true ;
2010-01-23 19:44:49 +00:00
if ( codec & & format )
{
handled = apptable [ i ] . control ;
wxWindow * item = FindWindowById ( apptable [ i ] . control , this ) ;
if ( item ! = NULL ) item - > Enable ( apptable [ i ] . enable ) ;
}
}
}
}
void ExportFFmpegOptions : : DoOnFormatList ( )
{
wxString * selfmt = NULL ;
wxString * selfmtlong = NULL ;
FindSelectedFormat ( & selfmt , & selfmtlong ) ;
if ( selfmt = = NULL )
{
return ;
}
wxString * selcdc = NULL ;
wxString * selcdclong = NULL ;
FindSelectedCodec ( & selcdc , & selcdclong ) ;
2011-04-02 02:10:50 +00:00
AVOutputFormat * fmt = av_guess_format ( selfmt - > ToUTF8 ( ) , NULL , NULL ) ;
2010-01-23 19:44:49 +00:00
if ( fmt = = NULL )
{
//This shouldn't really happen
mFormatName - > SetLabel ( wxString ( _ ( " Failed to guess format " ) ) ) ;
return ;
}
2017-10-09 05:03:14 +00:00
mFormatName - > SetLabel ( wxString : : Format ( wxT ( " %s " ) , * selfmtlong ) ) ;
2010-01-23 19:44:49 +00:00
int selcdcid = - 1 ;
if ( selcdc ! = NULL )
{
2011-04-02 02:10:50 +00:00
AVCodec * cdc = avcodec_find_encoder_by_name ( selcdc - > ToUTF8 ( ) ) ;
2010-01-23 19:44:49 +00:00
if ( cdc ! = NULL )
{
selcdcid = cdc - > id ;
}
}
2017-10-09 05:03:14 +00:00
int newselcdc = FetchCompatibleCodecList ( * selfmt , ( AVCodecID ) selcdcid ) ;
2010-01-23 19:44:49 +00:00
if ( newselcdc > = 0 ) mCodecList - > Select ( newselcdc ) ;
AVCodec * cdc = NULL ;
if ( selcdc ! = NULL )
2011-04-02 02:10:50 +00:00
cdc = avcodec_find_encoder_by_name ( selcdc - > ToUTF8 ( ) ) ;
2010-01-23 19:44:49 +00:00
EnableDisableControls ( cdc , selfmt ) ;
Layout ( ) ;
Fit ( ) ;
return ;
}
void ExportFFmpegOptions : : DoOnCodecList ( )
{
wxString * selcdc = NULL ;
wxString * selcdclong = NULL ;
FindSelectedCodec ( & selcdc , & selcdclong ) ;
if ( selcdc = = NULL )
{
return ;
}
wxString * selfmt = NULL ;
wxString * selfmtlong = NULL ;
FindSelectedFormat ( & selfmt , & selfmtlong ) ;
2011-04-02 02:10:50 +00:00
AVCodec * cdc = avcodec_find_encoder_by_name ( selcdc - > ToUTF8 ( ) ) ;
2010-01-23 19:44:49 +00:00
if ( cdc = = NULL )
{
//This shouldn't really happen
2019-12-19 19:49:42 +00:00
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
2010-01-23 19:44:49 +00:00
mCodecName - > SetLabel ( wxString ( _ ( " Failed to find the codec " ) ) ) ;
return ;
}
2017-10-09 05:03:14 +00:00
mCodecName - > SetLabel ( wxString : : Format ( wxT ( " [%d] %s " ) , ( int ) cdc - > id , * selcdclong ) ) ;
2010-01-23 19:44:49 +00:00
if ( selfmt ! = NULL )
{
2011-04-02 02:10:50 +00:00
AVOutputFormat * fmt = av_guess_format ( selfmt - > ToUTF8 ( ) , NULL , NULL ) ;
2010-01-23 19:44:49 +00:00
if ( fmt = = NULL )
{
selfmt = NULL ;
selfmtlong = NULL ;
}
}
int newselfmt = FetchCompatibleFormatList ( cdc - > id , selfmt ) ;
if ( newselfmt > = 0 ) mFormatList - > Select ( newselfmt ) ;
EnableDisableControls ( cdc , selfmt ) ;
Layout ( ) ;
Fit ( ) ;
return ;
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnFormatList ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
DoOnFormatList ( ) ;
}
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnCodecList ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
DoOnCodecList ( ) ;
}
2019-07-15 09:52:22 +00:00
2010-01-23 19:44:49 +00:00
///
///
2013-08-25 21:51:26 +00:00
void ExportFFmpegOptions : : OnOK ( wxCommandEvent & WXUNUSED ( event ) )
2010-01-23 19:44:49 +00:00
{
2019-09-01 11:41:24 +00:00
if ( ReportIfBadCombination ( ) )
return ;
2010-01-23 19:44:49 +00:00
int selcdc = mCodecList - > GetSelection ( ) ;
int selfmt = mFormatList - > GetSelection ( ) ;
2014-05-27 21:36:01 +00:00
if ( selcdc > - 1 ) gPrefs - > Write ( wxT ( " /FileFormats/FFmpegCodec " ) , mCodecList - > GetString ( selcdc ) ) ;
2010-01-23 19:44:49 +00:00
if ( selfmt > - 1 ) gPrefs - > Write ( wxT ( " /FileFormats/FFmpegFormat " ) , mFormatList - > GetString ( selfmt ) ) ;
2012-08-02 06:03:19 +00:00
gPrefs - > Flush ( ) ;
2015-12-22 02:07:24 +00:00
2010-01-23 19:44:49 +00:00
ShuttleGui S ( this , eIsSavingToPrefs ) ;
PopulateOrExchange ( S ) ;
2015-12-22 02:07:24 +00:00
gPrefs - > Flush ( ) ;
2010-01-23 19:44:49 +00:00
EndModal ( wxID_OK ) ;
return ;
}
2019-07-15 09:52:22 +00:00
void ExportFFmpegOptions : : OnGetURL ( wxCommandEvent & WXUNUSED ( event ) )
{
2019-07-21 15:07:27 +00:00
HelpSystem : : ShowHelp ( this , wxT ( " Custom_FFmpeg_Export_Options " ) ) ;
2019-07-15 09:52:22 +00:00
}
2010-01-23 19:44:49 +00:00
# endif