[Asterisk-Dev] Re: MS-ADPCM in format_wav?
Steven Critchfield
critch at basesys.com
Wed Feb 2 11:02:01 MST 2005
On Wed, 2005-02-02 at 15:47 +0000, Tony Mountifield wrote:
> In article <1107359089.2799.18.camel at critch>,
> Steven Critchfield <critch at basesys.com> wrote:
> > On Wed, 2005-02-02 at 11:02 +0000, Tony Mountifield wrote:
> > > Does anyone know if there has been any work done on enhancing format_wav
> > > to support MS-ADPCM format (fmt codec type 2)?
> > >
> > > If not, I may consider having a go myself, but I don't want to re-invent
> > > the wheel unnecessarily.
> >
> > You wouldn't modify format_wav under the current method. You can copy it
> > to format_wav2 to mimic the way GSM wav files are handled by
> > format_wav49. Then you only need to modify the seek function, and the
> > header creation/update. After that, you just need to make sure the codec
> > is set to adpcm so your incoming frames are already in the right format.
>
> OK, thanks, I'll have a look at that. At the moment, I'm more interested
> in being able to play adpcm files than record them. Rather than relying
> on a matching codec, I was thinking more of having format_wav2 decode the
> ADPCM into SLIN or something, like format_mp3 does.
>
> And having each format in a separate module looks like it requires each
> format to have a different file extension, rather than looking at the
> fmt chunk in the file to determine the format. Is that correct?
>
> I'll take a look at format_adpcm too. Thanks to you and bkw for the pointers.
Ideally, if asterisk doesn't support the codec, you should look into
making the codec then. Putting audio encoding at the format level isn't
a real good idea.
Now as for combining the wav functions into one simple format_wav, that
wouldn't be too bad. Of course you would still have to signify to
asterisk what codec you wanted the file to be recorded in when you said
wav. The only thing that is different between the 2 currently supported
wav formats is the header functions and a few assumptions with how to
deal with blocks of audio for the codec.
For instance, in format_wav_gsm, you read a 65 byte block and send it to
the on it's way. you can not use anything smaller than 65 bytes, and you
have to be on the proper boundaries too. But in format_wav, you just
have to be on the right 2 byte boundary to send the slinear bytes to the
codec.
I'm assuming adpcm and MS-adpcm is similar.
--
Steven Critchfield <critch at basesys.com>
More information about the asterisk-dev
mailing list