Menu

MADFilter 1.0.0.1 released

This is the first release of MADFilter, a DirectShow filter for the MAD library!
The idea is mostly to provide an example on how to write a DirectShow audio-filter, however the filter itself can be used as a replacement for the standard MPEG Audio Layer 1, 2 and 3 filters.

It works well except for one thing:
The problem is that the plugin always reports (CD-quality) 44,1kHz/2 channels/16bit even though the decoded frequency could be different.

There are two ways of solving this:
- change the code in such it reports the right format
- upsample (downsample - although that would be very rare) to CD-quality

I'm working on the second option. The reason for that has to do with the reason I started writing this filter. There wasn't any filter which could use in combination with the streaming TCP/IP sourcefilters I had created for my work. I needed a MPEG Layer 1/2/3 filter which could do the following:

- handle all three MPEG audio layers
- be very tolerant to errors and garbage in audio (For instance play an MPEG-video stream by just skipping all video)
- decode frame by frame, because in my streaming sourcefilters the content-type could change every next frame (Basicly we streamed MP3-files over TCP/IP and whenever a file ended or the user choose to go to the next file during playback, a new MP3 was used. And the next MP3 could have a completly different bitrate, etc.)

The MAD-libray can do all, if you wrap it up in some functions (which I based on the madlld example). Especially the third option is relevant: I wanted to keep the output constant to make things easy. So even though the input MP3-type could/would vary, the soundcard (and media player) would think the output format was always constant. That made life easier since Media Player 6 isn't always that flexible.

I however forgot that besides bitrate, stereo, etc (which MAD can all nicely handle), also the frequency could change. And that's the only thing MAD doesn't handle.

In the next release I'll solve this. I already updated my MAD-wrapper functions, so that they would automaticly detect frequency changes and upsample frames if required. The problem was finding proper upsampling-algorithms which would function also on a frame-to-frame basis. I never found such code. That makes of course sence, since upsampling depends on the previous and following frames. So I had to create some buffering mechanisme. I also tried several upsampling routines and libaries, but in the end the good old Microsoft ACM worked the best. So I will use ACM-functions for upsampling in the next release.

However, I didn't implement those yet in the MAD DirectShow filter, but they seem to be 100% stable in a test-application, which gets a stream of MP3-files with varying types (bitrate and frequency changes).

Armin Gerritsen

Posted by bond 2003-08-21

Log in to post a comment.