From: Robin Gareus Date: Mon, 19 Nov 2018 22:45:26 +0000 (+0100) Subject: FFMPEG/MP3 encoder quality select GUI X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=dfef8b7f6257364053e13ab4d5e317b703abd0af FFMPEG/MP3 encoder quality select GUI --- diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc index bc9a553574..2a3a563005 100644 --- a/gtk2_ardour/export_format_dialog.cc +++ b/gtk2_ardour/export_format_dialog.cc @@ -196,6 +196,13 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : bold.insert (b); encoding_options_label.set_attributes (bold); + /* Codec options */ + + codec_quality_list = Gtk::ListStore::create (codec_quality_cols); + codec_quality_combo.set_model (codec_quality_list); + codec_quality_combo.pack_start (codec_quality_cols.label); + //codec_quality_combo.set_active (0); + /* Buttons */ revert_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); @@ -241,6 +248,7 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : silence_end_clock.ValueChanged.connect (sigc::mem_fun (*this, &ExportFormatDialog::update_silence_end_selection)); src_quality_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_src_quality_selection)); + codec_quality_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_codec_quality_selection)); /* Format table signals */ @@ -339,6 +347,13 @@ ExportFormatDialog::load_state (FormatPtr spec) } } + for (Gtk::ListStore::Children::iterator it = codec_quality_list->children().begin(); it != codec_quality_list->children().end(); ++it) { + if (it->get_value (codec_quality_cols.quality) == spec->codec_quality()) { + codec_quality_combo.set_active (it); + break; + } + } + for (Gtk::ListStore::Children::iterator it = format_list->children().begin(); it != format_list->children().end(); ++it) { boost::shared_ptr format_in_list = it->get_value (format_cols.ptr); if (format_in_list->get_format_id() == spec->format_id() && @@ -937,6 +952,17 @@ ExportFormatDialog::update_src_quality_selection () manager.select_src_quality (quality); } +void +ExportFormatDialog::update_codec_quality_selection () +{ + Gtk::TreeModel::const_iterator iter = codec_quality_combo.get_active(); + if (!iter) { + return; + } + int quality = iter->get_value (codec_quality_cols.quality); + manager.select_codec_quality (quality); +} + void ExportFormatDialog::update_tagging_selection () { @@ -952,6 +978,7 @@ ExportFormatDialog::change_encoding_options (ExportFormatPtr ptr) boost::shared_ptr ogg_ptr; boost::shared_ptr flac_ptr; boost::shared_ptr bwf_ptr; + boost::shared_ptr ffmpeg_ptr; if ((linear_ptr = boost::dynamic_pointer_cast (ptr))) { show_linear_enconding_options (linear_ptr); @@ -961,6 +988,8 @@ ExportFormatDialog::change_encoding_options (ExportFormatPtr ptr) show_flac_enconding_options (flac_ptr); } else if ((bwf_ptr = boost::dynamic_pointer_cast (ptr))) { show_bwf_enconding_options (bwf_ptr); + } else if ((ffmpeg_ptr = boost::dynamic_pointer_cast (ptr))) { + show_ffmpeg_enconding_options (ffmpeg_ptr); } else { std::cout << "Unrecognized format!" << std::endl; } @@ -1040,6 +1069,34 @@ ExportFormatDialog::show_bwf_enconding_options (boost::shared_ptr ptr) +{ + encoding_options_label.set_label (_("FFMPEG/MP3 options")); + encoding_options_table.resize (1, 1); + encoding_options_table.attach (codec_quality_combo, 0, 1, 0, 1); + + HasCodecQuality::CodecQualityList const & codecs = ptr->get_codec_qualities(); + + codec_quality_list->clear(); + for (HasCodecQuality::CodecQualityList::const_iterator it = codecs.begin(); it != codecs.end(); ++it) { + + Gtk::TreeModel::iterator iter = codec_quality_list->append(); + Gtk::TreeModel::Row row = *iter; + row[codec_quality_cols.quality] = (*it)->quality; + row[codec_quality_cols.label] = (*it)->name; + } + + for (Gtk::ListStore::Children::iterator it = codec_quality_list->children().begin(); it != codec_quality_list->children().end(); ++it) { + if (it->get_value (codec_quality_cols.quality) == format->codec_quality()) { + codec_quality_combo.set_active (it); + break; + } + } + + show_all_children (); +} + void ExportFormatDialog::fill_sample_format_lists (boost::shared_ptr ptr) { diff --git a/gtk2_ardour/export_format_dialog.h b/gtk2_ardour/export_format_dialog.h index 7df227ccb9..2b472e3494 100644 --- a/gtk2_ardour/export_format_dialog.h +++ b/gtk2_ardour/export_format_dialog.h @@ -145,6 +145,7 @@ private: void update_time (ARDOUR::AnyTime & time, AudioClock const & clock); void update_src_quality_selection (); + void update_codec_quality_selection (); void update_tagging_selection (); /*** Encoding options */ @@ -158,6 +159,7 @@ private: void show_ogg_enconding_options (boost::shared_ptr ptr); void show_flac_enconding_options (boost::shared_ptr ptr); void show_bwf_enconding_options (boost::shared_ptr ptr); + void show_ffmpeg_enconding_options (boost::shared_ptr ptr); void fill_sample_format_lists (boost::shared_ptr ptr); @@ -343,6 +345,22 @@ private: Gtk::TreeView sample_format_view; Gtk::TreeView dither_type_view; + + /* codec quality combo */ + + struct CodecQualityCols : public Gtk::TreeModelColumnRecord + { + public: + Gtk::TreeModelColumn quality; + Gtk::TreeModelColumn label; + + CodecQualityCols () { add(quality); add(label); } + }; + CodecQualityCols codec_quality_cols; + Glib::RefPtr codec_quality_list; + + Gtk::ComboBox codec_quality_combo; + /* Tagging */ Gtk::CheckButton tag_checkbox;