30#include <wx/textctrl.h>
48#if defined(WIN32) && _MSC_VER < 1900
49#define snprintf _snprintf
53#define FFMPEG_AUTO_RESAMPLE 1
74{ 32000, 44100, 48000, 0 };
77{ 8000, 11025, 16000, 22050, 44100, 0};
84 while(rates[index] != 0)
85 list.push_back(rates[index++]);
98const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AC3Options {
146 },
wxT(
"/FileFormats/AC3BitRate")
156const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AACOptions {
163 },
wxT(
"/FileFormats/AACQuality")
172const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AMRNBOptions {
198 },
wxT(
"/FileFormats/AMRNBBitRate")
212const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
OPUSOptions {
250 },
wxT(
"/FileFormats/OPUSBitrate")
258 },
wxT(
"/FileFormats/OPUSCompression")
281 },
wxT(
"/FileFormats/OPUSFrameDuration")
288 { std::string(
"off"), std::string(
"on"), std::string(
"constrained") },
289 {
XO(
"Off"),
XO(
"On"),
XO(
"Constrained") }
290 },
wxT(
"/FileFormats/OPUSVbrMode")
295 std::string(
"audio"),
297 { std::string(
"voip"), std::string(
"audio"), std::string(
"lowdelay") },
298 {
XO(
"VOIP"),
XO(
"Audio"),
XO(
"Low Delay") }
299 },
wxT(
"/FileFormats/OPUSApplication")
311 std::string(
"12000"),
319 XO(
"Super Wideband"),
322 },
wxT(
"/FileFormats/OPUSCutoff")
331const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
WMAOptions {
365 },
wxT(
"/FileFormats/WMABitRate")
370 { FELanguageID, {}, std::string() },
371 { FESampleRateID, {}, 0 },
372 { FEBitrateID, {}, 0 },
373 { FETagID, {}, std::string() },
374 { FEQualityID, {}, 0 },
375 { FECutoffID, {}, 0},
376 { FEBitReservoirID, {},
true },
377 { FEVariableBlockLenID, {},
true },
378 { FECompLevelID, {}, -1 },
379 { FEFrameSizeID, {}, 0 },
380 { FELPCCoeffsID, {}, 0 },
381 { FEMinPredID, {}, -1 },
382 { FEMaxPredID, {}, -1 },
383 { FEMinPartOrderID, {}, -1 },
384 { FEMaxPartOrderID, {}, -1 },
385 { FEPredOrderID, {}, 0 },
386 { FEMuxRateID, {}, 0 },
387 { FEPacketSizeID, {}, 0 },
388 { FECodecID, {}, std::string() },
389 { FEFormatID, {}, std::string() }
404 : mListener(listener)
414 mParent =
S.GetParent();
416 S.StartHorizontalLay(wxCENTER);
418 S.StartVerticalLay(wxCENTER, 0);
420 S.AddButton(
XXO(
"Open custom FFmpeg format options"))
422 S.StartMultiColumn(2, wxCENTER);
424 S.AddPrompt(
XXO(
"Current Format:"));
425 mFormat =
S.Name(
XXO(
"Current Format:"))
426 .Style(wxTE_READONLY).AddTextBox({},
wxT(
""), 25);
427 S.AddPrompt(
XXO(
"Current Codec:"));
428 mCodec =
S.Name(
XXO(
"Current Codec:"))
429 .Style(wxTE_READONLY).AddTextBox({},
wxT(
""), 25);
433 S.EndHorizontalLay();
435 S.EndHorizontalLay();
437 UpdateCodecAndFormat();
458 auto it = mValues.find(
id);
459 if(it != mValues.end())
476 auto it = mValues.find(FECodecID);
477 if(it == mValues.end())
480 const auto codecId = *std::get_if<std::string>(&it->second);
481 mAVCodec = mFFmpeg->CreateEncoder(codecId.c_str());
486 if(
const auto rates = mAVCodec->GetSupportedSamplerates())
493 mValues[FELanguageID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegLanguage"),
wxT(
"")).
ToUTF8());
494 mValues[FESampleRateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegSampleRate"), 0L));
495 mValues[FEBitrateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegBitRate"), 0L));
496 mValues[FETagID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegTag"),
wxT(
""))
497 .mb_str(wxConvUTF8));
498 mValues[FEQualityID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegQuality"), -99999L));
499 mValues[FECutoffID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegCutOff"), 0L));
500 mValues[FEBitReservoirID] = config.
ReadBool(
wxT(
"/FileFormats/FFmpegBitReservoir"),
true);
501 mValues[FEVariableBlockLenID] = config.
ReadBool(
wxT(
"/FileFormats/FFmpegVariableBlockLen"),
true);
502 mValues[FECompLevelID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegCompLevel"), -1L));
503 mValues[FEFrameSizeID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegFrameSize"), 0L));
505 mValues[FELPCCoeffsID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegLPCCoefPrec"), 0L));
506 mValues[FEMinPredID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMinPredOrder"), -1L));
507 mValues[FEMaxPredID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMaxPredOrder"), -1L));
508 mValues[FEMinPartOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMinPartOrder"), -1L));
509 mValues[FEMaxPartOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMaxPartOrder"), -1L));
510 mValues[FEPredOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegPredOrderMethod"), 0L));
511 mValues[FEMuxRateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMuxRate"), 0L));
512 mValues[FEPacketSizeID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegPacketSize"), 0L));
513 mValues[FECodecID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegCodec")));
514 mValues[FEFormatID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegFormat")));
547 if(!CheckFFmpeg(
true))
552 auto pWin = wxGetTopLevelParent( mParent );
555 auto pWin = wxTheApp->GetTopWindow();
566 UpdateCodecAndFormat();
568 mListener->OnSampleRateListChange();
571 wxWindow *mParent {
nullptr};
572 wxTextCtrl *mFormat {
nullptr};
573 wxTextCtrl *mCodec {
nullptr};
590 bool Init(
const char *shortname,
593 const Tags *metadata,
604 double startTime,
double stopTime,
628 int16_t* audio_samples,
673 double t0,
double t1,
bool selectedOnly,
676 const Tags* tags)
override;
689 std::unique_ptr<ExportOptionsEditor>
701 mutable std::shared_ptr<FFmpegFunctions>
mFFmpeg;
710 : mFFmpeg(
std::move(ffmpeg))
712 , mChannels(numChannels)
713 , mSubFormat(subFormat)
730 int avfver =
mFFmpeg ?
mFFmpeg->AVFormatVersion.GetIntVersion() : 0;
734 for (newfmt = 0; newfmt <
FMT_LAST; newfmt++)
741 auto avoformat =
mFFmpeg->GuessOutputFormat(shortname.mb_str(),
nullptr,
nullptr);
744 if (avoformat == NULL || avcodec == NULL)
757 formatInfo.extensions.push_back(
wxT(
"3gp"));
758 formatInfo.extensions.push_back(
wxT(
"m4r"));
759 formatInfo.extensions.push_back(
wxT(
"mp4"));
762 formatInfo.extensions.push_back(
wxT(
"asf"));
763 formatInfo.extensions.push_back(
wxT(
"wmv"));
772 formatInfo.canMetaData = canmeta && (canmeta ==
AV_CANMETA || canmeta <= avfver);
780std::unique_ptr<ExportOptionsEditor>
786 return std::make_unique<PlainExportOptionsEditor>(
AACOptions, listener);
788 return std::make_unique<PlainExportOptionsEditor>(
793 return std::make_unique<PlainExportOptionsEditor>(
798 return std::make_unique<PlainExportOptionsEditor>(
OPUSOptions, listener);
800 return std::make_unique<PlainExportOptionsEditor>(
805 return std::make_unique<ExportOptionsFFmpegCustomEditor>(listener);
841 return std::make_unique<FFmpegExportProcessor>(
mFFmpeg,
format);
848 const Tags *metadata,
857 const auto path =
mName.GetFullPath();
860 throw ExportException(
_(
"FFmpeg : ERROR - Can't determine format description for file \"%s\".").
Format(path));
867 throw ExportException(
_(
"FFmpeg : ERROR - Can't allocate output format context."));
877 throw ExportException(
_(
"FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."));
903 throw ExportException(
_(
"FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d.")
904 .
Format(path,
static_cast<int>(result)));
915 if (metadata == NULL)
921 const auto avfver =
mFFmpeg->AVFormatVersion.GetIntVersion();
922 if (canmeta && (canmeta ==
AV_CANMETA || canmeta <= avfver))
934 throw ExportException(
XO(
"FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d.")
944 if (lowrate && highrate)
946 if (rate < lowrate || rate > highrate)
969 std::unique_ptr<AVCodecWrapper> codec;
1023 options.
Set(
"b", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDBitRate,
"128000"), 0);
1024 options.
Set(
"vbr", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDVBRMode,
"on"), 0);
1025 options.
Set(
"compression_level", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDCompression,
"10"), 0);
1027 options.
Set(
"application", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDApplication,
"audio"), 0);
1028 options.
Set(
"cutoff", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDCutoff,
"0"), 0);
1029 options.
Set(
"mapping_family",
mChannels <= 2 ?
"0" :
"255", 0);
1050 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FELanguageID), 0);
1064 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FETagID).c_str());
1073 options.
Set(
"reservoir",
"1", 0);
1088 "lpc_coeff_precision",
1091 "min_prediction_order",
1094 "max_prediction_order",
1097 "min_partition_order",
1100 "max_partition_order",
1103 "prediction_order_method",
1112 codec =
mFFmpeg->CreateEncoder(
1113 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FECodecID).c_str());
1151 codec =
mFFmpeg->CreateEncoder(
"ac3_fixed");
1163 throw ExportException(
XO(
"FFmpeg cannot find audio codec 0x%x.\nSupport for this codec is probably not compiled in.")
1164 .
Format(
static_cast<const unsigned int>(codecID.value))
1168 if (codec->GetSampleFmts()) {
1193 if (codec->GetSupportedSamplerates())
1198 std::vector<int> rates;
1201 while (codec->GetSupportedSamplerates()[i] &&
1202 codec->GetSupportedSamplerates()[i] != 7350)
1204 rates.push_back(codec->GetSupportedSamplerates()[i++]);
1218 mSampleRate, 0, 0, codec->GetSupportedSamplerates()))
1221 0,
mSampleRate, 0, 0, codec->GetSupportedSamplerates());
1248 errmsg =
XO(
"The codec reported a generic error (EPERM)");
1251 errmsg =
XO(
"The codec reported an invalid parameter (EINVAL)");
1255 mFFmpeg->av_strerror(rc, buf,
sizeof(buf));
1261 .
Format(codec->GetName(), codecID.value, errmsg)
1271 wxT(
"FFmpeg : Audio Output Codec Frame Size: %d samples."),
1285 throw ExportException(
_(
"FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."));
1308 mFFmpeg->av_interleaved_write_frame(
1311 throw ExportException(
_(
"FFmpeg : ERROR - Couldn't write audio frame to output file."));
1320 int i, ch, buffer_size, ret, got_output = 0;
1323 std::unique_ptr<AVFrameWrapper> frame;
1325 if (audio_samples) {
1326 frame =
mFFmpeg->CreateAVFrameWrapper();
1331 frame->SetSamplesCount(nb_samples);
1335 buffer_size =
mFFmpeg->av_samples_get_buffer_size(
1339 if (buffer_size < 0) {
1340 throw ExportException(
_(
"FFmpeg : ERROR - Could not get sample buffer size"));
1343 samples =
mFFmpeg->CreateMemoryBuffer<uint8_t>(buffer_size);
1345 if (samples.empty()) {
1346 throw ExportException(
_(
"FFmpeg : ERROR - Could not allocate bytes for samples buffer"));
1349 ret =
mFFmpeg->avcodec_fill_audio_frame(
1361 for (i = 0; i < nb_samples; i++) {
1366 ((uint8_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount]/258 + 128;
1369 ((uint8_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount]/258 + 128;
1372 ((int16_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount];
1375 ((int16_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount];
1378 ((int32_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount]<<16;
1381 ((int32_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount]<<16;
1384 ((
float*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount] / 32767.0;
1387 ((
float*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount] / 32767.;
1401 if (
mFFmpeg->avcodec_send_frame !=
nullptr)
1403 ret =
mFFmpeg->avcodec_send_frame(
1405 frame ? frame->GetWrappedValue() :
nullptr);
1409 ret =
mFFmpeg->avcodec_receive_packet(
1427 ret =
mFFmpeg->avcodec_encode_audio2(
1429 frame ? frame->GetWrappedValue() :
nullptr, &got_output);
1440 mFFmpeg->av_strerror(ret, buf,
sizeof(buf));
1457 std::unique_ptr<AVPacketWrapper> pkt =
mFFmpeg->CreateAVPacketWrapper();
1459 const int nFifoBytes =
mFFmpeg->av_fifo_size(
1462 int encodeResult = 0;
1484 frame_size = nFifoBytes /
1488 wxLogDebug(
wxT(
"FFmpeg : Audio FIFO still contains %d bytes, writing %d sample frame ..."),
1489 nFifoBytes, frame_size);
1503 wxLogDebug(
wxT(
"FFmpeg : Reading from Audio FIFO failed, aborting"));
1515 if (encodeResult < 0) {
1519 else if (encodeResult == 0)
1536 const auto frameSize = numSamples *
sizeof(int16_t) *
mChannels;
1537 int nBytesToWrite = 0;
1538 uint8_t *pRawSamples =
nullptr;
1542 nBytesToWrite = frameSize;
1543 pRawSamples = (uint8_t*)pFrame;
1549 ret =
mFFmpeg->av_fifo_generic_write(
1550 mEncAudioFifo->GetWrappedValue(), pRawSamples, nBytesToWrite,
nullptr);
1552 if (ret != nBytesToWrite) {
1557 throw ExportException(
_(
"FFmpeg : ERROR - nAudioFrameSizeOut too large."));
1563 ret =
mFFmpeg->av_fifo_generic_read(
1565 nAudioFrameSizeOut,
nullptr);
1567 std::unique_ptr<AVPacketWrapper> pkt =
mFFmpeg->CreateAVPacketWrapper();
1580 : mFFmpeg(
std::move(ffmpeg))
1588 double t0,
double t1,
bool selectionOnly,
1591 const Tags* metadata)
1598 throw ExportException(
_(
"Properly configured FFmpeg is required to proceed.\nYou can configure it at Preferences > Libraries."));
1604 throw ExportException(
XO(
"Attempted to export %d channels, but maximum number of channels for selected output format is %d")
1614 if (adjustedFormatIndex >=
FMT_LAST) {
1621 shortname = ExportPluginHelpers::GetParameterValue<std::string>(parameters, FEFormatID,
"matroska");
1623 context.exporter = std::make_unique<FFmpegExporter>(
mFFmpeg, fName, channels, adjustedFormatIndex);
1636 context.status = selectionOnly
1637 ?
XO(
"Exporting selected audio as %s")
1639 :
XO(
"Exporting the audio as %s")
1651 auto pcmNumSamples =
context.mixer->Process();
1652 if (pcmNumSamples == 0)
1655 short *pcmBuffer = (
short *)
context.mixer->GetBuffer();
1657 if (!
context.exporter->EncodeAudioFrame(pcmBuffer, pcmNumSamples))
1668 if ( !
context.exporter->Finalize() )
1670 return exportResult;
1677 memcpy(
field,value.ToUTF8(),(
int)strlen(value.ToUTF8()) >
size -1 ?
size -1 : strlen(value.ToUTF8()));
1683 memcpy(
field,value.mb_str(),(
int)strlen(value.mb_str()) >
size -1 ?
size -1 : strlen(value.mb_str()));
1718 wxString value = tags->
GetTag(tag);
1734#if defined(FFMPEG_AUTO_RESAMPLE)
1735 std::vector<int> rates;
1742 std::sort(rates.begin(), rates.end());
1745 for (
auto i : rates)
1763 S.StartVerticalLay();
1766 S.StartStatic(
XO(
"Resample"));
1768 S.StartHorizontalLay(wxALIGN_CENTER,
false);
1773"The project sample rate (%d) is not supported by the current output\nfile format. ")
1776"The project sample rate (%d) and bit rate (%d kbps) combination is not\nsupported by the current output file format. ")
1777 .
Format( rate, bitrate/1000))
1778 +
XO(
"You may resample to one of the rates below.")
1781 S.EndHorizontalLay();
1783 S.StartHorizontalLay(wxALIGN_CENTER,
false);
1785 choice =
S.AddChoice(
XO(
"Sample Rates"),
1791 if ((!lowrate ||
label >= lowrate) && (!highrate ||
label <= highrate))
1801 std::max( 0, selected )
1804 S.EndHorizontalLay();
1808 S.AddStandardButtons();
1814 d.SetMinSize(d.GetSize());
1817 if (d.ShowModal() == wxID_CANCEL) {
1821 return wxAtoi(choice->GetStringSelection());
1826 []{
return std::make_unique< ExportFFmpeg >(); }
@ AUDACITY_AV_CODEC_ID_AC3
@ AUDACITY_AV_CODEC_ID_AAC
const TranslatableString name
void AddStringTagUTF8(char field[], int size, wxString value)
static ExportPluginRegistry::RegisteredPlugin sRegisteredPlugin
void AddStringTagANSI(char field[], int size, wxString value)
static int AdjustFormatIndex(int format)
static const std::vector< int > sampRates
TranslatableString n_kbps(int n)
std::variant< bool, int, double, std::string > ExportValue
A type of option values (parameters) used by exporting plugins.
bool FindFFmpegLibs(wxWindow *parent)
bool LoadFFmpeg(bool showerror)
std::vector< T, AVAllocator< T > > AVDataBuffer
#define AUDACITY_FF_PROFILE_AAC_LOW
#define AUDACITY_AV_CODEC_CAP_SMALL_LAST_FRAME
#define AUDACITY_AV_CODEC_FLAG_GLOBAL_HEADER
#define AUDACITY_AVERROR(e)
#define AUDACITY_FF_COMPLIANCE_EXPERIMENTAL
#define AUDACITY_AVERROR_EOF
#define AUDACITY_FF_QP2LAMBDA
#define AUDACITY_AV_CODEC_FLAG_QSCALE
#define AUDACITY_AVFMT_GLOBALHEADER
#define AUDACITY_AV_NOPTS_VALUE
#define AUDACITY_AVFMT_NOFILE
@ AUDACITY_AV_SAMPLE_FMT_S32P
signed 32 bits, planar
@ AUDACITY_AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AUDACITY_AV_SAMPLE_FMT_FLTP
float, planar
@ AUDACITY_AV_SAMPLE_FMT_NONE
@ AUDACITY_AV_SAMPLE_FMT_S16
signed 16 bits
@ AUDACITY_AV_SAMPLE_FMT_S32
signed 32 bits
@ AUDACITY_AV_SAMPLE_FMT_FLT
float
@ AUDACITY_AV_SAMPLE_FMT_U8
unsigned 8 bits
@ AUDACITY_AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
XXO("&Cut/Copy/Paste Toolbar")
audacity::BasicSettings * gPrefs
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
void Set(const std::string_view &key, const std::string &value, int flags=0) noexcept
virtual void ResetData() noexcept=0
virtual void SetStreamIndex(int index) noexcept=0
virtual int GetDuration() const noexcept=0
virtual void RescalePresentationTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept=0
virtual int64_t GetDecompressionTimestamp() const noexcept=0
AVPacket * GetWrappedValue() noexcept
virtual void RescaleDecompressionTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept=0
virtual void RescaleDuration(AudacityAVRational bq, AudacityAVRational cq) noexcept=0
virtual int64_t GetPresentationTimestamp() const noexcept=0
virtual void ResetTimestamps() noexcept=0
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Controlling class for FFmpeg exporting. Creates the options dialog of the appropriate type,...
int GetFormatCount() const override
bool CheckFileName(wxFileName &filename, int format=0) const override
Callback, called from GetFilename.
std::unique_ptr< ExportProcessor > CreateProcessor(int format) const override
std::unique_ptr< ExportOptionsEditor > CreateOptionsEditor(int format, ExportOptionsEditor::Listener *listener) const override
Creates format-dependent options editor, that is used to create a valid set of parameters to be used ...
std::vector< FormatInfo > mFormatInfos
FormatInfo GetFormatInfo(int index) const override
Returns FormatInfo structure for given index if it's valid, or a default one. FormatInfo::format isn'...
std::shared_ptr< FFmpegFunctions > mFFmpeg
Custom FFmpeg export dialog.
static ExposedFormat fmts[]
List of export types.
Listener object that is used to report on option changes.
Editor objects are used to retrieve a set of export options, and configure exporting parameters accor...
std::vector< int > SampleRateList
static T GetParameterValue(const ExportProcessor::Parameters ¶meters, int id, T defaultValue=T())
static ExportResult UpdateProgress(ExportProcessorDelegate &delegate, Mixer &mixer, double t0, double t1)
Sends progress update to delegate and retrieves state update from it. Typically used inside each expo...
static std::unique_ptr< Mixer > CreateMixer(const TrackList &tracks, bool selectionOnly, double startTime, double stopTime, unsigned numOutChannels, size_t outBufferSize, bool outInterleaved, double outRate, sampleFormat outFormat, MixerOptions::Downmix *mixerSpec)
virtual void SetStatusString(const TranslatableString &str)=0
std::vector< std::tuple< ExportOptionID, ExportValue > > Parameters
std::shared_ptr< FFmpegFunctions > mFFmpeg
TranslatableString status
ExportResult Process(ExportProcessorDelegate &delegate) override
FFmpegExportProcessor(std::shared_ptr< FFmpegFunctions > ffmpeg, int format)
struct FFmpegExportProcessor::@149 context
std::unique_ptr< Mixer > mixer
bool Initialize(AudacityProject &project, const Parameters ¶meters, const wxFileNameWrapper &filename, double t0, double t1, bool selectedOnly, double sampleRate, unsigned channels, MixerOptions::Downmix *mixerSpec, const Tags *tags) override
Called before start processing.
std::unique_ptr< FFmpegExporter > exporter
bool CheckSampleRate(int rate, int lowrate, int highrate, const int *sampRates)
Check whether or not current project sample rate is compatible with the export codec.
FFmpegExporter(std::shared_ptr< FFmpegFunctions > ffmpeg, const wxFileNameWrapper &filename, int numChannels, int subformat)
bool Finalize()
Flushes audio encoder.
std::unique_ptr< AVFormatContextWrapper > mEncFormatCtx
std::unique_ptr< AVFifoBufferWrapper > mEncAudioFifo
bool EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
Encodes audio.
std::shared_ptr< FFmpegFunctions > mFFmpeg
bool Init(const char *shortname, AudacityProject *project, int sampleRate, const Tags *metadata, const ExportProcessor::Parameters ¶meters)
Format initialization.
int mEncAudioFifoOutBufSize
std::unique_ptr< AVStreamWrapper > mEncAudioStream
bool AddTags(const Tags *metadata)
Writes metadata.
int EncodeAudio(AVPacketWrapper &pkt, int16_t *audio_samples, int nb_samples)
void SetMetadata(const Tags *tags, const char *name, const wxChar *tag)
Sets individual metadata values.
AVDataBuffer< int16_t > mEncAudioFifoOutBuf
int AskResample(int bitrate, int rate, int lowrate, int highrate, const int *sampRates)
Asks user to resample the project or cancel the export procedure.
void WritePacket(AVPacketWrapper &packet)
static constexpr auto MaxAudioPacketSize
std::unique_ptr< Mixer > CreateMixer(const TrackList &tracks, bool selectionOnly, double startTime, double stopTime, MixerOptions::Downmix *mixerSpec)
bool InitCodecs(int sampleRate, const ExportProcessor::Parameters ¶meters)
Codec initialization.
std::unique_ptr< AVCodecContextWrapper > mEncAudioCodecCtx
std::unique_ptr< AVOutputFormatWrapper > mEncFormatDesc
A matrix of booleans, one row per input channel, column per output.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
static TrackList & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
int GetOptionsCount() const override
void UpdateCodecAndFormat()
void Store(audacity::BasicSettings &settings) const override
std::unique_ptr< AVCodecWrapper > mAVCodec
ExportOptionsFFmpegCustomEditor(ExportOptionsEditor::Listener *listener=nullptr)
void Load(const audacity::BasicSettings &config) override
bool GetValue(int id, ExportValue &value) const override
bool GetOption(int, ExportOption &) const override
bool CheckFFmpeg(bool showError)
SampleRateList GetSampleRateList() const override
bool SetValue(int id, const ExportValue &value) override
void OnOpen(const wxCommandEvent &)
void PopulateUI(ShuttleGui &S) override
std::unordered_map< int, ExportValue > mValues
bool TransferDataFromWindow() override
std::shared_ptr< FFmpegFunctions > mFFmpeg
Base class for objects that provide facility to store data persistently, and access it with string ke...
bool ReadBool(const wxString &key, bool defaultValue) const
virtual bool Read(const wxString &key, bool *value) const =0
void SetName(const TranslatableString &title)
THEME_RESOURCES_API void Load()
constexpr auto sampleRate
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AMRNBOptions
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AC3Options
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AACOptions
@ OPUSOptionIDCompression
@ OPUSOptionIDApplication
@ OPUSOptionIDFrameDuration
const int iAC3SampleRates[]
const int iWMASampleRates[]
const std::vector< ExportOption > FFmpegOptions
TranslatableString f_kbps(double d)
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > OPUSOptions
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > WMAOptions
ExportOptionsEditor::SampleRateList ToSampleRateList(const int *rates)
std::string ToUTF8(const std::wstring &wstr)
A type that provides a description of an exporting option. Isn't allowed to change except non-type re...
@ TypeEnum
List/enum option. values holds items, and names text to be displayed.
@ TypeRange
Range option. values holds [min, max].
static std::shared_ptr< FFmpegFunctions > Load(bool fromUserPathOnly=false)