Git commit 3085f54797b0ab4b81be4554c97c5f8ff93ef12e by Thomas Eschenbacher. Committed on 12/11/2015 at 20:01. Pushed by eschenbacher into branch 'master'.
playback: dropped Phonon support (was broken and no longer supported by KF5) M +1 -0 CHANGES M +1 -3 CMakeLists.txt M +0 -3 LICENSES M +0 -6 TODO D +0 -39 cmake/KwavePhononSupport.cmake M +0 -3 config.h.cmake M +0 -6 doc/en/index.docbook M +0 -1 doxy.cfg.in M +1 -3 kwave.ebuild.in M +0 -1 libkwave/PlayBackParam.h M +0 -5 libkwave/PlayBackTypesMap.cpp M +1 -1 libkwave/PlaybackController.h M +1 -1 plugins/CMakeLists.txt M +0 -5 plugins/playback/CMakeLists.txt D +0 -367 plugins/playback/PlayBack-Phonon.cpp D +0 -180 plugins/playback/PlayBack-Phonon.h M +1 -11 plugins/playback/PlayBackPlugin.cpp http://commits.kde.org/kwave/3085f54797b0ab4b81be4554c97c5f8ff93ef12e diff --git a/CHANGES b/CHANGES index 02eca13..5bf9912 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ * bugfix: tooltips of fileinfo dialog were not translated * new make target: "make msgstats" to show the progress of translations * compile fix for armv7l + * playback: dropped Phonon support (was broken and no longer supported by KF5) 0.9.0 [2015-05-25] diff --git a/CMakeLists.txt b/CMakeLists.txt index d4ef5eb..d870a00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,6 @@ PROJECT(kwave) # OPTION(WITH_OGG_VORBIS "enable support for ogg/vorbis files [default=on]" ON) # OPTION(WITH_OSS "enable playback/recording via OSS [default=on]" ON) # OPTION(WITH_OPTIMIZED_MEMCPY "enable optimized memcpy [default=on]" ON) -# OPTION(WITH_PHONON "enable playback via Phonon [default=off]" OFF) # OPTION(WITH_PULSEAUDIO "enable playback/recording via PulseAudio [default=on]" ON) ############################################################################# @@ -271,12 +270,11 @@ INCLUDE(KwaveLibaudiofileSupport) INCLUDE(KwaveLibsamplerateSupport) ############################################################################# -### optionally: OSS, ALSA, PulseAudio and Phonon support ### +### optionally: OSS, ALSA and PulseAudio support ### ### for playback/recording ### INCLUDE(KwaveOSSSupport) INCLUDE(KwaveALSASupport) -INCLUDE(KwavePhononSupport) INCLUDE(KwavePulseAudioSupport) ############################################################################# diff --git a/LICENSES b/LICENSES index 6fffc46..32bd664 100644 --- a/LICENSES +++ b/LICENSES @@ -141,7 +141,6 @@ COMPLETE LIST OF FILES AND THEIR LICENSE cmake/KwaveLibaudiofileSupport.cmake GPL2+ cmake/KwaveLibsamplerateSupport.cmake GPL2+ cmake/KwaveOSSSupport.cmake GPL2+ - cmake/KwavePhononSupport.cmake GPL2+ cmake/KwavePulseAudioSupport.cmake GPL2+ cmake/KwaveRPMSupport.cmake GPL2+ cmake/KwaveSysinfo.cmake GPL2+ @@ -723,8 +722,6 @@ COMPLETE LIST OF FILES AND THEIR LICENSE plugins/playback/PlayBackDlg.ui (should be GPL2+) plugins/playback/PlayBack-OSS.cpp GPL2+ plugins/playback/PlayBack-OSS.h GPL2+ - plugins/playback/PlayBack-Phonon.cpp GPL2+ - plugins/playback/PlayBack-Phonon.h GPL2+ plugins/playback/PlayBack-PulseAudio.cpp GPL2+ plugins/playback/PlayBack-PulseAudio.h GPL2+ plugins/playback/PlayBackPlugin.cpp GPL2+ diff --git a/TODO b/TODO index 14998bc..09eac44 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,4 @@ -o PHONON playback is broken (skips input/too fast?) - -o recording via Phonon - o auto-detect song borders set markers, for splitting recorded stuff into several parts and then save them to disc as separate files @@ -108,8 +104,6 @@ o adjustable playback speed (similar to what vlcplayer offers) o support for compressed wav files, like those found on www.montypython.net -> MPEG 3 is still not supported by libaudiofile -o get Phonon playback support running correctly - o TrackPixmap: implement usage of "extra_samples" for interpolated mode o fileinfo plugin: auto-generate filename from "track - title" diff --git a/cmake/KwavePhononSupport.cmake b/cmake/KwavePhononSupport.cmake deleted file mode 100644 index 93281e8..0000000 --- a/cmake/KwavePhononSupport.cmake +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################# -## Kwave - cmake/KwavePhononSupport.cmake -## ------------------- -## begin : Fri May 15 2009 -## copyright : (C) 2009 by Thomas Eschenbacher -## email : thomas.eschenbac...@gmx.de -############################################################################# -# -############################################################################# -## # -## This program is free software; you can redistribute it and/or modify # -## it under the terms of the GNU General Public License as published by # -## the Free Software Foundation; either version 2 of the License, or # -## (at your option) any later version. # -## # -############################################################################# - -OPTION(WITH_PHONON "enable playback via Phonon [default=off]" OFF) - -IF (WITH_PHONON) - - FIND_PACKAGE(Phonon4Qt5 REQUIRED) - - IF (NOT PHONON_FOUND AND PHONON_FOUND_EXPERIMENTAL) - SET(PHONON_FOUND 1) - MESSAGE(STATUS "Found EXPERIMENTAL Phonon version") - ENDIF (NOT PHONON_FOUND AND PHONON_FOUND_EXPERIMENTAL) - - IF (PHONON_FOUND) - MESSAGE(STATUS "Found Phonon version ${PHONON_VERSION}") - SET(HAVE_PHONON_SUPPORT ON CACHE BOOL "enable Phonon support") - ELSE (PHONON_FOUND) - MESSAGE(FATAL_ERROR "Your system lacks Phonon support") - ENDIF (PHONON_FOUND) - -ENDIF (WITH_PHONON) - -############################################################################# -############################################################################# diff --git a/config.h.cmake b/config.h.cmake index 14a56e0..c1796cb 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -39,9 +39,6 @@ /* support playback/recording via PulseAudio */ #cmakedefine HAVE_PULSEAUDIO_SUPPORT -/* support playback via Phonon */ -#cmakedefine HAVE_PHONON_SUPPORT - /* support libsamplerate */ #cmakedefine HAVE_LIBSAMPLERATE diff --git a/doc/en/index.docbook b/doc/en/index.docbook index ce14bee..f85344c 100644 --- a/doc/en/index.docbook +++ b/doc/en/index.docbook @@ -765,12 +765,6 @@ default=<literal>on</literal>] </para></listitem> <listitem><para> - <literal>WITH_PHONON</literal> - enable playback via Phonon (for testing only) - [<literal>on</literal>/<literal>off</literal>, - default=<literal>off</literal>] - </para></listitem> - <listitem><para> <literal>WITH_PULSEAUDIO</literal> enable playback/recording via PulseAudio [<literal>on</literal>/<literal>off</literal>, diff --git a/doxy.cfg.in b/doxy.cfg.in index 55e8f0e..caf41b8 100644 --- a/doxy.cfg.in +++ b/doxy.cfg.in @@ -1952,7 +1952,6 @@ PREDEFINED = DEBUG \ HAVE_MP3 \ HAVE_OPTIMIZED_MEMCPY \ HAVE_PULSEAUDIO_SUPPORT \ - HAVE_PHONON_SUPPORT \ HAVE_OSS_SUPPORT \ HAVE_OGG_OPUS \ HAVE_OGG_VORBIS \ diff --git a/kwave.ebuild.in b/kwave.ebuild.in index 74563f7..433c7ca 100644 --- a/kwave.ebuild.in +++ b/kwave.ebuild.in @@ -16,7 +16,7 @@ LICENSE="BSD GPL-2 LGPL-2 handbook? ( FDL-1.2 )" SLOT="5" KEYWORDS="amd64 ~ppc x86" -IUSE="alsa debug flac handbook mp3 opus oss phonon pulseaudio vorbis" +IUSE="alsa debug flac handbook mp3 opus oss pulseaudio vorbis" RDEPEND=" media-libs/audiofile:= @@ -33,7 +33,6 @@ RDEPEND=" media-libs/libogg media-libs/opus ) - phonon? ( media-libs/phonon[qt5] ) pulseaudio? ( media-sound/pulseaudio ) vorbis? ( media-libs/libogg @@ -81,7 +80,6 @@ src_configure() { $(cmake-utils_use_with vorbis OGG_VORBIS) $(cmake-utils_use_with opus OGG_OPUS) $(cmake-utils_use_with oss) - $(cmake-utils_use_with phonon) $(cmake-utils_use_with pulseaudio) $(cmake-utils_use debug) ) diff --git a/libkwave/PlayBackParam.h b/libkwave/PlayBackParam.h index fe8cc80..afa59fb 100644 --- a/libkwave/PlayBackParam.h +++ b/libkwave/PlayBackParam.h @@ -32,7 +32,6 @@ namespace Kwave PLAYBACK_NONE = 0, /**< none selected */ PLAYBACK_JACK, /**< Jack sound daemon */ PLAYBACK_PULSEAUDIO, /**< PulseAudio Sound Server */ - PLAYBACK_PHONON, /**< Phonon (KDE) */ PLAYBACK_ALSA, /**< ALSA native */ PLAYBACK_OSS, /**< OSS native or ALSA OSS emulation */ PLAYBACK_INVALID /**< (keep this the last entry, EOL delimiter) */ diff --git a/libkwave/PlayBackTypesMap.cpp b/libkwave/PlayBackTypesMap.cpp index ead4a10..ae14cec 100644 --- a/libkwave/PlayBackTypesMap.cpp +++ b/libkwave/PlayBackTypesMap.cpp @@ -39,11 +39,6 @@ void Kwave::PlayBackTypesMap::fill() _(I18N_NOOP("OSS (Open Sound System)")) ); #endif /* HAVE_OSS_SUPPORT */ -#ifdef HAVE_PHONON_SUPPORT - append(index++, Kwave::PLAYBACK_PHONON, _("phonon"), - _(I18N_NOOP("Phonon (KDE)")) ); -#endif /* HAVE_PHONON_SUPPORT */ - #ifdef HAVE_PULSEAUDIO_SUPPORT append(index++, Kwave::PLAYBACK_PULSEAUDIO, _("pulseaudio"), _(I18N_NOOP("Pulse Audio")) ); diff --git a/libkwave/PlaybackController.h b/libkwave/PlaybackController.h index 5139166..562fdcb 100644 --- a/libkwave/PlaybackController.h +++ b/libkwave/PlaybackController.h @@ -107,7 +107,7 @@ namespace Kwave /** * Create a playback device matching the given playback method. * - * @param method a playback_method_t (e.g. Pulse, Phonon, ALSA, OSS...) + * @param method a playback_method_t (e.g. Pulse, ALSA, OSS...) * @return a new PlayBackDevice or 0 if failed */ virtual Kwave::PlayBackDevice *createDevice( diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 685307c..7ef32f1 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -94,7 +94,7 @@ ADD_SUBDIRECTORY( noise ) ADD_SUBDIRECTORY( normalize ) ADD_SUBDIRECTORY( notch_filter ) ADD_SUBDIRECTORY( pitch_shift ) -ADD_SUBDIRECTORY( playback ) # needs one of: OSS/ALSA/PulseAudio/Phonon +ADD_SUBDIRECTORY( playback ) # needs one of: OSS/ALSA/PulseAudio ADD_SUBDIRECTORY( record ) # needs OSS and/or ALSA ADD_SUBDIRECTORY( reverse ) ADD_SUBDIRECTORY( samplerate ) # needs libsamplerate diff --git a/plugins/playback/CMakeLists.txt b/plugins/playback/CMakeLists.txt index ef1716a..b23de45 100644 --- a/plugins/playback/CMakeLists.txt +++ b/plugins/playback/CMakeLists.txt @@ -24,11 +24,6 @@ IF (HAVE_ALSA_SUPPORT) SET(PLAYBACK_REQUIRED_LIBS ${PLAYBACK_REQUIRED_LIBS} asound) ENDIF (HAVE_ALSA_SUPPORT) -IF (HAVE_PHONON_SUPPORT) - SET(PLAYBACK_SOURCES ${PLAYBACK_SOURCES} PlayBack-Phonon.cpp) - SET(PLAYBACK_REQUIRED_LIBS ${PLAYBACK_REQUIRED_LIBS} ${PHONON_LIBRARY}) -ENDIF (HAVE_PHONON_SUPPORT) - IF (HAVE_PULSEAUDIO_SUPPORT) SET(PLAYBACK_SOURCES ${PLAYBACK_SOURCES} PlayBack-PulseAudio.cpp) SET(PLAYBACK_REQUIRED_LIBS ${PLAYBACK_REQUIRED_LIBS} ${PULSEAUDIO_LIBRARIES}) diff --git a/plugins/playback/PlayBack-Phonon.cpp b/plugins/playback/PlayBack-Phonon.cpp deleted file mode 100644 index 9a2fdfe..0000000 --- a/plugins/playback/PlayBack-Phonon.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/*************************************************************************** - PlayBack-Phonon.cpp - playback device for KDE4-Phonon - ------------------- - begin : Fri May 15 2009 - copyright : (C) 2009 by Thomas Eschenbacher - email : thomas.eschenbac...@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "config.h" -#ifdef HAVE_PHONON_SUPPORT - -#include <errno.h> - -#include "libkwave/SampleEncoderLinear.h" -#include "libkwave/String.h" -#include "libkwave/Utils.h" -#include "libkwave/memcpy.h" - -#include "PlayBack-Phonon.h" - -//*************************************************************************** -Kwave::PlayBackPhonon::PlayBackPhonon() - :Kwave::PlayBackDevice(), m_buffer(), m_raw_buffer(), m_buffer_size(0), - m_buffer_used(0), m_encoder(0), - m_sem(0), m_output(0), m_path(), m_media_object(), - m_media_source(this), m_first_write(true) -{ -} - -//*************************************************************************** -Kwave::PlayBackPhonon::~PlayBackPhonon() -{ -} - -//*************************************************************************** -void Kwave::PlayBackPhonon::createEncoder(unsigned int bits) -{ - // create the sample encoder - // we assume that OSS is always little endian - if (m_encoder) delete m_encoder; - - switch (bits) { - case 8: - m_encoder = new Kwave::SampleEncoderLinear( - Kwave::SampleFormat::Unsigned, 8, Kwave::LittleEndian); - break; - case 24: - m_encoder = new Kwave::SampleEncoderLinear( - Kwave::SampleFormat::Signed, 24, Kwave::LittleEndian); - break; - case 32: - m_encoder = new Kwave::SampleEncoderLinear( - Kwave::SampleFormat::Signed, 32, Kwave::LittleEndian); - break; - default: - m_encoder = new Kwave::SampleEncoderLinear( - Kwave::SampleFormat::Signed, 16, Kwave::LittleEndian); - break; - } -} - -//*************************************************************************** -void Kwave::PlayBackPhonon::createHeader(double rate, - quint8 channels, - quint16 bits) -{ - m_header.resize(44); - - m_header[ 0] = 'R'; - m_header[ 1] = 'I'; - m_header[ 2] = 'F'; - m_header[ 3] = 'F'; - - m_header[ 4] = 40; - m_header[ 5] = 0; - m_header[ 6] = 0; - m_header[ 7] = 0; - - m_header[ 8] = 'W'; - m_header[ 9] = 'A'; - m_header[10] = 'V'; - m_header[11] = 'E'; - - m_header[12] = 'f'; - m_header[13] = 'm'; - m_header[14] = 't'; - m_header[15] = ' '; - - m_header[16] = 16; - m_header[17] = 0; - m_header[18] = 0; - m_header[19] = 0; - - m_header[20] = 0x01; - m_header[21] = 0x00; - - m_header[22] = channels; - m_header[23] = 0; - - int r = Kwave::toInt(rate); - m_header[24] = (r >> 0) & 0xFF; - m_header[25] = (r >> 8) & 0xFF; - m_header[26] = (r >> 16) & 0xFF; - m_header[27] = (r >> 24) & 0xFF; - - int bps = r * ((channels * bits) / 8); - m_header[28] = (bps >> 0) & 0xFF; - m_header[29] = (bps >> 8) & 0xFF; - m_header[30] = (bps >> 16) & 0xFF; - m_header[31] = (bps >> 24) & 0xFF; - - m_header[32] = (((channels * bits) / 8) >> 0) & 0xFF; - m_header[33] = (((channels * bits) / 8) >> 8) & 0xFF; - - m_header[34] = (bits >> 0) & 0xFF; - m_header[35] = (bits >> 8) & 0xFF; - - m_header[36] = 'd'; - m_header[37] = 'a'; - m_header[38] = 't'; - m_header[39] = 'a'; - - m_header[40] = static_cast<char>(0xFF); - m_header[41] = static_cast<char>(0xFF); - m_header[42] = static_cast<char>(0xFF); - m_header[43] = static_cast<char>(0xFF); -} - -//*************************************************************************** -QString Kwave::PlayBackPhonon::open(const QString &device, double rate, - unsigned int channels, unsigned int bits, - unsigned int bufbase) -{ - // close the previous device - if (m_output) delete m_output; - m_output = 0; - - // create a new Phonon output device - m_output = new Phonon::AudioOutput(Phonon::MusicCategory); - Q_ASSERT(m_output); - if (!m_output) return i18n("Out of memory"); - - // try to find the matching device - QList<Phonon::AudioOutputDevice> devices = - Phonon::BackendCapabilities::availableAudioOutputDevices(); - - Phonon::AudioOutputDevice dev; - foreach(Phonon::AudioOutputDevice d, devices) { - if (d.name() == device) { - dev = d; - break; - } - } - if (!dev.isValid()) { - return i18n("Opening the device '%1' failed.", device); - } - - // set the output device name - m_output->setOutputDevice(dev); - - // create the path from the stream to the output - m_media_object.stop(); - m_media_object.clear(); - m_media_object.clearQueue(); - m_first_write = true; - m_media_object.enqueue(m_media_source); - m_path = Phonon::createPath(&m_media_object, m_output); - - // create a sample encoder - createEncoder(bits); - Q_ASSERT(m_encoder); - if (!m_encoder) return i18n("Out of memory"); - - // calculate the new buffer size - if (bufbase < 8) - bufbase = 8; - m_buffer_size = (1 << bufbase); - - // resize the raw buffer - m_raw_buffer.resize(m_buffer_size); - - // resize our buffer (size in samples) and reset it - m_buffer_size /= m_encoder->rawBytesPerSample(); - if (!m_buffer.resize(m_buffer_size)) - return i18n("Out of memory"); - - // create a dummy wave RIFF header - createHeader(rate, static_cast<quint8>(channels), - static_cast<quint16>(bits)); - - m_media_object.play(); - setStreamSize(-1); - - return QString(); -} - -//*************************************************************************** -int Kwave::PlayBackPhonon::write(const Kwave::SampleArray &samples) -{ - Q_ASSERT (m_buffer_used <= m_buffer_size); - if (m_buffer_used > m_buffer_size) { - qWarning("PlayBackPhonon::write(): buffer overflow ?!"); - m_buffer_used = m_buffer_size; - flush(); - return -EIO; - } - // number of samples left in the buffer - unsigned int remaining = samples.size(); - unsigned int offset = 0; - while (remaining) { - unsigned int length = remaining; - if (m_buffer_used + length > m_buffer_size) - length = m_buffer_size - m_buffer_used; - - MEMCPY(&(m_buffer[m_buffer_used]), - &(samples[offset]), - length * sizeof(sample_t)); - m_buffer_used += length; - offset += length; - remaining -= length; - - // write buffer to device if it has become full - if (m_buffer_used >= m_buffer_size) { - int err = flush(); - if (err != -EAGAIN) return err; - } - } - - return 0; -} - -//*************************************************************************** -int Kwave::PlayBackPhonon::flush() -{ - if (!m_buffer_used || !m_encoder) return 0; // nothing to do - - // convert into byte stream - m_encoder->encode(m_buffer, m_buffer_used, m_raw_buffer); - - // wait until the Phonon layer has called needData() - if (!m_sem.tryAcquire(1, 5000)) { - qDebug("PlayBackPhonon::flush() - EAGAIN"); - m_buffer_used = 0; - return -EAGAIN; - } - - writeData(m_raw_buffer); - - m_buffer_used = 0; - return 0; -} - -//*************************************************************************** -int Kwave::PlayBackPhonon::close() -{ - m_media_object.stop(); - m_media_object.clearQueue(); - m_media_object.clear(); - - // close the device - if (m_output) delete m_output; - m_output = 0; - m_first_write = true; - - return 0; -} - -//*************************************************************************** -QStringList Kwave::PlayBackPhonon::supportedDevices() -{ - QStringList list; - bool retry; - unsigned int retry_count = 3; // we try three times - - do { - retry = false; - list.clear(); - - // get the list of available audio output devices from Phonon - QList<Phonon::AudioOutputDevice> devices = - Phonon::BackendCapabilities::availableAudioOutputDevices(); - - // get and use the device name(s) from the object description(s) - foreach(const Phonon::AudioOutputDevice &device, devices) { - QString name = device.name(); - -// // for debugging: list all properties -// qDebug("name='%s'", DBG(name)); -// foreach (const char *property, device.propertyNames()) { -// qDebug(" '%s' = '%s'", property, -// DBG(device.property(property).toString())); -// } - - // device names not yet available ? - if (!name.length()) { - qWarning("PlayBackPhonon::supportedDevices() " - "=> BUG in Phonon: no device name?"); - retry = true; - break; - } - list << name; - - } - } while (retry && retry_count--); - - return list; -} - -//*************************************************************************** -QString Kwave::PlayBackPhonon::fileFilter() -{ - return _(""); -} - -//*************************************************************************** -QList<unsigned int> Kwave::PlayBackPhonon::supportedBits(const QString &device) -{ - Q_UNUSED(device); - - QList<unsigned int> list; - list << 8; - list << 16; - - return list; -} - -//*************************************************************************** -int Kwave::PlayBackPhonon::detectChannels(const QString &device, - unsigned int &min, unsigned int &max) -{ - Q_UNUSED(device); - - min = 1; - max = 2; - - return 0; -} - -//*************************************************************************** -void Kwave::PlayBackPhonon::reset() -{ -} - -//*************************************************************************** -void Kwave::PlayBackPhonon::needData() -{ - if (m_first_write) { - m_first_write = false; - writeData(m_header); - return; - } - m_sem.release(); -} - -#endif /* HAVE_PHONON_SUPPORT */ - -//*************************************************************************** -//*************************************************************************** diff --git a/plugins/playback/PlayBack-Phonon.h b/plugins/playback/PlayBack-Phonon.h deleted file mode 100644 index b47e89d..0000000 --- a/plugins/playback/PlayBack-Phonon.h +++ /dev/null @@ -1,180 +0,0 @@ -/*************************************************************************** - PlayBack-Phonon.h - playback device for KDE4-Phonon - ------------------- - begin : Fri May 15 2009 - copyright : (C) 2009 by Thomas Eschenbacher - email : thomas.eschenbac...@gmx.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef PLAY_BACK_PHONON_H -#define PLAY_BACK_PHONON_H - -#include "config.h" -#ifdef HAVE_PHONON_SUPPORT - -#include <QByteArray> -#include <QList> -#include <QSemaphore> -#include <QString> - -#include <phonon/abstractmediastream.h> -#include <phonon/audiooutput.h> -#include <phonon/backendcapabilities.h> -#include <phonon/mediaobject.h> -#include <phonon/mediasource.h> -#include <phonon/path.h> -#include <phonon/phononnamespace.h> - -#include "libkwave/PlayBackDevice.h" -#include "libkwave/SampleArray.h" - -namespace Kwave -{ - - class SampleEncoder; - - class PlayBackPhonon: public Kwave::PlayBackDevice, - public Phonon::AbstractMediaStream - { - public: - - /** Default constructor */ - PlayBackPhonon(); - - /** Destructor */ - virtual ~PlayBackPhonon(); - - /** - * Opens the device for playback. - * @see PlayBackDevice::open - */ - virtual QString open(const QString &device, double rate, - unsigned int channels, unsigned int bits, - unsigned int bufbase); - - /** - * Writes an array of samples to the output device. - * @see PlayBackDevice::write - */ - virtual int write(const Kwave::SampleArray &samples); - - /** - * Closes the output device. - * @see PlayBackDevice::close - */ - virtual int close(); - - /** return a string list with supported device names */ - virtual QStringList supportedDevices(); - - /** return a string suitable for a "File Open..." dialog */ - virtual QString fileFilter(); - - /** - * returns a list of supported bits per sample resolutions - * of a given device. - * - * @param device filename of the device - * @return list of supported bits per sample, or empty on errors - */ - virtual QList<unsigned int> supportedBits(const QString &device); - - /** - * Detect the minimum and maximum number of channels. - * If the detection fails, minimum and maximum are set to zero. - * - * @param device filename of the device - * @param min receives the lowest supported number of channels - * @param max receives the highest supported number of channels - * @return zero or positive number if ok, negative error number if failed - */ - virtual int detectChannels(const QString &device, - unsigned int &min, unsigned int &max); - - /** @see Phonon::AbstractMediaStream::reset */ - virtual void reset(); - - /** @see Phonon::AbstractMediaStream::needData */ - virtual void needData(); - - private: - - /** - * creates a sample encoder for playback, for linear - * formats - * @param bits number of bits/sample (8, 16, 24 or 32) - */ - void createEncoder(unsigned int bits); - - /** - * creates a dummy RIFF wav header for fooling Phonon - * @param rate sample rate [samples/second] - * @param channels number of channels [1...N] - * @param bits number of bits/sample (8, 16, 24 or 32) - */ - void createHeader(double rate, - quint8 channels, - quint16 bits); - - /** - * writes the output buffer to the Phonon layer - * @return 0 if succeeded, -EAGAIN on timeout - */ - int flush(); - - private: - - /** buffer with samples data */ - Kwave::SampleArray m_buffer; - - /** buffer with raw data */ - QByteArray m_raw_buffer; - - /** Buffer size on bytes */ - unsigned int m_buffer_size; - - /** number of bytes in the buffer */ - unsigned int m_buffer_used; - - /** encoder for converting from samples to raw format */ - Kwave::SampleEncoder *m_encoder; - - /** semaphore for communication between phonon and Kwave */ - QSemaphore m_sem; - - /** audio output device for Phonon */ - Phonon::AudioOutput *m_output; - - /** path from m_media_object to m_output */ - Phonon::Path m_path; - - /** media object that serves as container for the media source */ - Phonon::MediaObject m_media_object; - - /** media source, adapter for the playback stream */ - Phonon::MediaSource m_media_source; - - /** if true, send a header in the first write */ - bool m_first_write; - - /** faked RIFF header for wav format */ - QByteArray m_header; - - }; -} - -#endif /* HAVE_PHONON_SUPPORT */ - -#endif /* PLAY_BACK_PHONON_H */ - -//*************************************************************************** -//*************************************************************************** diff --git a/plugins/playback/PlayBackPlugin.cpp b/plugins/playback/PlayBackPlugin.cpp index e297c42..0d425a1 100644 --- a/plugins/playback/PlayBackPlugin.cpp +++ b/plugins/playback/PlayBackPlugin.cpp @@ -59,13 +59,12 @@ #include "PlayBack-ALSA.h" #include "PlayBack-OSS.h" -#include "PlayBack-Phonon.h" #include "PlayBack-PulseAudio.h" #include "PlayBackDialog.h" #include "PlayBackPlugin.h" -KWAVE_PLUGIN(Kwave::PlayBackPlugin, "playback", "2.3", +KWAVE_PLUGIN(Kwave::PlayBackPlugin, "playback", "2.4", I18N_NOOP("Playback"), I18N_NOOP("Thomas Eschenbacher")); @@ -235,10 +234,6 @@ QList<Kwave::playback_method_t> Kwave::PlayBackPlugin::supportedMethods() methods.append(Kwave::PLAYBACK_PULSEAUDIO); #endif /* HAVE_PULSEAUDIO_SUPPORT */ - #ifdef HAVE_PHONON_SUPPORT - methods.append(Kwave::PLAYBACK_PHONON); -#endif /* HAVE_PHONON_SUPPORT */ - #ifdef HAVE_ALSA_SUPPORT methods.append(Kwave::PLAYBACK_ALSA); #endif /* HAVE_ALSA_SUPPORT */ @@ -266,11 +261,6 @@ Kwave::PlayBackDevice *Kwave::PlayBackPlugin::createDevice( Kwave::FileInfo(signalManager().metaData())); #endif /* HAVE_PULSEAUDIO_SUPPORT */ -#ifdef HAVE_PHONON_SUPPORT - case Kwave::PLAYBACK_PHONON: - return new Kwave::PlayBackPhonon(); -#endif /* HAVE_PHONON_SUPPORT */ - #ifdef HAVE_ALSA_SUPPORT case Kwave::PLAYBACK_ALSA: return new Kwave::PlayBackALSA(); _______________________________________________ kde-doc-english mailing list kde-doc-english@kde.org https://mail.kde.org/mailman/listinfo/kde-doc-english