diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-09-29 10:02:35 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-09-29 10:02:35 +0000 |
commit | 474f8bc37623f48f7e69dff57aee233c99f6d07c (patch) | |
tree | ba5a457e177c60ba36f92248e90323b2ac84f622 /libs/ardour/export_formats.cc | |
parent | 400f8bb03dea167c4b1f17b2cc80cf24a0bd4679 (diff) |
Made Export format compatibility checking a bit more robust
git-svn-id: svn://localhost/ardour2/branches/3.0@3829 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_formats.cc')
-rw-r--r-- | libs/ardour/export_formats.cc | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/libs/ardour/export_formats.cc b/libs/ardour/export_formats.cc index f3c8f7197c..9e77bb2f1d 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -234,6 +234,16 @@ ExportFormatLinear::set_compatibility_state (ExportFormatCompatibility const & c ExportFormatOggVorbis::ExportFormatOggVorbis () { + /* Check system compatibility */ + + SF_INFO sf_info; + sf_info.channels = 2; + sf_info.samplerate = SR_44_1; + sf_info.format = F_Ogg | SF_Vorbis; + if (sf_format_check (&sf_info) != SF_TRUE) { + throw ExportFormatIncompatible(); + } + set_name ("Ogg Vorbis"); set_format_id (F_Ogg); sample_formats.insert (SF_Vorbis); @@ -252,17 +262,6 @@ ExportFormatOggVorbis::ExportFormatOggVorbis () } bool -ExportFormatOggVorbis::check_system_compatibility () -{ - SF_INFO sf_info; - sf_info.channels = 2; - sf_info.samplerate = SR_44_1; - sf_info.format = F_Ogg | SF_Vorbis; - - return (sf_format_check (&sf_info) == SF_TRUE ? true : false); -} - -bool ExportFormatOggVorbis::set_compatibility_state (ExportFormatCompatibility const & compatibility) { bool compatible = compatibility.has_format (F_Ogg); @@ -275,6 +274,16 @@ ExportFormatOggVorbis::set_compatibility_state (ExportFormatCompatibility const ExportFormatFLAC::ExportFormatFLAC () : HasSampleFormat (sample_formats) { + /* Check system compatibility */ + + SF_INFO sf_info; + sf_info.channels = 2; + sf_info.samplerate = SR_44_1; + sf_info.format = F_FLAC | SF_16; + if (sf_format_check (&sf_info) != SF_TRUE) { + throw ExportFormatIncompatible(); + } + set_name ("FLAC"); set_format_id (F_FLAC); @@ -296,17 +305,6 @@ ExportFormatFLAC::ExportFormatFLAC () : } bool -ExportFormatFLAC::check_system_compatibility () -{ - SF_INFO sf_info; - sf_info.channels = 2; - sf_info.samplerate = SR_44_1; - sf_info.format = F_FLAC | SF_16; - - return (sf_format_check (&sf_info) == SF_TRUE ? true : false); -} - -bool ExportFormatFLAC::set_compatibility_state (ExportFormatCompatibility const & compatibility) { bool compatible = compatibility.has_format (F_FLAC); |