summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-26 20:07:25 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-26 20:07:25 +0000
commitcc15fb071f3c327f17bbe1b0613974d5060b7f90 (patch)
tree58e46a1932b3dcfa3995239dd30ddee9d57ceaa2 /libs
parent5557c6fe5cbf38ed36fa3a0b9e5f5cdc925ba443 (diff)
cleanup a couple of audio file format names as reported by libsndfile
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5926 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/sndfile_helpers.cc12
-rw-r--r--libs/ardour/sndfilesource.cc12
2 files changed, 20 insertions, 4 deletions
diff --git a/libs/ardour/sndfile_helpers.cc b/libs/ardour/sndfile_helpers.cc
index 4a85b712f1..998e9a36c2 100644
--- a/libs/ardour/sndfile_helpers.cc
+++ b/libs/ardour/sndfile_helpers.cc
@@ -17,6 +17,7 @@
*/
+#include <strings.h>
#include <map>
#include <vector>
@@ -176,7 +177,16 @@ sndfile_major_format(int format)
format_info.format = i;
sf_command (0, SFC_GET_FORMAT_MAJOR,
&format_info, sizeof (format_info));
- m[format_info.format & SF_FORMAT_TYPEMASK] = format_info.name;
+
+ /* normalize a couple of names rather than use what libsndfile gives us */
+
+ if (strncasecmp (format_info.name, "OGG", 3) == 0) {
+ m[format_info.format & SF_FORMAT_TYPEMASK] = "Ogg";
+ } else if (strncasecmp (format_info.name, "WAV", 3) == 0) {
+ m[format_info.format & SF_FORMAT_TYPEMASK] = "WAV";
+ } else {
+ m[format_info.format & SF_FORMAT_TYPEMASK] = format_info.name;
+ }
}
}
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index b907b9739a..7ea3758859 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -877,9 +877,15 @@ SndFileSource::get_soundfile_info (const ustring& path, SoundFileInfo& info, str
info.samplerate = sf_info.samplerate;
info.channels = sf_info.channels;
info.length = sf_info.frames;
- info.format_name = string_compose("%1\n%2",
- sndfile_major_format(sf_info.format),
- sndfile_minor_format(sf_info.format));
+
+ string major = sndfile_major_format(sf_info.format);
+ string minor = sndfile_minor_format(sf_info.format);
+
+ if (major.length() + minor.length() < 16) { /* arbitrary */
+ info.format_name = string_compose("%1/%2", major, minor);
+ } else {
+ info.format_name = string_compose("%1\n%2", major, minor);
+ }
memset (&binfo, 0, sizeof (binfo));
info.timecode = get_timecode_info (sf, &binfo, timecode_exists);