13
0

Add enums for handling libsndfile mp3 encoding

MP3 support was introduced in libsndfile 1.1.0 . It will be a simple
alternative to using external ffmpeg.

To avoid dependency on the new libsndfile or config-time checking,
hardcode the constants from sndfile.h . The actual availability will
have to be checked at runtime.
This commit is contained in:
Mads Kiilerich 2022-10-07 14:25:53 +02:00 committed by Robin Gareus
parent f129cf4485
commit 886fe364b3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,7 @@ class LIBARDOUR_API ExportFormatBase {
F_RAW = SF_FORMAT_RAW,
F_FLAC = SF_FORMAT_FLAC,
F_Ogg = SF_FORMAT_OGG,
F_MPEG = 0x230000, /* hardcode SF_FORMAT_MPEG from libsndfile 1.1.0+ */
F_FFMPEG = 0xF10000
};
@ -78,7 +79,8 @@ class LIBARDOUR_API ExportFormatBase {
SF_U8 = SF_FORMAT_PCM_U8,
SF_Float = SF_FORMAT_FLOAT,
SF_Double = SF_FORMAT_DOUBLE,
SF_Vorbis = SF_FORMAT_VORBIS
SF_Vorbis = SF_FORMAT_VORBIS,
SF_MPEG_LAYER_III = 0x0082 /* SF_FORMAT_MPEG_LAYER_III */
};
enum DitherType {

View File

@ -634,6 +634,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (ExportFormatBase, F_Ogg);
REGISTER_CLASS_ENUM (ExportFormatBase, F_CAF);
REGISTER_CLASS_ENUM (ExportFormatBase, F_FFMPEG);
REGISTER_CLASS_ENUM (ExportFormatBase, F_MPEG);
REGISTER (_ExportFormatBase_FormatId);
REGISTER_CLASS_ENUM (ExportFormatBase, E_FileDefault);
@ -651,6 +652,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (ExportFormatBase, SF_Float);
REGISTER_CLASS_ENUM (ExportFormatBase, SF_Double);
REGISTER_CLASS_ENUM (ExportFormatBase, SF_Vorbis);
REGISTER_CLASS_ENUM (ExportFormatBase, SF_MPEG_LAYER_III);
REGISTER (_ExportFormatBase_SampleFormat);
REGISTER_CLASS_ENUM (ExportFormatBase, D_None);

View File

@ -179,6 +179,8 @@ HasSampleFormat::get_sample_format_name (ExportFormatBase::SampleFormat format)
return _("8-bit unsigned");
case ExportFormatBase::SF_Vorbis:
return _("Vorbis sample format");
case ExportFormatBase::SF_MPEG_LAYER_III:
return _("MPEG-2 Audio Layer III");
case ExportFormatBase::SF_None:
return _("No sample format");
}