Hi,
I'm trying to use minimad to understand the interface to libmad. First, I was having trouble using it with a command like: cat test.mp3 | minimad This was failing on the test for fstat...
So, I modified the code: fd = open ("test.mp3", O_RDONLY); fstat (fd, &stat); fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, fd, 0); if (fdm == MAP_FAILED) return 3;
When I run this version of minimad, minimad dumps junk to my screen.
Anyone have any ideas about what's going wrong?
w
Wayne Davis wrote:
I'm trying to use minimad to understand the interface to libmad. First, I was having trouble using it with a command like: cat test.mp3 | minimad This was failing on the test for fstat...
[...]
When I run this version of minimad, minimad dumps junk to my screen.
Anyone have any ideas about what's going wrong?
Try:
minimad <test.mp3 >test.pcm
Cheers,
Hi,
I'm trying to create a small footprint program that decodes and plays an mp3 from a buffer using libmad.
I started off with minimad and I recalled that decode_output() handled the buffering in madplay. I tried to replicate that by modifying minimad.c to include decode_output() and all of its dependencies. This required many components from madplay. However, I was never able to get this to run correctly.
I don't think that integrating decode_output() into minimad is the best solution. What is the best way to create a simple program to decode and play an mp3 from a buffer without using all of madplay (space requirements)?
Thanks, Wayne
Wayne Davis wrote:
I'm trying to create a small footprint program that decodes and plays an mp3 from a buffer using libmad.
I started off with minimad and I recalled that decode_output() handled the buffering in madplay. I tried to replicate that by modifying minimad.c to include decode_output() and all of its dependencies. This required many components from madplay. However, I was never able to get this to run correctly.
I don't think that integrating decode_output() into minimad is the best solution. What is the best way to create a simple program to decode and play an mp3 from a buffer without using all of madplay (space requirements)?
What do you mean by "from a buffer"?
decode_output() only handles output, not input -- and it doesn't "buffer" anything, it just passes the decoded output to an audio output module.
If your MP3 data is entirely in memory, you can use the minimad framework. If you need to load data from a file, without reading the entire file into memory at once, you may want to use something like madplay's decode_input_read().