vmo2wav stable port information

Package: vmo2wav
Version: 1
Revision: 3
Source: http://chaos.allsiemens.com/download/siefs-0.5.tar.gz
Source-MD5: 974328fc20b99e975d03a312a2814ed8
DocFiles: README AUTHORS COPYING
Description: Converts Siemens Voice Memo files to wav
License: GPL
Maintainer: Carl van Denzen
Homepage: http://chaos.allsiemens.com
BuildDepends: fink (>= 0.24.12-1)
PatchFile: %n.patch
PatchFile-MD5: 91c1063a954e8dcfedd3a6b97971f9fb
CompileScript: <<
#!/bin/sh -ev
mkdir include
mkdir include/fuse
echo '(*release)' >include/fuse/fuse.h
./configure --with-fuse=$(pwd)
cd converter
make
<<
InstallScript: <<
#!/bin/sh -ev
mkdir -p %i/bin
cp converter/vmo2wav %i/bin
<<
DescPort: <<
The utility vmo2wav is hidden in the SieFS (Siemens File System) project, which attempts to allow mounting of a mobile phone under Linux. Project home page: http://chaos.allsiemens.com/download/siefs-0.5.tar.gz
It didn't compile out of the box because SieFS depends on FUSE, which was not installed and does not HAVE to be installed for the conversion utility as such. However, ./configure did not want to continue without FUSE.
The solution: we simply fake the existence of the necessary file. The configure-script looks for a file .../include/fuse/fuse.h which is to contain at least the text "(*release)". Well, let's provide that than.
There is also a section on Endian-ness; it appeared that the converted files were not converted correctly on a Mac.
Peter Fokker / / 2005-08-03
<<

vmo2wav stable port .patch

--- siefs-0.5/converter/vmconvert.c-orig 2005-08-03 13:14:36.000000000 +0200
+++ siefs-0.5/converter/vmconvert.c 2005-08-03 13:05:14.000000000 +0200
@@ -1,3 +1,5 @@
+/* vmconvert.c - adapted by Peter Fokker ; deal with endianness 2005-08-03 */
+
#include
#include

@@ -48,6 +50,17 @@
rh->filesize = sizeof(struct riff_header) + wav_data_size - 8;
rh->datasize = wav_data_size;

+ /* take care of endian anomaly; make it little endian */
+ rh->filesize = endian_l(rh->filesize);
+ rh->fmthsize = endian_l(rh->fmthsize);
+ rh->format = endian_s(rh->format);
+ rh->channels = endian_s(rh->channels);
+ rh->rate = endian_l(rh->rate);
+ rh->bsec = endian_l(rh->bsec);
+ rh->align = endian_s(rh->align);
+ rh->bits = endian_s(rh->bits);
+ rh->datasize = endian_l(rh->datasize);
+
return sizeof(struct riff_header);
}

@@ -68,6 +81,7 @@

gsm_frame s;
gsm_byte *p;
+ gsm_signal *w; /* used to step through output for endianness */
int i;

p = (gsm_byte *)vmo_frame;
@@ -84,7 +98,12 @@
/* invalid frame */
bzero(buffer, 160 * sizeof(gsm_signal));
}
-
+ else {
+ /* valid frame, but how about endianness? */
+ for (w = (gsm_signal *) buffer, i=160; (i-- > 0); ++w) {
+ *w = endian_s(*w);
+ }
+ }
return;
}

@@ -94,3 +113,45 @@

}

+/* These two routines convert shorts (16 bits) and
+ * longs (32 bits) to little endian format. Trick is to let the
+ * compiler store a multibyte number in endian_test. On a little
+ * endian machine, this will result in the LSB being 1 whereas
+ * on a big endian machine it will be 0. By casting a pointer
+ * to unsigned char, we can determine the endianness automagically.
+ * If we discover we are running on a big endian, we swap, otherwise
+ * we do nothing.
+ */
+
+short endian_s(short i) {
+ static short endian_test = 0x0001;
+ unsigned char *little_endian = (unsigned char *) &endian_test;
+ unsigned char b0,b1;
+
+ if (*little_endian) {
+ return i;
+ }
+ else {
+ b0 = (i & 0x00FF);
+ b1 = ((i & 0xFF00) >> 8);
+ return (b0 << 8) | b1;
+ }
+}
+
+long endian_l(long i) {
+ static short endian_test = 0x0001;
+ unsigned char *little_endian = (unsigned char *) &endian_test;
+ unsigned char b0,b1,b2,b3;
+
+ if (*little_endian) {
+ return i;
+ }
+ else {
+ b0 = (i & 0x000000FF);
+ b1 = ((i & 0x0000FF00) >> 8);
+ b2 = ((i & 0x00FF0000) >> 16);
+ b3 = ((i & 0xFF000000) >> 24);
+ return (b0 << 24) | (b1 << 16) | (b2 << 8) | b3;
+ }
+}
+
--- siefs-0.5/converter/vmconvert.h-orig 2005-08-03 13:14:36.000000000 +0200
+++ siefs-0.5/converter/vmconvert.h 2005-08-03 09:40:04.000000000 +0200
@@ -1,3 +1,5 @@
+/* vmconvert.h - adapted by Peter Fokker ; deal with endianness 2005-08-03 */
+
#ifndef VMCONVERT_H
#define VMCONVERT_H

@@ -5,6 +7,8 @@
int vmo_start();
void vmo_decode(void *vmo_frame, void *buffer);
void vmo_end();
+short endian_s(short i);
+long endian_l(long i);

#endif

vmo2wav _unstable_ port .patch