changeset 1511:48fcdaa29159

Report lossless/lossy quality and the filename as the title. This plugin still shows mutex-related lockups for me though.
author Tony Vroon <chainsaw@gentoo.org>
date Wed, 22 Aug 2007 12:49:14 +0100
parents 3a252050736c
children 7b1b24af319f
files src/wav/wav-sndfile.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/wav/wav-sndfile.c	Tue Aug 21 17:11:59 2007 +0900
+++ b/src/wav/wav-sndfile.c	Wed Aug 22 12:49:14 2007 +0100
@@ -120,11 +120,13 @@
 {
 	SNDFILE	*tmp_sndfile;
 	SF_INFO tmp_sfinfo;
+	unsigned int lossy = 0;
 	gchar *realfn = NULL, *codec = NULL, *format, *subformat = NULL;
 	GString *codec_gs = NULL;
 
 	realfn = g_filename_from_uri(filename, NULL, NULL);
 	tmp_sndfile = sf_open (realfn ? realfn : filename, SFM_READ, &tmp_sfinfo);
+	tuple_associate_string(ti, "title", g_path_get_basename(realfn ? realfn : filename));
 	g_free(realfn); realfn = NULL;
 
 	if (!tmp_sndfile)
@@ -227,42 +229,55 @@
 			break;
 		case SF_FORMAT_ULAW:
 			subformat = "U-Law";
+			lossy = 1;
 			break;
 		case SF_FORMAT_ALAW:
 			subformat = "A-Law";
+			lossy = 1;
 			break;
 		case SF_FORMAT_IMA_ADPCM:
 			subformat = "IMA ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_MS_ADPCM:
 			subformat = "MS ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_GSM610:
 			subformat = "GSM 6.10";
+			lossy = 1;
 			break;
 		case SF_FORMAT_VOX_ADPCM:
 			subformat = "Oki Dialogic ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_G721_32:
 			subformat = "32kbs G721 ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_G723_24:
 			subformat = "24kbs G723 ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_G723_40:
 			subformat = "40kbs G723 ADPCM";
+			lossy = 1;
 			break;
 		case SF_FORMAT_DWVW_12:
 			subformat = "12 bit Delta Width Variable Word";
+			lossy = 1;
 			break;
 		case SF_FORMAT_DWVW_16:
 			subformat = "16 bit Delta Width Variable Word";
+			lossy = 1;
 			break;
 		case SF_FORMAT_DWVW_24:
 			subformat = "24 bit Delta Width Variable Word";
+			lossy = 1;
 			break;
 		case SF_FORMAT_DWVW_N:
 			subformat = "N bit Delta Width Variable Word";
+			lossy = 1;
 			break;
 		case SF_FORMAT_DPCM_8:
 			subformat = "8 bit differential PCM";
@@ -278,8 +293,12 @@
 		g_string_append_printf(codec_gs, "%s", format);
 	codec = g_strdup(codec_gs->str);
 	g_string_free(codec_gs, TRUE);
+	tuple_associate_string(ti, "codec", codec);
 
-	tuple_associate_string(ti, "codec", codec);
+	if (lossy != 0)
+		tuple_associate_string(ti, "quality", "lossy");
+	else
+		tuple_associate_string(ti, "quality", "lossless");
 }
 
 static gchar *get_title(char *filename)