Disambiguate export formats with different encoder settings

Disambiguate export formats with different encoder
qualities, sample-formats or settings (wav/bwav).

This allows to export multipe mp3 with different bitrates.
This commit is contained in:
Robin Gareus 2023-03-25 06:40:28 +01:00
parent 3715154a8e
commit 4b5333a721
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 40 additions and 2 deletions

View File

@ -80,6 +80,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
void set_format (std::shared_ptr<ExportFormat> format);
bool is_format (std::shared_ptr<ExportFormat> format) const;
bool operator== (ExportFormatSpecification const&) const;
void set_name (std::string const & name) { _name = name; }

View File

@ -581,6 +581,27 @@ ExportFormatSpecification::is_complete () const
return true;
}
bool ExportFormatSpecification::operator== (ExportFormatSpecification const& other) const
{
const int a = format_id() | sample_format() | endianness();
const int b = other.format_id() | other.sample_format() | other.endianness();
if (a != b) {
return false;
}
/* BWF has the same format id with wav, so we need to check this. */
if (has_broadcast_info () != other.has_broadcast_info ()) {
return false;
}
if (_has_codec_quality && other._has_codec_quality) {
if (_codec_quality != other._codec_quality) {
return false;
}
}
return true;
}
bool
ExportFormatSpecification::is_format (std::shared_ptr<ExportFormat> format) const
{

View File

@ -327,7 +327,9 @@ ExportGraphBuilder::Encoder::destroy_writer (bool delete_out_file)
bool
ExportGraphBuilder::Encoder::operator== (FileSpec const & other_config) const
{
return get_real_format (config) == get_real_format (other_config);
ExportFormatSpecification const& a = *config.format;
ExportFormatSpecification const& b = *other_config.format;
return a == b;
}
int
@ -649,7 +651,21 @@ ExportGraphBuilder::SFC::operator== (FileSpec const& other_config) const
ExportFormatSpecification const& a = *config.format;
ExportFormatSpecification const& b = *other_config.format;
bool id = a.sample_format() == b.sample_format();
bool id;
if (a.analyse () || b.analyse ()) {
/* Show dedicated analysis result for files with different
* quality or wav/bwav. This adds a dedicated SFC for each
* format, rater than only running dedicated Encoders as
* childs of of the same SFC.
*
* TODO: separate normalizer, and limiter into a dedicated
* graph-node, so that it can be shared.
*/
id = a == b;
} else {
/* delegate disambiguation to Encoder::operator== */
id = a.sample_format() == b.sample_format();
}
if (a.normalize_loudness () == b.normalize_loudness ()) {
id &= a.normalize_lufs () == b.normalize_lufs ();