1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 14:18:53 +02:00

TranslatableString for importer stream info...

... fixing some missed translations in OGG (and GStreamer too, if you care)
This commit is contained in:
Paul Licameli 2019-12-18 10:21:34 -05:00
parent 0d8c110320
commit 0300b49b37
10 changed files with 43 additions and 30 deletions

View File

@ -757,7 +757,9 @@ wxDialogWrapper( parent, id, title, position, size, style | wxRESIZE_BORDER )
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
vertSizer = uVertSizer.get();
auto choices = mFile->GetStreamInfo();
const auto choices = transform_container<wxArrayStringEx>(
mFile->GetStreamInfo(),
std::mem_fn( &TranslatableString::Translation ) );
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, choices, wxLB_EXTENDED | wxLB_ALWAYS_SB);
vertSizer->Add(StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5);

View File

@ -247,7 +247,7 @@ public:
///! Called by Import.cpp
///\return array of strings - descriptions of the streams
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
return mStreamInfo;
}
@ -267,7 +267,7 @@ private:
AVFormatContext *mFormatContext; //!< Format description, also contains metadata and some useful info
int mNumStreams; //!< mNumstreams is less or equal to mFormatContext->nb_streams
ScsPtr mScs; //!< Points to array of pointers to stream contexts, which may be shared with a decoder task.
wxArrayString mStreamInfo; //!< Array of stream descriptions. Length is mNumStreams
TranslatableStrings mStreamInfo; //!< Array of stream descriptions. Length is mNumStreams
wxInt64 mProgressPos; //!< Current timestamp, file position or whatever is used as first argument for Update()
wxInt64 mProgressLen; //!< Duration, total length or whatever is used as second argument for Update()
@ -436,7 +436,6 @@ bool FFmpegImportFileHandle::InitCodecs()
}
// Stream is decodeable and it is audio. Add it and its decription to the arrays
wxString strinfo;
int duration = 0;
if (sc->m_stream->duration > 0)
duration = sc->m_stream->duration * sc->m_stream->time_base.num / sc->m_stream->time_base.den;
@ -454,8 +453,16 @@ bool FFmpegImportFileHandle::InitCodecs()
{
lang.FromUTF8(tag->value);
}
strinfo.Printf(_("Index[%02x] Codec[%s], Language[%s], Bitrate[%s], Channels[%d], Duration[%d]"),
sc->m_stream->id,codec->name,lang,bitrate,(int)sc->m_stream->codec->channels,(int)duration);
auto strinfo = XO(
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
"Index[%02x] Codec[%s], Language[%s], Bitrate[%s], Channels[%d], Duration[%d]")
.Format(
sc->m_stream->id,
codec->name,
lang,
bitrate,
(int)sc->m_stream->codec->channels,
(int)duration);
mStreamInfo.push_back(strinfo);
mScs->get()[mNumStreams++] = std::move(sc);
}

View File

@ -157,9 +157,9 @@ public:
wxInt32 GetStreamCount() override { return 1; }
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
static wxArrayString empty;
static TranslatableStrings empty;
return empty;
}

View File

@ -174,7 +174,7 @@ public:
///! Called by Import.cpp
///\return array of strings - descriptions of the streams
const wxArrayString &GetStreamInfo() override;
const TranslatableStrings &GetStreamInfo() override;
///! Called by Import.cpp
///\param index - index of the stream in mStreamInfo and mStreams arrays
@ -215,7 +215,7 @@ public:
void OnNewSample(GStreamContext *c, GstSample *sample);
private:
wxArrayString mStreamInfo; //!< Array of stream descriptions. Length is the same as mStreams
TranslatableStrings mStreamInfo; //!< Array of stream descriptions. Length is the same as mStreams
Tags mTags; //!< Tags to be passed back to Audacity
TrackFactory *mTrackFactory; //!< Factory to create tracks when samples arrive
@ -892,7 +892,7 @@ GStreamerImportFileHandle::GetStreamCount()
// ----------------------------------------------------------------------------
// Return array of strings - descriptions of the streams
const wxArrayString &
const TranslatableStrings &
GStreamerImportFileHandle::GetStreamInfo()
{
return mStreamInfo;
@ -980,12 +980,12 @@ GStreamerImportFileHandle::Init()
GStreamContext *c = mStreams[i].get();
// Create stream info string
wxString strinfo;
strinfo.Printf(wxT("Index[%02d], Type[%s], Channels[%d], Rate[%d]"),
(unsigned int) i,
wxString::FromUTF8(c->mType.get()),
(int) c->mNumChannels,
(int) c->mSampleRate);
auto strinfo = XO("Index[%02d], Type[%s], Channels[%d], Rate[%d]")
.Format(
(unsigned int) i,
wxString::FromUTF8(c->mType.get()),
(int) c->mNumChannels,
(int) c->mSampleRate );
mStreamInfo.push_back(strinfo);
}

View File

@ -133,9 +133,9 @@ public:
wxInt32 GetStreamCount() override { return 1; }
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
static wxArrayString empty;
static TranslatableStrings empty;
return empty;
}

View File

@ -138,9 +138,9 @@ public:
wxInt32 GetStreamCount() override { return 1; }
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
static wxArrayString empty;
static TranslatableStrings empty;
return empty;
}

View File

@ -110,8 +110,12 @@ public:
for (int i = 0; i < mVorbisFile->links; i++)
{
wxString strinfo;
strinfo.Printf(wxT("Index[%02x] Version[%d], Channels[%d], Rate[%ld]"), (unsigned int) i,mVorbisFile->vi[i].version,mVorbisFile->vi[i].channels,mVorbisFile->vi[i].rate);
auto strinfo = XO("Index[%02x] Version[%d], Channels[%d], Rate[%ld]")
.Format(
(unsigned int) i,
mVorbisFile->vi[i].version,
mVorbisFile->vi[i].channels,
mVorbisFile->vi[i].rate);
mStreamInfo.push_back(strinfo);
mStreamUsage[i] = 0;
}
@ -132,7 +136,7 @@ public:
return 0;
}
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
return mStreamInfo;
}
@ -151,7 +155,7 @@ private:
std::unique_ptr<OggVorbis_File> mVorbisFile;
ArrayOf<int> mStreamUsage;
wxArrayString mStreamInfo;
TranslatableStrings mStreamInfo;
std::list<NewChannelGroup> mChannels;
sampleFormat mFormat;

View File

@ -104,9 +104,9 @@ public:
wxInt32 GetStreamCount() override { return 1; }
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
static wxArrayString empty;
static TranslatableStrings empty;
return empty;
}

View File

@ -146,7 +146,7 @@ public:
virtual wxInt32 GetStreamCount() = 0;
// Return stream descriptions list
virtual const wxArrayString &GetStreamInfo() = 0;
virtual const TranslatableStrings &GetStreamInfo() = 0;
// Set stream "import/don't import" flag
virtual void SetStreamUsage(wxInt32 StreamID, bool Use) = 0;

View File

@ -155,9 +155,9 @@ class QTImportFileHandle final : public ImportFileHandle
return 1;
}
const wxArrayString &GetStreamInfo() override
const TranslatableStrings &GetStreamInfo() override
{
static wxArrayString empty;
static TranslatableStrings empty;
return empty;
}