Re: Playing 5.1 sound on a stereo device with OpenAL Soft

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Friday, November 05, 2010 1:59:43 am Martin Lambers wrote:
> You're right, it is indeed an ffmpeg problem. Some audio streams are
> apparently *not* decoded to signed 16 bit sample formats. The ffplay
> player contains code to convert sample formats in this case, but uses an
> internal ffmpeg API for this purpose that is not part of the installed
> header files. So, no luck for alffmpeg and my project...

Seems ffmpeg was changed (again). When I originally wrote the code, 
avcodec_decode_audio2 guaranteed writing samples as signed 16-bit PCM, hence 
why the function takes int16_t* for output samples. But now it seems the 
AVCodecContext contains a sample_fmt field. And indeed, the WMA codec outputs 
32-bit float samples. This is easy enough to support with AL_EXT_FLOAT32, 
though 32-bit int and double sample formats would need conversion (double 
could work with AL_EXT_DOUBLE, but there's no multi-channel support for it).

This is one of the biggest problems I've found with using ffmpeg. It regularly 
breaks backwards compatibility, so you need to pick a specific version and 
stick with it. GStreamer is nicer for streaming playback (especially with an 
OpenAL sink <https://bugzilla.gnome.org/show_bug.cgi?id=615615> to integrate 
it with the rest of the OpenAL app), although it's not so nice for general 
decode-to-buffer functionality.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.