cmus/cmus — pull request #49 by stonekyx (2013-07-29 06:31:54+00:00)
Title: ffmpeg input plugin can work with newest ffmpeg now

I don't actually know if the plugin is already working in other branches, but when I used the latest version in the master branch, cmus just made noises when playing .ape or .wma files, which obviously uses ffmpeg plugin.

First I fixed the use of deprecated APIs, by adding more #if branches. When I changed to use avcodec_decode_audio4, the noise partly disappeared, but some audio played too fast this time. It was about sample formats. There were different problems here, but only one solution.

It seemed that the previous version of ffmpeg plugin just gives up when sample_fmt is AV_SAMPLE_FMT_FLT or AV_SAMPLE_FMT_DBL, but I do have some files with these sample formats. The solution I adopted is to use swresample, as this is the simplest one. In ffmpeg_open, the parameters of SwrContext is set, and in ffmpeg_fill_buffer, only a call to swr_convert solves everything. Now my file with AV_SAMPLE_FMT_FLTP plays perfect.

The exact version of ffmpeg I have tested with is 1.2.1. The output plugin was alsa.

My system is ArchLinux. `uname -a` prints:
Linux stone-arch 3.9.3-1-ARCH #1 SMP PREEMPT Mon May 20 08:00:01 CEST 2013 i686 GNU/Linux