31#include <wx/textctrl.h>
49#if defined(WIN32) && _MSC_VER < 1900
50#define snprintf _snprintf
54#define FFMPEG_AUTO_RESAMPLE 1
75{ 32000, 44100, 48000, 0 };
78{ 8000, 11025, 16000, 22050, 44100, 0};
85 while(rates[index] != 0)
86 list.push_back(rates[index++]);
99const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AC3Options {
147 },
wxT(
"/FileFormats/AC3BitRate")
157const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AACOptions {
164 },
wxT(
"/FileFormats/AACQuality")
173const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
AMRNBOptions {
199 },
wxT(
"/FileFormats/AMRNBBitRate")
203#ifdef SHOW_FFMPEG_OPUS_EXPORT
207 OPUSOptionIDCompression,
214const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
OPUSOptions {
252 },
wxT(
"/FileFormats/OPUSBitrate")
256 OPUSOptionIDCompression,
XO(
"Compression"),
260 },
wxT(
"/FileFormats/OPUSCompression")
283 },
wxT(
"/FileFormats/OPUSFrameDuration")
290 { std::string(
"off"), std::string(
"on"), std::string(
"constrained") },
291 {
XO(
"Off"),
XO(
"On"),
XO(
"Constrained") }
292 },
wxT(
"/FileFormats/OPUSVbrMode")
297 std::string(
"audio"),
299 { std::string(
"voip"), std::string(
"audio"), std::string(
"lowdelay") },
300 {
XO(
"VOIP"),
XO(
"Audio"),
XO(
"Low Delay") }
301 },
wxT(
"/FileFormats/OPUSApplication")
313 std::string(
"12000"),
321 XO(
"Super Wideband"),
324 },
wxT(
"/FileFormats/OPUSCutoff")
334const std::initializer_list<PlainExportOptionsEditor::OptionDesc>
WMAOptions {
368 },
wxT(
"/FileFormats/WMABitRate")
373 { FELanguageID, {}, std::string() },
374 { FESampleRateID, {}, 0 },
375 { FEBitrateID, {}, 0 },
376 { FETagID, {}, std::string() },
377 { FEQualityID, {}, 0 },
378 { FECutoffID, {}, 0},
379 { FEBitReservoirID, {},
true },
380 { FEVariableBlockLenID, {},
true },
381 { FECompLevelID, {}, -1 },
382 { FEFrameSizeID, {}, 0 },
383 { FELPCCoeffsID, {}, 0 },
384 { FEMinPredID, {}, -1 },
385 { FEMaxPredID, {}, -1 },
386 { FEMinPartOrderID, {}, -1 },
387 { FEMaxPartOrderID, {}, -1 },
388 { FEPredOrderID, {}, 0 },
389 { FEMuxRateID, {}, 0 },
390 { FEPacketSizeID, {}, 0 },
391 { FECodecID, {}, std::string() },
392 { FEFormatID, {}, std::string() }
407 : mListener(listener)
416 mParent =
S.GetParent();
418 S.StartHorizontalLay(wxCENTER);
420 S.StartVerticalLay(wxCENTER, 0);
422 S.AddButton(
XXO(
"Open custom FFmpeg format options"))
424 S.StartMultiColumn(2, wxCENTER);
426 S.AddPrompt(
XXO(
"Current Format:"));
427 mFormat =
S.Name(
XXO(
"Current Format:"))
428 .Style(wxTE_READONLY).AddTextBox({},
wxT(
""), 25);
429 S.AddPrompt(
XXO(
"Current Codec:"));
430 mCodec =
S.Name(
XXO(
"Current Codec:"))
431 .Style(wxTE_READONLY).AddTextBox({},
wxT(
""), 25);
435 S.EndHorizontalLay();
437 S.EndHorizontalLay();
439 UpdateCodecAndFormat();
465 auto it = mValues.find(
id);
466 if(it != mValues.end())
483 auto it = mValues.find(FECodecID);
484 if(it == mValues.end())
487 const auto codecId = *std::get_if<std::string>(&it->second);
489 mAVCodec = mFFmpeg->CreateEncoder(codecId.c_str());
495 if(
const auto rates = mAVCodec->GetSupportedSamplerates())
502 mValues[FELanguageID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegLanguage"),
wxT(
"")).
ToUTF8());
503 mValues[FESampleRateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegSampleRate"), 0L));
504 mValues[FEBitrateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegBitRate"), 0L));
505 mValues[FETagID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegTag"),
wxT(
""))
506 .mb_str(wxConvUTF8));
507 mValues[FEQualityID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegQuality"), -99999L));
508 mValues[FECutoffID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegCutOff"), 0L));
509 mValues[FEBitReservoirID] = config.
ReadBool(
wxT(
"/FileFormats/FFmpegBitReservoir"),
true);
510 mValues[FEVariableBlockLenID] = config.
ReadBool(
wxT(
"/FileFormats/FFmpegVariableBlockLen"),
true);
511 mValues[FECompLevelID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegCompLevel"), -1L));
512 mValues[FEFrameSizeID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegFrameSize"), 0L));
514 mValues[FELPCCoeffsID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegLPCCoefPrec"), 0L));
515 mValues[FEMinPredID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMinPredOrder"), -1L));
516 mValues[FEMaxPredID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMaxPredOrder"), -1L));
517 mValues[FEMinPartOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMinPartOrder"), -1L));
518 mValues[FEMaxPartOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMaxPartOrder"), -1L));
519 mValues[FEPredOrderID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegPredOrderMethod"), 0L));
520 mValues[FEMuxRateID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegMuxRate"), 0L));
521 mValues[FEPacketSizeID] =
static_cast<int>(config.
Read(
wxT(
"/FileFormats/FFmpegPacketSize"), 0L));
522 mValues[FECodecID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegCodec")));
523 mValues[FEFormatID] = std::string(config.
Read(
wxT(
"/FileFormats/FFmpegFormat")));
556 if(!CheckFFmpeg(
true))
561 auto pWin = wxGetTopLevelParent( mParent );
564 auto pWin = wxTheApp->GetTopWindow();
575 UpdateCodecAndFormat();
577 mListener->OnSampleRateListChange();
580 wxWindow *mParent {
nullptr};
581 wxTextCtrl *mFormat {
nullptr};
582 wxTextCtrl *mCodec {
nullptr};
599 bool Init(
const char *shortname,
602 const Tags *metadata,
636 int16_t* audio_samples,
681 double t0,
double t1,
bool selectedOnly,
684 const Tags* tags)
override;
697 std::unique_ptr<ExportOptionsEditor>
709 mutable std::shared_ptr<FFmpegFunctions>
mFFmpeg;
718 : mFFmpeg(
std::move(ffmpeg))
720 , mChannels(numChannels)
721 , mSubFormat(subFormat)
742 int avfver =
mFFmpeg ?
mFFmpeg->AVFormatVersion.GetIntVersion() : 0;
746 for (newfmt = 0; newfmt <
FMT_LAST; newfmt++)
753 auto avoformat =
mFFmpeg->GuessOutputFormat(shortname.mb_str(),
nullptr,
nullptr);
756 if (avoformat == NULL || avcodec == NULL)
769 formatInfo.extensions.push_back(
wxT(
"3gp"));
770 formatInfo.extensions.push_back(
wxT(
"m4r"));
771 formatInfo.extensions.push_back(
wxT(
"mp4"));
774 formatInfo.extensions.push_back(
wxT(
"asf"));
775 formatInfo.extensions.push_back(
wxT(
"wmv"));
784 formatInfo.canMetaData = canmeta && (canmeta ==
AV_CANMETA || canmeta <= avfver);
792std::unique_ptr<ExportOptionsEditor>
798 return std::make_unique<PlainExportOptionsEditor>(
AACOptions, listener);
800 return std::make_unique<PlainExportOptionsEditor>(
805 return std::make_unique<PlainExportOptionsEditor>(
809#ifdef SHOW_FFMPEG_OPUS_EXPORT
811 return std::make_unique<PlainExportOptionsEditor>(
OPUSOptions, listener);
814 return std::make_unique<PlainExportOptionsEditor>(
819 return std::make_unique<ExportOptionsFFmpegCustomEditor>(listener);
855 return std::make_unique<FFmpegExportProcessor>(
mFFmpeg,
format);
862 const Tags *metadata,
871 const auto path =
mName.GetFullPath();
874 throw ExportException(
_(
"FFmpeg : ERROR - Can't determine format description for file \"%s\".").
Format(path));
881 throw ExportException(
_(
"FFmpeg : ERROR - Can't allocate output format context."));
891 throw ExportException(
_(
"FFmpeg : ERROR - Can't add audio stream to output file \"%s\"."));
917 throw ExportException(
_(
"FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d.")
918 .
Format(path,
static_cast<int>(result)));
929 if (metadata == NULL)
935 const auto avfver =
mFFmpeg->AVFormatVersion.GetIntVersion();
936 if (canmeta && (canmeta ==
AV_CANMETA || canmeta <= avfver))
948 throw ExportException(
XO(
"FFmpeg : ERROR - Can't write headers to output file \"%s\". Error code is %d.")
958 if (lowrate && highrate)
960 if (rate < lowrate || rate > highrate)
983 std::unique_ptr<AVCodecWrapper> codec;
1036#ifdef SHOW_FFMPEG_OPUS_EXPORT
1038 options.
Set(
"b", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDBitRate,
"128000"), 0);
1039 options.
Set(
"vbr", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDVBRMode,
"on"), 0);
1040 options.
Set(
"compression_level", ExportPluginHelpers::GetParameterValue<std::string>(parameters, OPUSOptionIDCompression,
"10"), 0);
1042 options.
Set(
"application", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDApplication,
"audio"), 0);
1043 options.
Set(
"cutoff", ExportPluginHelpers::GetParameterValue<std::string>(parameters,
OPUSOptionIDCutoff,
"0"), 0);
1044 options.
Set(
"mapping_family",
mChannels <= 2 ?
"0" :
"255", 0);
1066 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FELanguageID), 0);
1080 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FETagID).c_str());
1089 options.
Set(
"reservoir",
"1", 0);
1104 "lpc_coeff_precision",
1107 "min_prediction_order",
1110 "max_prediction_order",
1113 "min_partition_order",
1116 "max_partition_order",
1119 "prediction_order_method",
1128 codec =
mFFmpeg->CreateEncoder(
1129 ExportPluginHelpers::GetParameterValue<std::string>(parameters, FECodecID).c_str());
1166 codec =
mFFmpeg->CreateEncoder(
"ac3_fixed");
1178 throw ExportException(
XO(
"FFmpeg cannot find audio codec 0x%x.\nSupport for this codec is probably not compiled in.")
1179 .
Format(
static_cast<const unsigned int>(codecID.value))
1183 if (codec->GetSampleFmts()) {
1208 if (codec->GetSupportedSamplerates())
1213 std::vector<int> rates;
1216 while (codec->GetSupportedSamplerates()[i] &&
1217 codec->GetSupportedSamplerates()[i] != 7350)
1219 rates.push_back(codec->GetSupportedSamplerates()[i++]);
1233 mSampleRate, 0, 0, codec->GetSupportedSamplerates()))
1236 0,
mSampleRate, 0, 0, codec->GetSupportedSamplerates());
1263 errmsg =
XO(
"The codec reported a generic error (EPERM)");
1266 errmsg =
XO(
"The codec reported an invalid parameter (EINVAL)");
1270 mFFmpeg->av_strerror(rc, buf,
sizeof(buf));
1276 .
Format(codec->GetName(), codecID.value, errmsg)
1286 wxT(
"FFmpeg : Audio Output Codec Frame Size: %d samples."),
1300 throw ExportException(
_(
"FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."));
1323 mFFmpeg->av_interleaved_write_frame(
1326 throw ExportException(
_(
"FFmpeg : ERROR - Couldn't write audio frame to output file."));
1335 int i, ch, buffer_size, ret, got_output = 0;
1338 std::unique_ptr<AVFrameWrapper> frame;
1340 if (audio_samples) {
1341 frame =
mFFmpeg->CreateAVFrameWrapper();
1346 frame->SetSamplesCount(nb_samples);
1350 buffer_size =
mFFmpeg->av_samples_get_buffer_size(
1354 if (buffer_size < 0) {
1355 throw ExportException(
_(
"FFmpeg : ERROR - Could not get sample buffer size"));
1358 samples =
mFFmpeg->CreateMemoryBuffer<uint8_t>(buffer_size);
1360 if (samples.empty()) {
1361 throw ExportException(
_(
"FFmpeg : ERROR - Could not allocate bytes for samples buffer"));
1364 ret =
mFFmpeg->avcodec_fill_audio_frame(
1376 for (i = 0; i < nb_samples; i++) {
1381 ((uint8_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount]/258 + 128;
1384 ((uint8_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount]/258 + 128;
1387 ((int16_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount];
1390 ((int16_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount];
1393 ((int32_t*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount]<<16;
1396 ((int32_t*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount]<<16;
1399 ((
float*)(frame->GetData(0)))[ch + i*channelsCount] = audio_samples[ch + i*channelsCount] / 32767.0;
1402 ((
float*)(frame->GetData(ch)))[i] = audio_samples[ch + i*channelsCount] / 32767.;
1416 if (
mFFmpeg->avcodec_send_frame !=
nullptr)
1418 ret =
mFFmpeg->avcodec_send_frame(
1420 frame ? frame->GetWrappedValue() :
nullptr);
1424 ret =
mFFmpeg->avcodec_receive_packet(
1442 ret =
mFFmpeg->avcodec_encode_audio2(
1444 frame ? frame->GetWrappedValue() :
nullptr, &got_output);
1455 mFFmpeg->av_strerror(ret, buf,
sizeof(buf));
1472 std::unique_ptr<AVPacketWrapper> pkt =
mFFmpeg->CreateAVPacketWrapper();
1474 const auto nFifoBytes =
1477 int encodeResult = 0;
1499 frame_size = nFifoBytes /
1503 wxLogDebug(
wxT(
"FFmpeg : Audio FIFO still contains %lld bytes, writing %d sample frame ..."),
1504 nFifoBytes, frame_size);
1518 wxLogDebug(
wxT(
"FFmpeg : Reading from Audio FIFO failed, aborting"));
1530 if (encodeResult < 0) {
1534 else if (encodeResult == 0)
1551 const auto frameSize = numSamples *
sizeof(int16_t) *
mChannels;
1552 int nBytesToWrite = 0;
1553 uint8_t *pRawSamples =
nullptr;
1557 nBytesToWrite = frameSize;
1558 pRawSamples = (uint8_t*)pFrame;
1563 if (ret != nBytesToWrite) {
1568 throw ExportException(
_(
"FFmpeg : ERROR - nAudioFrameSizeOut too large."));
1577 std::unique_ptr<AVPacketWrapper> pkt =
mFFmpeg->CreateAVPacketWrapper();
1590 : mFFmpeg(
std::move(ffmpeg))
1598 double t0,
double t1,
bool selectionOnly,
1601 const Tags* metadata)
1608 throw ExportException(
_(
"Properly configured FFmpeg is required to proceed.\nYou can configure it at Preferences > Libraries."));
1614 throw ExportException(
XO(
"Attempted to export %d channels, but maximum number of channels for selected output format is %d")
1623 if (adjustedFormatIndex >=
FMT_LAST) {
1630 shortname = ExportPluginHelpers::GetParameterValue<std::string>(parameters, FEFormatID,
"matroska");
1632 context.exporter = std::make_unique<FFmpegExporter>(
mFFmpeg, fName, channels, adjustedFormatIndex);
1644 context.status = selectionOnly
1645 ?
XO(
"Exporting selected audio as %s")
1647 :
XO(
"Exporting the audio as %s")
1659 auto pcmNumSamples =
context.mixer->Process();
1660 if (pcmNumSamples == 0)
1663 short *pcmBuffer = (
short *)
context.mixer->GetBuffer();
1665 if (!
context.exporter->EncodeAudioFrame(pcmBuffer, pcmNumSamples))
1676 if ( !
context.exporter->Finalize() )
1678 return exportResult;
1685 memcpy(
field,value.ToUTF8(),(
int)strlen(value.ToUTF8()) >
size -1 ?
size -1 : strlen(value.ToUTF8()));
1691 memcpy(
field,value.mb_str(),(
int)strlen(value.mb_str()) >
size -1 ?
size -1 : strlen(value.mb_str()));
1726 wxString value = tags->
GetTag(tag);
1742#if defined(FFMPEG_AUTO_RESAMPLE)
1743 std::vector<int> rates;
1750 std::sort(rates.begin(), rates.end());
1753 for (
auto i : rates)
1771 S.StartVerticalLay();
1774 S.StartStatic(
XO(
"Resample"));
1776 S.StartHorizontalLay(wxALIGN_CENTER,
false);
1781"The project sample rate (%d) is not supported by the current output\nfile format. ")
1784"The project sample rate (%d) and bit rate (%d kbps) combination is not\nsupported by the current output file format. ")
1785 .
Format( rate, bitrate/1000))
1786 +
XO(
"You may resample to one of the rates below.")
1789 S.EndHorizontalLay();
1791 S.StartHorizontalLay(wxALIGN_CENTER,
false);
1793 choice =
S.AddChoice(
XO(
"Sample Rates"),
1799 if ((!lowrate ||
label >= lowrate) && (!highrate ||
label <= highrate))
1809 std::max( 0, selected )
1812 S.EndHorizontalLay();
1816 S.AddStandardButtons();
1822 d.SetMinSize(d.GetSize());
1825 if (d.ShowModal() == wxID_CANCEL) {
1829 return wxAtoi(choice->GetStringSelection());
1834 []{
return std::make_unique< ExportFFmpeg >(); }
@ AUDACITY_AV_CODEC_ID_AC3
@ AUDACITY_AV_CODEC_ID_AAC
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 AudacityProject &project, 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
struct FFmpegExportProcessor::@148 context
ExportResult Process(ExportProcessorDelegate &delegate) override
FFmpegExportProcessor(std::shared_ptr< FFmpegFunctions > ffmpeg, int format)
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
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
std::unique_ptr< FifoBuffer > mEncAudioFifo
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 AudacityProject &project, 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.
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 CheckFFmpeg(bool showError)
bool GetOption(int index, ExportOption &option) const override
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
ProjectFileIOExtensionRegistry::Extension extension
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AMRNBOptions
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AC3Options
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > AACOptions
const int iAC3SampleRates[]
const int iWMASampleRates[]
const std::vector< ExportOption > FFmpegOptions
TranslatableString f_kbps(double d)
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > WMAOptions
ExportOptionsEditor::SampleRateList ToSampleRateList(const int *rates)
@ OPUSOptionIDApplication
@ OPUSOptionIDFrameDuration
const std::initializer_list< PlainExportOptionsEditor::OptionDesc > OPUSOptions
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)