Re: Playing 5.1 sound on a stereo device with OpenAL Soft
Martin Lambers <[email protected]>
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <[email protected]> |
On 05/11/10 17:40, Chris Robinson wrote: > 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). Thanks for these hints. I now take the samples from ffmpeg in the format it provides and let OpenAL do the conversion if supported. My application is a 3D video player <http://bino.nongnu.org/>, and I think this approach should work fine with most real world video files (multichannel sound streams with double format samples are probably only used for very special purposes). > 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. Yes, GStreamer seems a little bit too high-level for me - it seems difficult to control the whole thing, including timing. OTOH, ffmpeg seems a little too low-level for me... Martin _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal