Since the update to FFmpeg 5.0, when FFmpeg+libao internal player is
selected, most sounds fail to be pronounced. Furthermore, each failed
pronunciation attempt increases GoldenDict's CPU usage. Finally,
GoldenDict continues to hang and utilize the CPU cores when the user
attempts to exit it.
The reason for the issue is: GoldenDict's readAudioData() returns 0 at
EOF but FFmpeg expects the callback to return AVERROR_EOF. As a result,
internal player's threads are busy calling readAudioData() indefinitely.
a606f27f4c
documented the expected return value of the read_packet callback.
252500a78f
removed the code that handled the deprecated 0 return value gracefully.
The relevant deprecation warning
"Invalid return value 0 for stream protocol" had been flooding
GoldenDict's output for years
Fixes #1489.
Since libao+pulseaudio cannot play 32-bit or flt/fltp/dbl/dblp audio,
the following audio formats are passed through libswresample
to convert into AV_SAMPLE_FMT_S16, which is accepted by libao:
* AV_SAMPLE_FMT_S32
* AV_SAMPLE_FMT_S32P
* AV_SAMPLE_FMT_FLT
* AV_SAMPLE_FMT_FLTP
* AV_SAMPLE_FMT_DBL
* AV_SAMPLE_FMT_DBLP
This fixes issue #949 and issue #1014. Now FFmpeg+libao internal player
can play with pulseaudio backend enabled in /etc/libao.conf .
Signed-off-by: hrimfaxi <outmatch@gmail.com>
* add config and GUI support for internal player back end switching;
* make FFmpeg player disabling option consistent with other similar
qmake options by using CONFIG;
* add a new qmake option that disables Qt Multimedia player. This is
useful for GNU/Linux distributions where Qt WebKit and Qt Multimedia
packages depend on different GStreamer versions and don't work
correctly when combined in one application.
The existing FFmpeg+libao internal player back end has a relatively
low-level implementation, which is difficult to understand and improve.
There are at least 3 open internal player issues:
1) many GNU/Linux users have to edit their libao configuration file to
make Goldendict's internal player work (issue #412);
2) libao's pulseaudio plugin does not support 32-bit audio, which
means that many MediaWiki pronunciations don't work with the most
popular GNU/Linux audio driver (issue #949);
3) Ffmpeg::DecoderContext uses deprecated FFmpeg APIs, which causes
compiler warnings and means that this internal player back end
may not compile with a future FFmpeg library version (issue #978).
The Qt Multimedia back end implementation uses the highest-level
Qt audio API and is very simple.
This new back end works flawlessly on my GNU/Linux machine.
I'm not making it the default back end because I don't know how well
it will work on other platforms with different configurations.
* add a new interface class AudioPlayerInterface;
* inherit a new proxy class Ffmpeg::AudioPlayer from it;
* partially switch ArlticleView to using the interface;
* expose MainWindow's AudioPlayerInterface instance to all ArticleView
instances;
* add a new AudioPlayerFactory class responsible for creating instances
of concrete classes derived from AudioPlayerInterface depending on
relevant Config::Preferences values;
* increase minimum supported Qt version from 4.5 to 4.6 in README
in order to use QScopedPointer introduced in Qt 4.6.