aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/wav_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/wav_extractor.c')
-rw-r--r--src/plugins/wav_extractor.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/plugins/wav_extractor.c b/src/plugins/wav_extractor.c
index dae8890..5a7793b 100644
--- a/src/plugins/wav_extractor.c
+++ b/src/plugins/wav_extractor.c
@@ -49,9 +49,11 @@ little_endian_to_host32 (uint32_t in)
49{ 49{
50 unsigned char *ptr = (unsigned char *) ∈ 50 unsigned char *ptr = (unsigned char *) ∈
51 51
52 return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16) | 52 return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16)
53 ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF); 53 | ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF);
54} 54}
55
56
55#endif 57#endif
56 58
57 59
@@ -85,11 +87,12 @@ EXTRACTOR_wav_extract_method (struct EXTRACTOR_ExtractContext *ec)
85 ec->read (ec->cls, &data, 44)) 87 ec->read (ec->cls, &data, 44))
86 return; 88 return;
87 buf = data; 89 buf = data;
88 if ((buf[0] != 'R' || buf[1] != 'I' || 90 if (((buf[0] != 'R') || (buf[1] != 'I') ||
89 buf[2] != 'F' || buf[3] != 'F' || 91 (buf[2] != 'F') || (buf[3] != 'F') ||
90 buf[8] != 'W' || buf[9] != 'A' || 92 (buf[8] != 'W') || (buf[9] != 'A') ||
91 buf[10] != 'V' || buf[11] != 'E' || 93 (buf[10] != 'V') || (buf[11] != 'E') ||
92 buf[12] != 'f' || buf[13] != 'm' || buf[14] != 't' || buf[15] != ' ')) 94 (buf[12] != 'f') || (buf[13] != 'm') || (buf[14] != 't') || (buf[15] !=
95 ' ') ))
93 return; /* not a WAV file */ 96 return; /* not a WAV file */
94 97
95 channels = *((uint16_t *) &buf[22]); 98 channels = *((uint16_t *) &buf[22]);
@@ -119,23 +122,24 @@ EXTRACTOR_wav_extract_method (struct EXTRACTOR_ExtractContext *ec)
119 (samples < sample_rate) 122 (samples < sample_rate)
120 ? (samples * 1000 / sample_rate) 123 ? (samples * 1000 / sample_rate)
121 : (samples / sample_rate) * 1000, 124 : (samples / sample_rate) * 1000,
122 sample_rate, (1 == channels) ? _("mono") : _("stereo")); 125 sample_rate, (1 == channels) ? _ ("mono") : _ ("stereo"));
123 if (0 != ec->proc (ec->cls, 126 if (0 != ec->proc (ec->cls,
124 "wav", 127 "wav",
125 EXTRACTOR_METATYPE_RESOURCE_TYPE, 128 EXTRACTOR_METATYPE_RESOURCE_TYPE,
126 EXTRACTOR_METAFORMAT_UTF8, 129 EXTRACTOR_METAFORMAT_UTF8,
127 "text/plain", 130 "text/plain",
128 scratch, 131 scratch,
129 strlen (scratch) + 1)) 132 strlen (scratch) + 1))
130 return; 133 return;
131 if (0 != ec->proc (ec->cls, 134 if (0 != ec->proc (ec->cls,
132 "wav", 135 "wav",
133 EXTRACTOR_METATYPE_MIMETYPE, 136 EXTRACTOR_METATYPE_MIMETYPE,
134 EXTRACTOR_METAFORMAT_UTF8, 137 EXTRACTOR_METAFORMAT_UTF8,
135 "text/plain", 138 "text/plain",
136 "audio/x-wav", 139 "audio/x-wav",
137 strlen ("audio/x-wav") +1 )) 140 strlen ("audio/x-wav") + 1))
138 return; 141 return;
139} 142}
140 143
144
141/* end of wav_extractor.c */ 145/* end of wav_extractor.c */