Commit graph

34 commits

Author SHA1 Message Date
Xiao YiFang 82aea3ec33 remove ffmpeg deprecated method 2022-11-29 20:20:03 +08:00
Xiao YiFang c239973e16 fix: can not play some certain audio files 2022-11-29 20:20:03 +08:00
Xiao YiFang 12acff095c ffmpeg convert the the audio to raw format 2022-11-15 21:14:34 +08:00
Xiao YiFang f37e2862ce remove commented line 2022-11-12 17:27:16 +08:00
Xiao YiFang 85aad0f80c feature: remove libao dependency and use QAudioSink(QAudioOutput) to play the pcm audio format 2022-11-12 09:34:09 +08:00
Xiao YiFang cbf62a4dbe Merge commit '98b37fea' into staged 2022-11-05 10:00:44 +08:00
Igor Kushnir 98b37feac2 Print debug output with gdDebug() instead of av_log()
Users can enable or disable av_log() output only by inserting a call to
av_log_set_level() and recompiling GoldenDict. Blink browser engine
shipped with Qt WebEngine sets the log level to AV_LOG_QUIET in
chromium/media/base/media.cc and thus disables all output. So
GoldenDict's custom AV_LOG_INFO messages are always printed in the Qt
WebKit version and never in the Qt WebEngine version.

In contrast, users have many ways to enable or disable QDebug output
without recompilation since Qt 5. Furthermore, GoldenDict's command line
option --log-to-file allows to redirect gdDebug() output to a log file.

The two messages printed via av_log() are clearly debug messages,
because they are printed each time a word or a phrase is pronounced.
2022-11-04 19:52:39 +03:00
Xiao YiFang af4946d7a7 fix upstream merge conflict 2022-06-22 17:48:52 +08:00
Igor Kushnir 7fa7ad6e52 FFmpeg 5.0 player: stop reading raw data at EOF
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.
2022-06-21 17:53:23 +03:00
xiaoyifang bd2afff4da
Merge pull request #23 from MikeWalrus/master
add support for ffmpeg 5.0
2022-02-20 15:09:11 +08:00
Liao Junxuan 8acb288c9e add support for ffmpeg 5.0 2022-02-20 12:28:05 +08:00
yifang 8b2d6316ac jquery: noconflict compatibility 2022-02-08 07:56:48 +08:00
xiaoyifang 6cf9c35dd4 ffmpeg: remove deprecated code 2022-02-07 21:06:49 +08:00
xiaoyifang 5eac08c97a rename qt4x5.hh to utils.hh
the filename qt4x5 is not proper now,for the qt4 version can never meet.and the qt5 is actually mean qt>5 .
2021-12-13 22:45:35 +08:00
hrimfaxi 2d2db3b208 Use libswresample to convert 32-bit and float audio into s16
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>
2020-07-18 22:41:57 +08:00
Abs62 966f4a8b78 FFmpeg player: Fix some crashes on broken files 2019-09-27 17:00:52 +03:00
Abs62 03bbe01b79 Fix warnings while compile with FFMpeg 3.4.2 (issue #978) 2018-03-30 23:05:22 +03:00
Igor Kushnir 9aa3c44d4e Add QMediaPlayer internal player back end (Qt5 only)
* 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.
2018-03-30 17:10:33 +03:00
Igor Kushnir e5045860ef Make adding new audio player implementations easy
* 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.
2018-03-24 21:31:48 +02:00
Igor Kushnir 2e25be8f71 Eliminate redundant casts to/from void* in Ffmpeg player 2018-03-24 20:16:50 +02:00
Abs62 f82294b532 Merge branch 'Original' into Qt4x5 2016-02-24 17:44:26 +03:00
Abs62 cabc5aa7c3 Fix compilation with last FFMpeg versions (issue #673) 2016-02-17 17:37:23 +03:00
Abs62 89ab1bfba5 Adjust code for Qt5 2014-07-16 17:59:25 +04:00
Abs62 531aa79805 Merge branch 'Original' into Qt4x5
Conflicts:
	ffmpegaudio.cc
2014-07-16 17:58:40 +04:00
Abs62 2f8b4975a3 Fix play ADPCM wav files via internal player 2014-07-15 18:47:08 +04:00
Timon Wong 555b51260a Merge branch 'master' into qt4x5 2013-06-26 21:07:46 +08:00
Tvangeste 55e4de2cca Stop the internal audio player when the page is closed or changed 2013-06-23 11:54:46 +02:00
Timon Wong f5a43e22d4 Merge branch 'master' into qt4x5
Conflicts:
	goldendict.pro
2013-06-18 11:22:07 +08:00
Timon Wong cf71499242 Add "DISABLE_INTERNAL_PLAYER" to .pro as an option to disable internal audio player (issue #356) 2013-06-18 09:12:31 +08:00
Timon Wong 1d85f1b359 #212: Scratch, currently works under windows, for both Qt4 and Qt5 2013-05-30 21:24:21 +08:00
Timon Wong 525a539b7e FFmpeg: Fix potential crash on some codecs (speex for example) 2013-05-24 16:15:07 +08:00
Timon Wong 680c201b88 audio: localizable error string 2013-05-15 00:00:31 +08:00
Timon Wong fa1e0711b5 audio: give more meaningful error message for ao_open_live(). see #312 2013-05-14 22:24:19 +08:00
Timon Wong c4752eb14c Add internal audio player(ffmpeg/libav + libao).
* phonon, bass, playsound are removed.
2013-05-05 18:22:12 +08:00