[iPAQ] dodgy mp3 hack

From: Sam Watkins <sam.a.t.myinternet.com.au>
Date: Mon Sep 24 2001 - 12:22:52 EDT

How to get an mp3 onto an ipaq (mine is called ruby) in 78 characters:

(echo tee /tmp/$1\|madplay -;mpg123 -w- $1|fixwav|lame -b48 - -)|ssh root@ruby

Let's see you do that with wince!

It's not really cheating to use fixwav (below) - I'm making up for a dodginess
in mpg123, and it's useful for other stuff too.

---
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
int main(void)
{
	int n = 44;
	char buf[n];
	int i=0;
	while (i < n) { i += read(0, buf+i, n-i); }
	if (strncmp(buf, "RIFF", 4) || strncmp(buf+36, "data", 4)) {
		fprintf(stderr, "whoops, that's not a .wav file!\n");
		exit(1);
	}
	buf[4] = 0xF7;
	buf[5] = 0xFF;
	buf[6] = 0xFF;
	buf[7] = 0x7F;
	buf[40] = 0xd3;
	buf[41] = 0xFF;
	buf[42] = 0xFF;
	buf[43] = 0x7F;
	write(1, buf, n);
	execlp("cat", "cat", 0);
	perror("ohno can't exec cat");
	exit(1);
}
Received on Mon Sep 24 08:25:14 2001

This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:44:11 EDT