1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Fix all remaining misuses of macro _ in static initializers...

... I found them using a rewritten macro _ that dynamically checked
that translations have been initialized.  But I do not commit that changed
macro.
This commit is contained in:
Paul Licameli
2017-09-29 20:14:37 -04:00
parent c94222ff54
commit 6a8bba0a99
8 changed files with 188 additions and 109 deletions

View File

@@ -223,7 +223,7 @@ ExportFFmpeg::ExportFFmpeg()
}
SetMaxChannels(ExportFFmpegOptions::fmts[newfmt].maxchannels,fmtindex);
SetDescription(ExportFFmpegOptions::fmts[newfmt].description,fmtindex);
SetDescription(ExportFFmpegOptions::fmts[newfmt].Description(), fmtindex);
int canmeta = ExportFFmpegOptions::fmts[newfmt].canmetadata;
if (canmeta && (canmeta == AV_VERSION_INT(-1,-1,-1) || canmeta <= avfver))
@@ -872,8 +872,8 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
{
ProgressDialog progress(wxFileName(fName).GetName(),
selectionOnly ?
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].description) :
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].description));
wxString::Format(_("Exporting selected audio as %s"), ExportFFmpegOptions::fmts[mSubFormat].Description()) :
wxString::Format(_("Exporting entire file as %s"), ExportFFmpegOptions::fmts[mSubFormat].Description()));
while (updateResult == ProgressResult::Success) {
auto pcmNumSamples = mixer->Process(pcmBufferSize);

View File

@@ -61,6 +61,7 @@
#include "../Prefs.h"
#include "../Project.h"
#include "../Tags.h"
#include "../TranslatableStringArray.h"
#include "Export.h"
@@ -1191,23 +1192,44 @@ int ExportFFmpegOptions::iAACProfileValues[] = {
};
/// Names of AAC profiles to be displayed
const wxChar *ExportFFmpegOptions::iAACProfileNames[] = {
_("LC"),
_("Main"),
/*_("SSR"),*/ //SSR is not supported
_("LTP")
};
static wxString iAACProfileNames(int index)
{
static const wxString names[] = {
XO("LC"),
XO("Main"),
/*_("SSR"),*/ //SSR is not supported
XO("LTP")
};
class NamesArray final : public TranslatableStringArray
{
void Populate() override
{
for (auto &name : names)
mContents.push_back( wxGetTranslation( name ) );
}
};
static NamesArray theArray;
return theArray.Get()[ index ];
}
/// List of export types
ExposedFormat ExportFFmpegOptions::fmts[] =
{
{FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_VERSION_INT(-1,-1,-1), true, _("M4A (AAC) Files (FFmpeg)"), AV_CODEC_ID_AAC, true},
{FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7, AV_VERSION_INT(0,0,0), false, _("AC3 Files (FFmpeg)"), AV_CODEC_ID_AC3, true},
{FMT_AMRNB, wxT("AMRNB"), wxT("amr"), wxT("amr"), 1, AV_VERSION_INT(0,0,0), false, _("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, _("WMA (version 2) Files (FFmpeg)"), AV_CODEC_ID_WMAV2, true},
{FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_VERSION_INT(-1,-1,-1), true, _("Custom FFmpeg Export"), AV_CODEC_ID_NONE, true}
{FMT_M4A, wxT("M4A"), wxT("m4a"), wxT("ipod"), 48, AV_VERSION_INT(-1,-1,-1), true, XO("M4A (AAC) Files (FFmpeg)"), AV_CODEC_ID_AAC, true},
{FMT_AC3, wxT("AC3"), wxT("ac3"), wxT("ac3"), 7, AV_VERSION_INT(0,0,0), false, XO("AC3 Files (FFmpeg)"), 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},
{FMT_OTHER, wxT("FFMPEG"), wxT(""), wxT(""), 255, AV_VERSION_INT(-1,-1,-1), true, XO("Custom FFmpeg Export"), AV_CODEC_ID_NONE, true}
};
wxString ExposedFormat::Description() const
{
return wxGetTranslation(description_);
}
/// 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 };
@@ -1297,7 +1319,31 @@ ApplicableFor ExportFFmpegOptions::apptable[] =
};
/// Prediction order method - names. Labels are indices of this array.
const wxChar *ExportFFmpegOptions::PredictionOrderMethodNames[] = { _("Estimate"), _("2-level"), _("4-level"), _("8-level"), _("Full search"), _("Log search")};
static wxString PredictionOrderMethodNames(int index)
{
static const wxString names[] = {
XO("Estimate"),
XO("2-level"),
XO("4-level"),
XO("8-level"),
XO("Full search"),
XO("Log search")
};
class NamesArray final : public TranslatableStringArray
{
void Populate() override
{
for (auto &name : names)
mContents.push_back( wxGetTranslation( name ) );
}
};
static NamesArray theArray;
return theArray.Get()[ index ];
}
ExportFFmpegOptions::~ExportFFmpegOptions()
@@ -1325,12 +1371,12 @@ ExportFFmpegOptions::ExportFFmpegOptions(wxWindow *parent)
for (unsigned int i = 0; i < 6; i++)
{
mPredictionOrderMethodLabels.Add(i);
mPredictionOrderMethodNames.Add(wxString::Format(wxT("%s"),PredictionOrderMethodNames[i]));
mPredictionOrderMethodNames.Add(wxString::Format(wxT("%s"),PredictionOrderMethodNames(i)));
}
for (unsigned int i=0; i < (sizeof(iAACProfileValues)/sizeof(int)); i++)
{
mProfileNames.Add(wxString::Format(wxT("%s"),iAACProfileNames[i]));
mProfileNames.Add(wxString::Format(wxT("%s"),iAACProfileNames(i)));
mProfileLabels.Add(iAACProfileValues[i]);
}

View File

@@ -44,9 +44,11 @@ struct ExposedFormat
unsigned maxchannels; //!< how many channels this format could handle
int canmetadata; //!< !=0 if format supports metadata, -1 any avformat version, otherwise version support added
bool canutf8; //!< true if format supports metadata in UTF-8, false otherwise
const wxChar *description; //!< format description (will be shown in export dialog)
const wxChar *description_; //!< format description (will be shown in export dialog) (untranslated!)
AVCodecID codecid; //!< codec ID (see libavcodec/avcodec.h)
bool compiledIn; //!< support for this codec/format is compiled in (checked at runtime)
wxString Description() const; // get translation
};
@@ -199,11 +201,9 @@ public:
// Static tables
static CompatibilityEntry CompatibilityList[];
static int iAACProfileValues[];
static const wxChar *iAACProfileNames[];
static ExposedFormat fmts[];
static const int iAACSampleRates[];
static ApplicableFor apptable[];
static const wxChar *PredictionOrderMethodNames[];
private: