Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor Class Reference
Inheritance diagram for anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor:
[legend]
Collaboration diagram for anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor:
[legend]

Public Member Functions

 ExportOptionsFFmpegCustomEditor (ExportOptionsEditor::Listener *listener=nullptr)
 
void PopulateUI (ShuttleGui &S) override
 
bool TransferDataFromWindow () override
 
int GetOptionsCount () const override
 
bool GetOption (int index, ExportOption &option) const override
 
bool GetValue (int id, ExportValue &value) const override
 
bool SetValue (int id, const ExportValue &value) override
 
SampleRateList GetSampleRateList () const override
 
void Load (const audacity::BasicSettings &config) override
 
void Store (audacity::BasicSettings &settings) const override
 
- Public Member Functions inherited from ExportOptionsEditor
virtual ~ExportOptionsEditor ()
 
virtual int GetOptionsCount () const =0
 
virtual bool GetOption (int index, ExportOption &option) const =0
 
virtual bool GetValue (ExportOptionID id, ExportValue &value) const =0
 
virtual bool SetValue (ExportOptionID id, const ExportValue &value)=0
 
virtual SampleRateList GetSampleRateList () const =0
 
virtual void Store (audacity::BasicSettings &settings) const =0
 
virtual void Load (const audacity::BasicSettings &config)=0
 
- Public Member Functions inherited from ExportOptionsUIServices
virtual ~ExportOptionsUIServices ()
 
virtual void PopulateUI (ShuttleGui &)=0
 
virtual bool TransferDataFromWindow ()=0
 

Private Member Functions

bool CheckFFmpeg (bool showError)
 
void UpdateCodecAndFormat ()
 
void OnOpen (const wxCommandEvent &)
 

Private Attributes

std::unordered_map< int, ExportValuemValues
 
std::shared_ptr< FFmpegFunctionsmFFmpeg
 
ExportOptionsEditor::ListenermListener {}
 
std::unique_ptr< AVCodecWrappermAVCodec
 
wxWindow * mParent {nullptr}
 
wxTextCtrl * mFormat {nullptr}
 
wxTextCtrl * mCodec {nullptr}
 

Additional Inherited Members

- Public Types inherited from ExportOptionsEditor
using SampleRateList = std::vector< int >
 

Detailed Description

Definition at line 395 of file ExportFFmpeg.cpp.

Constructor & Destructor Documentation

◆ ExportOptionsFFmpegCustomEditor()

anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::ExportOptionsFFmpegCustomEditor ( ExportOptionsEditor::Listener listener = nullptr)
inline

Definition at line 406 of file ExportFFmpeg.cpp.

407 : mListener(listener)
408 {
409 }

Member Function Documentation

◆ CheckFFmpeg()

bool anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::CheckFFmpeg ( bool  showError)
inlineprivate

Definition at line 533 of file ExportFFmpeg.cpp.

534 {
535 // Show "Locate FFmpeg" dialog
536 if(!mFFmpeg)
537 {
539 if (!mFFmpeg)
540 {
542 return LoadFFmpeg(showError);
543 }
544 }
545 return true;
546 }
bool FindFFmpegLibs(wxWindow *parent)
Definition: FFmpeg.cpp:303
bool LoadFFmpeg(bool showerror)
Definition: FFmpeg.cpp:39
static std::shared_ptr< FFmpegFunctions > Load(bool fromUserPathOnly=false)

References FindFFmpegLibs(), FFmpegFunctions::Load(), and LoadFFmpeg().

Here is the call graph for this function:

◆ GetOption()

bool anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::GetOption ( int  index,
ExportOption option 
) const
inlineoverridevirtual

Implements ExportOptionsEditor.

Definition at line 453 of file ExportFFmpeg.cpp.

454 {
455 if(index >= 0 && index < FFmpegOptions.size())
456 {
457 option = FFmpegOptions[index];
458 return true;
459 }
460 return false;
461 }
const std::vector< ExportOption > FFmpegOptions

References anonymous_namespace{ExportFFmpeg.cpp}::FFmpegOptions.

◆ GetOptionsCount()

int anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::GetOptionsCount ( ) const
inlineoverridevirtual

Implements ExportOptionsEditor.

Definition at line 448 of file ExportFFmpeg.cpp.

449 {
450 return static_cast<int>(FFmpegOptions.size());
451 }

References anonymous_namespace{ExportFFmpeg.cpp}::FFmpegOptions.

◆ GetSampleRateList()

SampleRateList anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::GetSampleRateList ( ) const
inlineoverridevirtual

Implements ExportOptionsEditor.

Definition at line 479 of file ExportFFmpeg.cpp.

480 {
481 if(!mAVCodec)
482 {
483 auto it = mValues.find(FECodecID);
484 if(it == mValues.end())
485 return {};
486
487 const auto codecId = *std::get_if<std::string>(&it->second);
488 if (mFFmpeg) {
489 mAVCodec = mFFmpeg->CreateEncoder(codecId.c_str());
490 }
491 }
492 if(!mAVCodec)
493 return {};
494
495 if(const auto rates = mAVCodec->GetSupportedSamplerates())
496 return ToSampleRateList(rates);
497 return {};
498 }
ExportOptionsEditor::SampleRateList ToSampleRateList(const int *rates)

References anonymous_namespace{ExportFFmpeg.cpp}::ToSampleRateList().

Here is the call graph for this function:

◆ GetValue()

bool anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::GetValue ( int  id,
ExportValue value 
) const
inlineoverride

Definition at line 463 of file ExportFFmpeg.cpp.

464 {
465 auto it = mValues.find(id);
466 if(it != mValues.end())
467 {
468 value = it->second;
469 return true;
470 }
471 return false;
472 }

◆ Load()

void anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::Load ( const audacity::BasicSettings config)
inlineoverridevirtual

Implements ExportOptionsEditor.

Definition at line 500 of file ExportFFmpeg.cpp.

501 {
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));
513
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")));
524 }
wxT("CloseDown"))
bool ReadBool(const wxString &key, bool defaultValue) const
virtual bool Read(const wxString &key, bool *value) const =0
std::string ToUTF8(const std::wstring &wstr)

References audacity::BasicSettings::Read(), audacity::BasicSettings::ReadBool(), audacity::ToUTF8(), and wxT().

Here is the call graph for this function:

◆ OnOpen()

void anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::OnOpen ( const wxCommandEvent &  )
inlineprivate

Definition at line 554 of file ExportFFmpeg.cpp.

555 {
556 if(!CheckFFmpeg(true))
557 return;
558
559 #ifdef __WXMAC__
560 // Bug 2077 Must be a parent window on OSX or we will appear behind.
561 auto pWin = wxGetTopLevelParent( mParent );
562 #else
563 // Use GetTopWindow on windows as there is no hWnd with top level parent.
564 auto pWin = wxTheApp->GetTopWindow();
565 #endif
566
567 ExportFFmpegOptions od(pWin);
568 od.ShowModal();
569 //ExportFFmpegOptions uses gPrefs to store options
570 //Instead we could provide it with instance of wxConfigBase
571 //constructed locally and read from it later
572 Load(*gPrefs);
573 mAVCodec.reset();
574
576 if(mListener)
578 }
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
Custom FFmpeg export dialog.
virtual void OnSampleRateListChange()=0
void Load(const audacity::BasicSettings &config) override

References gPrefs, and ThemeResources::Load().

Here is the call graph for this function:

◆ PopulateUI()

void anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::PopulateUI ( ShuttleGui S)
inlineoverridevirtual

Implements ExportOptionsUIServices.

Definition at line 411 of file ExportFFmpeg.cpp.

412 {
413 CheckFFmpeg(true);
414 //Continue anyway, as we do not need ffmpeg functions to build and fill in the UI
415
416 mParent = S.GetParent();
417
418 S.StartHorizontalLay(wxCENTER);
419 {
420 S.StartVerticalLay(wxCENTER, 0);
421 {
422 S.AddButton(XXO("Open custom FFmpeg format options"))
423 ->Bind(wxEVT_BUTTON, &ExportOptionsFFmpegCustomEditor::OnOpen, this);
424 S.StartMultiColumn(2, wxCENTER);
425 {
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);
432 }
433 S.EndMultiColumn();
434 }
435 S.EndHorizontalLay();
436 }
437 S.EndHorizontalLay();
438
440 }
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64

References anonymous_namespace{FileMenus.cpp}::OnOpen(), S, wxT(), and XXO().

Here is the call graph for this function:

◆ SetValue()

bool anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::SetValue ( int  id,
const ExportValue value 
)
inlineoverride

Definition at line 474 of file ExportFFmpeg.cpp.

475 {
476 return false;
477 }

◆ Store()

void anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::Store ( audacity::BasicSettings settings) const
inlineoverridevirtual

Implements ExportOptionsEditor.

Definition at line 526 of file ExportFFmpeg.cpp.

527 {
528
529 }

◆ TransferDataFromWindow()

bool anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::TransferDataFromWindow ( )
inlineoverridevirtual

Implements ExportOptionsUIServices.

Definition at line 442 of file ExportFFmpeg.cpp.

443 {
444 Load(*gPrefs);
445 return true;
446 }

References gPrefs, and ThemeResources::Load().

Here is the call graph for this function:

◆ UpdateCodecAndFormat()

void anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::UpdateCodecAndFormat ( )
inlineprivate

Definition at line 548 of file ExportFFmpeg.cpp.

549 {
550 mFormat->SetValue(gPrefs->Read(wxT("/FileFormats/FFmpegFormat"), wxT("")));
551 mCodec->SetValue(gPrefs->Read(wxT("/FileFormats/FFmpegCodec"), wxT("")));
552 }

References gPrefs, audacity::BasicSettings::Read(), and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ mAVCodec

std::unique_ptr<AVCodecWrapper> anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mAVCodec
mutableprivate

Definition at line 403 of file ExportFFmpeg.cpp.

◆ mCodec

wxTextCtrl* anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mCodec {nullptr}
private

Definition at line 582 of file ExportFFmpeg.cpp.

◆ mFFmpeg

std::shared_ptr<FFmpegFunctions> anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mFFmpeg
private

Definition at line 400 of file ExportFFmpeg.cpp.

◆ mFormat

wxTextCtrl* anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mFormat {nullptr}
private

Definition at line 581 of file ExportFFmpeg.cpp.

◆ mListener

ExportOptionsEditor::Listener* anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mListener {}
private

Definition at line 401 of file ExportFFmpeg.cpp.

◆ mParent

wxWindow* anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mParent {nullptr}
private

Definition at line 580 of file ExportFFmpeg.cpp.

◆ mValues

std::unordered_map<int, ExportValue> anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::mValues
private

Definition at line 399 of file ExportFFmpeg.cpp.


The documentation for this class was generated from the following file: