mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove Phonon and the VLC backend for it
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
128a047295
commit
e4ec23f0f0
292 changed files with 8 additions and 37554 deletions
|
@ -104,9 +104,6 @@ add_feature_info(mysql WITH_MYSQL "the world's most popular open source database
|
|||
option(WITH_SQLITE "Build SQLite database plugin" ON)
|
||||
add_feature_info(sqlite WITH_SQLITE "the world's most popular open source database")
|
||||
|
||||
option(WITH_VLC "Build VLC Phonon backend" ON)
|
||||
add_feature_info(sqlite WITH_VLC "VLC C API Library")
|
||||
|
||||
option(WITH_X11 "Build X11/X.Org support" ON)
|
||||
add_feature_info(x11 WITH_X11 "an open source something")
|
||||
|
||||
|
@ -420,15 +417,6 @@ set_package_properties(Sqlite PROPERTIES
|
|||
TYPE RECOMMENDED
|
||||
)
|
||||
|
||||
set(VLC_MIN_VERSION "2.1.0")
|
||||
find_package(VLC)
|
||||
set_package_properties(VLC PROPERTIES
|
||||
PURPOSE "Required for VLC Phonon backend"
|
||||
DESCRIPTION "VLC C API Library"
|
||||
URL "http://www.videolan.org/vlc/"
|
||||
TYPE RECOMMENDED
|
||||
)
|
||||
|
||||
find_package(Threads)
|
||||
set_package_properties(Threads PROPERTIES
|
||||
PURPOSE "Required for threads support"
|
||||
|
@ -559,7 +547,6 @@ if(NOT KATIE_BOOTSTRAP)
|
|||
if(WITH_OPENGL AND OPENGL_FOUND)
|
||||
add_subdirectory(src/opengl)
|
||||
endif()
|
||||
add_subdirectory(src/phonon)
|
||||
add_subdirectory(src/plugins)
|
||||
add_subdirectory(src/script)
|
||||
add_subdirectory(src/scripttools)
|
||||
|
@ -601,7 +588,6 @@ katie_generate_obsolete(qhboxlayout.h QtGui qboxlayout.h)
|
|||
katie_generate_obsolete(qvboxlayout.h QtGui qboxlayout.h)
|
||||
katie_generate_obsolete(qspaceritem.h QtGui qlayoutitem.h)
|
||||
katie_generate_obsolete(qdoublespinbox.h QtGui qspinbox.h)
|
||||
katie_generate_obsolete(global.h Phonon ../phonon/phononnamespace.h)
|
||||
katie_generate_obsolete(qxmlstream.h QtXml ../QtCore/qxmlstream.h)
|
||||
katie_generate_obsolete(qxmlstreamwriter.h QtXml ../QtCore/qxmlstream.h)
|
||||
katie_generate_obsolete(qxmlstreamreader.h QtXml ../QtCore/qxmlstream.h)
|
||||
|
|
4
README
4
README
|
@ -7,7 +7,7 @@ There are several things you should be aware before considering Katie:
|
|||
- some components and tools have been removed:
|
||||
- QMake, D-Bus viewer, Linguist, Assistant, checksdk, macdeployqt, pixeltool,
|
||||
qconfig, qdoc, qev, qvfb, runonphone and other non-essential
|
||||
- Qt3Support, QtWebKit and ActiveQt
|
||||
- Qt3Support, QtWebKit, ActiveQt and Phonon
|
||||
|
||||
- some things have changed:
|
||||
- QMake build system replaced with CMake
|
||||
|
@ -16,8 +16,6 @@ There are several things you should be aware before considering Katie:
|
|||
- OpenSSL and D-Bus cannot be runtime dependencies, they must be linked to
|
||||
during build
|
||||
- QtUiTools is build as shared library by default
|
||||
- Phonon has been updated to 4.8.51
|
||||
- Phonon backends (GStreamer, DS9, MMF, QT7, WaveOut) replaced with VLC
|
||||
- updated bundled Harfbuzz from upstream (not Harfbuzz-NG)
|
||||
- Symbian, QWS and QPA are no longer supported platforms
|
||||
- OpenVG is no longer supported graphics output
|
||||
|
|
2
TODO
2
TODO
|
@ -2,8 +2,6 @@ finish plugins porting to cmake
|
|||
deal with obsolete headers, besides those mentioned in the CMake files
|
||||
use system harfbuzz and clucene (optionally) and unbundle
|
||||
make use of qstandarddirs and qcommandlineparser trought the codebase, e.g. moc
|
||||
move phonon sources to 3rdparty, still, generate docs for it
|
||||
do not rebuild phonon on prefix change
|
||||
QT_MOC_CPP seems unused but checked for in two headers
|
||||
manual pages for lconvert, qcollectiongenerator, qhelpgenerator, rcc and uic
|
||||
new logo, branding, copyright header changes, etc.
|
||||
|
|
|
@ -34,15 +34,6 @@ foreach(component ${KATIE_COMPONENTS})
|
|||
if(uppercomp STREQUAL "MAIN")
|
||||
set(KATIE_INCLUDES ${KATIE_INCLUDES} "@QT_HEADERS_PATH@")
|
||||
set(KATIE_${uppercomp}_INCLUDES "@QT_HEADERS_PATH@")
|
||||
elseif(uppercomp STREQUAL "PHONON")
|
||||
set(KATIE_INCLUDES ${KATIE_INCLUDES}
|
||||
"@QT_HEADERS_PATH@/phonon"
|
||||
"@QT_HEADERS_PATH@/Phonon"
|
||||
)
|
||||
set(KATIE_${uppercomp}_INCLUDES
|
||||
"@QT_HEADERS_PATH@/phonon"
|
||||
"@QT_HEADERS_PATH@/Phonon"
|
||||
)
|
||||
else()
|
||||
set(KATIE_INCLUDES ${KATIE_INCLUDES} "@QT_HEADERS_PATH@/Qt${component}")
|
||||
set(KATIE_${uppercomp}_INCLUDES "@QT_HEADERS_PATH@/Qt${component}")
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
# - Try to find the VLC
|
||||
# Once done this will define
|
||||
#
|
||||
# VLC_FOUND - system has VLC
|
||||
# VLC_INCLUDES - the VLC include directory
|
||||
# VLC_LIBRARIES - The libraries needed to use VLC
|
||||
#
|
||||
# Copyright (c) 2015, Ivailo Monev, <xakepa10@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
|
||||
if(VLC_INCLUDES AND VLC_LIBRARIES)
|
||||
set(VLC_FIND_QUIETLY TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(PC_VLC QUIET libvlc)
|
||||
|
||||
set(VLC_VERSION ${PC_VLC_VERSION})
|
||||
endif()
|
||||
|
||||
find_path(VLC_INCLUDES
|
||||
NAMES
|
||||
vlc/vlc.h
|
||||
HINTS
|
||||
$ENV{VLCDIR}/include
|
||||
${PC_VLC_INCLUDEDIR}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
find_library(VLC_LIBRARIES
|
||||
vlc
|
||||
HINTS
|
||||
$ENV{VLCDIR}/lib
|
||||
${PC_VLC_LIBDIR}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
find_library(VLC_CORE_LIBRARIES
|
||||
vlccore
|
||||
HINTS
|
||||
$ENV{VLCDIR}/lib
|
||||
${PC_VLC_LIBDIR}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
if(VLC_LIBRARIES AND VLC_CORE_LIBRARIES)
|
||||
set(VLC_LIBRARIES ${VLC_LIBRARIES} ${VLC_CORE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDES VLC_LIBRARIES VLC_CORE_LIBRARIES)
|
||||
|
||||
mark_as_advanced(VLC_INCLUDES VLC_LIBRARIES)
|
|
@ -38,7 +38,7 @@ PROJECT_NAME = "Katie"
|
|||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.8.7
|
||||
PROJECT_NUMBER = 4.9.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
@ -809,7 +809,7 @@ EXCLUDE_SYMLINKS = NO
|
|||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS = */src/3rdparty/* */tests/* */src/tools/* */src/phonon/phonon-vlc/*
|
||||
EXCLUDE_PATTERNS = */src/3rdparty/* */tests/* */src/tools/*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
|
|
|
@ -8,7 +8,7 @@ set(KATIE_VERSION "${KATIE_MAJOR}.${KATIE_MINOR}.${KATIE_MICRO}")
|
|||
set(KATIE_STRING "katie ${KATIE_MAJOR}.${KATIE_MINOR}.${KATIE_MICRO}")
|
||||
set(KATIE_BUGREPORT "xakepa10@gmail.com")
|
||||
set(KATIE_URL "http://github.com/fluxer/katie")
|
||||
set(KATIE_COMPONENTS "Core Gui DBus Declarative Designer DesignerComponents Help Multimedia Network OpenGL Phonon Sql Svg Xml XmlPatterns Script ScriptTools Test UiTools")
|
||||
set(KATIE_COMPONENTS "Core Gui DBus Declarative Designer DesignerComponents Help Multimedia Network OpenGL Sql Svg Xml XmlPatterns Script ScriptTools Test UiTools")
|
||||
# TODO: make dbus tools optional
|
||||
set(KATIE_TOOLS "moc uic rcc qdbusxml2cpp qdbuscpp2xml qhelpgenerator qcollectiongenerator lupdate lrelease lconvert designer")
|
||||
set(QT_LICENSE "Open Source")
|
||||
|
@ -98,7 +98,6 @@ include(${KATIE_MKSPECS_DIR}/tests/tests.cmake)
|
|||
set(LDCONF_INSTALL_DIR "etc/ld.so.conf.d")
|
||||
set(PROFILE_INSTALL_DIR "etc/profile.d")
|
||||
set(DBUS_INTERFACES_INSTALL_DIR "etc/dbus-1/interfaces")
|
||||
set(KDE4_SERVICES_INSTALL_DIR "share/kde4/services/phononbackends")
|
||||
set(MAN_INSTALL_DIR "share/man")
|
||||
set(CMAKE_INSTALL_DIR "cmake")
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@ pkgdesc='C++ toolkit derived from the Qt 4.8 framework (mingw-w64)'
|
|||
arch=('i686' 'x86_64')
|
||||
url='https://github.com/fluxer/katie'
|
||||
license=('LGPL' 'FDL' 'custom')
|
||||
# FIXME: depend on mingw-w64-vlc
|
||||
depends=('mingw-w64-openssl' 'mingw-w64-zlib' 'mingw-w64-crt')
|
||||
makedepends=('cmake' 'git' 'python' 'vlc' 'unifdef' 'mingw-w64-gcc')
|
||||
optdepends=('vlc: Phonon VLC backend')
|
||||
makedepends=('cmake' 'git' 'python' 'unifdef' 'mingw-w64-gcc')
|
||||
source=("git+https://github.com/fluxer/katie")
|
||||
sha1sums=('SKIP')
|
||||
conflicts=('mingw-w64-katie')
|
||||
|
@ -27,8 +25,6 @@ pkgver() {
|
|||
prepare() {
|
||||
mkdir -p build
|
||||
|
||||
echo "set(DBUS_INTERFACES_INSTALL_DIR /usr/${_arch}/etc/dbus-1/interfaces)" \
|
||||
>> katie/mkspecs/win32/vendor.cmake
|
||||
echo "set(CMAKE_INSTALL_DIR /usr/${_arch}/share/cmake)" \
|
||||
>> katie/mkspecs/win32/vendor.cmake
|
||||
echo 'set(QT_LIBRARIES_PATH "${QT_PREFIX_PATH}/lib/katie")' \
|
||||
|
|
|
@ -13,11 +13,10 @@ depends=('openssl' 'zlib' 'cups' 'alsa-lib' 'gtk2' 'libgl' 'libice'
|
|||
'libsm' 'libxcursor' 'libxext' 'libxfixes' 'libxi' 'libxinerama'
|
||||
'libxrandr' 'libxrender' 'libx11' 'fontconfig' 'freetype2' 'glib2')
|
||||
makedepends=('cmake' 'git' 'python' 'postgresql' 'mariadb' 'unixodbc' 'mesa'
|
||||
'vlc' 'unifdef')
|
||||
'unifdef')
|
||||
optdepends=('postgresql-libs: PostgreSQL driver'
|
||||
'libmariadbclient: MariaDB driver'
|
||||
'unixodbc: ODBC driver'
|
||||
'vlc: Phonon VLC backend')
|
||||
'unixodbc: ODBC driver')
|
||||
source=("git+https://github.com/fluxer/katie")
|
||||
sha1sums=('SKIP')
|
||||
conflicts=('katie')
|
||||
|
@ -35,8 +34,6 @@ prepare() {
|
|||
>> katie/mkspecs/linux/vendor.cmake
|
||||
echo 'set(PROFILE_INSTALL_DIR /etc/profile.d)' \
|
||||
>> katie/mkspecs/linux/vendor.cmake
|
||||
echo 'set(DBUS_INTERFACES_INSTALL_DIR /etc/dbus-1/interfaces)' \
|
||||
>> katie/mkspecs/linux/vendor.cmake
|
||||
echo 'set(CMAKE_INSTALL_DIR /usr/share/cmake)' \
|
||||
>> katie/mkspecs/linux/vendor.cmake
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ override_dh_auto_configure:
|
|||
> mkspecs/linux/vendor.cmake
|
||||
echo 'set(PROFILE_INSTALL_DIR /etc/profile.d)' \
|
||||
>> mkspecs/linux/vendor.cmake
|
||||
echo 'set(DBUS_INTERFACES_INSTALL_DIR /etc/dbus-1/interfaces)' \
|
||||
>> mkspecs/linux/vendor.cmake
|
||||
echo 'set(CMAKE_INSTALL_DIR /usr/share/cmake)' \
|
||||
>> mkspecs/linux/vendor.cmake
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@
|
|||
\ingroup painting
|
||||
|
||||
This class is used to show simple animations without sound. If you want
|
||||
to display video and media content, use the \l{Phonon Module}{Phonon}
|
||||
multimedia framework instead.
|
||||
to display video and media content, use other multimedia framework.
|
||||
|
||||
First, create a QMovie object by passing either the name of a file or a
|
||||
pointer to a QIODevice containing an animated image format to QMovie's
|
||||
|
|
|
@ -1,386 +0,0 @@
|
|||
add_definitions(
|
||||
-DQT_BUILD_PHONON_LIB
|
||||
-DMAKE_PHONON_LIB
|
||||
-DPHONON_LIBRARY_PATH="${QT_PLUGINS_PATH}"
|
||||
-DPHONON_BACKEND_DIR_SUFFIX="/phonon_backend/"
|
||||
# do not use any platform plugin
|
||||
# -DQT_NO_PHONON_PLATFORMPLUGIN
|
||||
# -DPHONON_NO_CAPTURE
|
||||
)
|
||||
set(EXTRA_PHONON_LIBS KtCore KtGui)
|
||||
|
||||
# TODO: aliases
|
||||
set(PHONON_PUBLIC_HEADERS
|
||||
${PHONON_PUBLIC_HEADERS}
|
||||
AbstractAudioOutput
|
||||
AbstractMediaStream
|
||||
AbstractVideoOutput
|
||||
AddonInterface
|
||||
AudioCaptureDevice
|
||||
AudioCaptureDeviceModel
|
||||
AudioChannelDescription
|
||||
AudioChannelDescriptionModel
|
||||
AudioDataOutput
|
||||
AudioOutput
|
||||
AudioOutputDevice
|
||||
AudioOutputDeviceModel
|
||||
AudioOutputInterface
|
||||
AudioOutputInterface40
|
||||
AudioOutputInterface42
|
||||
AvCapture
|
||||
BackendCapabilities
|
||||
BackendInterface
|
||||
Effect
|
||||
EffectDescription
|
||||
EffectDescriptionModel
|
||||
EffectInterface
|
||||
EffectParameter
|
||||
EffectWidget
|
||||
Global
|
||||
GlobalDescriptionContainer
|
||||
MediaController
|
||||
MediaNode
|
||||
MediaObject
|
||||
MediaObjectInterface
|
||||
MediaSource
|
||||
Mrl
|
||||
ObjectDescription
|
||||
ObjectDescriptionData
|
||||
ObjectDescriptionModel
|
||||
ObjectDescriptionModelData
|
||||
Path
|
||||
PlatformPlugin
|
||||
SeekSlider
|
||||
StreamInterface
|
||||
SubtitleDescription
|
||||
SubtitleDescriptionModel
|
||||
VideoCaptureDevice
|
||||
VideoCaptureDeviceModel
|
||||
VideoPlayer
|
||||
VideoWidget
|
||||
VideoWidgetInterface
|
||||
VideoWidgetInterface44
|
||||
VideoWidgetInterfaceLatest
|
||||
VolumeFaderEffect
|
||||
VolumeFaderInterface
|
||||
VolumeSlider
|
||||
)
|
||||
|
||||
set(PHONON_LIB_MAJOR_VERSION ${KATIE_MAJOR})
|
||||
set(PHONON_LIB_MINOR_VERSION ${KATIE_MINOR})
|
||||
set(PHONON_LIB_PATCH_VERSION ${KATIE_MICRO})
|
||||
set(PHONON_EXPERIMENTAL TRUE)
|
||||
set(PHONON_GRAPHICS TRUE)
|
||||
set(BACKEND_INSTALL_DIR "${QT_PLUGINS_PATH_INST}/phonon_backend/")
|
||||
|
||||
set_source_files_properties(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/factory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/globalconfig.h
|
||||
PROPERTIES SKIP_RESOURCE TRUE
|
||||
)
|
||||
|
||||
set(PHONON_HEADERS
|
||||
${PHONON_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractaudiooutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractmediastream.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractvideooutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/addoninterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiodataoutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiodataoutputinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutputinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backendcapabilities.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backendinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effect.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectparameter.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectwidget.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globalconfig.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globaldescriptioncontainer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediacontroller.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/medianode.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediaobject.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediaobjectinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediasource.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mrl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescription.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescriptionmodel.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/path.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phonon_export.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phonondefs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platformplugin.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/seekslider.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/streaminterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videoplayer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videowidget.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videowidgetinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumefadereffect.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumefaderinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumeslider.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractaudiooutput_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractmediastream_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractvideooutput_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiodataoutput_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutputadaptor_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutput_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backendcapabilities_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectparameter_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effect_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectwidget_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/factory_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/frontendinterface_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globalconfig_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globalstatic_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/iodevicestream_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/medianodedestructionhandler_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/medianode_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediaobject_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediasource_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescriptionmodel_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescription_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/path_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phonondefs_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phononnamespace_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phononpimpl_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qsettingsgroup_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/seekslider_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/statesvalidator_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/streaminterface_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/swiftslider_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videowidget_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumefadereffect_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumeslider_p.h
|
||||
)
|
||||
|
||||
set(PHONON_SOURCES
|
||||
${PHONON_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractaudiooutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractaudiooutput_p.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractmediastream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractvideooutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractvideooutput_p.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiodataoutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutputinterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backendcapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effect.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectparameter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/effectwidget.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/factory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globalconfig.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/iodevicestream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediacontroller.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediaobject.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/medianode.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mediasource.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mrl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescription.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/objectdescriptionmodel.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phononnamespace.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/seekslider.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/statesvalidator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/streaminterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/swiftslider.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumefadereffect.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/volumeslider.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videoplayer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/videowidget.cpp
|
||||
)
|
||||
|
||||
if(WITH_OPENGL AND OPENGL_FOUND AND PHONON_GRAPHICS)
|
||||
set(PHONON_HEADERS
|
||||
${PHONON_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/abstractvideographicspainter.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/glpainter.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videoframe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videographicsobjectinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videoframe.h
|
||||
# VGO does not need to be public, as there is only pull but no push behavior.
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videographicsobject.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videographicsobjectinterface.h
|
||||
)
|
||||
|
||||
set(PHONON_SOURCES
|
||||
${PHONON_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/glpainter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/glslpainter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/qpainterpainter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/graphicsview/videographicsobject.cpp
|
||||
)
|
||||
set(EXTRA_PHONON_LIBS
|
||||
${EXTRA_PHONON_LIBS}
|
||||
KtOpenGL
|
||||
)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
else()
|
||||
set(PHONON_GRAPHICS FALSE)
|
||||
katie_definition(-DPHONON_NO_GRAPHICSVIEW)
|
||||
endif()
|
||||
|
||||
if(WITH_DBUS AND DBUS_FOUND)
|
||||
set(PHONON_SOURCES
|
||||
${PHONON_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/audiooutputadaptor.cpp
|
||||
)
|
||||
set(EXTRA_PHONON_LIBS
|
||||
${EXTRA_PHONON_LIBS}
|
||||
KtDBus
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/org.kde.Phonon.AudioOutput.xml
|
||||
${CMAKE_CURRENT_BINARY_DIR}/org.kde.Phonon.AudioOutput.xml
|
||||
@ONLY
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Phonon.AudioOutput.xml
|
||||
DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phononconfig_p.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/phononconfig_p.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/phononnamespace.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/phononnamespace.h
|
||||
)
|
||||
|
||||
set(PHONON_HEADERS
|
||||
${PHONON_HEADERS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/phononconfig_p.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/phononnamespace.h
|
||||
)
|
||||
|
||||
if(PHONON_EXPERIMENTAL)
|
||||
set(PHONON_EXPERIMENTAL_HEADERS
|
||||
${PHONON_EXPERIMENTAL_HEADERS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/abstractaudiodataoutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/abstractvideodataoutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/audiodataoutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/audiodataoutputinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/audioformat.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/avcapture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/avcaptureinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/backendcapabilities.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/backendinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/export.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/mediasource.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/objectdescription.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/snapshotinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/packet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/packetpool.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/phononnamespace.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videodataoutput.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videodataoutput2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videodataoutputinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videoframe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videoframe2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videowidget.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/visualization.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/globalconfig.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/factory_p.h
|
||||
)
|
||||
set(PHONON_SOURCES
|
||||
${PHONON_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/abstractaudiodataoutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/abstractvideodataoutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/audiodataoutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/audioformat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/avcapture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/backendcapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/factory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/globalconfig.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/mediasource.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/objectdescription.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/packet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/packetpool.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videodataoutput.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videodataoutput2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/videowidget.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental/visualization.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractaudiooutput_p.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/abstractvideooutput_p.cpp
|
||||
)
|
||||
add_definitions(-DMAKE_PHONONEXPERIMENTAL_LIB)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/privateinclude
|
||||
${CMAKE_BINARY_DIR}/include/QtCore
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtCore
|
||||
${CMAKE_BINARY_DIR}/include/QtGui
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtGui
|
||||
${CMAKE_BINARY_DIR}/include/QtOpenGL
|
||||
${CMAKE_BINARY_DIR}/privateinclude/QtOpenGL
|
||||
${CMAKE_BINARY_DIR}/include/phonon
|
||||
${CMAKE_BINARY_DIR}/privateinclude/phonon
|
||||
${CMAKE_BINARY_DIR}/include/phonon/experimental
|
||||
${CMAKE_BINARY_DIR}/privateinclude/phonon/experimental
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/experimental
|
||||
${CMAKE_CURRENT_BINARY_DIR}/graphicsview
|
||||
)
|
||||
|
||||
katie_generate_misc("${PHONON_HEADERS}" phonon)
|
||||
katie_generate_misc("${PHONON_EXPERIMENTAL_HEADERS}" phonon/experimental)
|
||||
# for Qt Phonon and KDE Phonon compat do it for both
|
||||
# TODO: migrate the vlc backend from Phonon, Katana is happy with phonon
|
||||
katie_generate_public("${PHONON_PUBLIC_HEADERS}" Phonon)
|
||||
katie_generate_public("${PHONON_PUBLIC_HEADERS}" phonon)
|
||||
if(PHONON_EXPERIMENTAL)
|
||||
katie_generate_map(Phonon "PHONON_EXPORT|PHONONEXPERIMENTAL_EXPORT")
|
||||
katie_generate_map(phonon "PHONON_EXPORT|PHONONEXPERIMENTAL_EXPORT")
|
||||
else()
|
||||
katie_generate_map(Phonon PHONON_EXPORT)
|
||||
katie_generate_map(phonon PHONON_EXPORT)
|
||||
endif()
|
||||
katie_resources(${PHONON_SOURCES} ${PHONON_HEADERS})
|
||||
if(PHONON_EXPERIMENTAL)
|
||||
katie_resources(${PHONON_EXPERIMENTAL_HEADERS})
|
||||
endif()
|
||||
katie_setup_flags()
|
||||
|
||||
add_library(KtPhonon ${KATIE_TYPE} ${PHONON_SOURCES} ${PHONON_HEADERS} ${PHONON_EXPERIMENTAL_HEADERS})
|
||||
target_link_libraries(KtPhonon ${EXTRA_PHONON_LIBS})
|
||||
set_target_properties(KtPhonon PROPERTIES
|
||||
VERSION ${KATIE_MAJOR}.${KATIE_MINOR}
|
||||
SOVERSION ${KATIE_VERSION}
|
||||
EXPORT_NAME Phonon
|
||||
)
|
||||
|
||||
set(PHONON_REQUIRES KtCore)
|
||||
if(WITH_OPENGL AND OPENGL_FOUND AND PHONON_GRAPHICS)
|
||||
set(PHONON_REQUIRES "${PHONON_REQUIRES} KtOpenGL")
|
||||
endif()
|
||||
if(WITH_DBUS AND DBUS_FOUND)
|
||||
set(PHONON_REQUIRES "${PHONON_REQUIRES} KtDBus")
|
||||
endif()
|
||||
katie_generate_package(KtPhonon "" "${EXTRA_PHONON_LIBS}" "${PHONON_REQUIRES}")
|
||||
|
||||
if(WITH_VLC AND VLC_FOUND)
|
||||
add_subdirectory(phonon-vlc)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS KtPhonon
|
||||
EXPORT KatieLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
DESTINATION ${QT_LIBRARIES_PATH_INST}
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/include/phonon
|
||||
${CMAKE_BINARY_DIR}/include/Phonon
|
||||
DESTINATION ${QT_HEADERS_PATH_INST}
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
katie_optimize_headers(${QT_HEADERS_PATH}/phonon)
|
|
@ -1,510 +0,0 @@
|
|||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
This is Git checkout 40cb0c510bed119fc054cb68807e321a584bdaea
|
||||
from git://anongit.kde.org/phonon.git that has been modified to fit our needs.
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "abstractaudiooutput.h"
|
||||
#include "abstractaudiooutput_p.h"
|
||||
#include "factory_p.h"
|
||||
|
||||
#define PHONON_CLASSNAME AbstractAudioOutput
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
AbstractAudioOutput::AbstractAudioOutput(AbstractAudioOutputPrivate &dd, QObject *parent) : QObject(parent),
|
||||
MediaNode(dd)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractAudioOutput::~AbstractAudioOutput()
|
||||
{
|
||||
}
|
||||
|
||||
} //namespace Phonon
|
||||
|
||||
#undef PHONON_CLASSNAME
|
||||
|
||||
#include "moc_abstractaudiooutput.cpp"
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#include "moc_abstractaudiooutput.h"
|
|
@ -1,53 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef Phonon_ABSTRACTAUDIOOUTPUTBASE_H
|
||||
#define Phonon_ABSTRACTAUDIOOUTPUTBASE_H
|
||||
|
||||
#include "phonondefs.h"
|
||||
#include "phonon_export.h"
|
||||
#include "medianode.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AbstractAudioOutputPrivate;
|
||||
|
||||
/** \class AbstractAudioOutput abstractaudiooutput.h phonon/AbstractAudioOutput
|
||||
* Common base class for all audio outputs.
|
||||
*
|
||||
* \see AudioOutput
|
||||
*/
|
||||
class PHONON_EXPORT AbstractAudioOutput : public QObject, public MediaNode
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(AbstractAudioOutput)
|
||||
protected:
|
||||
AbstractAudioOutput(AbstractAudioOutputPrivate &dd, QObject *parent);
|
||||
public:
|
||||
~AbstractAudioOutput();
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#endif // Phonon_ABSTRACTAUDIOOUTPUTBASE_H
|
|
@ -1,40 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "abstractaudiooutput_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
bool AbstractAudioOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AbstractAudioOutputPrivate::setupBackendObject()
|
||||
{
|
||||
Q_ASSERT(m_backendObject);
|
||||
|
||||
// set up attributes
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
|
@ -1,46 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_ABSTRACTAUDIOOUTPUT_P_H
|
||||
#define PHONON_ABSTRACTAUDIOOUTPUT_P_H
|
||||
|
||||
#include "abstractaudiooutput.h"
|
||||
#include "medianode_p.h"
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AbstractAudioOutputPrivate : public MediaNodePrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AbstractAudioOutput)
|
||||
PHONON_PRIVATEABSTRACTCLASS
|
||||
public:
|
||||
virtual QObject *qObject() { return q_func(); }
|
||||
protected:
|
||||
AbstractAudioOutputPrivate(CastId castId = AbstractAudioOutputPrivateType)
|
||||
: MediaNodePrivate(castId)
|
||||
{
|
||||
}
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif // PHONON_ABSTRACTAUDIOOUTPUT_P_H
|
|
@ -1,195 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "abstractmediastream.h"
|
||||
#include "abstractmediastream_p.h"
|
||||
#include "mediaobjectinterface.h"
|
||||
#include "mediaobject_p.h"
|
||||
#include "phonondefs_p.h"
|
||||
#include "streaminterface_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
AbstractMediaStream::AbstractMediaStream(QObject *parent)
|
||||
: QObject(parent),
|
||||
d_ptr(new AbstractMediaStreamPrivate)
|
||||
{
|
||||
d_ptr->q_ptr = this;
|
||||
}
|
||||
|
||||
AbstractMediaStream::AbstractMediaStream(AbstractMediaStreamPrivate &dd, QObject *parent)
|
||||
: QObject(parent),
|
||||
d_ptr(&dd)
|
||||
{
|
||||
d_ptr->q_ptr = this;
|
||||
}
|
||||
|
||||
AbstractMediaStream::~AbstractMediaStream()
|
||||
{
|
||||
}
|
||||
|
||||
qint64 AbstractMediaStream::streamSize() const
|
||||
{
|
||||
return d_ptr->streamSize;
|
||||
}
|
||||
|
||||
void AbstractMediaStream::setStreamSize(qint64 newSize)
|
||||
{
|
||||
d_ptr->setStreamSize(newSize);
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::setStreamSize(qint64 newSize)
|
||||
{
|
||||
streamSize = newSize;
|
||||
if (streamInterface) {
|
||||
streamInterface->setStreamSize(newSize);
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractMediaStream::streamSeekable() const
|
||||
{
|
||||
return d_ptr->streamSeekable;
|
||||
}
|
||||
|
||||
void AbstractMediaStream::setStreamSeekable(bool s)
|
||||
{
|
||||
d_ptr->setStreamSeekable(s);
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::setStreamSeekable(bool s)
|
||||
{
|
||||
streamSeekable = s;
|
||||
if (streamInterface) {
|
||||
streamInterface->setStreamSeekable(s);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStream::writeData(const QByteArray &data)
|
||||
{
|
||||
d_ptr->writeData(data);
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::writeData(const QByteArray &data)
|
||||
{
|
||||
if (ignoreWrites) {
|
||||
return;
|
||||
}
|
||||
Q_ASSERT(streamInterface);
|
||||
streamInterface->writeData(data);
|
||||
}
|
||||
|
||||
void AbstractMediaStream::endOfData()
|
||||
{
|
||||
d_ptr->endOfData();
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::endOfData()
|
||||
{
|
||||
if (streamInterface) {
|
||||
streamInterface->endOfData();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStream::error(Phonon::ErrorType type, const QString &text)
|
||||
{
|
||||
Q_D(AbstractMediaStream);
|
||||
d->errorType = type;
|
||||
d->errorText = text;
|
||||
if (d->mediaObjectPrivate) {
|
||||
// TODO: MediaObject might be in a different thread
|
||||
d->mediaObjectPrivate->streamError(type, text);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStream::enoughData()
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractMediaStream::seekStream(qint64)
|
||||
{
|
||||
Q_ASSERT(!d_ptr->streamSeekable);
|
||||
}
|
||||
|
||||
AbstractMediaStreamPrivate::~AbstractMediaStreamPrivate()
|
||||
{
|
||||
if (mediaObjectPrivate) {
|
||||
// TODO: MediaObject might be in a different thread
|
||||
mediaObjectPrivate->removeDestructionHandler(this);
|
||||
}
|
||||
if (streamInterface) {
|
||||
// TODO: StreamInterface might be in a different thread
|
||||
streamInterface->d->disconnectMediaStream();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::setStreamInterface(StreamInterface *iface)
|
||||
{
|
||||
P_Q(AbstractMediaStream);
|
||||
streamInterface = iface;
|
||||
if (!iface) {
|
||||
// our subclass might be just about to call writeData, so tell it we have enoughData and
|
||||
// ignore the next writeData calls
|
||||
q->enoughData();
|
||||
ignoreWrites = true;
|
||||
return;
|
||||
}
|
||||
if (ignoreWrites) {
|
||||
ignoreWrites = false;
|
||||
// we had a StreamInterface before. The new StreamInterface expects us to start reading from
|
||||
// position 0
|
||||
q->reset();
|
||||
} else {
|
||||
iface->setStreamSize(streamSize);
|
||||
iface->setStreamSeekable(streamSeekable);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::setMediaObjectPrivate(MediaObjectPrivate *mop)
|
||||
{
|
||||
// TODO: MediaObject might be in a different thread
|
||||
mediaObjectPrivate = mop;
|
||||
mediaObjectPrivate->addDestructionHandler(this);
|
||||
if (!errorText.isEmpty()) {
|
||||
mediaObjectPrivate->streamError(errorType, errorText);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStreamPrivate::phononObjectDestroyed(MediaNodePrivate *bp)
|
||||
{
|
||||
// TODO: MediaObject might be in a different thread
|
||||
Q_ASSERT(bp == mediaObjectPrivate);
|
||||
Q_UNUSED(bp);
|
||||
mediaObjectPrivate = 0;
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#include "moc_abstractmediastream.cpp"
|
||||
|
||||
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
// vim: sw=4 sts=4 et tw=100
|
||||
#include "moc_abstractmediastream.h"
|
|
@ -1,223 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_ABSTRACTMEDIASTREAM_H
|
||||
#define PHONON_ABSTRACTMEDIASTREAM_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "phononnamespace.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
|
||||
class QByteArray;
|
||||
|
||||
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class MediaObject;
|
||||
class AbstractMediaStreamPrivate;
|
||||
|
||||
/** \class AbstractMediaStream abstractmediastream.h phonon/AbstractMediaStream
|
||||
* \brief Base class for custom media data streams.
|
||||
*
|
||||
* Implement this class to provide a custom data stream to the backend. The class supports both, the
|
||||
* push and the pull model.
|
||||
*
|
||||
* Push:
|
||||
* \code
|
||||
* PushStream::PushStream(QObject *parent)
|
||||
* : AbstractMediaStream(parent), m_timer(new QTimer(this))
|
||||
* {
|
||||
* setStreamSize(getMediaStreamSize());
|
||||
*
|
||||
* connect(m_timer, SIGNAL(timeout()), SLOT(moreData()));
|
||||
* m_timer->setInterval(0);
|
||||
* }
|
||||
*
|
||||
* void PushStream::moreData()
|
||||
* {
|
||||
* const QByteArray data = getMediaData();
|
||||
* if (data.isEmpty()) {
|
||||
* endOfData();
|
||||
* } else {
|
||||
* writeData(data);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* void PushStream::needData()
|
||||
* {
|
||||
* m_timer->start();
|
||||
* moreData();
|
||||
* }
|
||||
*
|
||||
* void PushStream::enoughData()
|
||||
* {
|
||||
* m_timer->stop();
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* Pull:
|
||||
* \code
|
||||
* PullStream::PullStream(QObject *parent)
|
||||
* : AbstractMediaStream(parent)
|
||||
* {
|
||||
* setStreamSize(getMediaStreamSize());
|
||||
* }
|
||||
*
|
||||
* void PullStream::needData()
|
||||
* {
|
||||
* const QByteArray data = getMediaData();
|
||||
* if (data.isEmpty()) {
|
||||
* endOfData();
|
||||
* } else {
|
||||
* writeData(data);
|
||||
* }
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \ingroup Playback
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONON_EXPORT AbstractMediaStream : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(AbstractMediaStream)
|
||||
friend class MediaObject;
|
||||
friend class MediaObjectPrivate;
|
||||
friend class StreamInterface;
|
||||
public:
|
||||
virtual ~AbstractMediaStream();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Constructs an AbstractMediaStream object with a \p parent.
|
||||
*/
|
||||
explicit AbstractMediaStream(QObject *parent = 0);
|
||||
|
||||
/**
|
||||
* Returns the stream size that was set with \ref setStreamSize.
|
||||
*
|
||||
* A negative value means that the length of the stream cannot be known.
|
||||
*
|
||||
* Defaults to \c 0.
|
||||
*/
|
||||
qint64 streamSize() const;
|
||||
|
||||
/**
|
||||
* Sets the size of the stream in number of bytes.
|
||||
*
|
||||
* A negative value means that the length of the stream cannot be known.
|
||||
*
|
||||
* Defaults to 0.
|
||||
*
|
||||
* This function has to be called. A backend will not call \ref needData() until the
|
||||
* stream size is set.
|
||||
*/
|
||||
void setStreamSize(qint64);
|
||||
|
||||
/**
|
||||
* Returns whether your data stream is set as seekable.
|
||||
*
|
||||
* Defaults to \c false.
|
||||
*/
|
||||
bool streamSeekable() const;
|
||||
|
||||
/**
|
||||
* Sets whether your data stream is seekable.
|
||||
*
|
||||
* Defaults to \c false.
|
||||
*
|
||||
* If you set this to \c true you have to implement the \ref seekStream function.
|
||||
*/
|
||||
void setStreamSeekable(bool);
|
||||
|
||||
/**
|
||||
* Sends the media \p data to the backend for decoding.
|
||||
*
|
||||
* \warning Don't call this function before the first needData() is emitted.
|
||||
*/
|
||||
void writeData(const QByteArray &data);
|
||||
|
||||
/**
|
||||
* Tells the backend that the media data stream is at its end.
|
||||
*
|
||||
* \warning Don't call this function before the first needData() is emitted.
|
||||
*/
|
||||
void endOfData();
|
||||
|
||||
/**
|
||||
* If an I/O error occurs you should call this function to make MediaObject go into
|
||||
* ErrorState.
|
||||
*
|
||||
* \see MediaObject::errorType()
|
||||
* \see MediaObject::errorString()
|
||||
*/
|
||||
void error(Phonon::ErrorType errorType, const QString &errorString);
|
||||
|
||||
/**
|
||||
* Reimplement this function to reset the stream. Subsequent calls to writeData should start
|
||||
* from the first position of the data unless a seek is requested.
|
||||
*
|
||||
* The function is necessary for the case where a non-seekable MediaStream is
|
||||
* played more than once. For a seekable stream the implementation can simply call
|
||||
* \code
|
||||
* seekStream(0);
|
||||
* \endcode.
|
||||
*/
|
||||
Q_INVOKABLE virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* Reimplement this function to be notified when the backend needs data.
|
||||
*
|
||||
* When this function is called you should try to call writeData or endOfData before
|
||||
* returning.
|
||||
*/
|
||||
Q_INVOKABLE virtual void needData() = 0;
|
||||
|
||||
/**
|
||||
* Reimplement this function to be notified when the backend has enough data and your stream
|
||||
* object may take a break. This method is important for pushing data to the backend in
|
||||
* order to not fill the backend buffer unnecessarily.
|
||||
*/
|
||||
Q_INVOKABLE virtual void enoughData();
|
||||
|
||||
/**
|
||||
* Reimplement this function if your stream is seekable.
|
||||
*
|
||||
* When this function is called the next call to writeData has to be at the requested \p
|
||||
* offset.
|
||||
*
|
||||
* \warning Do not call the parent implementation.
|
||||
*/
|
||||
Q_INVOKABLE virtual void seekStream(qint64 offset);
|
||||
|
||||
AbstractMediaStream(AbstractMediaStreamPrivate &dd, QObject *parent);
|
||||
QScopedPointer<AbstractMediaStreamPrivate> d_ptr;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
|
||||
#endif // PHONON_ABSTRACTMEDIASTREAM_H
|
|
@ -1,79 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ABSTRACTMEDIASTREAM_P_H
|
||||
#define ABSTRACTMEDIASTREAM_P_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "abstractmediastream.h"
|
||||
#include "mediaobject_p.h"
|
||||
#include "streaminterface.h"
|
||||
|
||||
#include "medianodedestructionhandler_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
class MediaObjectPrivate;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class PHONON_EXPORT AbstractMediaStreamPrivate : private MediaNodeDestructionHandler
|
||||
{
|
||||
friend class MediaObject;
|
||||
P_DECLARE_PUBLIC(AbstractMediaStream)
|
||||
public:
|
||||
void setStreamInterface(StreamInterface *);
|
||||
void setMediaObjectPrivate(MediaObjectPrivate *);
|
||||
~AbstractMediaStreamPrivate();
|
||||
|
||||
protected:
|
||||
AbstractMediaStreamPrivate()
|
||||
: streamSize(0),
|
||||
streamSeekable(false),
|
||||
ignoreWrites(false),
|
||||
streamInterface(0),
|
||||
mediaObjectPrivate(0),
|
||||
errorType(NoError)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void setStreamSize(qint64 newSize);
|
||||
virtual void setStreamSeekable(bool s);
|
||||
virtual void writeData(const QByteArray &data);
|
||||
virtual void endOfData();
|
||||
void phononObjectDestroyed(MediaNodePrivate *);
|
||||
|
||||
AbstractMediaStream *q_ptr;
|
||||
qint64 streamSize;
|
||||
bool streamSeekable;
|
||||
bool ignoreWrites;
|
||||
StreamInterface *streamInterface;
|
||||
MediaObjectPrivate *mediaObjectPrivate;
|
||||
Phonon::ErrorType errorType;
|
||||
QString errorText;
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
|
||||
|
||||
#endif // ABSTRACTMEDIASTREAM_P_H
|
||||
// vim: sw=4 sts=4 et tw=100
|
|
@ -1,37 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "abstractvideooutput.h"
|
||||
#include "abstractvideooutput_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_VIDEO
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
AbstractVideoOutput::AbstractVideoOutput(AbstractVideoOutputPrivate &d)
|
||||
: MediaNode(d)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_VIDEO
|
|
@ -1,70 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef Phonon_ABSTRACTVIDEOOUTPUTBASE_H
|
||||
#define Phonon_ABSTRACTVIDEOOUTPUTBASE_H
|
||||
|
||||
#include "phonondefs.h"
|
||||
#include "phonon_export.h"
|
||||
#include "medianode.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_VIDEO
|
||||
|
||||
class QString;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
namespace Experimental
|
||||
{
|
||||
class Visualization;
|
||||
class VisualizationPrivate;
|
||||
} // namespace Experimental
|
||||
|
||||
class AbstractVideoOutputPrivate;
|
||||
|
||||
/** \class AbstractVideoOutput abstractvideooutput.h phonon/AbstractVideoOutput
|
||||
* \brief Common base class for all video outputs.
|
||||
*
|
||||
* \see VideoWidget
|
||||
*/
|
||||
class PHONON_EXPORT AbstractVideoOutput : public MediaNode
|
||||
{
|
||||
friend class Experimental::Visualization;
|
||||
friend class Experimental::VisualizationPrivate;
|
||||
P_DECLARE_PRIVATE(AbstractVideoOutput)
|
||||
protected:
|
||||
/**
|
||||
* \internal
|
||||
* Constructor that is called from derived classes.
|
||||
*
|
||||
* \param d the private object
|
||||
*/
|
||||
AbstractVideoOutput(AbstractVideoOutputPrivate &d);
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_VIDEO
|
||||
|
||||
|
||||
#endif // Phonon_ABSTRACTVIDEOOUTPUTBASE_H
|
|
@ -1,37 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "abstractvideooutput_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_VIDEO
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
bool AbstractVideoOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} //namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_VIDEO
|
|
@ -1,44 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ABSTRACTVIDEOOUTPUT_P_H
|
||||
#define ABSTRACTVIDEOOUTPUT_P_H
|
||||
|
||||
#include "abstractvideooutput.h"
|
||||
#include "medianode_p.h"
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_VIDEO
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AbstractVideoOutputPrivate : public MediaNodePrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AbstractVideoOutput)
|
||||
PHONON_PRIVATEABSTRACTCLASS
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_VIDEO
|
||||
|
||||
#endif // ABSTRACTVIDEOOUTPUT_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,181 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
Copyright (C) 2011 Harald Sitter <sitter@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_ADDONINTERFACE_H
|
||||
#define PHONON_ADDONINTERFACE_H
|
||||
|
||||
#include "phononnamespace.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_MEDIACONTROLLER
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
/** \class AddonInterface addoninterface.h phonon/AddonInterface
|
||||
* \short Interface for Menu, Chapter, Angle and Title/Track control.
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class AddonInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AddonInterface() {}
|
||||
|
||||
enum Interface {
|
||||
NavigationInterface = 1, /**< Interface for (menu) navigation */
|
||||
ChapterInterface = 2, /**< Interface for chapter control */
|
||||
AngleInterface = 3, /**< Interface for angle control */
|
||||
TitleInterface = 4, /**< Interface for title control */
|
||||
SubtitleInterface = 5, /**< Interface for subtitle control */
|
||||
AudioChannelInterface = 6 /**< Interface for audio channel control */
|
||||
};
|
||||
|
||||
enum NavigationCommand {
|
||||
availableMenus, /**< \returns a QList<MediaController::NavigationMenu>
|
||||
containing all supported navigation menu types */
|
||||
setMenu /**< Sets the current menu to the first
|
||||
\c MediaController::NavigationMenu in a QList */
|
||||
};
|
||||
|
||||
enum ChapterCommand {
|
||||
availableChapters, /**< \returns an \c int representing the amount of
|
||||
available chapters on the media source */
|
||||
chapter, /**< \returns an \c int representing the current chapter */
|
||||
setChapter /**< Sets the current chapter to the first \c int in the QList */
|
||||
};
|
||||
|
||||
enum AngleCommand {
|
||||
availableAngles, /**< \returns \c int representing the amount of
|
||||
available angles on the media source */
|
||||
angle, /**< \returns an \c int representing the current angle */
|
||||
setAngle /**< Sets the current angle to the first \c int in the QList */
|
||||
};
|
||||
|
||||
enum TitleCommand {
|
||||
availableTitles, /**< \returns \c int representing the amount of
|
||||
available titles on the media source */
|
||||
title, /**< \returns \c int representing the current title */
|
||||
setTitle, /**< Sets the current tittle to the first \c int in the QList */
|
||||
autoplayTitles, /**< \returns \c bool whether autoplay of titles is on */
|
||||
setAutoplayTitles /**< Sets autoplay to \c true or \c false as
|
||||
indicated in the first \c bool in the QList */
|
||||
};
|
||||
|
||||
enum SubtitleCommand {
|
||||
availableSubtitles, /**< \returns \c int representing the amount of
|
||||
available subtitles on the media source */
|
||||
currentSubtitle, /**< \returns \c int representing the current subtitle */
|
||||
setCurrentSubtitle, /**< Sets the current subtitle to the first
|
||||
\c int in the QList */
|
||||
setCurrentSubtitleFile, /**< Sets the current subtitle to the first QUrl \since 4.7.0 */
|
||||
subtitleAutodetect, /**< \returns \c bool representing if subtitles
|
||||
autodetection is enabled \since 4.7.0 */
|
||||
setSubtitleAutodetect, /**< Sets/Unsets subtitles autodetection \since 4.7.0 */
|
||||
subtitleEncoding, /**< \returns a QString representing the current encoding
|
||||
used to render subtitles \since 4.7.0 */
|
||||
setSubtitleEncoding, /** Sets the current encoding used to render subtitles \since 4.7.0 */
|
||||
subtitleFont, /**< \returns a QFont representing the current font used
|
||||
to render subtitles \since 4.7.0 */
|
||||
setSubtitleFont /**< Sets the current font used to render subtitles \since 4.7.0 */
|
||||
};
|
||||
|
||||
enum AudioChannelCommand {
|
||||
availableAudioChannels, /**< \returns \c int representing the amount
|
||||
of all available audio channels on the
|
||||
media source */
|
||||
currentAudioChannel, /**< \returns \c int representing the current
|
||||
audio channel */
|
||||
setCurrentAudioChannel /**< Sets the current audio channel to the first
|
||||
\c int in the QList */
|
||||
};
|
||||
|
||||
/**
|
||||
* Queries whether the backend supports a specific interface.
|
||||
*
|
||||
* \param iface The interface to query support information about
|
||||
* \returns \c true when the backend supports the interface, \c false otherwise
|
||||
*
|
||||
* \ingroup backend
|
||||
**/
|
||||
virtual bool hasInterface(Interface iface) const = 0;
|
||||
|
||||
/**
|
||||
* Calls an interface on the backend.
|
||||
*
|
||||
* \param iface The interface to call.
|
||||
* \param command The command the interface shall execute. This can be
|
||||
* any value of the Command enumeration associated with the command. The
|
||||
* backend casts this appropriately.
|
||||
* \param arguments The arguments for the command. This list can contain
|
||||
* a QVariant supported format + additions specific to Phonon. The
|
||||
* content entirely depends on the command (e.g. a getter may simply use
|
||||
* an empty list).
|
||||
*
|
||||
* \return \c QVariant, as with the arguments this can be anything ranging
|
||||
* from an empty QVariant to custom types used within Phonon
|
||||
*
|
||||
* Setting the chapter of a Media could be done like this:
|
||||
* \code
|
||||
* AddonInterface *iface = d->iface();
|
||||
* iface->interfaceCall(AddonInterface::ChapterInterface,
|
||||
* AddonInterface::setChapter,
|
||||
* QList<QVariant>() << QVariant(titleNumber));
|
||||
* \endcode
|
||||
*
|
||||
* Handling such a request in the backend is done as follows:
|
||||
* \code
|
||||
* switch (iface) {
|
||||
* case AddonInterface::ChapterInterface:
|
||||
* switch (static_cast<AddonInterface::ChapterCommand>(command)) {
|
||||
* case setChapter:
|
||||
* setCurrentChapter(arguments.first().toInt());
|
||||
* return QVariant();
|
||||
* }
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \see Interface
|
||||
* \see NavigationCommand
|
||||
* \see ChapterCommand
|
||||
* \see AngleCommand
|
||||
* \see TitleCommand
|
||||
* \see SubtitleCommand
|
||||
* \see AudioChannelCommand
|
||||
*
|
||||
* \ingroup backend
|
||||
**/
|
||||
virtual QVariant interfaceCall(Interface iface, int command,
|
||||
const QList<QVariant> &arguments = QList<QVariant>()) = 0;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::AddonInterface, "AddonInterface0.2.phonon.kde.org")
|
||||
|
||||
#endif //QT_NO_PHONON_MEDIACONTROLLER
|
||||
|
||||
|
||||
#endif // PHONON_ADDONINTERFACE_H
|
|
@ -1,68 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "audiodataoutput.h"
|
||||
#include "audiodataoutput_p.h"
|
||||
#include "factory_p.h"
|
||||
|
||||
#define PHONON_CLASSNAME AudioDataOutput
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
PHONON_HEIR_IMPL(AbstractAudioOutput)
|
||||
|
||||
PHONON_GETTER(int, dataSize, d->dataSize)
|
||||
PHONON_GETTER(int, sampleRate, -1)
|
||||
PHONON_SETTER(setDataSize, dataSize, int)
|
||||
|
||||
bool AudioDataOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
Q_ASSERT(m_backendObject);
|
||||
pBACKEND_GET(int, dataSize, "dataSize");
|
||||
|
||||
return AbstractAudioOutputPrivate::aboutToDeleteBackendObject();
|
||||
}
|
||||
|
||||
void AudioDataOutputPrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AudioDataOutput);
|
||||
Q_ASSERT(m_backendObject);
|
||||
AbstractAudioOutputPrivate::setupBackendObject();
|
||||
|
||||
// set up attributes
|
||||
pBACKEND_CALL1("setDataSize", int, dataSize);
|
||||
|
||||
qRegisterMetaType<QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > >("QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> >");
|
||||
|
||||
QObject::connect(m_backendObject,
|
||||
SIGNAL(dataReady(QMap<Phonon::AudioDataOutput::Channel,QVector<qint16> >)),
|
||||
q, SIGNAL(dataReady(QMap<Phonon::AudioDataOutput::Channel,QVector<qint16> >)));
|
||||
QObject::connect(m_backendObject, SIGNAL(endOfMedia(int)), q, SIGNAL(endOfMedia(int)));
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#undef PHONON_CLASSNAME
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#include "moc_audiodataoutput.h"
|
|
@ -1,131 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef Phonon_AUDIODATAOUTPUT_H
|
||||
#define Phonon_AUDIODATAOUTPUT_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "abstractaudiooutput.h"
|
||||
#include "phonondefs.h"
|
||||
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template<typename T> class QVector;
|
||||
template<typename Key, typename T> class QMap;
|
||||
#endif
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AudioDataOutputPrivate;
|
||||
|
||||
/**
|
||||
* \short This class gives you the audio data (for visualizations).
|
||||
*
|
||||
* This class implements a special AbstractAudioOutput that gives your
|
||||
* application the audio data. Don't expect realtime performance. But
|
||||
* the latencies should be low enough to use the audio data for
|
||||
* visualizations. You can also use the audio data for further processing
|
||||
* (e.g. encoding and saving to a file).
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONON_EXPORT AudioDataOutput : public AbstractAudioOutput
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(AudioDataOutput)
|
||||
Q_ENUMS(Channel)
|
||||
Q_PROPERTY(int dataSize READ dataSize WRITE setDataSize)
|
||||
PHONON_HEIR(AudioDataOutput)
|
||||
public:
|
||||
/**
|
||||
* Specifies the channel the audio data belongs to.
|
||||
*/
|
||||
enum Channel
|
||||
{
|
||||
LeftChannel,
|
||||
RightChannel,
|
||||
CenterChannel,
|
||||
LeftSurroundChannel,
|
||||
RightSurroundChannel,
|
||||
SubwooferChannel
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the currently used number of samples passed through
|
||||
* the signal.
|
||||
*
|
||||
* \see setDataSize
|
||||
*/
|
||||
int dataSize() const;
|
||||
|
||||
/**
|
||||
* Returns the sample rate in Hz. Common sample rates are 44100 Hz
|
||||
* and 48000 Hz. AudioDataOutput will not do any sample rate
|
||||
* conversion for you. If you need to convert the sample rate you
|
||||
* might want to take a look at libsamplerate. For visualizations it
|
||||
* is often enough to do simple interpolation or even drop/duplicate
|
||||
* samples.
|
||||
*
|
||||
* \return The sample rate as reported by the backend. If the
|
||||
* backend is unavailable -1 is returned.
|
||||
*/
|
||||
int sampleRate() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Sets the number of samples to be passed in one signal emission.
|
||||
*
|
||||
* Defaults to 512 samples per emitted signal.
|
||||
*
|
||||
* \param size the number of samples
|
||||
*/
|
||||
void setDataSize(int size);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted whenever another dataSize number of samples are ready.
|
||||
*
|
||||
* \param data A mapping of Channel to a vector holding the audio data.
|
||||
*/
|
||||
void dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > &data);
|
||||
|
||||
|
||||
/**
|
||||
* This signal is emitted before the last dataReady signal of a
|
||||
* media is emitted.
|
||||
*
|
||||
* If, for example, the playback of a media file has finished and the
|
||||
* last audio data of that file is going to be passed with the next
|
||||
* dataReady signal, and only the 28 first samples of the data
|
||||
* vector are from that media file endOfMedia will be emitted right
|
||||
* before dataReady with \p remainingSamples = 28.
|
||||
*
|
||||
* \param remainingSamples The number of samples in the next
|
||||
* dataReady vector that belong to the media that was playing to
|
||||
* this point.
|
||||
*/
|
||||
void endOfMedia(int remainingSamples);
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#endif // Phonon_AUDIODATAOUTPUT_H
|
|
@ -1,50 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AUDIODATAOUTPUT_P_H
|
||||
#define AUDIODATAOUTPUT_P_H
|
||||
|
||||
#include "audiodataoutput.h"
|
||||
#include "abstractaudiooutput_p.h"
|
||||
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class AudioDataOutputPrivate : public AbstractAudioOutputPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AudioDataOutput)
|
||||
PHONON_PRIVATECLASS
|
||||
protected:
|
||||
AudioDataOutputPrivate()
|
||||
: dataSize(512)
|
||||
{
|
||||
}
|
||||
|
||||
int dataSize;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // AUDIODATAOUTPUT_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,46 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_AUDIODATAOUTPUTINTERFACE_H
|
||||
#define PHONON_AUDIODATAOUTPUTINTERFACE_H
|
||||
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class AudioDataOutput;
|
||||
|
||||
class AudioDataOutputInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AudioDataOutputInterface() {}
|
||||
|
||||
virtual AudioDataOutput *frontendObject() const = 0;
|
||||
virtual void setFrontendObject(AudioDataOutput *) = 0;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioDataOutputInterface, "0AudioDataOutputInterface.phonon.kde.org")
|
||||
|
||||
|
||||
#endif // PHONON_AUDIODATAOUTPUTINTERFACE_H
|
|
@ -1,513 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "audiooutput.h"
|
||||
#include "audiooutput_p.h"
|
||||
|
||||
#include "audiooutputadaptor_p.h"
|
||||
#include "audiooutputinterface.h"
|
||||
#include "factory_p.h"
|
||||
#include "globalconfig.h"
|
||||
#include "objectdescription.h"
|
||||
#include "phononconfig_p.h"
|
||||
#include "phononnamespace_p.h"
|
||||
#include "platform_p.h"
|
||||
|
||||
#include <QtCore/QUuid>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
#define PHONON_CLASSNAME AudioOutput
|
||||
#define IFACES9 AudioOutputInterface49
|
||||
#define IFECES7 AudioOutputInterface47
|
||||
#define IFACES2 AudioOutputInterface42
|
||||
#define IFACES1 IFACES2
|
||||
#define IFACES0 AudioOutputInterface40, IFACES1, IFECES7, IFACES9
|
||||
#define PHONON_INTERFACENAME IFACES0
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
static inline bool callSetOutputDevice(AudioOutputPrivate *const d, const AudioOutputDevice &dev)
|
||||
{
|
||||
if (!d->backendObject())
|
||||
return false;
|
||||
|
||||
Iface<IFACES2> iface(d);
|
||||
if (iface) {
|
||||
return iface->setOutputDevice(dev);
|
||||
}
|
||||
return Iface<IFACES0>::cast(d)->setOutputDevice(dev.index());
|
||||
}
|
||||
|
||||
AudioOutput::AudioOutput(Phonon::Category category, QObject *parent)
|
||||
: AbstractAudioOutput(*new AudioOutputPrivate, parent)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
d->init(category);
|
||||
}
|
||||
|
||||
AudioOutput::AudioOutput(QObject *parent)
|
||||
: AbstractAudioOutput(*new AudioOutputPrivate, parent)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
d->init(NoCategory);
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::init(Phonon::Category c)
|
||||
{
|
||||
P_Q(AudioOutput);
|
||||
#ifndef PHONON_NO_DBUS
|
||||
adaptor = new AudioOutputAdaptor(q);
|
||||
static unsigned int number = 0;
|
||||
const QString &path = QLatin1String("/AudioOutputs/") + QString::number(number++);
|
||||
QDBusConnection con = QDBusConnection::sessionBus();
|
||||
con.registerObject(path, q);
|
||||
emit adaptor->newOutputAvailable(con.baseService(), path);
|
||||
q->connect(q, SIGNAL(volumeChanged(qreal)), adaptor, SIGNAL(volumeChanged(qreal)));
|
||||
q->connect(q, SIGNAL(mutedChanged(bool)), adaptor, SIGNAL(mutedChanged(bool)));
|
||||
#endif
|
||||
|
||||
category = c;
|
||||
#ifndef QT_NO_QUUID_STRING
|
||||
streamUuid = QUuid::createUuid().toString();
|
||||
#endif
|
||||
|
||||
createBackendObject();
|
||||
|
||||
q->connect(Factory::sender(), SIGNAL(availableAudioOutputDevicesChanged()), SLOT(_k_deviceListChanged()));
|
||||
}
|
||||
|
||||
QString AudioOutputPrivate::getStreamUuid()
|
||||
{
|
||||
return streamUuid;
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::createBackendObject()
|
||||
{
|
||||
if (m_backendObject)
|
||||
return;
|
||||
P_Q(AudioOutput);
|
||||
m_backendObject = Factory::createAudioOutput(q);
|
||||
// (cg) Is it possible that PulseAudio initialisation means that the device here is not valid?
|
||||
// User reports seem to suggest this possibility but I can't see how :s.
|
||||
// See other comment and check for isValid() in handleAutomaticDeviceChange()
|
||||
device = AudioOutputDevice::fromIndex(GlobalConfig().audioOutputDeviceFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices));
|
||||
if (m_backendObject) {
|
||||
setupBackendObject();
|
||||
}
|
||||
}
|
||||
|
||||
QString AudioOutput::name() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
return d->name;
|
||||
}
|
||||
|
||||
void AudioOutput::setName(const QString &newName)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
if (d->name == newName) {
|
||||
return;
|
||||
}
|
||||
d->name = newName;
|
||||
setVolume(Platform::loadVolume(newName));
|
||||
#ifndef PHONON_NO_DBUS
|
||||
if (d->adaptor) {
|
||||
emit d->adaptor->nameChanged(newName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static const qreal LOUDNESS_TO_VOLTAGE_EXPONENT = qreal(0.67);
|
||||
static const qreal VOLTAGE_TO_LOUDNESS_EXPONENT = qreal(1.0/LOUDNESS_TO_VOLTAGE_EXPONENT);
|
||||
|
||||
void AudioOutput::setVolume(qreal volume)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
d->volume = volume;
|
||||
if (k_ptr->backendObject()) {
|
||||
if (!d->muted) {
|
||||
// using Stevens' power law loudness is proportional to (sound pressure)^0.67
|
||||
// sound pressure is proportional to voltage:
|
||||
// p² \prop P \prop V²
|
||||
// => if a factor for loudness of x is requested
|
||||
INTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT)));
|
||||
} else {
|
||||
emit volumeChanged(volume);
|
||||
}
|
||||
} else {
|
||||
emit volumeChanged(volume);
|
||||
}
|
||||
Platform::saveVolume(d->name, volume);
|
||||
}
|
||||
|
||||
qreal AudioOutput::volume() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
if (d->muted || !d->m_backendObject)
|
||||
return d->volume;
|
||||
return pow(INTERFACE_CALL(volume()), LOUDNESS_TO_VOLTAGE_EXPONENT);
|
||||
}
|
||||
|
||||
#ifndef PHONON_LOG10OVER20
|
||||
#define PHONON_LOG10OVER20
|
||||
static const qreal log10over20 = qreal(0.1151292546497022842); // ln(10) / 20
|
||||
#endif // PHONON_LOG10OVER20
|
||||
|
||||
qreal AudioOutput::volumeDecibel() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
if (d->muted || !d->m_backendObject)
|
||||
return log(d->volume) / log10over20;
|
||||
return 0.67 * log(INTERFACE_CALL(volume())) / log10over20;
|
||||
}
|
||||
|
||||
void AudioOutput::setVolumeDecibel(qreal newVolumeDecibel)
|
||||
{
|
||||
setVolume(exp(newVolumeDecibel * log10over20));
|
||||
}
|
||||
|
||||
bool AudioOutput::isMuted() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
return d->muted;
|
||||
}
|
||||
|
||||
void AudioOutput::setMuted(bool mute)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
if (d->muted != mute) {
|
||||
if (mute) {
|
||||
d->muted = mute;
|
||||
if (k_ptr->backendObject()) {
|
||||
INTERFACE_CALL(setVolume(0.0));
|
||||
}
|
||||
} else {
|
||||
if (k_ptr->backendObject()) {
|
||||
INTERFACE_CALL(setVolume(pow(d->volume, VOLTAGE_TO_LOUDNESS_EXPONENT)));
|
||||
}
|
||||
d->muted = mute;
|
||||
}
|
||||
if (!Iface<IFACES9>(d)) {
|
||||
emit mutedChanged(mute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Category AudioOutput::category() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
return d->category;
|
||||
}
|
||||
|
||||
AudioOutputDevice AudioOutput::outputDevice() const
|
||||
{
|
||||
P_D(const AudioOutput);
|
||||
return d->device;
|
||||
}
|
||||
|
||||
bool AudioOutput::setOutputDevice(const AudioOutputDevice &newAudioOutputDevice)
|
||||
{
|
||||
P_D(AudioOutput);
|
||||
if (!newAudioOutputDevice.isValid()) {
|
||||
d->outputDeviceOverridden = d->forceMove = false;
|
||||
const int newIndex = GlobalConfig().audioOutputDeviceFor(d->category);
|
||||
if (newIndex == d->device.index()) {
|
||||
return true;
|
||||
}
|
||||
d->device = AudioOutputDevice::fromIndex(newIndex);
|
||||
} else {
|
||||
d->outputDeviceOverridden = d->forceMove = true;
|
||||
if (d->device == newAudioOutputDevice) {
|
||||
return true;
|
||||
}
|
||||
d->device = newAudioOutputDevice;
|
||||
}
|
||||
if (k_ptr->backendObject()) {
|
||||
return callSetOutputDevice(d, d->device);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
if (m_backendObject) {
|
||||
volume = pINTERFACE_CALL(volume());
|
||||
}
|
||||
return AbstractAudioOutputPrivate::aboutToDeleteBackendObject();
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AudioOutput);
|
||||
Q_ASSERT(m_backendObject);
|
||||
AbstractAudioOutputPrivate::setupBackendObject();
|
||||
|
||||
QObject::connect(m_backendObject, SIGNAL(volumeChanged(qreal)), q, SLOT(_k_volumeChanged(qreal)));
|
||||
QObject::connect(m_backendObject, SIGNAL(audioDeviceFailed()), q, SLOT(_k_audioDeviceFailed()));
|
||||
if (Iface<IFACES9>(this)) {
|
||||
QObject::connect(m_backendObject, SIGNAL(mutedChanged(bool)),
|
||||
q, SLOT(_k_mutedChanged(bool)));
|
||||
}
|
||||
|
||||
// set up attributes
|
||||
pINTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT)));
|
||||
|
||||
#ifndef QT_NO_PHONON_SETTINGSGROUP
|
||||
// if the output device is not available and the device was not explicitly set
|
||||
// There is no need to set the output device initially if PA is used as
|
||||
// we know it will not work (stream doesn't exist yet) and that this will be
|
||||
// handled by _k_deviceChanged()
|
||||
if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) {
|
||||
// fall back in the preference list of output devices
|
||||
QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
|
||||
if (deviceList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < deviceList.count(); ++i) {
|
||||
const AudioOutputDevice &dev = AudioOutputDevice::fromIndex(deviceList.at(i));
|
||||
if (callSetOutputDevice(this, dev)) {
|
||||
handleAutomaticDeviceChange(dev, AudioOutputPrivate::FallbackChange);
|
||||
return; // found one that works
|
||||
}
|
||||
}
|
||||
// if we get here there is no working output device. Tell the backend.
|
||||
const AudioOutputDevice none;
|
||||
callSetOutputDevice(this, none);
|
||||
handleAutomaticDeviceChange(none, FallbackChange);
|
||||
}
|
||||
#endif //QT_NO_PHONON_SETTINGSGROUP
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_volumeChanged(qreal newVolume)
|
||||
{
|
||||
volume = pow(newVolume, LOUDNESS_TO_VOLTAGE_EXPONENT);
|
||||
if (!muted) {
|
||||
P_Q(AudioOutput);
|
||||
emit q->volumeChanged(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_mutedChanged(bool newMuted)
|
||||
{
|
||||
muted = newMuted;
|
||||
P_Q(AudioOutput);
|
||||
emit q->mutedChanged(newMuted);
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_revertFallback()
|
||||
{
|
||||
if (deviceBeforeFallback == -1) {
|
||||
return;
|
||||
}
|
||||
device = AudioOutputDevice::fromIndex(deviceBeforeFallback);
|
||||
callSetOutputDevice(this, device);
|
||||
P_Q(AudioOutput);
|
||||
emit q->outputDeviceChanged(device);
|
||||
#ifndef PHONON_NO_DBUS
|
||||
emit adaptor->outputDeviceIndexChanged(device.index());
|
||||
#endif
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_audioDeviceFailed()
|
||||
{
|
||||
#ifndef QT_NO_PHONON_SETTINGSGROUP
|
||||
|
||||
pDebug() << Q_FUNC_INFO;
|
||||
// outputDeviceIndex identifies a failing device
|
||||
// fall back in the preference list of output devices
|
||||
const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
|
||||
for (int i = 0; i < deviceList.count(); ++i) {
|
||||
const int devIndex = deviceList.at(i);
|
||||
// if it's the same device as the one that failed, ignore it
|
||||
if (device.index() != devIndex) {
|
||||
const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex);
|
||||
if (callSetOutputDevice(this, info)) {
|
||||
handleAutomaticDeviceChange(info, FallbackChange);
|
||||
return; // found one that works
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //QT_NO_PHONON_SETTINGSGROUP
|
||||
// if we get here there is no working output device. Tell the backend.
|
||||
const AudioOutputDevice none;
|
||||
callSetOutputDevice(this, none);
|
||||
handleAutomaticDeviceChange(none, FallbackChange);
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_deviceListChanged()
|
||||
{
|
||||
#ifndef QT_NO_PHONON_SETTINGSGROUP
|
||||
pDebug() << Q_FUNC_INFO;
|
||||
// Check to see if we have an override and do not change to a higher priority device if the overridden device is still present.
|
||||
if (outputDeviceOverridden && device.property("available").toBool()) {
|
||||
return;
|
||||
}
|
||||
// let's see if there's a usable device higher in the preference list
|
||||
const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
|
||||
DeviceChangeType changeType = HigherPreferenceChange;
|
||||
for (int i = 0; i < deviceList.count(); ++i) {
|
||||
const int devIndex = deviceList.at(i);
|
||||
const AudioOutputDevice &info = AudioOutputDevice::fromIndex(devIndex);
|
||||
if (!info.property("available").toBool()) {
|
||||
if (device.index() == devIndex) {
|
||||
// we've reached the currently used device and it's not available anymore, so we
|
||||
// fallback to the next available device
|
||||
changeType = FallbackChange;
|
||||
}
|
||||
pDebug() << devIndex << "is not available";
|
||||
continue;
|
||||
}
|
||||
pDebug() << devIndex << "is available";
|
||||
if (device.index() == devIndex) {
|
||||
// we've reached the currently used device, nothing to change
|
||||
break;
|
||||
}
|
||||
if (callSetOutputDevice(this, info)) {
|
||||
handleAutomaticDeviceChange(info, changeType);
|
||||
break; // found one with higher preference that works
|
||||
}
|
||||
}
|
||||
#endif //QT_NO_PHONON_SETTINGSGROUP
|
||||
}
|
||||
|
||||
void AudioOutputPrivate::_k_deviceChanged(int deviceIndex)
|
||||
{
|
||||
// NB that this method is only used by PulseAudio at present.
|
||||
|
||||
// 1. Check to see if we are overridden. If we are, and devices do not match,
|
||||
// then try and apply our own device as the output device.
|
||||
// We only do this the first time
|
||||
if (outputDeviceOverridden && forceMove) {
|
||||
forceMove = false;
|
||||
const AudioOutputDevice ¤tDevice = AudioOutputDevice::fromIndex(deviceIndex);
|
||||
if (currentDevice != device) {
|
||||
if (!callSetOutputDevice(this, device)) {
|
||||
// What to do if we are overridden and cannot change to our preferred device?
|
||||
}
|
||||
}
|
||||
}
|
||||
// 2. If we are not overridden, then we need to update our perception of what
|
||||
// device we are using. If the devices do not match, something lower in the
|
||||
// stack is overriding our preferences (e.g. a per-application stream preference,
|
||||
// specific application move, priority list changed etc. etc.)
|
||||
else if (!outputDeviceOverridden) {
|
||||
const AudioOutputDevice ¤tDevice = AudioOutputDevice::fromIndex(deviceIndex);
|
||||
if (currentDevice != device) {
|
||||
// The device is not what we think it is, so lets say what is happening.
|
||||
handleAutomaticDeviceChange(currentDevice, SoundSystemChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
int first;
|
||||
int second;
|
||||
} g_lastFallback = { 0, 0 };
|
||||
|
||||
void AudioOutputPrivate::handleAutomaticDeviceChange(const AudioOutputDevice &device2, DeviceChangeType type)
|
||||
{
|
||||
P_Q(AudioOutput);
|
||||
deviceBeforeFallback = device.index();
|
||||
device = device2;
|
||||
emit q->outputDeviceChanged(device2);
|
||||
#ifndef PHONON_NO_DBUS
|
||||
emit adaptor->outputDeviceIndexChanged(device.index());
|
||||
#endif
|
||||
const AudioOutputDevice &device1 = AudioOutputDevice::fromIndex(deviceBeforeFallback);
|
||||
switch (type) {
|
||||
case FallbackChange:
|
||||
if (g_lastFallback.first != device1.index() || g_lastFallback.second != device2.index()) {
|
||||
#ifndef QT_NO_PHONON_PLATFORMPLUGIN
|
||||
const QString &text = //device2.isValid() ?
|
||||
AudioOutput::tr("<html>The audio playback device <b>%1</b> does not work.<br/>"
|
||||
"Falling back to <b>%2</b>.</html>").arg(device1.name()).arg(device2.name()) /*:
|
||||
AudioOutput::tr("<html>The audio playback device <b>%1</b> does not work.<br/>"
|
||||
"No other device available.</html>").arg(device1.name())*/;
|
||||
Platform::notification("AudioDeviceFallback", text);
|
||||
#endif //QT_NO_PHONON_PLATFORMPLUGIN
|
||||
g_lastFallback.first = device1.index();
|
||||
g_lastFallback.second = device2.index();
|
||||
}
|
||||
break;
|
||||
case HigherPreferenceChange:
|
||||
{
|
||||
#ifndef QT_NO_PHONON_PLATFORMPLUGIN
|
||||
const QString text = AudioOutput::tr("<html>Switching to the audio playback device <b>%1</b><br/>"
|
||||
"which just became available and has higher preference.</html>").arg(device2.name());
|
||||
Platform::notification("AudioDeviceFallback", text,
|
||||
QStringList(AudioOutput::tr("Revert back to device '%1'").arg(device1.name())),
|
||||
q, SLOT(_k_revertFallback()));
|
||||
#endif //QT_NO_PHONON_PLATFORMPLUGIN
|
||||
g_lastFallback.first = 0;
|
||||
g_lastFallback.second = 0;
|
||||
}
|
||||
break;
|
||||
case SoundSystemChange:
|
||||
{
|
||||
#ifndef QT_NO_PHONON_PLATFORMPLUGIN
|
||||
// If device1 is not "valid" this indicates that the preferences used to select
|
||||
// a device was perhaps not available when this object was created (although
|
||||
// I can't quite work out how that would be....)
|
||||
if (device1.isValid()) {
|
||||
if (device1.property("available").toBool()) {
|
||||
const QString text = AudioOutput::tr("<html>Switching to the audio playback device <b>%1</b><br/>"
|
||||
"which has higher preference or is specifically configured for this stream.</html>").arg(device2.name());
|
||||
Platform::notification("AudioDeviceFallback", text,
|
||||
QStringList(AudioOutput::tr("Revert back to device '%1'").arg(device1.name())),
|
||||
q, SLOT(_k_revertFallback()));
|
||||
} else {
|
||||
const QString &text =
|
||||
AudioOutput::tr("<html>The audio playback device <b>%1</b> does not work.<br/>"
|
||||
"Falling back to <b>%2</b>.</html>").arg(device1.name()).arg(device2.name());
|
||||
Platform::notification("AudioDeviceFallback", text);
|
||||
}
|
||||
}
|
||||
#endif //QT_NO_PHONON_PLATFORMPLUGIN
|
||||
//outputDeviceOverridden = true;
|
||||
g_lastFallback.first = 0;
|
||||
g_lastFallback.second = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AudioOutputPrivate::~AudioOutputPrivate()
|
||||
{
|
||||
#ifndef PHONON_NO_DBUS
|
||||
if (adaptor) {
|
||||
emit adaptor->outputDestroyed();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} //namespace Phonon
|
||||
|
||||
#include "moc_audiooutput.cpp"
|
||||
|
||||
#undef PHONON_CLASSNAME
|
||||
#undef PHONON_INTERFACENAME
|
||||
#undef IFECES7
|
||||
#undef IFACES2
|
||||
#undef IFACES1
|
||||
#undef IFACES0
|
||||
#include "moc_audiooutput.h"
|
|
@ -1,177 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef Phonon_AUDIOOUTPUT_H
|
||||
#define Phonon_AUDIOOUTPUT_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "abstractaudiooutput.h"
|
||||
#include "phonondefs.h"
|
||||
#include "phononnamespace.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
|
||||
class QString;
|
||||
|
||||
class AudioOutputAdaptor;
|
||||
namespace Phonon
|
||||
{
|
||||
class AudioOutputPrivate;
|
||||
|
||||
/** \class AudioOutput audiooutput.h phonon/AudioOutput
|
||||
* \short Class for audio output to the soundcard.
|
||||
*
|
||||
* Use this class to define the audio output.
|
||||
*
|
||||
* \ingroup Frontend
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
* \see Phonon::Ui::VolumeSlider
|
||||
*/
|
||||
class PHONON_EXPORT AudioOutput : public AbstractAudioOutput
|
||||
{
|
||||
friend class FactoryPrivate;
|
||||
friend class ::AudioOutputAdaptor;
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(AudioOutput)
|
||||
/**
|
||||
* This is the name that appears in Mixer applications that control
|
||||
* the volume of this output.
|
||||
*
|
||||
* \see category
|
||||
*/
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
/**
|
||||
* This is the current loudness of the output (it is using Stevens' law
|
||||
* to calculate the change in voltage internally).
|
||||
*
|
||||
* \see volumeDecibel
|
||||
*/
|
||||
Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
||||
/**
|
||||
* This is the current volume of the output in decibel.
|
||||
*
|
||||
* 0 dB means no change in volume, -6dB means an attenuation of the
|
||||
* voltage to 50% and an attenuation of the power to 25%, -inf dB means
|
||||
* silence.
|
||||
*
|
||||
* \see volume
|
||||
*/
|
||||
Q_PROPERTY(qreal volumeDecibel READ volumeDecibel WRITE setVolumeDecibel)
|
||||
/**
|
||||
* This property holds the (hardware) destination for the output.
|
||||
*
|
||||
* The default device is determined by the category and the global
|
||||
* configuration for that category of outputs. Normally you don't need
|
||||
* to override this setting - letting the user change the global
|
||||
* configuration is the right choice. You can still override the
|
||||
* device though, if you have good reasons to do so.
|
||||
*
|
||||
* \see outputDeviceChanged
|
||||
*/
|
||||
Q_PROPERTY(AudioOutputDevice outputDevice READ outputDevice WRITE setOutputDevice)
|
||||
|
||||
/**
|
||||
* This property tells whether the output is muted.
|
||||
*
|
||||
* Muting the output has the same effect as calling setVolume(0.0).
|
||||
*/
|
||||
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
||||
public:
|
||||
/**
|
||||
* Creates a new AudioOutput that defines output to a physical
|
||||
* device.
|
||||
*
|
||||
* \param category The category can be used by mixer applications to group volume
|
||||
* controls of applications into categories. That makes it easier for
|
||||
* the user to identify the programs.
|
||||
* The category is also used for the default output device that is
|
||||
* configured centrally. As an example: often users want to have the
|
||||
* audio signal of a VoIP application go to their USB headset while
|
||||
* all other sounds should go to the internal soundcard.
|
||||
*
|
||||
* \param parent QObject parent
|
||||
*
|
||||
* \see Phonon::categoryToString
|
||||
* \see outputDevice
|
||||
*/
|
||||
explicit AudioOutput(Phonon::Category category, QObject *parent = 0);
|
||||
explicit AudioOutput(QObject *parent = 0);
|
||||
|
||||
QString name() const;
|
||||
qreal volume() const;
|
||||
qreal volumeDecibel() const;
|
||||
|
||||
/**
|
||||
* Returns the category of this output.
|
||||
*
|
||||
* \see AudioOutput(Phonon::Category, QObject *)
|
||||
*/
|
||||
Phonon::Category category() const;
|
||||
AudioOutputDevice outputDevice() const;
|
||||
bool isMuted() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setName(const QString &newName);
|
||||
void setVolume(qreal newVolume);
|
||||
void setVolumeDecibel(qreal newVolumeDecibel);
|
||||
bool setOutputDevice(const Phonon::AudioOutputDevice &newAudioOutputDevice);
|
||||
void setMuted(bool mute);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted whenever the volume has changed. As the
|
||||
* volume can change without a call to setVolume (calls over dbus)
|
||||
* this is important
|
||||
* to keep a widget showing the current volume up to date.
|
||||
*/
|
||||
void volumeChanged(qreal newVolume);
|
||||
|
||||
/**
|
||||
* This signal is emitted when the muted property has changed. As
|
||||
* this property can change by outside sources, a UI element showing
|
||||
* the muted property should listen to this signal.
|
||||
*/
|
||||
void mutedChanged(bool);
|
||||
|
||||
/**
|
||||
* This signal is emitted when the (hardware) device for the output
|
||||
* has changed.
|
||||
*
|
||||
* The change can happen either through setOutputDevice or if the
|
||||
* global configuration for the used category has changed.
|
||||
*
|
||||
* \see outputDevice
|
||||
*/
|
||||
void outputDeviceChanged(const Phonon::AudioOutputDevice &newAudioOutputDevice);
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_volumeChanged(qreal))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_mutedChanged(bool))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_revertFallback())
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_audioDeviceFailed())
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_deviceListChanged())
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_deviceChanged(int device))
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#endif // Phonon_AUDIOOUTPUT_H
|
|
@ -1,99 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AUDIOOUTPUT_P_H
|
||||
#define AUDIOOUTPUT_P_H
|
||||
|
||||
#include "audiooutput.h"
|
||||
#include "abstractaudiooutput_p.h"
|
||||
#include "phononconfig_p.h"
|
||||
#include "platform_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AudioOutputAdaptor;
|
||||
|
||||
class AudioOutputPrivate : public AbstractAudioOutputPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AudioOutput)
|
||||
PHONON_PRIVATECLASS
|
||||
public:
|
||||
inline static AudioOutputPrivate *cast(MediaNodePrivate *x)
|
||||
{
|
||||
if (x && x->castId == MediaNodePrivate::AudioOutputType) {
|
||||
return static_cast<AudioOutputPrivate *>(x);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void init(Phonon::Category c);
|
||||
QString getStreamUuid();
|
||||
|
||||
|
||||
protected:
|
||||
AudioOutputPrivate(CastId castId = MediaNodePrivate::AudioOutputType)
|
||||
: AbstractAudioOutputPrivate(castId),
|
||||
name(Platform::applicationName()),
|
||||
volume(Platform::loadVolume(name)),
|
||||
#ifndef PHONON_NO_DBUS
|
||||
adaptor(0),
|
||||
#endif
|
||||
deviceBeforeFallback(-1),
|
||||
outputDeviceOverridden(false),
|
||||
forceMove(false),
|
||||
muted(false)
|
||||
{
|
||||
}
|
||||
|
||||
~AudioOutputPrivate();
|
||||
|
||||
enum DeviceChangeType {
|
||||
FallbackChange,
|
||||
HigherPreferenceChange,
|
||||
SoundSystemChange
|
||||
};
|
||||
void handleAutomaticDeviceChange(const AudioOutputDevice &newDev, DeviceChangeType type);
|
||||
|
||||
void _k_volumeChanged(qreal);
|
||||
void _k_mutedChanged(bool);
|
||||
void _k_revertFallback();
|
||||
void _k_audioDeviceFailed();
|
||||
void _k_deviceListChanged();
|
||||
void _k_deviceChanged(int deviceIndex);
|
||||
|
||||
private:
|
||||
QString name;
|
||||
Phonon::AudioOutputDevice device;
|
||||
qreal volume;
|
||||
QString streamUuid;
|
||||
#ifndef PHONON_NO_DBUS
|
||||
Phonon::AudioOutputAdaptor *adaptor;
|
||||
#endif
|
||||
Category category;
|
||||
int deviceBeforeFallback;
|
||||
bool outputDeviceOverridden;
|
||||
bool forceMove;
|
||||
bool muted;
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif // AUDIOOUTPUT_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* This file was generated by dbusidl2cpp version 0.4
|
||||
* when processing input file org.kde.Phonon.AudioOutput.xml
|
||||
*
|
||||
* dbusidl2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file. This file has been hand-edited.
|
||||
*/
|
||||
|
||||
#include "audiooutputadaptor_p.h"
|
||||
#include "audiooutput.h"
|
||||
#include <QtCore/qobjectdefs.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include "phononconfig_p.h"
|
||||
#include "phononnamespace_p.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
#ifndef PHONON_NO_DBUS
|
||||
|
||||
/*
|
||||
* Implementation of adaptor class AudioOutputAdaptor
|
||||
*/
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
AudioOutputAdaptor::AudioOutputAdaptor(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent)
|
||||
{
|
||||
// constructor
|
||||
setAutoRelaySignals(true);
|
||||
}
|
||||
|
||||
AudioOutputAdaptor::~AudioOutputAdaptor()
|
||||
{
|
||||
// destructor
|
||||
}
|
||||
|
||||
double AudioOutputAdaptor::volume() const
|
||||
{
|
||||
// get the value of property volume
|
||||
return qvariant_cast<qreal>(parent()->property("volume"));
|
||||
}
|
||||
|
||||
void AudioOutputAdaptor::setVolume(double value)
|
||||
{
|
||||
// set the value of property volume
|
||||
parent()->setProperty("volume", QVariant::fromValue(static_cast<qreal>(value)));
|
||||
}
|
||||
|
||||
bool AudioOutputAdaptor::muted() const
|
||||
{
|
||||
return parent()->property("muted").toBool();
|
||||
}
|
||||
|
||||
void AudioOutputAdaptor::setMuted(bool value)
|
||||
{
|
||||
parent()->setProperty("muted", value);
|
||||
}
|
||||
|
||||
QString AudioOutputAdaptor::category()
|
||||
{
|
||||
// handle method call org.kde.Phonon.AudioOutput.category
|
||||
return Phonon::categoryToString(static_cast<Phonon::AudioOutput *>(parent())->category());
|
||||
}
|
||||
|
||||
QString AudioOutputAdaptor::name()
|
||||
{
|
||||
// handle method call org.kde.Phonon.AudioOutput.name
|
||||
QString name;
|
||||
//QMetaObject::invokeMethod(parent(), "name", Q_RETURN_ARG(QString, name));
|
||||
|
||||
// Alternative:
|
||||
name = static_cast<Phonon::AudioOutput *>(parent())->name();
|
||||
return name;
|
||||
}
|
||||
|
||||
int AudioOutputAdaptor::outputDeviceIndex() const
|
||||
{
|
||||
return static_cast<Phonon::AudioOutput *>(parent())->outputDevice().index();
|
||||
}
|
||||
|
||||
void AudioOutputAdaptor::setOutputDeviceIndex(int newAudioOutputDeviceIndex)
|
||||
{
|
||||
static_cast<Phonon::AudioOutput *>(parent())
|
||||
->setOutputDevice(Phonon::AudioOutputDevice::fromIndex(newAudioOutputDeviceIndex));
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#include "moc_audiooutputadaptor_p.h"
|
||||
|
||||
#endif
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* This file was generated by dbusidl2cpp version 0.4
|
||||
* when processing input file org.kde.Phonon.AudioOutput.xml
|
||||
*
|
||||
* dbusidl2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file. This file has been hand-edited.
|
||||
*/
|
||||
|
||||
#ifndef AUDIOOUTPUTADAPTOR_P_H
|
||||
#define AUDIOOUTPUTADAPTOR_P_H
|
||||
|
||||
#include "phononconfig_p.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#ifndef PHONON_NO_DBUS
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
|
||||
class QByteArray;
|
||||
template<class T> class QList;
|
||||
template<class Key, class Value> class QMap;
|
||||
class QString;
|
||||
class QStringList;
|
||||
class QVariant;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class AudioOutputPrivate;
|
||||
class AudioOutput;
|
||||
|
||||
/*
|
||||
* Adaptor class for interface org.kde.Phonon.AudioOutput
|
||||
*/
|
||||
class AudioOutputAdaptor: public QDBusAbstractAdaptor
|
||||
{
|
||||
friend class Phonon::AudioOutputPrivate;
|
||||
friend class Phonon::AudioOutput;
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.Phonon.AudioOutput")
|
||||
Q_CLASSINFO("D-Bus Introspection", ""
|
||||
" <interface name=\"org.kde.Phonon.AudioOutput\" >\n"
|
||||
" <property access=\"readwrite\" type=\"d\" name=\"volume\" />\n"
|
||||
" <property access=\"readwrite\" type=\"b\" name=\"muted\" />\n"
|
||||
" <property access=\"readwrite\" type=\"i\" name=\"outputDeviceIndex\" />\n"
|
||||
" <signal name=\"volumeChanged\" >\n"
|
||||
" <arg direction=\"out\" type=\"d\" />\n"
|
||||
" </signal>\n"
|
||||
" <signal name=\"mutedChanged\" >\n"
|
||||
" <arg direction=\"out\" type=\"b\" />\n"
|
||||
" </signal>\n"
|
||||
" <signal name=\"outputDeviceIndexChanged\" >\n"
|
||||
" <arg direction=\"out\" type=\"i\" />\n"
|
||||
" </signal>\n"
|
||||
" <signal name=\"nameChanged\" >\n"
|
||||
" <arg direction=\"out\" type=\"s\" name=\"newName\" />\n"
|
||||
" </signal>\n"
|
||||
" <signal name=\"newOutputAvailable\" >\n"
|
||||
" <arg direction=\"out\" type=\"s\" name=\"service\" />\n"
|
||||
" <arg direction=\"out\" type=\"s\" name=\"path\" />\n"
|
||||
" </signal>\n"
|
||||
" <signal name=\"outputDestroyed\" >\n"
|
||||
" </signal>\n"
|
||||
" <method name=\"category\" >\n"
|
||||
" <arg direction=\"out\" type=\"s\" />\n"
|
||||
" </method>\n"
|
||||
" <method name=\"name\" >\n"
|
||||
" <arg direction=\"out\" type=\"s\" />\n"
|
||||
" </method>\n"
|
||||
" </interface>\n"
|
||||
"")
|
||||
public:
|
||||
AudioOutputAdaptor(QObject *parent);
|
||||
virtual ~AudioOutputAdaptor();
|
||||
|
||||
public: // PROPERTIES
|
||||
Q_PROPERTY(bool muted READ muted WRITE setMuted)
|
||||
bool muted() const;
|
||||
void setMuted(bool value);
|
||||
|
||||
Q_PROPERTY(int outputDeviceIndex READ outputDeviceIndex WRITE setOutputDeviceIndex)
|
||||
int outputDeviceIndex() const;
|
||||
void setOutputDeviceIndex(int value);
|
||||
|
||||
Q_PROPERTY(double volume READ volume WRITE setVolume)
|
||||
double volume() const;
|
||||
void setVolume(double value);
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
QString category();
|
||||
QString name();
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void mutedChanged(bool in0);
|
||||
void nameChanged(const QString &newName);
|
||||
void newOutputAvailable(const QString &service, const QString &path);
|
||||
void outputDestroyed();
|
||||
void outputDeviceIndexChanged(int in0);
|
||||
void volumeChanged(qreal in0);
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // PHONON_NO_DBUS
|
||||
|
||||
#endif // AUDIOOUTPUTADAPTOR_P_H
|
|
@ -1,36 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "audiooutputinterface.h"
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QPair>
|
||||
#include "platform_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
QList<QPair<QByteArray, QString> > AudioOutputInterface42::deviceAccessListFor(const Phonon::AudioOutputDevice &deviceDesc) const
|
||||
{
|
||||
return Platform::deviceAccessListFor(deviceDesc);
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
|
@ -1,211 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2015 Harald Sitter <sitter@kde.org>
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_AUDIOOUTPUTINTERFACE_H
|
||||
#define PHONON_AUDIOOUTPUTINTERFACE_H
|
||||
|
||||
#include "phononnamespace.h"
|
||||
#include "objectdescription.h"
|
||||
#include "phonondefs.h"
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
/** \class AudioOutputInterface audiooutputinterface.h phonon/AudioOutputInterface
|
||||
* \short Interface for AudioOutput objects
|
||||
*
|
||||
* The implementation can make use of the signals
|
||||
* \code
|
||||
void volumeChanged(qreal newVolume);
|
||||
void audioDeviceFailed();
|
||||
* \endcode
|
||||
* to notify the frontend whenever the volume has changed or when an audioDeviceFailed (e.g. USB
|
||||
* unplug or sound server failure).
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class AudioOutputInterface40
|
||||
{
|
||||
public:
|
||||
virtual ~AudioOutputInterface40() {}
|
||||
|
||||
/**
|
||||
* Returns the current software volume.
|
||||
*
|
||||
* A value of 0.0 means muted, 1.0 means unchanged, 2.0 means double voltage (i.e. all
|
||||
* samples are multiplied by 2).
|
||||
*/
|
||||
virtual qreal volume() const = 0;
|
||||
/**
|
||||
* Sets the new current software volume.
|
||||
*
|
||||
* A value of 0.0 means muted, 1.0 means unchanged, 2.0 means double voltage (i.e. all
|
||||
* samples are multiplied by 2).
|
||||
*
|
||||
* Every time the volume in the backend changes it should emit volumeChanged(qreal), also
|
||||
* inside this function.
|
||||
*/
|
||||
virtual void setVolume(qreal) = 0;
|
||||
|
||||
/**
|
||||
* Returns the index of the device that is used. The index is the number returned from
|
||||
* BackendInterface::objectDescriptionIndexes(AudioOutputDeviceType).
|
||||
*/
|
||||
virtual int outputDevice() const = 0;
|
||||
/**
|
||||
* \deprecated
|
||||
*
|
||||
* Requests to change the current output device to the one identified by the passed index.
|
||||
*
|
||||
* The index is the number returned from
|
||||
* BackendInterface::objectDescriptionIndexes(AudioOutputDeviceType).
|
||||
*
|
||||
* \returns \c true if the requested device works and is used after this call.
|
||||
* \returns \c false if something failed and the device is not used after this call.
|
||||
*/
|
||||
virtual bool setOutputDevice(int) = 0;
|
||||
};
|
||||
|
||||
class AudioOutputInterface42 : public AudioOutputInterface40
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Requests to change the current output device.
|
||||
*
|
||||
* \returns \c true if the requested device works and is used after this call.
|
||||
* \returns \c false if something failed and the device is not used after this call.
|
||||
*/
|
||||
virtual bool setOutputDevice(const Phonon::AudioOutputDevice &) = 0;
|
||||
|
||||
using AudioOutputInterface40::setOutputDevice;
|
||||
|
||||
/**
|
||||
* Helper function for backends to get a list of (driver, handle) pairs for
|
||||
* AudioOutputDevice objects that are listed by the platform plugin.
|
||||
*
|
||||
* Example:
|
||||
* \code
|
||||
typedef QPair<QByteArray, QString> PhononDeviceAccess;
|
||||
const QList<PhononDeviceAccess> &deviceAccessList = deviceAccessListFor(deviceDesc);
|
||||
foreach (const PhononDeviceAccess &access, deviceAccessList) {
|
||||
const QByteArray &driver = access.first;
|
||||
const QString &handle = access.second;
|
||||
if (openDevice(driver, handle)) {
|
||||
// we found the first pair in the list that works. done.
|
||||
return;
|
||||
}
|
||||
// continue trying the other (driver, handle) pairs
|
||||
}
|
||||
// none of the (driver, handle) pairs worked, that means the whole AudioOutputDevice is
|
||||
// inaccessible and the frontend needs to know (either by emitting audioDeviceFailed or
|
||||
// returning false when called from setOutputDevice)
|
||||
* \endcode
|
||||
*
|
||||
* At the time of this writing the following driver strings are known to be in use:
|
||||
* \li \c alsa: The handle is the string to pass to snd_pcm_open (e.g. "dmix:CARD=0,DEV=1")
|
||||
* \li \c oss: The handle is the device file (e.g. "/dev/dsp")
|
||||
* \li \c pulseaudio: The handle contains the server string and the sink/source name
|
||||
* separated by a newline character.
|
||||
* (e.g. unix:/tmp/pulse-mkretz/native\nalsa_output.pci_8086_293e_sound_card_0_alsa_playback_0)
|
||||
*/
|
||||
PHONON_EXPORT QList<QPair<QByteArray, QString> > deviceAccessListFor(const Phonon::AudioOutputDevice &) const;
|
||||
};
|
||||
|
||||
class AudioOutputInterface47 : public AudioOutputInterface42
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* This function is meant to be used in conjuction with PulseSupport
|
||||
* to either get the property set for the associated PulseAudio straem or
|
||||
* to automatically apply them to the envrionment.
|
||||
*
|
||||
* If a backend subsystem supports actively setting arbitrary properties
|
||||
* this method should be preferred and PulseSupport::streamProperties()
|
||||
* should be used.
|
||||
* If a backend subsystem does not support setting arbitrary properties
|
||||
* PulseSupport::setupStreamEnvironment() should be called as close to
|
||||
* stream creation as possible to manipulate the process envrionment
|
||||
* such that PulseAudio will pick up the properties.
|
||||
*
|
||||
* \param uuid the UUID used by PulseSupport to identify the associated stream
|
||||
*
|
||||
* \since 4.7.0
|
||||
*/
|
||||
virtual void setStreamUuid(QString uuid) = 0;
|
||||
};
|
||||
|
||||
class AudioOutputInterface49 : public AudioOutputInterface47
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* SIGNAL emitted when the muteness of the output changes.
|
||||
*
|
||||
* \warning When implementing the 4.9 interface this signal MUST be emitted
|
||||
* from all relevant sources.
|
||||
*
|
||||
* This signal must be emitted whenever muteness is reached. Presently
|
||||
* Phonon has a fallback mechanic which for example forces muteness on
|
||||
* setVolume(0.0) on the frontend side, assuming that the backend enforces
|
||||
* this.
|
||||
* Whenever muteness is reached in the backend this signal
|
||||
* must be emitted, regardless of whether it was reached by
|
||||
* volume=0.0 or mute=true or device=dead or digital-passthrough=true...
|
||||
*
|
||||
* \param mute \c true when the output is mute, \c false if it is not mute
|
||||
*
|
||||
* \since 4.9.0
|
||||
*/
|
||||
virtual void mutedChanged(bool mute) = 0;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#ifdef PHONON_BACKEND_VERSION_4_9
|
||||
namespace Phonon { typedef AudioOutputInterface49 AudioOutputInterface; }
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface40, "AudioOutputInterface2.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface42, "3AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface47, "4AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface, "5AudioOutputInterface.phonon.kde.org")
|
||||
#elif defined PHONON_BACKEND_VERSION_4_7
|
||||
namespace Phonon { typedef AudioOutputInterface47 AudioOutputInterface; }
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface40, "AudioOutputInterface2.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface42, "3AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface, "4AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface49, "5AudioOutputInterface.phonon.kde.org")
|
||||
#elif defined PHONON_BACKEND_VERSION_4_2
|
||||
namespace Phonon { typedef AudioOutputInterface42 AudioOutputInterface; }
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface40, "AudioOutputInterface2.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface, "3AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface47, "4AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface49, "5AudioOutputInterface.phonon.kde.org")
|
||||
#else
|
||||
namespace Phonon { typedef AudioOutputInterface40 AudioOutputInterface; }
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface, "AudioOutputInterface2.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface42, "3AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface47, "4AudioOutputInterface.phonon.kde.org")
|
||||
Q_DECLARE_INTERFACE(Phonon::AudioOutputInterface49, "5AudioOutputInterface.phonon.kde.org")
|
||||
#endif
|
||||
|
||||
|
||||
#endif // PHONON_AUDIOOUTPUTINTERFACE_H
|
|
@ -1,107 +0,0 @@
|
|||
/**
|
||||
\page phonon_Backend The Backend Class
|
||||
\ingroup Backend
|
||||
|
||||
\section phonon_Backend_requiredfunctions Required Functions
|
||||
\li bool \ref phonon_Backend_supportsOSD "supportsOSD()"
|
||||
\li bool \ref phonon_Backend_supportsFourcc "supportsFourcc( quint32 )"
|
||||
\li bool \ref phonon_Backend_supportsSubtitles "supportsSubtitles()"
|
||||
\li bool \ref phonon_Backend_supportsVideo "supportsVideo()"
|
||||
\li QStringList \ref phonon_Backend_availableMimeTypes "availableMimeTypes()"
|
||||
|
||||
\section Member Function Documentation
|
||||
|
||||
\subsection phonon_Backend_supportsFourcc bool supportsFourcc( quint32 fourcc )
|
||||
Tells whether the FOURCC (four character code) is supported for
|
||||
the \ref phonon_VideoDataOutput "VideoDataOutput" interface. If you return \c true, you have to be
|
||||
able to return VideoFrame objects accordingly from
|
||||
\ref phonon_VideoDataOutput "VideoDataOutput".
|
||||
\param fourcc A four character code defining a video frame format.
|
||||
\returns \c true if your \ref phonon_VideoDataOutput "VideoDataOutput" can
|
||||
output video frames in the requested format.
|
||||
\returns \c false if the video frames can not be converted into the requested
|
||||
format.
|
||||
|
||||
\subsection phonon_Backend_availableMimeTypes QStringList availableMimeTypes()
|
||||
Lists the MIME types the backend can read and decode.
|
||||
|
||||
\subsection phonon_Backend_xIndexes QSet<int> <device/codec/effect/...>Indexes()
|
||||
Returns a set of indexes that identify the devices/codecs/effects/... the
|
||||
backend supports. This list needs to be compiled from looking at
|
||||
available hardware and virtual devices/plugins/... . The implementation
|
||||
should use cached information, but you need to invalidate the cache
|
||||
whenever the hardware configuration changes or new virtual devices come
|
||||
available/new plugins are installed/... .
|
||||
|
||||
\return The indexes of the available devices/codecs/effects/...
|
||||
|
||||
\see \ref phonon_Backend_xName
|
||||
\see \ref phonon_Backend_xDescription
|
||||
|
||||
\subsection phonon_Backend_xName QString <device/codec/effect/...>Name( int index )
|
||||
Returns the name of the given device/codec/effect/...
|
||||
|
||||
\param index The index of one device/codec/effect/... this is one index
|
||||
out of \ref phonon_Backend_xIndexes
|
||||
|
||||
\returns A translated user visible string to name the device.
|
||||
|
||||
\see \ref phonon_Backend_xIndexes
|
||||
\see \ref phonon_Backend_xDescription
|
||||
\subsection phonon_Backend_xDescription QString <device/codec/effect/...>Description( int index )
|
||||
Returns the description of the given device/codec/effect/...
|
||||
|
||||
\param index The index of one device/codec/effect/... this is one index
|
||||
out of \ref phonon_Backend_xIndexes
|
||||
|
||||
\returns A translated user visible string to describe the device.
|
||||
|
||||
\see \ref phonon_Backend_xIndexes
|
||||
\see \ref phonon_Backend_xName
|
||||
|
||||
\subsection phonon_Backend_audioCaptureDeviceVideoIndex qint32 audioCaptureDeviceVideoIndex( int index )
|
||||
\param index The index of the device. This is one of the indexes the backend
|
||||
returned via \ref phonon_Backend_xIndexes
|
||||
\returns An index of a video capture device that is associated with the given
|
||||
audio capture device. For example a webcam might have both a video and an audio
|
||||
capture device, and in order give the user a hint that the audio and video
|
||||
capture devices belong together this index is used.
|
||||
\returns If there is no associated video capture device return -1.
|
||||
|
||||
\subsection phonon_Backend_videoCaptureDeviceAudioIndex qint32 videoCaptureDeviceAudioIndex( int index )
|
||||
\param index The index of the device. This is one of the indexes the backend
|
||||
returned via \ref phonon_Backend_xIndexes
|
||||
\returns An index of a audio capture device that is associated with the given
|
||||
video capture device. For example a webcam might have both a audio and an video
|
||||
capture device, and in order give the user a hint that the video and audio
|
||||
capture devices belong together this index is used.
|
||||
\returns If there is no associated audio capture device return -1.
|
||||
|
||||
\page phonon_AudioDataOutput The AudioDataOutput Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_AudioOutput The AudioOutput Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_VideoDataOutput The VideoDataOutput Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_VideoWidget The VideoWidget Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_Effect The Effect Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_BrightnessControl The BrightnessControl Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_VideoEffect The VideoEffect Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_Visualization The Visualization Class
|
||||
\ingroup Backend
|
||||
|
||||
\page phonon_VolumeFaderEffect The VolumeFaderEffect Class
|
||||
\ingroup Backend
|
||||
|
||||
*/
|
|
@ -1,146 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "backendcapabilities.h"
|
||||
#include "backendcapabilities_p.h"
|
||||
|
||||
#include "phonondefs_p.h"
|
||||
#include "backendinterface.h"
|
||||
#include "factory_p.h"
|
||||
#include "globalconfig.h"
|
||||
#include "globalstatic_p.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
PHONON_GLOBAL_STATIC(Phonon::BackendCapabilitiesPrivate, globalBCPrivate)
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
BackendCapabilities::Notifier *BackendCapabilities::notifier()
|
||||
{
|
||||
return globalBCPrivate;
|
||||
}
|
||||
|
||||
QStringList BackendCapabilities::availableMimeTypes()
|
||||
{
|
||||
if (BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend()))
|
||||
return backendIface->availableMimeTypes();
|
||||
else
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
bool BackendCapabilities::isMimeTypeAvailable(const QString &mimeType)
|
||||
{
|
||||
QObject *m_backendObject = Factory::backend(false);
|
||||
if (!m_backendObject) {
|
||||
if (!Factory::isMimeTypeAvailable(mimeType)) {
|
||||
return false;
|
||||
}
|
||||
// without loading the backend we found out that the MIME type might be supported, now we
|
||||
// want to know for certain. For that we need to load the backend.
|
||||
m_backendObject = Factory::backend(true);
|
||||
}
|
||||
if (!m_backendObject) {
|
||||
// no backend == no MIME type supported at all
|
||||
return false;
|
||||
}
|
||||
return availableMimeTypes().contains(mimeType);
|
||||
}
|
||||
|
||||
QList<AudioOutputDevice> BackendCapabilities::availableAudioOutputDevices()
|
||||
{
|
||||
QList<AudioOutputDevice> ret;
|
||||
#ifndef QT_NO_PHONON_SETTINGSGROUP
|
||||
const QList<int> deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory, GlobalConfig::ShowAdvancedDevices);
|
||||
for (int i = 0; i < deviceIndexes.count(); ++i) {
|
||||
ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i)));
|
||||
}
|
||||
#endif //QT_NO_PHONON_SETTINGSGROUP
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifndef PHONON_NO_AUDIOCAPTURE
|
||||
QList<AudioCaptureDevice> BackendCapabilities::availableAudioCaptureDevices()
|
||||
{
|
||||
QList<AudioCaptureDevice> ret;
|
||||
const QList<int> deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCaptureCategory, GlobalConfig::ShowAdvancedDevices);
|
||||
for (int i = 0; i < deviceIndexes.count(); ++i) {
|
||||
ret.append(AudioCaptureDevice::fromIndex(deviceIndexes.at(i)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif //PHONON_NO_AUDIOCAPTURE
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
QList<VideoCaptureDevice> BackendCapabilities::availableVideoCaptureDevices()
|
||||
{
|
||||
QList<VideoCaptureDevice> ret;
|
||||
const QList<int> deviceIndexes = GlobalConfig().videoCaptureDeviceListFor(Phonon::NoCaptureCategory, GlobalConfig::ShowAdvancedDevices);
|
||||
for (int i = 0; i < deviceIndexes.count(); ++i) {
|
||||
ret.append(VideoCaptureDevice::fromIndex(deviceIndexes.at(i)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif //PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
#if !defined(PHONON_NO_VIDEOCAPTURE) && !defined(PHONON_NO_AUDIOCAPTURE)
|
||||
QList<VideoCaptureDevice> BackendCapabilities::availableAVCaptureDevices()
|
||||
{
|
||||
QList<VideoCaptureDevice> ret;
|
||||
const QList<int> deviceIndexes = GlobalConfig().videoCaptureDeviceListFor(Phonon::NoCaptureCategory, GlobalConfig::ShowAdvancedDevices);
|
||||
for (int i = 0; i < deviceIndexes.count(); ++i) {
|
||||
VideoCaptureDevice vcd = VideoCaptureDevice::fromIndex(deviceIndexes.at(i));
|
||||
if (vcd.propertyNames().contains("hasaudio") && vcd.property("hasaudio").isValid())
|
||||
ret.append(vcd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif // NOT PHONON_NO_VIDEOCAPTURE AND NOT PHONON_NO_AUDIOCAPTURE
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
QList<EffectDescription> BackendCapabilities::availableAudioEffects()
|
||||
{
|
||||
BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend());
|
||||
QList<EffectDescription> ret;
|
||||
if (backendIface) {
|
||||
const QList<int> deviceIndexes = backendIface->objectDescriptionIndexes(Phonon::EffectType);
|
||||
for (int i = 0; i < deviceIndexes.count(); ++i) {
|
||||
ret.append(EffectDescription::fromIndex(deviceIndexes.at(i)));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#include "moc_backendcapabilities.cpp"
|
||||
|
||||
// vim: sw=4 ts=4
|
||||
|
||||
|
||||
#include "moc_backendcapabilities.h"
|
|
@ -1,239 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef Phonon_BACKENDCAPABILITIES_H
|
||||
#define Phonon_BACKENDCAPABILITIES_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
|
||||
template<class T> class QList;
|
||||
class QStringList;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
/**
|
||||
* Collection of functions describing the capabilities of the Backend.
|
||||
*
|
||||
* \ingroup BackendInformation
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
namespace BackendCapabilities
|
||||
{
|
||||
/** \class Notifier backendcapabilities.h phonon/BackendCapabilities
|
||||
* Notifications about backend capabilities.
|
||||
*
|
||||
* \ingroup BackendInformation
|
||||
*/
|
||||
class Notifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if the capabilities have changed. This can
|
||||
* happen if the user has requested a backend change.
|
||||
*/
|
||||
void capabilitiesChanged();
|
||||
|
||||
/**
|
||||
* This signal is emitted when audio output devices were plugged or
|
||||
* unplugged.
|
||||
*
|
||||
* Check BackendCapabilities::availableAudioOutputDevices to get the
|
||||
* current list of available devices.
|
||||
*/
|
||||
void availableAudioOutputDevicesChanged();
|
||||
|
||||
#ifndef PHONON_NO_AUDIOCAPTURE
|
||||
/**
|
||||
* This signal is emitted when audio capture devices were plugged or
|
||||
* unplugged.
|
||||
*
|
||||
* Check BackendCapabilities::availableAudioCaptureDevices to get the
|
||||
* current list of available devices.
|
||||
*/
|
||||
void availableAudioCaptureDevicesChanged();
|
||||
#endif //PHONON_NO_AUDIOCAPTURE
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
/**
|
||||
* This signal is emitted when video capture devices were plugged or
|
||||
* unplugged.
|
||||
*
|
||||
* Check BackendCapabilities::availableVideoCaptureDevices to get the
|
||||
* current list of available devices.
|
||||
*/
|
||||
void availableVideoCaptureDevicesChanged();
|
||||
#endif //PHONON_NO_VIDEOCAPTURE
|
||||
};
|
||||
|
||||
/**
|
||||
* Use this function to get a QObject pointer to connect to one of the Notifier signals.
|
||||
*
|
||||
* \return a pointer to a QObject.
|
||||
*
|
||||
* To connect to the signal do the following:
|
||||
* \code
|
||||
* QObject::connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), ...
|
||||
* \endcode
|
||||
*
|
||||
* \see Notifier::capabilitiesChanged()
|
||||
* \see Notifier::availableAudioOutputDevicesChanged()
|
||||
* \see Notifier::availableAudioCaptureDevicesChanged()
|
||||
* \see Notifier::availableVideoCaptureDevicesChanged()
|
||||
*/
|
||||
PHONON_EXPORT Notifier *notifier();
|
||||
|
||||
/**
|
||||
* Returns a list of mime types that the Backend can decode.
|
||||
*
|
||||
* \see isMimeTypeAvailable()
|
||||
*/
|
||||
PHONON_EXPORT QStringList availableMimeTypes();
|
||||
|
||||
/**
|
||||
* Often all you want to know is whether one given MIME type can be
|
||||
* decoded by the backend. Use this method in favor of availableMimeTypes()
|
||||
* as it can give you a negative answer without having a backend loaded.
|
||||
*
|
||||
* \see availableMimeTypes();
|
||||
*/
|
||||
PHONON_EXPORT bool isMimeTypeAvailable(const QString &mimeType);
|
||||
|
||||
/**
|
||||
* Returns the audio output devices the backend supports.
|
||||
*
|
||||
* \return A list of AudioOutputDevice objects that give a name and
|
||||
* description for every supported audio output device.
|
||||
*/
|
||||
PHONON_EXPORT QList<AudioOutputDevice> availableAudioOutputDevices();
|
||||
|
||||
#ifndef PHONON_NO_AUDIOCAPTURE
|
||||
/**
|
||||
* Returns the audio capture devices the backend supports.
|
||||
*
|
||||
* \return A list of AudioCaptureDevice objects that give a name and
|
||||
* description for every supported audio capture device.
|
||||
*/
|
||||
PHONON_EXPORT QList<AudioCaptureDevice> availableAudioCaptureDevices();
|
||||
#endif //PHONON_NO_AUDIOCAPTURE
|
||||
|
||||
/**
|
||||
* Returns the video output devices the backend supports.
|
||||
*
|
||||
* \return A list of VideoOutputDevice objects that give a name and
|
||||
* description for every supported video output device.
|
||||
*/
|
||||
// PHONON_EXPORT QList<VideoOutputDevice> availableVideoOutputDevices();
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
/**
|
||||
* Returns the video capture devices the backend supports.
|
||||
*
|
||||
* \return A list of VideoCaptureDevice objects that give a name and
|
||||
* description for every supported video capture device.
|
||||
*/
|
||||
PHONON_EXPORT QList<VideoCaptureDevice> availableVideoCaptureDevices();
|
||||
#endif //PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
/**
|
||||
* Returns the video capture devices that have audio capture capabilities
|
||||
* that the backend supports. In effect, these are both video and audio
|
||||
* capture devices and one can connect them to both a VideoWidget and an
|
||||
* AudioOutput, for example.
|
||||
*
|
||||
* The resulting VideoCaptureDevices have a "hasaudio" property to true.
|
||||
*
|
||||
* \note These devices appear both in availableVideoCaptureDevices() and
|
||||
* availableAudioCaptureDevices()
|
||||
*
|
||||
* \warning Creating two separate MediaObject instances for the same capture
|
||||
* device, one for video and the other for audio, most probably doesn't work.
|
||||
* But, if there are two separate devices, use Experimental::AVCapture.
|
||||
*
|
||||
* \see availableVideoCaptureDevices()
|
||||
* \see availableAudioCaptureDevices()
|
||||
* \see Experimental::AVCapture
|
||||
*/
|
||||
#if !defined(PHONON_NO_VIDEOCAPTURE) && !defined(PHONON_NO_AUDIOCAPTURE)
|
||||
PHONON_EXPORT QList<VideoCaptureDevice> availableAVCaptureDevices();
|
||||
#endif // NOT PHONON_NO_VIDEOCAPTURE AND NOT PHONON_NO_AUDIOCAPTURE
|
||||
|
||||
/**
|
||||
* Returns the visualization effects the backend supports.
|
||||
*
|
||||
* \return A list of VisualizationEffect objects that give a name and
|
||||
* description for every supported visualization effect.
|
||||
*/
|
||||
// PHONON_EXPORT QList<VisualizationDescription> availableVisualizations();
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
/**
|
||||
* Returns descriptions for the audio effects the backend supports.
|
||||
*
|
||||
* \return A list of AudioEffectDescription objects that give a name and
|
||||
* description for every supported audio effect.
|
||||
*/
|
||||
PHONON_EXPORT QList<EffectDescription> availableAudioEffects();
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
//X /**
|
||||
//X * Returns descriptions for the video effects the backend supports.
|
||||
//X *
|
||||
//X * \return A list of VideoEffectDescription objects that give a name and
|
||||
//X * description for every supported video effect.
|
||||
//X */
|
||||
//X PHONON_EXPORT QList<EffectDescription> availableVideoEffects();
|
||||
|
||||
/**
|
||||
* Returns descriptions for the audio codecs the backend supports.
|
||||
*
|
||||
* \return A list of AudioCodec objects that give a name and
|
||||
* description for every supported audio codec.
|
||||
*/
|
||||
// PHONON_EXPORT QList<AudioCodecDescription> availableAudioCodecs();
|
||||
|
||||
/**
|
||||
* Returns descriptions for the video codecs the backend supports.
|
||||
*
|
||||
* \return A list of VideoCodec objects that give a name and
|
||||
* description for every supported video codec.
|
||||
*/
|
||||
// PHONON_EXPORT QList<VideoCodecDescription> availableVideoCodecs();
|
||||
|
||||
/**
|
||||
* Returns descriptions for the container formats the backend supports.
|
||||
*
|
||||
* \return A list of ContainerFormat objects that give a name and
|
||||
* description for every supported container format.
|
||||
*/
|
||||
// PHONON_EXPORT QList<ContainerFormatDescription> availableContainerFormats();
|
||||
} // namespace BackendCapabilities
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // Phonon_BACKENDCAPABILITIES_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_BACKENDCAPABILITIES_P_H
|
||||
#define PHONON_BACKENDCAPABILITIES_P_H
|
||||
|
||||
#include "backendcapabilities.h"
|
||||
#include <QtCore/QObject>
|
||||
#include "factory_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class BackendCapabilitiesPrivate : public BackendCapabilities::Notifier
|
||||
{
|
||||
public:
|
||||
BackendCapabilitiesPrivate()
|
||||
{
|
||||
connect(Factory::sender(), SIGNAL(backendChanged()), SIGNAL(capabilitiesChanged()));
|
||||
connect(Factory::sender(), SIGNAL(availableAudioOutputDevicesChanged()), SIGNAL(availableAudioOutputDevicesChanged()));
|
||||
connect(Factory::sender(), SIGNAL(availableAudioCaptureDevicesChanged()), SIGNAL(availableAudioCaptureDevicesChanged()));
|
||||
connect(Factory::sender(), SIGNAL(availableVideoCaptureDevicesChanged()), SIGNAL(availableVideoCaptureDevicesChanged()));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_BACKENDCAPABILITIES_P_H
|
||||
// vim: sw=4 sts=4 et tw=100
|
|
@ -1,284 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_BACKENDINTERFACE_H
|
||||
#define PHONON_BACKENDINTERFACE_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtCore/QSet>
|
||||
|
||||
|
||||
class QVariant;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
/** \class BackendInterface backendinterface.h phonon/BackendInterface
|
||||
* \short Main Backend class interface
|
||||
*
|
||||
* This interface defines the main factory of the backend. The createObject function creates all the
|
||||
* objects needed by the frontend.
|
||||
*
|
||||
* The objectDescriptionIndexes and objectDescriptionProperties functions return information about
|
||||
* available devices, effects and codecs.
|
||||
*
|
||||
* An implementation could look like this:
|
||||
* \code
|
||||
* QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
|
||||
* {
|
||||
* switch (c) {
|
||||
* case MediaObjectClass:
|
||||
* return new MediaObject(parent);
|
||||
* case VolumeFaderEffectClass:
|
||||
* return new VolumeFaderEffect(parent);
|
||||
* case AudioOutputClass:
|
||||
* return new AudioOutput(parent);
|
||||
* case AudioDataOutputClass:
|
||||
* return new AudioDataOutput(parent);
|
||||
* case VisualizationClass:
|
||||
* return new Visualization(parent);
|
||||
* case VideoDataOutputClass:
|
||||
* return new VideoDataOutput(parent);
|
||||
* case EffectClass:
|
||||
* return new Effect(args[0].toInt(), parent);
|
||||
* case VideoWidgetClass:
|
||||
* return new VideoWidget(qobject_cast<QWidget *>(parent));
|
||||
* }
|
||||
* return 0;
|
||||
* }
|
||||
*
|
||||
* QSet<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const
|
||||
* {
|
||||
* QSet<int> set;
|
||||
* switch(type)
|
||||
* {
|
||||
* case Phonon::AudioOutputDeviceType:
|
||||
* // use AudioDeviceEnumerator to list ALSA and OSS devices
|
||||
* set << 10000 << 10001;
|
||||
* break;
|
||||
* case Phonon::AudioCaptureDeviceType:
|
||||
* set << 20000 << 20001;
|
||||
* break;
|
||||
* case Phonon::VideoOutputDeviceType:
|
||||
* break;
|
||||
* case Phonon::VideoCaptureDeviceType:
|
||||
* set << 30000 << 30001;
|
||||
* break;
|
||||
* case Phonon::VisualizationType:
|
||||
* case Phonon::AudioCodecType:
|
||||
* case Phonon::VideoCodecType:
|
||||
* case Phonon::ContainerFormatType:
|
||||
* break;
|
||||
* case Phonon::EffectType:
|
||||
* set << 0x7F000001;
|
||||
* break;
|
||||
* }
|
||||
* return set;
|
||||
* }
|
||||
*
|
||||
* QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const
|
||||
* {
|
||||
* QHash<QByteArray, QVariant> ret;
|
||||
* switch (type) {
|
||||
* case Phonon::AudioOutputDeviceType:
|
||||
* switch (index) {
|
||||
* case 10000:
|
||||
* ret.insert("name", QLatin1String("internal Soundcard"));
|
||||
* break;
|
||||
* case 10001:
|
||||
* ret.insert("name", QLatin1String("USB Headset"));
|
||||
* ret.insert("icon", KIcon("usb-headset"));
|
||||
* ret.insert("available", false);
|
||||
* break;
|
||||
* }
|
||||
* break;
|
||||
* case Phonon::AudioCaptureDeviceType:
|
||||
* switch (index) {
|
||||
* case 20000:
|
||||
* ret.insert("name", QLatin1String("Soundcard"));
|
||||
* ret.insert("description", QLatin1String("first description"));
|
||||
* break;
|
||||
* case 20001:
|
||||
* ret.insert("name", QLatin1String("DV"));
|
||||
* ret.insert("description", QLatin1String("second description"));
|
||||
* break;
|
||||
* }
|
||||
* break;
|
||||
* case Phonon::VideoOutputDeviceType:
|
||||
* break;
|
||||
* case Phonon::VideoCaptureDeviceType:
|
||||
* switch (index) {
|
||||
* case 30000:
|
||||
* ret.insert("name", QLatin1String("USB Webcam"));
|
||||
* ret.insert("description", QLatin1String("first description"));
|
||||
* break;
|
||||
* case 30001:
|
||||
* ret.insert("name", QLatin1String("DV"));
|
||||
* ret.insert("description", QLatin1String("second description"));
|
||||
* break;
|
||||
* }
|
||||
* break;
|
||||
* case Phonon::VisualizationType:
|
||||
* break;
|
||||
* case Phonon::AudioCodecType:
|
||||
* break;
|
||||
* case Phonon::VideoCodecType:
|
||||
* break;
|
||||
* case Phonon::ContainerFormatType:
|
||||
* break;
|
||||
* case Phonon::EffectType:
|
||||
* switch (index) {
|
||||
* case 0x7F000001:
|
||||
* ret.insert("name", QLatin1String("Delay"));
|
||||
* ret.insert("description", QLatin1String("Simple delay effect with time, feedback and level controls."));
|
||||
* break;
|
||||
* }
|
||||
* break;
|
||||
* }
|
||||
* return ret;
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class BackendInterface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Silence gcc's warning.
|
||||
*/
|
||||
virtual ~BackendInterface() {}
|
||||
|
||||
/**
|
||||
* Classes that the createObject function has to handle.
|
||||
*/
|
||||
enum Class {
|
||||
/**
|
||||
* Request to return a %MediaObject object.
|
||||
*/
|
||||
MediaObjectClass,
|
||||
/**
|
||||
* Request to return a %VolumeFaderEffect object.
|
||||
*/
|
||||
VolumeFaderEffectClass,
|
||||
/**
|
||||
* Request to return a %AudioOutput object.
|
||||
*/
|
||||
AudioOutputClass,
|
||||
/**
|
||||
* Request to return a %AudioDataOutput object.
|
||||
*/
|
||||
AudioDataOutputClass,
|
||||
/**
|
||||
* Request to return a %Visualization object.
|
||||
*/
|
||||
VisualizationClass,
|
||||
/**
|
||||
* Request to return a %VideoDataOutput object.
|
||||
*/
|
||||
VideoDataOutputClass,
|
||||
/**
|
||||
* Request to return a %Effect object.
|
||||
*
|
||||
* Takes an additional int that specifies the effect Id.
|
||||
*/
|
||||
EffectClass,
|
||||
/**
|
||||
* Request to return a %VideoWidget object.
|
||||
*/
|
||||
VideoWidgetClass,
|
||||
VideoGraphicsObjectClass /* < Request to return a %VideoGraphicsObject */
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a new instance of the requested class.
|
||||
*
|
||||
* \param c The requested class.
|
||||
* \param parent The parent object.
|
||||
* \param args Additional arguments (documented in \ref Class).
|
||||
*/
|
||||
virtual QObject *createObject(Class c, QObject *parent, const QList<QVariant> &args = QList<QVariant>()) = 0;
|
||||
|
||||
/**
|
||||
* Returns the unique identifiers for the devices/effects/codecs of the given \p type.
|
||||
*
|
||||
* \param type see \ref ObjectDescriptionType
|
||||
*/
|
||||
virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const = 0;
|
||||
|
||||
/**
|
||||
* Given a unique identifier that was returned from objectDescriptionIndexes this function
|
||||
* returns a hash mapping property names to values.
|
||||
*
|
||||
* The property "name" must always be present. All other properties are optional.
|
||||
*
|
||||
* List of possible properties:
|
||||
* \li \c \b name: The name of the device/effect/codec/...
|
||||
* \li \c \b description: A text explaining what this device/effect/codec/... is/can do
|
||||
* \li \c \b icon: An icon name (using the freedesktop naming scheme) or a QIcon for this
|
||||
* device/effect/codec/...
|
||||
* \li \c \b available: A bool telling whether the device is present or unplugged.
|
||||
*
|
||||
* \param type see \ref ObjectDescriptionType
|
||||
* \param index The unique identifier that is returned from objectDescriptionIndexes
|
||||
*/
|
||||
virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const = 0;
|
||||
|
||||
/**
|
||||
* When this function is called the nodes given in the parameter list should not lose any
|
||||
* signal data when connections are changed.
|
||||
*/
|
||||
virtual bool startConnectionChange(QSet<QObject *>) = 0;
|
||||
|
||||
/**
|
||||
* Defines a signal connection between the two given nodes.
|
||||
*/
|
||||
virtual bool connectNodes(QObject *, QObject *) = 0;
|
||||
|
||||
/**
|
||||
* Cuts a signal connection between the two given nodes.
|
||||
*/
|
||||
virtual bool disconnectNodes(QObject *, QObject *) = 0;
|
||||
|
||||
/**
|
||||
* When this function is called the nodes given in the parameter list may lose
|
||||
* signal data when a port is not connected.
|
||||
*/
|
||||
virtual bool endConnectionChange(QSet<QObject *>) = 0;
|
||||
|
||||
/**
|
||||
* gets all available mime types
|
||||
*/
|
||||
virtual QStringList availableMimeTypes() const = 0;
|
||||
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::BackendInterface, "BackendInterface3.phonon.kde.org")
|
||||
|
||||
|
||||
#endif // PHONON_BACKENDINTERFACE_H
|
|
@ -1,135 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "effect.h"
|
||||
#include "effect_p.h"
|
||||
#include "effectparameter.h"
|
||||
#include "effectinterface.h"
|
||||
#include "factory_p.h"
|
||||
|
||||
#define PHONON_INTERFACENAME EffectInterface
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
Effect::~Effect()
|
||||
{
|
||||
}
|
||||
|
||||
Effect::Effect(const EffectDescription &description, QObject *parent)
|
||||
: QObject(parent), MediaNode(*new EffectPrivate)
|
||||
{
|
||||
P_D(Effect);
|
||||
d->description = description;
|
||||
d->createBackendObject();
|
||||
}
|
||||
|
||||
Effect::Effect(EffectPrivate &dd, QObject *parent)
|
||||
: QObject(parent), MediaNode(dd)
|
||||
{
|
||||
}
|
||||
|
||||
void EffectPrivate::createBackendObject()
|
||||
{
|
||||
if (m_backendObject)
|
||||
return;
|
||||
P_Q(Effect);
|
||||
m_backendObject = Factory::createEffect(description.index(), q);
|
||||
if (m_backendObject) {
|
||||
setupBackendObject();
|
||||
}
|
||||
}
|
||||
|
||||
//X Effect::Type Effect::type() const
|
||||
//X {
|
||||
//X P_D(const Effect);
|
||||
//X return d->type;
|
||||
//X }
|
||||
//X
|
||||
EffectDescription Effect::description() const
|
||||
{
|
||||
P_D(const Effect);
|
||||
return d->description;
|
||||
}
|
||||
|
||||
QList<EffectParameter> Effect::parameters() const
|
||||
{
|
||||
P_D(const Effect);
|
||||
// there should be an iface object, but better be safe for those backend
|
||||
// switching corner-cases: when the backend switches the new backend might
|
||||
// not support this effect -> no iface object
|
||||
if (d->m_backendObject) {
|
||||
return INTERFACE_CALL(parameters());
|
||||
}
|
||||
return QList<EffectParameter>();
|
||||
}
|
||||
|
||||
QVariant Effect::parameterValue(const EffectParameter ¶m) const
|
||||
{
|
||||
P_D(const Effect);
|
||||
if (!d->m_backendObject) {
|
||||
return d->parameterValues[param];
|
||||
}
|
||||
return INTERFACE_CALL(parameterValue(param));
|
||||
}
|
||||
|
||||
void Effect::setParameterValue(const EffectParameter ¶m, const QVariant &newValue)
|
||||
{
|
||||
P_D(Effect);
|
||||
d->parameterValues[param] = newValue;
|
||||
if (d->backendObject()) {
|
||||
INTERFACE_CALL(setParameterValue(param, newValue));
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
if (m_backendObject) {
|
||||
const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
|
||||
for (int i = 0; i < parameters.count(); ++i) {
|
||||
const EffectParameter &p = parameters.at(i);
|
||||
parameterValues[p] = pINTERFACE_CALL(parameterValue(p));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectPrivate::setupBackendObject()
|
||||
{
|
||||
Q_ASSERT(m_backendObject);
|
||||
|
||||
// set up attributes
|
||||
const QList<EffectParameter> parameters = pINTERFACE_CALL(parameters());
|
||||
for (int i = 0; i < parameters.count(); ++i) {
|
||||
const EffectParameter &p = parameters.at(i);
|
||||
pINTERFACE_CALL(setParameterValue(p, parameterValues[p]));
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
#include "moc_effect.cpp"
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#include "moc_effect.h"
|
|
@ -1,115 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PHONON_EFFECT_H
|
||||
#define PHONON_EFFECT_H
|
||||
|
||||
#include "phonondefs.h"
|
||||
#include <QtCore/QObject>
|
||||
#include "objectdescription.h"
|
||||
#include "medianode.h"
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
class QString;
|
||||
template<class T> class QList;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class EffectParameter;
|
||||
class EffectPrivate;
|
||||
|
||||
/** \class Effect effect.h phonon/Effect
|
||||
* \short Effects that can be inserted into a Path.
|
||||
* An effect is a special object which can perform
|
||||
* transformations on the specified path. Examples may include simple
|
||||
* modifiers such as fading or pitch shifting, or more complex mathematical
|
||||
* transformations.
|
||||
*
|
||||
* In order to use an effect, insert it into the path as follows:
|
||||
* \code
|
||||
* Path path = Phonon::createPath(...);
|
||||
* Effect *effect = new Effect(this);
|
||||
* path.insertEffect(effect);
|
||||
* \endcode
|
||||
*
|
||||
* The effect will immediately begin applying it's transformations on
|
||||
* the path. To stop it, remove the Effect from the path.
|
||||
*
|
||||
* \ingroup PhononEffects
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONON_EXPORT Effect : public QObject, public MediaNode
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(Effect)
|
||||
|
||||
public:
|
||||
~Effect();
|
||||
|
||||
//X enum Type {
|
||||
//X AudioEffect,
|
||||
//X VideoEffect
|
||||
//X };
|
||||
|
||||
/**
|
||||
* QObject constructor.
|
||||
*
|
||||
* \param description An EffectDescription object to determine the
|
||||
* type of effect. See BackendCapabilities::availableAudioEffects().
|
||||
* \param parent QObject parent
|
||||
*/
|
||||
explicit Effect(const EffectDescription &description, QObject *parent = 0);
|
||||
|
||||
//X Type type() const;
|
||||
|
||||
/**
|
||||
* Returns the description of this effect. This is the same type as was
|
||||
* passed to the constructor.
|
||||
*/
|
||||
EffectDescription description() const;
|
||||
|
||||
/**
|
||||
* Returns a list of parameters that this effect provides to control
|
||||
* its behaviour.
|
||||
*
|
||||
* \see EffectParameter
|
||||
* \see EffectWidget
|
||||
*/
|
||||
QList<EffectParameter> parameters() const;
|
||||
|
||||
QVariant parameterValue(const EffectParameter&) const;
|
||||
void setParameterValue(const EffectParameter&, const QVariant &value);
|
||||
|
||||
protected:
|
||||
Effect(EffectPrivate &dd, QObject *parent);
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif // QT_NO_EFFECT
|
||||
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#endif // PHONON_EFFECT_H
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EFFECT_P_H
|
||||
#define EFFECT_P_H
|
||||
|
||||
#include "effect.h"
|
||||
#include "effectparameter.h"
|
||||
#include "medianode_p.h"
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QVariant>
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class EffectPrivate : public MediaNodePrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(Effect)
|
||||
PHONON_PRIVATECLASS
|
||||
public:
|
||||
virtual QObject *qObject() { return q_func(); }
|
||||
protected:
|
||||
EffectPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
//X Effect::Type type;
|
||||
EffectDescription description;
|
||||
QHash<EffectParameter, QVariant> parameterValues;
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
#endif // EFFECT_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,64 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EFFECTINTERFACE_H
|
||||
#define PHONON_EFFECTINTERFACE_H
|
||||
|
||||
#include "phononnamespace.h"
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class EffectParameter;
|
||||
/** \class EffectInterface effectinterface.h phonon/EffectInterface
|
||||
* \short Interface for Effect objects
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class EffectInterface
|
||||
{
|
||||
public:
|
||||
virtual ~EffectInterface() {}
|
||||
/**
|
||||
* Returns the EffectParameter objects to describe the parameters of this effect.
|
||||
*/
|
||||
virtual QList<EffectParameter> parameters() const = 0;
|
||||
/**
|
||||
* Returns the value for the selected parameter.
|
||||
*/
|
||||
virtual QVariant parameterValue(const EffectParameter &) const = 0;
|
||||
/**
|
||||
* Sets the value for the selected parameter.
|
||||
*/
|
||||
virtual void setParameterValue(const EffectParameter &, const QVariant &newValue) = 0;
|
||||
};
|
||||
} //namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::EffectInterface, "EffectInterface0.phonon.kde.org")
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
|
||||
#endif // PHONON_EFFECTINTERFACE_H
|
|
@ -1,138 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "effectparameter.h"
|
||||
#include "effectparameter_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
uint qHash(const Phonon::EffectParameter ¶m)
|
||||
{
|
||||
return param.id();
|
||||
}
|
||||
|
||||
EffectParameter::EffectParameter()
|
||||
: d(new EffectParameterPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
EffectParameter::EffectParameter(int parameterId, const QString &name, Hints hints,
|
||||
const QVariant &defaultValue, const QVariant &min, const QVariant &max,
|
||||
const QVariantList &values, const QString &description)
|
||||
: d(new EffectParameterPrivate)
|
||||
{
|
||||
d->parameterId = parameterId;
|
||||
d->min = min;
|
||||
d->max = max;
|
||||
d->defaultValue = defaultValue;
|
||||
d->name = name;
|
||||
d->possibleValues = values;
|
||||
d->description = description;
|
||||
d->hints = hints;
|
||||
}
|
||||
|
||||
EffectParameter::~EffectParameter()
|
||||
{
|
||||
}
|
||||
|
||||
EffectParameter::EffectParameter(const EffectParameter &rhs)
|
||||
: d(rhs.d)
|
||||
{
|
||||
}
|
||||
|
||||
EffectParameter &EffectParameter::operator=(const EffectParameter &rhs)
|
||||
{
|
||||
d = rhs.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool EffectParameter::operator<(const EffectParameter &rhs) const
|
||||
{
|
||||
return d->parameterId < rhs.d->parameterId;
|
||||
}
|
||||
|
||||
bool EffectParameter::operator==(const EffectParameter &rhs) const
|
||||
{
|
||||
return d->parameterId == rhs.d->parameterId;
|
||||
}
|
||||
|
||||
bool EffectParameter::operator>(const EffectParameter &rhs) const
|
||||
{
|
||||
return d->parameterId > rhs.d->parameterId;
|
||||
}
|
||||
|
||||
const QString &EffectParameter::name() const
|
||||
{
|
||||
return d->name;
|
||||
}
|
||||
|
||||
const QString &EffectParameter::description() const
|
||||
{
|
||||
return d->description;
|
||||
}
|
||||
|
||||
bool EffectParameter::isLogarithmicControl() const
|
||||
{
|
||||
return d->hints & LogarithmicHint;
|
||||
}
|
||||
|
||||
QVariant::Type EffectParameter::type() const
|
||||
{
|
||||
if (d->possibleValues.isEmpty()) {
|
||||
return d->defaultValue.type();
|
||||
}
|
||||
return QVariant::String;
|
||||
}
|
||||
|
||||
QVariantList EffectParameter::possibleValues() const
|
||||
{
|
||||
return d->possibleValues;
|
||||
}
|
||||
|
||||
QVariant EffectParameter::minimumValue() const
|
||||
{
|
||||
return d->min;
|
||||
}
|
||||
|
||||
QVariant EffectParameter::maximumValue() const
|
||||
{
|
||||
return d->max;
|
||||
}
|
||||
|
||||
QVariant EffectParameter::defaultValue() const
|
||||
{
|
||||
return d->defaultValue;
|
||||
}
|
||||
|
||||
int EffectParameter::id() const
|
||||
{
|
||||
return d->parameterId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
// vim: sw=4 ts=4
|
|
@ -1,233 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EFFECTPARAMETER_H
|
||||
#define PHONON_EFFECTPARAMETER_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class Effect;
|
||||
class EffectParameterPrivate;
|
||||
|
||||
/** \class EffectParameter effectparameter.h phonon/EffectParameter
|
||||
* \brief This class describes one parameter of an effect.
|
||||
*
|
||||
* \ingroup PhononEffects
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
* \see Effect
|
||||
*/
|
||||
class PHONON_EXPORT EffectParameter
|
||||
{
|
||||
friend class BrightnessControl;
|
||||
public:
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Creates an invalid effect parameter.
|
||||
*/
|
||||
EffectParameter();
|
||||
|
||||
/**
|
||||
* The name of the parameter. Can be used as the label.
|
||||
*
|
||||
* \return A label for the parameter.
|
||||
*/
|
||||
const QString &name() const;
|
||||
|
||||
/**
|
||||
* The parameter may come with a description (LADSPA doesn't have a
|
||||
* field for this, so don't expect many effects to provide a
|
||||
* description).
|
||||
*
|
||||
* The description can be used for a tooltip or WhatsThis help.
|
||||
*
|
||||
* \return A text describing the parameter.
|
||||
*/
|
||||
const QString &description() const;
|
||||
|
||||
/**
|
||||
* Returns the parameter type.
|
||||
*
|
||||
* Common types are QVariant::Int, QVariant::Double, QVariant::Bool and QVariant::String. When
|
||||
* QVariant::String is returned you get the possible values from possibleValues.
|
||||
*/
|
||||
QVariant::Type type() const;
|
||||
|
||||
/**
|
||||
* Returns whether the parameter should be
|
||||
* displayed using a logarithmic scale. This is particularly useful for
|
||||
* frequencies and gains.
|
||||
*/
|
||||
bool isLogarithmicControl() const;
|
||||
|
||||
/**
|
||||
* The minimum value to be used for the control to edit the parameter.
|
||||
*
|
||||
* If the returned QVariant is invalid the value is not bounded from
|
||||
* below.
|
||||
*/
|
||||
QVariant minimumValue() const;
|
||||
|
||||
/**
|
||||
* The maximum value to be used for the control to edit the parameter.
|
||||
*
|
||||
* If the returned QVariant is invalid the value is not bounded from
|
||||
* above.
|
||||
*/
|
||||
QVariant maximumValue() const;
|
||||
|
||||
/**
|
||||
* The default value.
|
||||
*/
|
||||
QVariant defaultValue() const;
|
||||
|
||||
/**
|
||||
* The possible values to be used for the control to edit the parameter.
|
||||
*
|
||||
* if the value of this parameter is to be picked from predefined values
|
||||
* this returns the list (otherwise it returns an empty QVariantList).
|
||||
*/
|
||||
QVariantList possibleValues() const;
|
||||
|
||||
/**
|
||||
* \internal
|
||||
* compares the ids of the parameters
|
||||
*/
|
||||
bool operator<(const EffectParameter &rhs) const;
|
||||
|
||||
/**
|
||||
* \internal
|
||||
* compares the ids of the parameters
|
||||
*/
|
||||
bool operator>(const EffectParameter &rhs) const;
|
||||
|
||||
/**
|
||||
* \internal
|
||||
* compares the ids of the parameters
|
||||
*/
|
||||
bool operator==(const EffectParameter &rhs) const;
|
||||
|
||||
/* dtor, cctor and operator= for forward decl of EffectParameterPrivate */
|
||||
~EffectParameter();
|
||||
EffectParameter(const EffectParameter &rhs);
|
||||
EffectParameter &operator=(const EffectParameter &rhs);
|
||||
|
||||
/**
|
||||
* Only for backend developers:
|
||||
*
|
||||
* Flags to set the return values of isToggleControl(),
|
||||
* isLogarithmicControl(), isIntegerControl(), isBoundedBelow() and
|
||||
* isBoundedAbove(). The values of the flags correspond to the values
|
||||
* used for LADSPA effects.
|
||||
*/
|
||||
enum Hint {
|
||||
/**
|
||||
* If this hint is set it means that
|
||||
* the control has only two states: zero and non-zero.
|
||||
*
|
||||
* \see isToggleControl()
|
||||
*/
|
||||
ToggledHint = 0x04,
|
||||
|
||||
/* LADSPA's SAMPLE_RATE hint needs to be translated by the backend
|
||||
* to normal bounds, as the backend knows the sample rate - and the
|
||||
* frontend doesn't */
|
||||
|
||||
/**
|
||||
* \see isLogarithmicControl()
|
||||
*/
|
||||
LogarithmicHint = 0x10,
|
||||
/**
|
||||
* \see isIntegerControl
|
||||
*/
|
||||
IntegerHint = 0x20
|
||||
};
|
||||
Q_DECLARE_FLAGS(Hints, Hint)
|
||||
|
||||
/**
|
||||
* Only to be used by backend implementations:
|
||||
*
|
||||
* Creates a new effect parameter.
|
||||
*
|
||||
* \param parameterId This is a number to uniquely identify the
|
||||
* parameter. The id is used for value() and setValue().
|
||||
*
|
||||
* \param name The name/label for this parameter.
|
||||
*
|
||||
* \param hints Sets the hints for the type of parameter.
|
||||
*
|
||||
* \param defaultValue The value that should be used as a default.
|
||||
*
|
||||
* \param min The minimum value allowed for this parameter. You only
|
||||
* need to set this if the BoundedBelowHint is set.
|
||||
*
|
||||
* \param max The maximum value allowed for this parameter. You only
|
||||
* need to set this if the BoundedAboveHint is set.
|
||||
*
|
||||
* \param description A descriptive text for the parameter
|
||||
* (explaining what it controls) to be used as a tooltip or
|
||||
* WhatsThis help.
|
||||
*/
|
||||
EffectParameter(int parameterId, const QString &name, Hints hints,
|
||||
const QVariant &defaultValue, const QVariant &min = QVariant(),
|
||||
const QVariant &max = QVariant(), const QVariantList &values = QVariantList(),
|
||||
const QString &description = QString());
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Returns the parameter's id.
|
||||
*/
|
||||
int id() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The data is implicitly shared.
|
||||
*/
|
||||
QExplicitlySharedDataPointer<EffectParameterPrivate> d;
|
||||
};
|
||||
|
||||
uint PHONON_EXPORT qHash(const Phonon::EffectParameter ¶m);
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
|
||||
//this ensures that code outside Phonon can use the hash function
|
||||
//it also a workaround for some compilers
|
||||
inline uint qHash(const Phonon::EffectParameter ¶m) { return Phonon::qHash(param); } //krazy:exclude=inline
|
||||
#endif
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Phonon::EffectParameter::Hints)
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
|
||||
#endif // PHONON_EFFECTPARAMETER_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,52 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EFFECTPARAMETER_P_H
|
||||
#define EFFECTPARAMETER_P_H
|
||||
|
||||
#include "effectparameter.h"
|
||||
#include <QtCore/QSharedData>
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECT
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class EffectParameterPrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
int parameterId;
|
||||
QVariant min;
|
||||
QVariant max;
|
||||
QVariant defaultValue;
|
||||
QString name;
|
||||
QString description;
|
||||
QVariantList possibleValues;
|
||||
EffectParameter::Hints hints;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECT
|
||||
|
||||
#endif // EFFECTPARAMETER_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,256 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "effectwidget.h"
|
||||
#include "effectwidget_p.h"
|
||||
|
||||
#include <QtCore/qalgorithms.h>
|
||||
#include <QtCore/QList>
|
||||
|
||||
#include "effect.h"
|
||||
#include "effectparameter.h"
|
||||
#include "phonondefs_p.h"
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QSlider>
|
||||
#include <limits>
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
static const qreal DEFAULT_MIN = std::numeric_limits<qreal>::min();
|
||||
static const qreal DEFAULT_MAX = std::numeric_limits<qreal>::max();
|
||||
static const int DEFAULT_MIN_INT = std::numeric_limits<int>::min();
|
||||
static const int DEFAULT_MAX_INT = std::numeric_limits<int>::max();
|
||||
static const int SLIDER_RANGE = 8;
|
||||
static const int TICKINTERVAL = 4;
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
EffectWidget::EffectWidget(Effect *effect, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
k_ptr(new EffectWidgetPrivate(effect))
|
||||
{
|
||||
P_D(EffectWidget);
|
||||
d->q_ptr = this;
|
||||
d->autogenerateUi();
|
||||
}
|
||||
|
||||
EffectWidget::~EffectWidget()
|
||||
{
|
||||
delete k_ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
EffectWidget::EffectWidget(EffectWidgetPrivate &dd, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, k_ptr(&dd)
|
||||
{
|
||||
P_D(EffectWidget);
|
||||
d->q_ptr = this;
|
||||
d->autogenerateUi();
|
||||
}
|
||||
*/
|
||||
|
||||
EffectWidgetPrivate::EffectWidgetPrivate(Effect *e)
|
||||
: effect(e)
|
||||
{
|
||||
//TODO: look up whether there is a specialized widget for this effect. This
|
||||
//could be a DSO or a Designer ui file found via KTrader.
|
||||
//
|
||||
//if no specialized widget is available:
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::autogenerateUi()
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(q);
|
||||
mainLayout->setMargin(0);
|
||||
const QList<Phonon::EffectParameter> parameters = effect->parameters();
|
||||
for (int i = 0; i < parameters.count(); ++i) {
|
||||
const EffectParameter ¶ = parameters.at(i);
|
||||
QVariant value = effect->parameterValue(para);
|
||||
QHBoxLayout *pLayout = new QHBoxLayout;
|
||||
mainLayout->addLayout(pLayout);
|
||||
|
||||
QLabel *label = new QLabel(q);
|
||||
pLayout->addWidget(label);
|
||||
label->setText(para.name());
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
label->setToolTip(para.description());
|
||||
#endif
|
||||
|
||||
QWidget *control = 0;
|
||||
switch (int(para.type())) {
|
||||
case QVariant::String:
|
||||
{
|
||||
QComboBox *cb = new QComboBox(q);
|
||||
control = cb;
|
||||
if (value.type() == QVariant::Int) {
|
||||
//value just defines the item index
|
||||
for (int i = 0; i < para.possibleValues().count(); ++i) {
|
||||
cb->addItem(para.possibleValues().at(i).toString());
|
||||
}
|
||||
cb->setCurrentIndex(value.toInt());
|
||||
QObject::connect(cb, SIGNAL(currentIndexChanged(int)), q, SLOT(_k_setIntParameter(int)));
|
||||
} else {
|
||||
for (int i = 0; i < para.possibleValues().count(); ++i) {
|
||||
const QVariant &item = para.possibleValues().at(i);
|
||||
cb->addItem(item.toString());
|
||||
if (item == value) {
|
||||
cb->setCurrentIndex(cb->count() - 1);
|
||||
}
|
||||
}
|
||||
QObject::connect(cb, SIGNAL(currentIndexChanged(QString)), q, SLOT(_k_setStringParameter(QString)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
{
|
||||
QCheckBox *cb = new QCheckBox(q);
|
||||
control = cb;
|
||||
cb->setChecked(value.toBool());
|
||||
QObject::connect(cb, SIGNAL(toggled(bool)), q, SLOT(_k_setToggleParameter(bool)));
|
||||
}
|
||||
break;
|
||||
case QVariant::Int:
|
||||
{
|
||||
QSpinBox *sb = new QSpinBox(q);
|
||||
control = sb;
|
||||
bool minValueOk = false;
|
||||
bool maxValueOk = false;
|
||||
const int minValue = para.minimumValue().toInt(&minValueOk);
|
||||
const int maxValue = para.maximumValue().toInt(&maxValueOk);
|
||||
|
||||
sb->setRange(minValueOk ? minValue : DEFAULT_MIN_INT, maxValueOk ? maxValue : DEFAULT_MAX_INT);
|
||||
sb->setValue(value.toInt());
|
||||
QObject::connect(sb, SIGNAL(valueChanged(int)), q, SLOT(_k_setIntParameter(int)));
|
||||
}
|
||||
break;
|
||||
case QMetaType::Float:
|
||||
case QVariant::Double:
|
||||
{
|
||||
const qreal minValue = para.minimumValue().canConvert(QVariant::Double) ?
|
||||
para.minimumValue().toReal() : DEFAULT_MIN;
|
||||
const qreal maxValue = para.maximumValue().canConvert(QVariant::Double) ?
|
||||
para.maximumValue().toReal() : DEFAULT_MAX;
|
||||
|
||||
if (minValue == -1. && maxValue == 1.) {
|
||||
//Special case values between -1 and 1.0 to use a slider for improved usability
|
||||
QSlider *slider = new QSlider(Qt::Horizontal, q);
|
||||
control = slider;
|
||||
slider->setRange(-SLIDER_RANGE, +SLIDER_RANGE);
|
||||
slider->setValue(int(SLIDER_RANGE * value.toReal()));
|
||||
slider->setTickPosition(QSlider::TicksBelow);
|
||||
slider->setTickInterval(TICKINTERVAL);
|
||||
QObject::connect(slider, SIGNAL(valueChanged(int)), q, SLOT(_k_setSliderParameter(int)));
|
||||
} else {
|
||||
double step = 0.1;
|
||||
if (qAbs(maxValue - minValue) > 50)
|
||||
step = 1.0;
|
||||
QDoubleSpinBox *sb = new QDoubleSpinBox(q);
|
||||
control = sb;
|
||||
sb->setRange(minValue, maxValue);
|
||||
sb->setValue(value.toDouble());
|
||||
sb->setSingleStep(step);
|
||||
QObject::connect(sb, SIGNAL(valueChanged(double)), q,
|
||||
SLOT(_k_setDoubleParameter(double)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (control) {
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
control->setToolTip(para.description());
|
||||
#endif
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
label->setBuddy(control);
|
||||
#endif
|
||||
pLayout->addWidget(control);
|
||||
parameterForObject.insert(control, para);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::_k_setToggleParameter(bool checked)
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
if (parameterForObject.contains(q->sender())) {
|
||||
effect->setParameterValue(parameterForObject[q->sender()], checked);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::_k_setIntParameter(int value)
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
if (parameterForObject.contains(q->sender())) {
|
||||
effect->setParameterValue(parameterForObject[q->sender()], value);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::_k_setDoubleParameter(double value)
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
if (parameterForObject.contains(q->sender())) {
|
||||
effect->setParameterValue(parameterForObject[q->sender()], value);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::_k_setStringParameter(const QString &value)
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
if (parameterForObject.contains(q->sender())) {
|
||||
effect->setParameterValue(parameterForObject[q->sender()], value);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectWidgetPrivate::_k_setSliderParameter(int value)
|
||||
{
|
||||
P_Q(EffectWidget);
|
||||
if (parameterForObject.contains(q->sender())) {
|
||||
effect->setParameterValue(parameterForObject[q->sender()], double(value) / double(SLIDER_RANGE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
#include "moc_effectwidget.cpp"
|
||||
|
||||
// vim: sw=4 ts=4
|
||||
#include "moc_effectwidget.h"
|
|
@ -1,72 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_UI_EFFECTWIDGET_H
|
||||
#define PHONON_UI_EFFECTWIDGET_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "phonondefs.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class Effect;
|
||||
|
||||
class EffectWidgetPrivate;
|
||||
|
||||
/** \class EffectWidget effectwidget.h phonon/EffectWidget
|
||||
* \brief Widget to control the parameters of an Effect.
|
||||
*
|
||||
* \ingroup PhononWidgets
|
||||
* \ingroup PhononEffects
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONON_EXPORT EffectWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(EffectWidget)
|
||||
public:
|
||||
explicit EffectWidget(Effect *effect, QWidget *parent = 0);
|
||||
~EffectWidget();
|
||||
|
||||
protected:
|
||||
//EffectWidget(EffectWidgetPrivate &dd, QWidget *parent);
|
||||
EffectWidgetPrivate *const k_ptr;
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_setToggleParameter(bool checked))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_setIntParameter(int value))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_setDoubleParameter(double value))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_setStringParameter(const QString &))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_setSliderParameter(int))
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
|
||||
#endif // PHONON_UI_EFFECTWIDGET_H
|
||||
|
||||
// vim: sw=4 ts=4 tw=100
|
|
@ -1,62 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_UI_EFFECTWIDGET_P_H
|
||||
#define PHONON_UI_EFFECTWIDGET_P_H
|
||||
|
||||
#include <QtCore/QHash>
|
||||
|
||||
#include "effectparameter.h"
|
||||
#include "effectwidget.h"
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
#ifndef QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class EffectWidgetPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(EffectWidget)
|
||||
protected:
|
||||
EffectWidgetPrivate(Effect *effect);
|
||||
|
||||
EffectWidget *q_ptr;
|
||||
|
||||
private:
|
||||
Effect *effect;
|
||||
QHash<QObject *, EffectParameter> parameterForObject;
|
||||
|
||||
void _k_setToggleParameter(bool checked);
|
||||
void _k_setIntParameter(int value);
|
||||
void _k_setDoubleParameter(double value);
|
||||
void _k_setStringParameter(const QString &);
|
||||
void _k_setSliderParameter(int);
|
||||
|
||||
void autogenerateUi();
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
#endif //QT_NO_PHONON_EFFECTWIDGET
|
||||
|
||||
#endif // PHONON_UI_EFFECTWIDGET_P_H
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,113 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "abstractaudiodataoutput.h"
|
||||
#include "abstractaudiodataoutput_p.h"
|
||||
#include "audiodataoutputinterface.h"
|
||||
#include "factory_p.h"
|
||||
#include "../phonondefs_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
AbstractAudioDataOutput::AbstractAudioDataOutput()
|
||||
: MediaNode(*new AbstractAudioDataOutputPrivate)
|
||||
{
|
||||
P_D(AbstractAudioDataOutput);
|
||||
d->isRunning = false;
|
||||
d->allowedFormats << AudioFormat();
|
||||
}
|
||||
|
||||
AbstractAudioDataOutput::~AbstractAudioDataOutput()
|
||||
{
|
||||
setRunning(false);
|
||||
}
|
||||
|
||||
QSet<AudioFormat> AbstractAudioDataOutput::allowedFormats() const
|
||||
{
|
||||
P_D(const AbstractAudioDataOutput);
|
||||
return d->allowedFormats;
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutput::setAllowedFormats(const QSet<AudioFormat> &allowedFormats)
|
||||
{
|
||||
P_D(AbstractAudioDataOutput);
|
||||
d->allowedFormats = allowedFormats;
|
||||
}
|
||||
|
||||
bool AbstractAudioDataOutput::isRunning() const
|
||||
{
|
||||
P_D(const AbstractAudioDataOutput);
|
||||
return d->isRunning;
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutput::setRunning(bool running)
|
||||
{
|
||||
P_D(AbstractAudioDataOutput);
|
||||
Iface<AudioDataOutputInterface> iface(d);
|
||||
if (iface) {
|
||||
if (running) {
|
||||
iface->setFrontendObject(this);
|
||||
} else {
|
||||
iface->setFrontendObject(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutput::start()
|
||||
{
|
||||
setRunning(true);
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutput::stop()
|
||||
{
|
||||
setRunning(false);
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutputPrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AbstractAudioDataOutput);
|
||||
Q_ASSERT(m_backendObject);
|
||||
//AbstractAudioOutputPrivate::setupBackendObject();
|
||||
if (isRunning) {
|
||||
Iface<AudioDataOutputInterface> iface(this);
|
||||
if (iface) {
|
||||
iface->setFrontendObject(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractAudioDataOutputPrivate::createBackendObject()
|
||||
{
|
||||
if (m_backendObject)
|
||||
return;
|
||||
//P_Q(AbstractAudioDataOutput);
|
||||
m_backendObject = Factory::createAudioDataOutput(0);
|
||||
if (m_backendObject) {
|
||||
setupBackendObject();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,100 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006,2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_X_ABSTRACTAUDIODATAOUTPUT_H
|
||||
#define PHONON_X_ABSTRACTAUDIODATAOUTPUT_H
|
||||
|
||||
#include "export.h"
|
||||
#include "../medianode.h"
|
||||
#include "../phonondefs.h"
|
||||
#include "audioformat.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template<typename T> class QSet;
|
||||
#endif
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class Packet;
|
||||
class AbstractAudioDataOutputPrivate;
|
||||
|
||||
/**
|
||||
* \short This class gives you the audio data.
|
||||
*
|
||||
* This class implements a special AbstractAudioOutput that gives your
|
||||
* application the audio data. This class is usable for realtime performance.
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT AbstractAudioDataOutput : public Phonon::MediaNode
|
||||
{
|
||||
P_DECLARE_PRIVATE(AbstractAudioDataOutput)
|
||||
public:
|
||||
/**
|
||||
* Constructs an AbstractAudioDataOutput
|
||||
*/
|
||||
AbstractAudioDataOutput();
|
||||
~AbstractAudioDataOutput();
|
||||
|
||||
/**
|
||||
* Lists the formats this output is allowed to pass via frameReady.
|
||||
*/
|
||||
virtual QSet<AudioFormat> allowedFormats() const;
|
||||
|
||||
// TODO: consider to remove the following function and make the above pure virtual
|
||||
/**
|
||||
* Defaults to AudioFormat().
|
||||
* I.e. 16 bit, stereo, 48000 kHz PCM data.
|
||||
*/
|
||||
void setAllowedFormats(const QSet<AudioFormat> &);
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
/**
|
||||
* This function is called whenever an audio packet is ready for
|
||||
* processing.
|
||||
*
|
||||
* \warning packetReady can get called from any thread (other than the
|
||||
* main thread or the thread affinity of this QObject).
|
||||
*/
|
||||
virtual void packetReady(const Packet &) = 0;
|
||||
|
||||
/**
|
||||
* This function is called after the last packetReady of a media was
|
||||
* called.
|
||||
*/
|
||||
void endOfMedia();
|
||||
|
||||
void setRunning(bool running);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
AbstractAudioDataOutput(AbstractAudioDataOutputPrivate &dd);
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_X_ABSTRACTAUDIODATAOUTPUT_H
|
|
@ -1,51 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H
|
||||
#define PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H
|
||||
|
||||
#include "abstractaudiodataoutput.h"
|
||||
#include "../medianode_p.h"
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AbstractAudioDataOutputPrivate : public Phonon::MediaNodePrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AbstractAudioDataOutput)
|
||||
protected:
|
||||
virtual bool aboutToDeleteBackendObject() { return true; }
|
||||
virtual void createBackendObject();
|
||||
void setupBackendObject();
|
||||
|
||||
private:
|
||||
bool isRunning;
|
||||
QSet<AudioFormat> allowedFormats;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_X_ABSTRACTAUDIODATAOUTPUT_P_H
|
|
@ -1,188 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "abstractmediastream2.h"
|
||||
#include "abstractmediastream2_p.h"
|
||||
#include "mediaobjectinterface.h"
|
||||
#include "mediaobject_p.h"
|
||||
#include "phononnamespace_p.h"
|
||||
|
||||
#include <QtCore/QAbstractEventDispatcher>
|
||||
#include <QtCore/QEvent>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
bool AbstractMediaStream2::event(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::ThreadChange) {
|
||||
Q_D(AbstractMediaStream2);
|
||||
if (d->eventDispatcher) {
|
||||
pWarning() << "Do not call moveToThread on an AbstractMediaStream2 object when it is in use.";
|
||||
QObject::disconnect(d->eventDispatcher, SIGNAL(awake()), this, SLOT(_k_handleStreamEvent()));
|
||||
d->eventDispatcher = 0;
|
||||
}
|
||||
}
|
||||
return AbstractMediaStream::event(e);
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::dataReady()
|
||||
{
|
||||
Q_Q(AbstractMediaStream2);
|
||||
if (!eventDispatcher) {
|
||||
eventDispatcher = QAbstractEventDispatcher::instance(q->thread());
|
||||
if (!eventDispatcher) {
|
||||
pError() << "AbstractMediaStream2 needs to run in a thread with QEventLoop";
|
||||
return;
|
||||
} else {
|
||||
QObject::connect(eventDispatcher, SIGNAL(awake()), q, SLOT(_k_handleStreamEvent()), Qt::DirectConnection);
|
||||
}
|
||||
}
|
||||
eventDispatcher->wakeUp();
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::_k_handleStreamEvent()
|
||||
{
|
||||
Q_ASSERT(streamEventQueue);
|
||||
Q_Q(AbstractMediaStream2);
|
||||
StreamEventQueue::Command c;
|
||||
while (streamEventQueue->nextCommandForFrontend(&c)) {
|
||||
switch (c.command) {
|
||||
case StreamEventQueue::SetStreamSize:
|
||||
case StreamEventQueue::SetSeekable:
|
||||
case StreamEventQueue::Write:
|
||||
case StreamEventQueue::EndOfData:
|
||||
case StreamEventQueue::SeekDone:
|
||||
case StreamEventQueue::ResetDone:
|
||||
case StreamEventQueue::ConnectDone:
|
||||
pFatal("AbstractMediaStream2 received wrong Command");
|
||||
break;
|
||||
case StreamEventQueue::NeedData:
|
||||
q->needData(qvariant_cast<quint32>(c.data));
|
||||
break;
|
||||
case StreamEventQueue::EnoughData:
|
||||
q->enoughData();
|
||||
break;
|
||||
case StreamEventQueue::Seek:
|
||||
q->seekStream(qvariant_cast<quint64>(c.data));
|
||||
break;
|
||||
case StreamEventQueue::Reset:
|
||||
q->reset();
|
||||
break;
|
||||
case StreamEventQueue::Connect:
|
||||
if (firstConnect) {
|
||||
firstConnect = false;
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::ConnectDone);
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::SetSeekable, streamSeekable);
|
||||
if (streamSize != 0) {
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::SetStreamSize, streamSize);
|
||||
}
|
||||
} else {
|
||||
++connectReset;
|
||||
q->reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AbstractMediaStream2::AbstractMediaStream2(QObject *parent)
|
||||
: AbstractMediaStream(*new AbstractMediaStream2Private, parent)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractMediaStream2::AbstractMediaStream2(AbstractMediaStream2Private &dd, QObject *parent)
|
||||
: AbstractMediaStream(dd, parent)
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::setStreamSize(qint64 newSize)
|
||||
{
|
||||
streamSize = newSize;
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::SetStreamSize, newSize);
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::setStreamSeekable(bool s)
|
||||
{
|
||||
streamSeekable = s;
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::SetSeekable, s);
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::writeData(const QByteArray &data)
|
||||
{
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::Write, data);
|
||||
}
|
||||
|
||||
void AbstractMediaStream2Private::endOfData()
|
||||
{
|
||||
streamEventQueue->sendToBackend(StreamEventQueue::EndOfData);
|
||||
}
|
||||
|
||||
void AbstractMediaStream2::resetDone()
|
||||
{
|
||||
Q_D(AbstractMediaStream2);
|
||||
if (d->connectReset > 0) {
|
||||
--d->connectReset;
|
||||
d->streamEventQueue->sendToBackend(StreamEventQueue::ConnectDone);
|
||||
} else {
|
||||
d->streamEventQueue->sendToBackend(StreamEventQueue::ResetDone);
|
||||
}
|
||||
d->streamEventQueue->sendToBackend(StreamEventQueue::SetSeekable, d->streamSeekable);
|
||||
if (d->streamSize != 0) {
|
||||
d->streamEventQueue->sendToBackend(StreamEventQueue::SetStreamSize, d->streamSize);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMediaStream2::seekStreamDone()
|
||||
{
|
||||
d_func()->streamEventQueue->sendToBackend(StreamEventQueue::SeekDone);
|
||||
}
|
||||
|
||||
AbstractMediaStream2Private::AbstractMediaStream2Private()
|
||||
: streamEventQueue(new StreamEventQueue),
|
||||
eventDispatcher(0),
|
||||
connectReset(0),
|
||||
firstConnect(true)
|
||||
{
|
||||
streamEventQueue->ref();
|
||||
streamEventQueue->setFrontendCommandHandler(this);
|
||||
}
|
||||
|
||||
AbstractMediaStream2Private::~AbstractMediaStream2Private()
|
||||
{
|
||||
// setFrontendCommandHandler blocks internally until a handler that might be called right now is
|
||||
// done. That means AbstractMediaStream2Private::dataReady will either not run again or it will
|
||||
// be done before this object and our q object are deleted.
|
||||
streamEventQueue->setFrontendCommandHandler(0);
|
||||
streamEventQueue->deref();
|
||||
streamEventQueue = 0;
|
||||
// if eventDispatcher->wakeUp() was called and we are now still connected to its awake() signal
|
||||
// then the QObject will be deleted until execution reaches the event loop again and
|
||||
// _k_handleStreamEvent will not get called
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#include "experimental/moc_abstractmediastream2.cpp"
|
||||
|
||||
// vim: sw=4 sts=4 et tw=100
|
||||
#include "experimental/moc_abstractmediastream2.h"
|
|
@ -1,149 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_ABSTRACTMEDIASTREAM2_H
|
||||
#define PHONON_ABSTRACTMEDIASTREAM2_H
|
||||
|
||||
#include "abstractmediastream.h"
|
||||
|
||||
|
||||
class QByteArray;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class MediaObject;
|
||||
class AbstractMediaStream2Private;
|
||||
|
||||
/** \class AbstractMediaStream2 abstractmediastream2.h phonon/AbstractMediaStream2
|
||||
* \brief Base class for custom media data streams.
|
||||
*
|
||||
* Implement this class to provide a custom data stream to the backend. The class supports both, the
|
||||
* push and the pull model.
|
||||
*
|
||||
* Push:
|
||||
* \code
|
||||
* PushStream::PushStream(QObject *parent)
|
||||
* : AbstractMediaStream2(parent), m_timer(new QTimer(this))
|
||||
* {
|
||||
* setStreamSize(getMediaStreamSize());
|
||||
*
|
||||
* connect(m_timer, SIGNAL(timeout()), SLOT(moreData()));
|
||||
* m_timer->setInterval(0);
|
||||
* }
|
||||
*
|
||||
* void PushStream::moreData()
|
||||
* {
|
||||
* const QByteArray data = getMediaData();
|
||||
* if (data.isEmpty()) {
|
||||
* endOfData();
|
||||
* } else {
|
||||
* writeData(data);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* void PushStream::needData()
|
||||
* {
|
||||
* m_timer->start();
|
||||
* moreData();
|
||||
* }
|
||||
*
|
||||
* void PushStream::enoughData()
|
||||
* {
|
||||
* m_timer->stop();
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* Pull:
|
||||
* \code
|
||||
* PullStream::PullStream(QObject *parent)
|
||||
* : AbstractMediaStream2(parent)
|
||||
* {
|
||||
* setStreamSize(getMediaStreamSize());
|
||||
* }
|
||||
*
|
||||
* void PullStream::needData()
|
||||
* {
|
||||
* const QByteArray data = getMediaData();
|
||||
* if (data.isEmpty()) {
|
||||
* endOfData();
|
||||
* } else {
|
||||
* writeData(data);
|
||||
* }
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* \ingroup Playback
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONON_EXPORT AbstractMediaStream2 : public AbstractMediaStream
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(AbstractMediaStream2)
|
||||
friend class MediaObject;
|
||||
friend class MediaObjectPrivate;
|
||||
friend class MediaSourcePrivate;
|
||||
protected:
|
||||
/////////////////////////////////////////////////////////////
|
||||
// functions an implementation will call:
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Constructs an AbstractMediaStream2 object with a \p parent.
|
||||
*/
|
||||
explicit AbstractMediaStream2(QObject *parent = 0);
|
||||
|
||||
void resetDone();
|
||||
void seekStreamDone();
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// functions to implement:
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Reimplement this function to be notified when the backend needs data.
|
||||
*
|
||||
* When this function is called you should try to call writeData or endOfData before
|
||||
* returning.
|
||||
*
|
||||
* \param size The number of bytes that are needed. If possible, pass \p size bytes of media
|
||||
* data in the next writeData call.
|
||||
*/
|
||||
virtual void needData(quint32 size) = 0;
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// internal
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
bool event(QEvent *e);
|
||||
AbstractMediaStream2(AbstractMediaStream2Private &dd, QObject *parent);
|
||||
|
||||
private:
|
||||
// hide needData() explicitly
|
||||
virtual void needData() {}
|
||||
|
||||
Q_PRIVATE_SLOT(d_func(), void _k_handleStreamEvent())
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // PHONON_ABSTRACTMEDIASTREAM2_H
|
|
@ -1,63 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ABSTRACTMEDIASTREAM2_P_H
|
||||
#define ABSTRACTMEDIASTREAM2_P_H
|
||||
|
||||
#include "phonon_export.h"
|
||||
#include "abstractmediastream2.h"
|
||||
#include "abstractmediastream_p.h"
|
||||
#include "mediaobject_p.h"
|
||||
|
||||
#include "medianodedestructionhandler_p.h"
|
||||
#include "streameventqueue_p.h"
|
||||
|
||||
class MediaObjectPrivate;
|
||||
class QAbstractEventDispatcher;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class PHONON_EXPORT AbstractMediaStream2Private : public AbstractMediaStreamPrivate, private LockFreeQueueBase::DataReadyHandler
|
||||
{
|
||||
friend class MediaObject;
|
||||
friend class MediaSourcePrivate;
|
||||
Q_DECLARE_PUBLIC(AbstractMediaStream2)
|
||||
protected:
|
||||
AbstractMediaStream2Private();
|
||||
~AbstractMediaStream2Private();
|
||||
|
||||
virtual void setStreamSize(qint64 newSize);
|
||||
virtual void setStreamSeekable(bool s);
|
||||
virtual void writeData(const QByteArray &data);
|
||||
virtual void endOfData();
|
||||
virtual void dataReady();
|
||||
void _k_handleStreamEvent();
|
||||
|
||||
StreamEventQueue *streamEventQueue;
|
||||
QAbstractEventDispatcher *eventDispatcher;
|
||||
int connectReset;
|
||||
bool firstConnect;
|
||||
};
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // ABSTRACTMEDIASTREAM2_P_H
|
||||
// vim: sw=4 sts=4 et tw=100
|
|
@ -1,122 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
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) version 3 or any later version
|
||||
accepted by the membership of KDE e.V. (or its successor approved
|
||||
by the membership of KDE e.V.), Nokia Corporation (or its successors,
|
||||
if any) and the KDE Free Qt Foundation, which shall act as a proxy
|
||||
defined in Section 14 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "abstractvideodataoutput.h"
|
||||
#include "abstractvideodataoutput_p.h"
|
||||
#include "videodataoutputinterface.h"
|
||||
#include "factory_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
AbstractVideoDataOutput::AbstractVideoDataOutput()
|
||||
: AbstractVideoOutput(*new AbstractVideoDataOutputPrivate)
|
||||
{
|
||||
P_D(AbstractVideoDataOutput);
|
||||
d->isRunning = false;
|
||||
d->allowedFormats << VideoFrame2::Format_RGB888;
|
||||
}
|
||||
|
||||
AbstractVideoDataOutput::AbstractVideoDataOutput(AbstractVideoDataOutputPrivate &dd)
|
||||
: AbstractVideoOutput(dd)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractVideoDataOutput::~AbstractVideoDataOutput()
|
||||
{
|
||||
setRunning(false);
|
||||
}
|
||||
|
||||
QSet<VideoFrame2::Format> AbstractVideoDataOutput::allowedFormats() const
|
||||
{
|
||||
P_D(const AbstractVideoDataOutput);
|
||||
return d->allowedFormats;
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutput::setAllowedFormats(const QSet<VideoFrame2::Format> &allowedFormats)
|
||||
{
|
||||
P_D(AbstractVideoDataOutput);
|
||||
d->allowedFormats = allowedFormats;
|
||||
}
|
||||
|
||||
bool AbstractVideoDataOutput::isRunning() const
|
||||
{
|
||||
P_D(const AbstractVideoDataOutput);
|
||||
return d->isRunning;
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutput::setRunning(bool running)
|
||||
{
|
||||
P_D(AbstractVideoDataOutput);
|
||||
d->isRunning = running;
|
||||
Iface<VideoDataOutputInterface> iface(d);
|
||||
if (iface) {
|
||||
if (running) {
|
||||
iface->setFrontendObject(this);
|
||||
} else {
|
||||
iface->setFrontendObject(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutput::start()
|
||||
{
|
||||
setRunning(true);
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutput::stop()
|
||||
{
|
||||
setRunning(false);
|
||||
}
|
||||
|
||||
bool AbstractVideoDataOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
return AbstractVideoOutputPrivate::aboutToDeleteBackendObject();
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutputPrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AbstractVideoDataOutput);
|
||||
Q_ASSERT(m_backendObject);
|
||||
//AbstractVideoOutputPrivate::setupBackendObject();
|
||||
if (isRunning) {
|
||||
Iface<VideoDataOutputInterface> iface(this);
|
||||
if (iface) {
|
||||
iface->setFrontendObject(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractVideoDataOutputPrivate::createBackendObject()
|
||||
{
|
||||
if (m_backendObject)
|
||||
return;
|
||||
//P_Q(AbstractVideoDataOutput);
|
||||
m_backendObject = Factory::createVideoDataOutput(0);
|
||||
if (m_backendObject) {
|
||||
setupBackendObject();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,107 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
|
||||
#define PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
|
||||
|
||||
#include "export.h"
|
||||
#include "../abstractvideooutput.h"
|
||||
#include "../phonondefs.h"
|
||||
#include <QtCore/QObject>
|
||||
#include "videoframe2.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template<typename T> class QSet;
|
||||
#endif
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AbstractVideoDataOutputPrivate;
|
||||
|
||||
/**
|
||||
* \short This class gives you the video data.
|
||||
*
|
||||
* This class implements a special AbstractVideoOutput that gives your
|
||||
* application the video data.
|
||||
*
|
||||
* You can also use the video data for further processing (e.g. encoding and
|
||||
* saving to a file).
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*
|
||||
* \see VideoDataOutput2
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT AbstractVideoDataOutput : public AbstractVideoOutput
|
||||
{
|
||||
P_DECLARE_PRIVATE(AbstractVideoDataOutput)
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs an AbstractVideoDataOutput
|
||||
*/
|
||||
AbstractVideoDataOutput();
|
||||
~AbstractVideoDataOutput();
|
||||
|
||||
/**
|
||||
* Lists the formats this output is allowed to pass via frameReady.
|
||||
*/
|
||||
virtual QSet<VideoFrame2::Format> allowedFormats() const;
|
||||
|
||||
// TODO: consider to remove the following function and make the above pure virtual
|
||||
/**
|
||||
* Defaults to VideoFrame2::Format_RGB888.
|
||||
*/
|
||||
void setAllowedFormats(const QSet<VideoFrame2::Format> &);
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
/**
|
||||
* This function is called whenever a frame should be displayed.
|
||||
*
|
||||
* \warning frameReady can get called from any thread (other than the
|
||||
* main thread or the thread affinity of this QObject). A common error to create a deadlock
|
||||
* situation is to block the thread this function is called from, until the main thread
|
||||
* has found time to handle the frame. If it is blocking while the main thread decides to
|
||||
* stop/delete the MediaObject you might get a deadlock.
|
||||
*/
|
||||
virtual void frameReady(const VideoFrame2 &) = 0;
|
||||
|
||||
/**
|
||||
* This function is called after the last frameReady of a MediaObject was called.
|
||||
*/
|
||||
virtual void endOfMedia() = 0;
|
||||
|
||||
void setRunning(bool running);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
AbstractVideoDataOutput(AbstractVideoDataOutputPrivate &dd);
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} //namespace Phonon
|
||||
|
||||
#endif // PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
|
|
@ -1,50 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H
|
||||
#define PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H
|
||||
|
||||
#include "abstractvideodataoutput.h"
|
||||
#include "../abstractvideooutput_p.h"
|
||||
#include <QtCore/QSet>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AbstractVideoDataOutputPrivate : public Phonon::AbstractVideoOutputPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AbstractVideoDataOutput)
|
||||
protected:
|
||||
virtual bool aboutToDeleteBackendObject();
|
||||
virtual void createBackendObject();
|
||||
void setupBackendObject();
|
||||
|
||||
private:
|
||||
bool isRunning;
|
||||
QSet<VideoFrame2::Format> allowedFormats;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_X_ABSTRACTVIDEODATAOUTPUT_P_H
|
|
@ -1,73 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "audiodataoutput.h"
|
||||
#include "audiodataoutput_p.h"
|
||||
#include "factory_p.h"
|
||||
|
||||
#define PHONON_CLASSNAME AudioDataOutput
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
PHONON_HEIR_IMPL(AbstractAudioOutput)
|
||||
|
||||
PHONON_GETTER(Phonon::Experimental::AudioDataOutput::Format, format, d->format)
|
||||
PHONON_GETTER(int, dataSize, d->dataSize)
|
||||
PHONON_GETTER(int, sampleRate, -1)
|
||||
PHONON_SETTER(setFormat, format, Phonon::Experimental::AudioDataOutput::Format)
|
||||
PHONON_SETTER(setDataSize, dataSize, int)
|
||||
|
||||
bool AudioDataOutputPrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
Q_ASSERT(m_backendObject);
|
||||
pBACKEND_GET(Phonon::Experimental::AudioDataOutput::Format, format, "format");
|
||||
pBACKEND_GET(int, dataSize, "dataSize");
|
||||
|
||||
return AbstractAudioOutputPrivate::aboutToDeleteBackendObject();
|
||||
}
|
||||
|
||||
void AudioDataOutputPrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AudioDataOutput);
|
||||
Q_ASSERT(m_backendObject);
|
||||
AbstractAudioOutputPrivate::setupBackendObject();
|
||||
|
||||
// set up attributes
|
||||
pBACKEND_CALL1("setFormat", Phonon::Experimental::AudioDataOutput::Format, format);
|
||||
pBACKEND_CALL1("setDataSize", int, dataSize);
|
||||
QObject::connect(m_backendObject,
|
||||
SIGNAL(dataReady(QMap<Phonon::Experimental::AudioDataOutput::Channel,QVector<qint16> >)),
|
||||
q, SIGNAL(dataReady(QMap<Phonon::Experimental::AudioDataOutput::Channel,QVector<qint16> >)));
|
||||
QObject::connect(m_backendObject,
|
||||
SIGNAL(dataReady(QMap<Phonon::Experimental::AudioDataOutput::Channel,QVector<float> >)),
|
||||
q, SIGNAL(dataReady(QMap<Phonon::Experimental::AudioDataOutput::Channel,QVector<float> >)));
|
||||
QObject::connect(m_backendObject, SIGNAL(endOfMedia(int)), q, SIGNAL(endOfMedia(int)));
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#undef PHONON_CLASSNAME
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#include "experimental/moc_audiodataoutput.h"
|
|
@ -1,189 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef Phonon_AUDIODATAOUTPUT_H
|
||||
#define Phonon_AUDIODATAOUTPUT_H
|
||||
|
||||
#include "export.h"
|
||||
#include "../abstractaudiooutput.h"
|
||||
#include "../phonondefs.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
template<typename T> class QVector;
|
||||
template<typename Key, typename T> class QMap;
|
||||
#endif
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
class AudioDataOutputPrivate;
|
||||
|
||||
/**
|
||||
* \short This class gives you the audio data (for visualizations).
|
||||
*
|
||||
* This class implements a special AbstractAudioOutput that gives your
|
||||
* application the audio data. Don't expect realtime performance. But
|
||||
* the latencies should be low enough to use the audio data for
|
||||
* visualizations. You can also use the audio data for further processing
|
||||
* (e.g. encoding and saving to a file).
|
||||
*
|
||||
* The class supports different data formats. One of the most common formats
|
||||
* is to read vectors of integers (which will only use 16 Bit), but you can
|
||||
* also request floats which some backends use internally.
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT AudioDataOutput : public AbstractAudioOutput
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(AudioDataOutput)
|
||||
Q_ENUMS(Channel Format)
|
||||
Q_PROPERTY(Format format READ format WRITE setFormat)
|
||||
Q_PROPERTY(int dataSize READ dataSize WRITE setDataSize)
|
||||
PHONON_HEIR(AudioDataOutput)
|
||||
public:
|
||||
/**
|
||||
* Specifies the channel the audio data belongs to.
|
||||
*/
|
||||
enum Channel
|
||||
{
|
||||
LeftChannel,
|
||||
RightChannel,
|
||||
CenterChannel,
|
||||
LeftSurroundChannel,
|
||||
RightSurroundChannel,
|
||||
SubwooferChannel
|
||||
};
|
||||
|
||||
/**
|
||||
* Used for telling the object whether you want 16 bit Integers or
|
||||
* 32 bit floats.
|
||||
*
|
||||
* \see requestFormat
|
||||
*/
|
||||
enum Format
|
||||
{
|
||||
/**
|
||||
* Requests 16 bit signed integers.
|
||||
*
|
||||
* \see dataReady(const QVector<qint16> &)
|
||||
*/
|
||||
IntegerFormat = 1,
|
||||
/**
|
||||
* Requests 32 bit floating point: signed, zero centered, and
|
||||
* normalized to the unit value (-1.0 to 1.0).
|
||||
*
|
||||
* \see dataReady(const QVector<float> &)
|
||||
*/
|
||||
FloatFormat = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the currently used format.
|
||||
*
|
||||
* \see setFormat
|
||||
*/
|
||||
Format format() const;
|
||||
|
||||
/**
|
||||
* Returns the currently used number of samples passed through
|
||||
* the signal.
|
||||
*
|
||||
* \see setDataSize
|
||||
*/
|
||||
int dataSize() const;
|
||||
|
||||
/**
|
||||
* Returns the sample rate in Hz. Common sample rates are 44100 Hz
|
||||
* and 48000 Hz. AudioDataOutput will not do any sample rate
|
||||
* conversion for you. If you need to convert the sample rate you
|
||||
* might want to take a look at libsamplerate. For visualizations it
|
||||
* is often enough to do simple interpolation or even drop/duplicate
|
||||
* samples.
|
||||
*
|
||||
* \return The sample rate as reported by the backend. If the
|
||||
* backend is unavailable -1 is returned.
|
||||
*/
|
||||
int sampleRate() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Requests the dataformat you'd like to receive. Only one of the
|
||||
* signals of this class will be emitted when new data is ready.
|
||||
*
|
||||
* The default format is IntegerFormat.
|
||||
*
|
||||
* \see format()
|
||||
*/
|
||||
void setFormat(Format format);
|
||||
|
||||
/**
|
||||
* Sets the number of samples to be passed in one signal emission.
|
||||
*
|
||||
* Defaults to 512 samples per emitted signal.
|
||||
*
|
||||
* \param size the number of samples
|
||||
*/
|
||||
void setDataSize(int size);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted whenever another dataSize number of samples are ready and
|
||||
* format is set to IntegerFormat.
|
||||
*
|
||||
* If format is set to FloatFormat the signal is not emitted at all.
|
||||
*
|
||||
* \param data A mapping of Channel to a vector holding the audio data.
|
||||
*/
|
||||
void dataReady(const QMap<Phonon::Experimental::AudioDataOutput::Channel, QVector<qint16> > &data);
|
||||
|
||||
/**
|
||||
* Emitted whenever another dataSize number of samples are ready and
|
||||
* format is set to FloatFormat.
|
||||
*
|
||||
* If format is set to IntegerFormat the signal is not emitted at all.
|
||||
*
|
||||
* \param data A mapping of Channel to a vector holding the audio data.
|
||||
*/
|
||||
void dataReady(const QMap<Phonon::Experimental::AudioDataOutput::Channel, QVector<float> > &data);
|
||||
|
||||
/**
|
||||
* This signal is emitted before the last dataReady signal of a
|
||||
* media is emitted.
|
||||
*
|
||||
* If, for example, the playback of a media file has finished and the
|
||||
* last audio data of that file is going to be passed with the next
|
||||
* dataReady signal, and only the 28 first samples of the data
|
||||
* vector are from that media file endOfMedia will be emitted right
|
||||
* before dataReady with \p remainingSamples = 28.
|
||||
*
|
||||
* \param remainingSamples The number of samples in the next
|
||||
* dataReady vector that belong to the media that was playing to
|
||||
* this point.
|
||||
*/
|
||||
void endOfMedia(int remainingSamples);
|
||||
};
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
// vim: sw=4 ts=4 tw=80
|
||||
#endif // Phonon_AUDIODATAOUTPUT_H
|
|
@ -1,53 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AUDIODATAOUTPUT_P_H
|
||||
#define AUDIODATAOUTPUT_P_H
|
||||
|
||||
#include "audiodataoutput.h"
|
||||
#include "../abstractaudiooutput_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AudioDataOutputPrivate : public AbstractAudioOutputPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AudioDataOutput)
|
||||
PHONON_PRIVATECLASS
|
||||
protected:
|
||||
AudioDataOutputPrivate()
|
||||
: format(AudioDataOutput::IntegerFormat)
|
||||
, dataSize(512)
|
||||
{
|
||||
}
|
||||
|
||||
AudioDataOutput::Format format;
|
||||
int dataSize;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // AUDIODATAOUTPUT_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_X_AUDIODATAOUTPUTINTERFACE_H
|
||||
#define PHONON_X_AUDIODATAOUTPUTINTERFACE_H
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AbstractAudioDataOutput;
|
||||
|
||||
class AudioDataOutputInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AudioDataOutputInterface() {}
|
||||
|
||||
virtual AbstractAudioDataOutput *frontendObject() const = 0;
|
||||
virtual void setFrontendObject(AbstractAudioDataOutput *) = 0;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::Experimental::AudioDataOutputInterface, "0AudioDataOutputInterface.phonon.kde.org")
|
||||
|
||||
#endif // PHONON_X_AUDIODATAOUTPUTINTERFACE_H
|
|
@ -1,112 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "audioformat.h"
|
||||
#include "phonondefs_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AudioFormatPrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AudioFormat)
|
||||
protected:
|
||||
AudioFormat *q_ptr;
|
||||
};
|
||||
|
||||
AudioFormat::AudioFormat(int sampleRate, int channelCount, Phonon::Experimental::BitRate bitRate, QSysInfo::Endian byteOrder)
|
||||
{
|
||||
s.m_sampleRate = sampleRate;
|
||||
s.m_channelCount = channelCount;
|
||||
s.m_bitRate = bitRate;
|
||||
s.m_byteOrder = byteOrder;
|
||||
}
|
||||
|
||||
AudioFormat::~AudioFormat()
|
||||
{
|
||||
}
|
||||
|
||||
int AudioFormat::sampleRate() const
|
||||
{
|
||||
return s.m_sampleRate;
|
||||
}
|
||||
|
||||
int AudioFormat::channelCount() const
|
||||
{
|
||||
return s.m_channelCount;
|
||||
}
|
||||
|
||||
Phonon::Experimental::BitRate AudioFormat::bitRate() const
|
||||
{
|
||||
return s.m_bitRate;
|
||||
}
|
||||
|
||||
QSysInfo::Endian AudioFormat::byteOrder() const
|
||||
{
|
||||
return s.m_byteOrder;
|
||||
}
|
||||
|
||||
AudioFormat::AudioFormat(const AudioFormat &f)
|
||||
{
|
||||
s.m_sampleRate = f.sampleRate();
|
||||
s.m_channelCount = f.channelCount();
|
||||
s.m_bitRate = f.bitRate();
|
||||
s.m_byteOrder = f.byteOrder();
|
||||
}
|
||||
|
||||
AudioFormat &AudioFormat::operator=(const AudioFormat &f)
|
||||
{
|
||||
s.m_sampleRate = f.sampleRate();
|
||||
s.m_channelCount = f.channelCount();
|
||||
s.m_bitRate = f.bitRate();
|
||||
s.m_byteOrder = f.byteOrder();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool AudioFormat::operator==(const AudioFormat &f) const
|
||||
{
|
||||
return s.m_sampleRate == f.sampleRate() &&
|
||||
s.m_channelCount == f.channelCount() &&
|
||||
s.m_bitRate == f.bitRate() &&
|
||||
s.m_byteOrder == f.byteOrder();
|
||||
}
|
||||
|
||||
bool AudioFormat::operator<(const AudioFormat &f) const
|
||||
{
|
||||
return s.m_bitRate < f.bitRate() ||
|
||||
(s.m_bitRate == f.bitRate() && (s.m_sampleRate < f.sampleRate() ||
|
||||
(s.m_sampleRate == f.sampleRate() && (s.m_channelCount < f.channelCount() ||
|
||||
(s.m_channelCount == f.channelCount() && s.m_byteOrder != QSysInfo::ByteOrder && f.byteOrder() == QSysInfo::ByteOrder)))));
|
||||
}
|
||||
|
||||
quint32 AudioFormat::key() const
|
||||
{
|
||||
return (s.m_byteOrder == QSysInfo::ByteOrder ? 1 : 0) + // 1 bit least significant
|
||||
(s.m_channelCount << 1) + // give it 8 bits
|
||||
(s.m_sampleRate) + // 192kHz ~ 18 bits (let the (unimportant) lower 9 bits overlap with channels + byteOrder)
|
||||
(s.m_bitRate << 18); // most significant
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,95 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_X_AUDIOFORMAT_H
|
||||
#define PHONON_X_AUDIOFORMAT_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include "phononnamespace.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AudioFormatPrivate;
|
||||
class AudioFormat
|
||||
{
|
||||
//Q_DECLARE_PRIVATE(AudioFormat)
|
||||
public:
|
||||
AudioFormat(int sampleRate = 48000, int channelCount = 2, Phonon::Experimental::BitRate bitRate = Phonon::Experimental::Signed16Bit, QSysInfo::Endian byteOrder = QSysInfo::ByteOrder);
|
||||
AudioFormat(const AudioFormat &);
|
||||
~AudioFormat();
|
||||
|
||||
AudioFormat &operator=(const AudioFormat &);
|
||||
|
||||
int sampleRate() const;
|
||||
int channelCount() const;
|
||||
Phonon::Experimental::BitRate bitRate() const;
|
||||
QSysInfo::Endian byteOrder() const;
|
||||
|
||||
bool operator==(const AudioFormat &) const;
|
||||
inline bool operator!=(const AudioFormat &f) const { return !operator==(f); }
|
||||
|
||||
/**
|
||||
* ess than operator for sorting:
|
||||
* A Format is considered smaller if
|
||||
* - smaller bit rate
|
||||
* - smaller sample rate
|
||||
* - less channels
|
||||
* - non-native byte order
|
||||
*/
|
||||
bool operator<(const AudioFormat &) const;
|
||||
|
||||
quint32 key() const;
|
||||
|
||||
private:
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
int m_sampleRate;
|
||||
int m_channelCount;
|
||||
Phonon::Experimental::BitRate m_bitRate;
|
||||
QSysInfo::Endian m_byteOrder;
|
||||
} s;
|
||||
// for future use:
|
||||
AudioFormatPrivate *d_ptr;
|
||||
};
|
||||
};
|
||||
|
||||
inline uint qHash(const AudioFormat &p)
|
||||
{
|
||||
return p.key();
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
|
||||
//this ensures that code outside Phonon can use the hash function
|
||||
//it also a workaround for some compilers
|
||||
inline uint qHash(const Phonon::Experimental::AudioFormat &p) { return Phonon::Experimental::qHash(p); } //krazy:exclude=inline
|
||||
#endif
|
||||
|
||||
|
||||
#endif // PHONON_X_AUDIOFORMAT_H
|
|
@ -1,61 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_AUDIOWRITER_H
|
||||
#define PHONON_AUDIOWRITER_H
|
||||
|
||||
#include "export.h"
|
||||
#include "../abstractaudiooutput.h"
|
||||
#include "../phonondefs.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AudioWriterPrivate;
|
||||
class PHONONEXPERIMENTAL_EXPORT AudioWriter : public AbstractAudioOutput
|
||||
{
|
||||
Q_OBJECT
|
||||
K_DECLARE_PRIVATE(AudioWriter)
|
||||
PHONON_HEIR(AudioWriter)
|
||||
/**
|
||||
* This property defines the codec to be used for encoding the audio signal.
|
||||
* Possible codecs can be retrieved from BackendCapabilities using the
|
||||
* availableAudioCodecs() function.
|
||||
*
|
||||
* The default codec is an invalid codec (audioCodec().isValid() == false)
|
||||
*/
|
||||
Q_PROPERTY(AudioCodec audioCodec READ audioCodec WRITE setAudioCodec)
|
||||
public:
|
||||
AudioCodec audioCodec() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
setAudioCodec(AudioCodec audioCodec);
|
||||
// codec parameters? reuse EffectParameter class?
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_AUDIOWRITER_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,189 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006, 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "phononnamespace_p.h"
|
||||
|
||||
#if defined(PHONON_NO_VIDEOCAPTURE) || defined(PHONON_NO_AUDIOCAPTURE)
|
||||
#define NO_PHONON_AVCAPTURE
|
||||
#endif
|
||||
|
||||
#ifndef NO_PHONON_AVCAPTURE
|
||||
|
||||
#include "avcapture.h"
|
||||
#include "avcapture_p.h"
|
||||
|
||||
#include "avcaptureinterface.h"
|
||||
#include "factory_p.h"
|
||||
#include "globalconfig.h"
|
||||
|
||||
#define PHONON_CLASSNAME AvCapture
|
||||
#define PHONON_INTERFACENAME AvCaptureInterface
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
PHONON_OBJECT_IMPL
|
||||
|
||||
AvCapture::AvCapture(Phonon::CaptureCategory category, QObject *parent)
|
||||
: QObject(parent), MediaNode(*new AvCapturePrivate())
|
||||
{
|
||||
setCaptureDevices(category);
|
||||
}
|
||||
|
||||
Phonon::State AvCapture::state() const
|
||||
{
|
||||
P_D(const AvCapture);
|
||||
if (d->m_backendObject) {
|
||||
return INTERFACE_CALL(state());
|
||||
}
|
||||
return Phonon::StoppedState;
|
||||
}
|
||||
|
||||
void AvCapture::start()
|
||||
{
|
||||
P_D(AvCapture);
|
||||
if (d->backendObject()) {
|
||||
INTERFACE_CALL(start());
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::pause()
|
||||
{
|
||||
P_D(AvCapture);
|
||||
if (d->backendObject()) {
|
||||
INTERFACE_CALL(pause());
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::stop()
|
||||
{
|
||||
P_D(AvCapture);
|
||||
if (d->backendObject()) {
|
||||
INTERFACE_CALL(stop());
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::setCaptureDevices(Phonon::CaptureCategory category)
|
||||
{
|
||||
setAudioCaptureDevice(category);
|
||||
setVideoCaptureDevice(category);
|
||||
}
|
||||
|
||||
Phonon::AudioCaptureDevice AvCapture::audioCaptureDevice() const
|
||||
{
|
||||
P_D(const AvCapture);
|
||||
if (d->m_backendObject) {
|
||||
return INTERFACE_CALL(audioCaptureDevice());
|
||||
}
|
||||
return d->audioCaptureDevice;
|
||||
}
|
||||
|
||||
void AvCapture::setAudioCaptureDevice(const Phonon::AudioCaptureDevice &audioCaptureDevice)
|
||||
{
|
||||
P_D(AvCapture);
|
||||
d->audioCaptureDevice = audioCaptureDevice;
|
||||
if (d->m_backendObject) {
|
||||
INTERFACE_CALL(setAudioCaptureDevice(d->audioCaptureDevice));
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::setAudioCaptureDevice(Phonon::CaptureCategory category)
|
||||
{
|
||||
P_D(AvCapture);
|
||||
d->audioCaptureDevice = AudioCaptureDevice::fromIndex(Phonon::GlobalConfig().audioCaptureDeviceFor(category));
|
||||
if (d->m_backendObject) {
|
||||
INTERFACE_CALL(setAudioCaptureDevice(d->audioCaptureDevice));
|
||||
}
|
||||
}
|
||||
|
||||
PHONON_DEPRECATED void AvCapture::setAudioCaptureDevice(Phonon::Category category)
|
||||
{
|
||||
setAudioCaptureDevice(Phonon::categoryToCaptureCategory(category));
|
||||
}
|
||||
|
||||
Phonon::VideoCaptureDevice AvCapture::videoCaptureDevice() const
|
||||
{
|
||||
P_D(const AvCapture);
|
||||
if (d->m_backendObject) {
|
||||
return INTERFACE_CALL(videoCaptureDevice());
|
||||
}
|
||||
return d->videoCaptureDevice;
|
||||
}
|
||||
|
||||
void AvCapture::setVideoCaptureDevice(const Phonon::Experimental::VideoCaptureDevice &videoCaptureDevice)
|
||||
{
|
||||
setVideoCaptureDevice(phononExperimentalVcdToVcd(videoCaptureDevice));
|
||||
}
|
||||
|
||||
void AvCapture::setVideoCaptureDevice(const Phonon::VideoCaptureDevice &videoCaptureDevice)
|
||||
{
|
||||
P_D(AvCapture);
|
||||
d->videoCaptureDevice = videoCaptureDevice;
|
||||
if (d->m_backendObject) {
|
||||
INTERFACE_CALL(setVideoCaptureDevice(d->videoCaptureDevice));
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::setVideoCaptureDevice(Phonon::CaptureCategory category)
|
||||
{
|
||||
P_D(AvCapture);
|
||||
d->videoCaptureDevice = Phonon::VideoCaptureDevice::fromIndex(Phonon::GlobalConfig().videoCaptureDeviceFor(category));
|
||||
if (d->m_backendObject) {
|
||||
INTERFACE_CALL(setVideoCaptureDevice(d->videoCaptureDevice));
|
||||
}
|
||||
}
|
||||
|
||||
void AvCapture::setVideoCaptureDevice(Phonon::Category category)
|
||||
{
|
||||
setVideoCaptureDevice(Phonon::categoryToCaptureCategory(category));
|
||||
}
|
||||
|
||||
bool AvCapturePrivate::aboutToDeleteBackendObject()
|
||||
{
|
||||
audioCaptureDevice = pINTERFACE_CALL(audioCaptureDevice());
|
||||
videoCaptureDevice = pINTERFACE_CALL(videoCaptureDevice());
|
||||
return true;
|
||||
}
|
||||
|
||||
void AvCapturePrivate::setupBackendObject()
|
||||
{
|
||||
P_Q(AvCapture);
|
||||
Q_ASSERT(m_backendObject);
|
||||
|
||||
QObject::connect(m_backendObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), q, SIGNAL(stateChanged(Phonon::State,Phonon::State)), Qt::QueuedConnection);
|
||||
|
||||
// set up attributes
|
||||
pINTERFACE_CALL(setAudioCaptureDevice(audioCaptureDevice));
|
||||
pINTERFACE_CALL(setVideoCaptureDevice(videoCaptureDevice));
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#include "experimental/moc_avcapture.cpp"
|
||||
|
||||
#undef PHONON_CLASSNAME
|
||||
#undef PHONON_INTERFACENAME
|
||||
|
||||
#endif // NO_PHONON_AVCAPTURE
|
||||
#include "experimental/moc_avcapture.h"
|
|
@ -1,191 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2005-2006, 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_EXPERIMENTAL_AVCAPTURE_H
|
||||
#define PHONON_EXPERIMENTAL_AVCAPTURE_H
|
||||
|
||||
#if defined(PHONON_NO_VIDEOCAPTURE) || defined(PHONON_NO_AUDIOCAPTURE)
|
||||
#define NO_PHONON_AVCAPTURE
|
||||
#endif
|
||||
|
||||
#ifndef NO_PHONON_AVCAPTURE
|
||||
|
||||
#include "export.h"
|
||||
#include "../medianode.h"
|
||||
#include "../phonondefs.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
#if defined(MAKE_PHONONEXPERIMENTAL_LIB)
|
||||
#include "../phononnamespace.h"
|
||||
#else
|
||||
#include "phonon/phononnamespace.h"
|
||||
#endif
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AvCapturePrivate;
|
||||
|
||||
/**
|
||||
* @short Media data from a soundcard, soundserver, camera or any other
|
||||
* hardware device supported by the backend.
|
||||
*
|
||||
* This class gives you access to the capture capabilities of the backend.
|
||||
* There might be more than only one possible capture source, for audio, as
|
||||
* well as for video. A prefferable device may easily be obtained by providing
|
||||
* a capture category.
|
||||
*
|
||||
* @ingroup Recording
|
||||
* @author Matthias Kretz <kretz@kde.org>
|
||||
* @see BackendCapabilities::availableAudioCaptureDevices
|
||||
* @see BackendCapabilities::availableVideoCaptureDevices
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT AvCapture : public QObject, public Phonon::MediaNode
|
||||
{
|
||||
Q_OBJECT
|
||||
P_DECLARE_PRIVATE(AvCapture)
|
||||
PHONON_OBJECT(AvCapture)
|
||||
Q_PROPERTY(Phonon::AudioCaptureDevice audioCaptureDevice READ audioCaptureDevice WRITE setAudioCaptureDevice)
|
||||
Q_PROPERTY(Phonon::VideoCaptureDevice videoCaptureDevice READ videoCaptureDevice WRITE setVideoCaptureDevice)
|
||||
public:
|
||||
/**
|
||||
* Constructs an AvCapture with the devices preferred for the specified
|
||||
* capture category.
|
||||
*
|
||||
* @param category Used to determine what devices are most suited for
|
||||
* the AvCapture.
|
||||
*
|
||||
* @see CaptureCategory
|
||||
*/
|
||||
AvCapture(Phonon::CaptureCategory category, QObject *parent = NULL);
|
||||
|
||||
/**
|
||||
* Returns the current state of the capture.
|
||||
*
|
||||
* @li If only the audio capture device is valid, it returns the audio capture state.
|
||||
* @li If only the video capture device is valid, it returns the video capture state.
|
||||
* @li If both the audio and video capture devices are valid, it only returns the
|
||||
* video capture state.
|
||||
*/
|
||||
State state() const;
|
||||
|
||||
/**
|
||||
* Returns the currently used capture source for the audio signal.
|
||||
*/
|
||||
Phonon::AudioCaptureDevice audioCaptureDevice() const;
|
||||
|
||||
/**
|
||||
* Returns the currently used capture source for the video signal.
|
||||
*/
|
||||
Phonon::VideoCaptureDevice videoCaptureDevice() const;
|
||||
|
||||
/**
|
||||
* Sets both the video and audio devices to the ones most suited for the
|
||||
* specified category
|
||||
*
|
||||
* @param category Used to determine what devices are most suited for
|
||||
* the AvCapture.
|
||||
*/
|
||||
void setCaptureDevices(Phonon::CaptureCategory category);
|
||||
|
||||
/**
|
||||
* Sets the audio capture source to use.
|
||||
*
|
||||
* @param source An object of class AudioCaptureDevice.
|
||||
*
|
||||
*/
|
||||
void setAudioCaptureDevice(const Phonon::AudioCaptureDevice &source);
|
||||
|
||||
/**
|
||||
* Sets the audio capture device by using a capture category to get
|
||||
* the appropriate device.
|
||||
*
|
||||
* @param category Capture category to use for getting a device
|
||||
*/
|
||||
void setAudioCaptureDevice(Phonon::CaptureCategory category);
|
||||
|
||||
PHONON_DEPRECATED void setAudioCaptureDevice(Phonon::Category category);
|
||||
|
||||
/**
|
||||
* Sets the video capture source to use.
|
||||
*
|
||||
* @param source An object of class VideoCaptureDevice.
|
||||
*
|
||||
* @see videoCaptureDevice
|
||||
* @see setVideoCaptureDevice(int)
|
||||
*/
|
||||
void setVideoCaptureDevice(const Phonon::VideoCaptureDevice &source);
|
||||
|
||||
/**
|
||||
* Sets the audio capture device by using a capture category to get
|
||||
* the appropriate device.
|
||||
*
|
||||
* @param category Capture category to use for getting a device
|
||||
*/
|
||||
void setVideoCaptureDevice(Phonon::CaptureCategory category);
|
||||
|
||||
PHONON_DEPRECATED void setVideoCaptureDevice(Phonon::Category category);
|
||||
|
||||
/**
|
||||
* @deprecated since 4.4.3, use
|
||||
* setVideoCaptureDevice(const Phonon::VideoCaptureDevice &source) instead
|
||||
*/
|
||||
PHONON_DEPRECATED void setVideoCaptureDevice(const Phonon::Experimental::VideoCaptureDevice &source);
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Start capture.
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Pause capture.
|
||||
*/
|
||||
void pause();
|
||||
|
||||
/**
|
||||
* Stop capture.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted when the state of the video or audio capture device has been changed.
|
||||
*
|
||||
* \li If only the audio capture device is valid, it notifies about the audio capture state.
|
||||
* \li If only the video capture device is valid, it notifies about the video capture state.
|
||||
* \li If both the audio and video capture devices are valid, it only notifies about the
|
||||
* video capture state.
|
||||
*/
|
||||
void stateChanged(Phonon::State newstate, Phonon::State oldstate);
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // NO_PHONON_AVCAPTURE
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_AVCAPTURE_H
|
|
@ -1,54 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef AVCAPTURE_P_H
|
||||
#define AVCAPTURE_P_H
|
||||
|
||||
#ifndef NO_PHONON_AVCAPTURE
|
||||
|
||||
#include "avcapture.h"
|
||||
#include "../phonondefs_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AvCapturePrivate : public MediaNodePrivate
|
||||
{
|
||||
P_DECLARE_PUBLIC(AvCapture)
|
||||
PHONON_PRIVATECLASS
|
||||
public:
|
||||
protected:
|
||||
PHONON_EXPORT void _k_stateChanged(Phonon::State, Phonon::State);
|
||||
protected:
|
||||
Phonon::AudioCaptureDevice audioCaptureDevice;
|
||||
Phonon::VideoCaptureDevice videoCaptureDevice;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // NO_PHONON_AVCAPTURE
|
||||
|
||||
#endif // AVCAPTURE_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,52 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_AVCAPTUREINTERFACE_H
|
||||
#define PHONON_EXPERIMENTAL_AVCAPTUREINTERFACE_H
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AvCaptureInterface
|
||||
{
|
||||
public:
|
||||
virtual ~AvCaptureInterface() {}
|
||||
|
||||
virtual Phonon::State state() const = 0;
|
||||
virtual void start() = 0;
|
||||
virtual void pause() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual Phonon::AudioCaptureDevice audioCaptureDevice() const = 0;
|
||||
virtual Phonon::VideoCaptureDevice videoCaptureDevice() const = 0;
|
||||
virtual void setAudioCaptureDevice(const Phonon::AudioCaptureDevice &) = 0;
|
||||
virtual void setVideoCaptureDevice(const Phonon::VideoCaptureDevice &) = 0;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::Experimental::AvCaptureInterface, "0AvCaptureInterface.Phonon.kde.org")
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_AVCAPTUREINTERFACE_H
|
|
@ -1,44 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "avwriter.h"
|
||||
#include "avwriter_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
AvWriter::AvWriter(QObject *parent)
|
||||
: QObject(parent)
|
||||
, k_ptr(new AvWriterPrivate)
|
||||
{
|
||||
K_D(AvWriter);
|
||||
d->q_ptr = this;
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#include "experimental/moc_avwriter.cpp"
|
||||
// vim: sw=4 ts=4
|
||||
#include "experimental/moc_avwriter.h"
|
|
@ -1,86 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_AVWRITER_H
|
||||
#define PHONON_AVWRITER_H
|
||||
|
||||
#include "export.h"
|
||||
#include "../phonondefs.h"
|
||||
#include "../abstractaudiooutput.h"
|
||||
#include "../abstractvideooutput.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AvWriterPrivate;
|
||||
|
||||
//TODO:
|
||||
// Container formats can support multiple audio, video and subtitle streams, a
|
||||
// control track (menus) and chapters. Anything else?
|
||||
// How should those features be mapped to this API? Multiple audio and video
|
||||
// streams should be covered already. Are the subtitle streams implicit
|
||||
// depending on the source material?
|
||||
// Chapters: call a method when to add a chapter? How does that map to a
|
||||
// specific frame/sample? Chapter support is probably overkill for Phonon.
|
||||
class PHONONEXPERIMENTAL_EXPORT AvWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
K_DECLARE_PRIVATE(AvWriter)
|
||||
Q_PROPERTY(ContainerFormat containerFormat READ containerFormat WRITE setContainerFormat)
|
||||
Q_PROPERTY(KUrl url READ url WRITE setUrl)
|
||||
public:
|
||||
/**
|
||||
* Standard QObject constructor.
|
||||
*
|
||||
* \param parent QObject parent
|
||||
*/
|
||||
AvWriter(QObject *parent);
|
||||
|
||||
KUrl url() const;
|
||||
setUrl(const KUrl &url);
|
||||
|
||||
/**
|
||||
* Creates a new AudioWriter object to be used for sending the audio
|
||||
* data to this file
|
||||
*
|
||||
* \param streamName A name identifying the stream. Often this name is
|
||||
* used for the language identifier.
|
||||
*
|
||||
* \return Returns the new AudioWriter object or 0 if the container
|
||||
* format does not support multiple audio streams.
|
||||
*/
|
||||
AudioWriter *addAudioStream(const QString &streamName);
|
||||
VideoWriter *addVideoStream(const QString &streamName);
|
||||
|
||||
ContainerFormat containerFormat() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setContainerFormat(ContainerFormat format);
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_AVWRITER_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,44 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_AVWRITER_P_H
|
||||
#define PHONON_AVWRITER_P_H
|
||||
|
||||
#include "rtpsender.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class AvWriterPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(AvWriter)
|
||||
protected:
|
||||
AvWriter *q_ptr;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_AVWRITER_P_H
|
||||
// vim: sw=4 ts=4 tw=80
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
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) version 3 or any later version
|
||||
accepted by the membership of KDE e.V. (or its successor approved
|
||||
by the membership of KDE e.V.), Nokia Corporation (or its successors,
|
||||
if any) and the KDE Free Qt Foundation, which shall act as a proxy
|
||||
defined in Section 14 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "backendcapabilities.h"
|
||||
#include "../backendcapabilities.h"
|
||||
#include "globalconfig.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
QList<VideoCaptureDevice> BackendCapabilities::availableVideoCaptureDevices()
|
||||
{
|
||||
QList<Phonon::VideoCaptureDevice> phononList;
|
||||
QList<VideoCaptureDevice> experimentalList;
|
||||
|
||||
phononList = Phonon::BackendCapabilities::availableVideoCaptureDevices();
|
||||
foreach (const Phonon::VideoCaptureDevice &vcd, phononList) {
|
||||
experimentalList << phononVcdToExperimentalVcd(vcd);
|
||||
}
|
||||
|
||||
return experimentalList;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,43 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_EXPERIMENTAL_BACKENDCAPABILITIES_H
|
||||
#define PHONON_EXPERIMENTAL_BACKENDCAPABILITIES_H
|
||||
|
||||
#include "export.h"
|
||||
#include "objectdescription.h"
|
||||
#include "../backendcapabilities.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
namespace BackendCapabilities
|
||||
{
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
PHONONEXPERIMENTAL_EXPORT QList<VideoCaptureDevice> availableVideoCaptureDevices();
|
||||
#endif
|
||||
|
||||
} // namespace BackendCapabilities
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
#endif // PHONON_EXPERIMENTAL_BACKENDCAPABILITIES_H
|
|
@ -1,41 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_EXPERIMENTAL_BACKENDINTERFACE_H
|
||||
#define PHONON_EXPERIMENTAL_BACKENDINTERFACE_H
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
namespace BackendInterface
|
||||
{
|
||||
enum Class {
|
||||
VideoDataOutputClass = 0x10000,
|
||||
AudioDataOutputClass,
|
||||
VisualizationClass,
|
||||
AvCaptureClass
|
||||
};
|
||||
} // namespace BackendInterface
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_BACKENDINTERFACE_H
|
|
@ -1,39 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_EXPORT_H
|
||||
#define PHONON_EXPERIMENTAL_EXPORT_H
|
||||
|
||||
/* needed for KDE_EXPORT and KDE_IMPORT macros */
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#ifndef PHONONEXPERIMENTAL_EXPORT
|
||||
# if defined(MAKE_PHONONEXPERIMENTAL_LIB)
|
||||
/* We are building this library */
|
||||
# define PHONONEXPERIMENTAL_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define PHONONEXPERIMENTAL_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,129 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
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) version 3 or any later version
|
||||
accepted by the membership of KDE e.V. (or its successor approved
|
||||
by the membership of KDE e.V.), Nokia Corporation (or its successors,
|
||||
if any) and the KDE Free Qt Foundation, which shall act as a proxy
|
||||
defined in Section 14 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "factory_p.h"
|
||||
#include "objectdescription.h"
|
||||
#include "../factory_p.h"
|
||||
#include "../globalstatic_p.h"
|
||||
#include "../backendinterface.h"
|
||||
#include "backendinterface.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class FactoryPrivate : public Phonon::Experimental::Factory::Sender
|
||||
{
|
||||
public:
|
||||
FactoryPrivate();
|
||||
~FactoryPrivate();
|
||||
//QPointer<QObject> m_backendObject;
|
||||
|
||||
private Q_SLOTS:
|
||||
void objectDescriptionChanged(ObjectDescriptionType);
|
||||
};
|
||||
|
||||
PHONON_GLOBAL_STATIC(Phonon::Experimental::FactoryPrivate, globalFactory)
|
||||
|
||||
FactoryPrivate::FactoryPrivate()
|
||||
{
|
||||
QObject *backendObj = Phonon::Factory::backend();
|
||||
Q_ASSERT(backendObj);
|
||||
//QMetaObject::invokeMethod(backendObj, "experimentalBackend", Qt::DirectConnection,
|
||||
//Q_RETURN_ARG(QObject *, m_backendObject));
|
||||
//if (!m_backendObject) {
|
||||
//qDebug() << "The backend does not support Phonon::Experimental";
|
||||
//return;
|
||||
//}
|
||||
connect(backendObj, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)),
|
||||
SLOT(objectDescriptionChanged(ObjectDescriptionType)));
|
||||
connect(Phonon::Factory::sender(), SIGNAL(availableVideoCaptureDevicesChanged()), Factory::sender(),
|
||||
SLOT(availableVideoCaptureDevicesChanged()));
|
||||
}
|
||||
|
||||
FactoryPrivate::~FactoryPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void FactoryPrivate::objectDescriptionChanged(ObjectDescriptionType type)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << type;
|
||||
switch (type) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Factory::Sender *Factory::sender()
|
||||
{
|
||||
return globalFactory;
|
||||
}
|
||||
|
||||
QObject *Factory::createAudioDataOutput(QObject *parent)
|
||||
{
|
||||
Phonon::BackendInterface *b = qobject_cast<Phonon::BackendInterface *>(Phonon::Factory::backend());
|
||||
if (b) {
|
||||
return Phonon::Factory::registerQObject(b->createObject(
|
||||
static_cast<Phonon::BackendInterface::Class>(Phonon::BackendInterface::AudioDataOutputClass),
|
||||
parent));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QObject *Factory::createVideoDataOutput(QObject *parent)
|
||||
{
|
||||
Phonon::BackendInterface *b = qobject_cast<Phonon::BackendInterface *>(Phonon::Factory::backend());
|
||||
if (b) {
|
||||
return Phonon::Factory::registerQObject(b->createObject(
|
||||
static_cast<Phonon::BackendInterface::Class>(Phonon::BackendInterface::VideoDataOutputClass),
|
||||
parent));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QObject *Factory::createAvCapture(QObject *parent)
|
||||
{
|
||||
Phonon::BackendInterface *b = qobject_cast<Phonon::BackendInterface *>(Phonon::Factory::backend());
|
||||
if (b) {
|
||||
return Phonon::Factory::registerQObject(b->createObject(
|
||||
static_cast<Phonon::BackendInterface::Class>(Phonon::Experimental::BackendInterface::AvCaptureClass),
|
||||
parent));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QObject *Factory::createVisualization(QObject *parent)
|
||||
{
|
||||
Phonon::BackendInterface *b = qobject_cast<Phonon::BackendInterface *>(Phonon::Factory::backend());
|
||||
if (b) {
|
||||
return Phonon::Factory::registerQObject(b->createObject(
|
||||
static_cast<Phonon::BackendInterface::Class>(Phonon::Experimental::BackendInterface::VisualizationClass),
|
||||
parent));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
#include "experimental/moc_factory_p.h"
|
|
@ -1,74 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_EXPERIMENTAL_FACTORY_P_H
|
||||
#define PHONON_EXPERIMENTAL_FACTORY_P_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include "export.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
namespace Factory
|
||||
{
|
||||
/**
|
||||
* Emits signals for Phonon::Experimental::Factory.
|
||||
*/
|
||||
class Sender : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SIGNALS:
|
||||
void availableVideoCaptureDevicesChanged();
|
||||
};
|
||||
|
||||
PHONONEXPERIMENTAL_EXPORT Sender *sender();
|
||||
|
||||
/**
|
||||
* Create a new backend object for a AudioDataOutput.
|
||||
*
|
||||
* \return a pointer to the AudioDataOutput the backend provides.
|
||||
*/
|
||||
PHONONEXPERIMENTAL_EXPORT QObject *createAudioDataOutput(QObject *parent = 0);
|
||||
|
||||
/**
|
||||
* Create a new backend object for a VideoDataOutput.
|
||||
*
|
||||
* \return a pointer to the VideoDataOutput the backend provides.
|
||||
*/
|
||||
QObject *createVideoDataOutput(QObject *parent = 0);
|
||||
|
||||
QObject *createAvCapture(QObject *parent = 0);
|
||||
|
||||
/**
|
||||
* Create a new backend object for a Visualization.
|
||||
*
|
||||
* \return a pointer to the Visualization the backend provides.
|
||||
*/
|
||||
PHONONEXPERIMENTAL_EXPORT QObject *createVisualization(QObject *parent = 0);
|
||||
|
||||
} // namespace Factory
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_FACTORY_P_H
|
|
@ -1,66 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "globalconfig.h"
|
||||
#include "../globalconfig_p.h"
|
||||
|
||||
#include "../factory_p.h"
|
||||
#include "../phonondefs_p.h"
|
||||
#include "../backendinterface.h"
|
||||
#include "../qsettingsgroup_p.h"
|
||||
#include "../platformplugin.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
QList<int> GlobalConfig::videoCaptureDeviceListFor(Category category, int override) const
|
||||
{
|
||||
Q_UNUSED(category);
|
||||
return Phonon::GlobalConfig::videoCaptureDeviceListFor(Phonon::NoCaptureCategory, override);
|
||||
}
|
||||
|
||||
int GlobalConfig::videoCaptureDeviceFor(Category category, int override) const
|
||||
{
|
||||
Q_UNUSED(category);
|
||||
return Phonon::GlobalConfig::videoCaptureDeviceFor(Phonon::NoCaptureCategory, override);
|
||||
}
|
||||
|
||||
QList< int > GlobalConfig::videoCaptureDeviceListFor(CaptureCategory category, int override) const
|
||||
{
|
||||
return Phonon::GlobalConfig::videoCaptureDeviceListFor(category, override);
|
||||
}
|
||||
|
||||
int Experimental::GlobalConfig::videoCaptureDeviceFor(CaptureCategory category, int override) const
|
||||
{
|
||||
return Phonon::GlobalConfig::videoCaptureDeviceFor(category, override);
|
||||
}
|
||||
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,59 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_GLOBALCONFIG_P_H
|
||||
#define PHONON_EXPERIMENTAL_GLOBALCONFIG_P_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include "export.h"
|
||||
#include "../globalconfig.h"
|
||||
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class PHONONEXPERIMENTAL_EXPORT GlobalConfig : public Phonon::GlobalConfig
|
||||
{
|
||||
P_DECLARE_PRIVATE(Phonon::GlobalConfig)
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
public:
|
||||
PHONON_DEPRECATED QList<int> videoCaptureDeviceListFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const;
|
||||
PHONON_DEPRECATED int videoCaptureDeviceFor(Phonon::Category category, int override = AdvancedDevicesFromSettings) const;
|
||||
QList<int> videoCaptureDeviceListFor(Phonon::CaptureCategory category, int override = AdvancedDevicesFromSettings) const;
|
||||
int videoCaptureDeviceFor(Phonon::CaptureCategory category, int override = AdvancedDevicesFromSettings) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void videoCaptureDeviceConfigChanged();
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
}; // GlobalConfig class
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_GLOBALCONFIG_P_H
|
|
@ -1,309 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "lockfreequeue_p.h"
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QWriteLocker>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#include <stdlib.h>
|
||||
#include "globalstatic_p.h"
|
||||
|
||||
struct MemoryPool
|
||||
{
|
||||
~MemoryPool();
|
||||
// Stack structure:
|
||||
QAtomicPointer<LockFreeQueueBase::NodeBase> stack;
|
||||
QAtomicInt count;
|
||||
QAtomicInt size;
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
void MemoryPool::clear()
|
||||
{
|
||||
LockFreeQueueBase::NodeBase *node = stack;
|
||||
while (node) {
|
||||
if (stack.testAndSetAcquire(node, const_cast<LockFreeQueueBase::NodeBase *>(node->next))) {
|
||||
count.deref();
|
||||
free(node);
|
||||
}
|
||||
node = stack;
|
||||
}
|
||||
}
|
||||
|
||||
MemoryPool::~MemoryPool()
|
||||
{
|
||||
LockFreeQueueBase::NodeBase *node = stack;
|
||||
while (node) {
|
||||
void *toDelete = node;
|
||||
node = const_cast<LockFreeQueueBase::NodeBase *>(node->next);
|
||||
::free(toDelete);
|
||||
}
|
||||
}
|
||||
|
||||
struct MemoryPoolVector
|
||||
{
|
||||
static const int POOL_COUNT = 16;
|
||||
~MemoryPoolVector() { delete next; }
|
||||
inline MemoryPool &operator[](size_t s)
|
||||
{
|
||||
for (int i = 0; i < POOL_COUNT; ++i) {
|
||||
if (m_pools[i].size == static_cast<int>(s)) {
|
||||
return m_pools[i];
|
||||
} else if (m_pools[i].size == 0) {
|
||||
if (m_pools[i].size.testAndSetRelaxed(0, static_cast<int>(s))) {
|
||||
return m_pools[i];
|
||||
}
|
||||
if (m_pools[i].size == static_cast<int>(s)) {
|
||||
return m_pools[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!next) {
|
||||
MemoryPoolVector *newPoolVector = new MemoryPoolVector;
|
||||
if (!next.testAndSetRelaxed(0, newPoolVector)) {
|
||||
delete newPoolVector;
|
||||
}
|
||||
}
|
||||
return (*next)[s];
|
||||
}
|
||||
|
||||
void clearAllPools()
|
||||
{
|
||||
for (int i = 0; i < POOL_COUNT; ++i) {
|
||||
if (0 == m_pools[i].size) {
|
||||
return;
|
||||
}
|
||||
m_pools[i].clear();
|
||||
}
|
||||
if (next) {
|
||||
next->clearAllPools();
|
||||
}
|
||||
}
|
||||
|
||||
MemoryPool m_pools[POOL_COUNT];
|
||||
QAtomicPointer<MemoryPoolVector> next;
|
||||
};
|
||||
|
||||
static int s_poolSize = 128;
|
||||
PHONON_GLOBAL_STATIC(MemoryPoolVector, s_memoryPool)
|
||||
|
||||
void *LockFreeQueueBase::NodeBaseKeepNodePool::operator new(size_t s)
|
||||
{
|
||||
MemoryPool &p = (*s_memoryPool)[s];
|
||||
NodeBase *node = p.stack;
|
||||
if (node) {
|
||||
if (!p.stack.testAndSetAcquire(node, const_cast<NodeBase *>(node->next))) {
|
||||
return ::malloc(s);
|
||||
}
|
||||
p.count.deref();
|
||||
return node;
|
||||
}
|
||||
return ::malloc(s);
|
||||
}
|
||||
|
||||
void LockFreeQueueBase::NodeBaseKeepNodePool::operator delete(void *ptr, size_t s)
|
||||
{
|
||||
MemoryPool &p = (*s_memoryPool)[s];
|
||||
if (p.count > s_poolSize) {
|
||||
::free(ptr);
|
||||
return;
|
||||
}
|
||||
NodeBase *node = static_cast<NodeBase *>(ptr);
|
||||
NodeBase *next = p.stack;
|
||||
node->next = next;
|
||||
if (!p.stack.testAndSetOrdered(next, node)) {
|
||||
::free(ptr);
|
||||
return;
|
||||
}
|
||||
p.count.ref();
|
||||
}
|
||||
|
||||
void LockFreeQueueBase::NodeBaseKeepNodePool::clear()
|
||||
{
|
||||
s_memoryPool->clearAllPools();
|
||||
}
|
||||
|
||||
void LockFreeQueueBase::NodeBaseKeepNodePool::setPoolSize(int s)
|
||||
{
|
||||
s_poolSize = s;
|
||||
}
|
||||
|
||||
int LockFreeQueueBase::NodeBaseKeepNodePool::poolSize()
|
||||
{
|
||||
return s_poolSize;
|
||||
}
|
||||
|
||||
class LockFreeQueueBasePrivate
|
||||
{
|
||||
public:
|
||||
LockFreeQueueBasePrivate();
|
||||
~LockFreeQueueBasePrivate();
|
||||
QReadWriteLock dataReadyHandlerMutex;
|
||||
LockFreeQueueBase::NodeBase *sentinel; // end marker
|
||||
LockFreeQueueBase::NodeBase *lastHeadNode;
|
||||
QAtomicPointer<LockFreeQueueBase::NodeBasePointer> queueHead;
|
||||
QAtomicPointer<LockFreeQueueBase::NodeBasePointer> queueTail;
|
||||
QAtomicInt size;
|
||||
LockFreeQueueBase::DataReadyHandler *dataReadyHandler;
|
||||
};
|
||||
|
||||
LockFreeQueueBasePrivate::LockFreeQueueBasePrivate()
|
||||
: sentinel(new LockFreeQueueBase::NodeBase(0)),
|
||||
lastHeadNode(new LockFreeQueueBase::NodeBase(sentinel)),
|
||||
queueHead(&lastHeadNode->next),
|
||||
queueTail(&lastHeadNode->next),
|
||||
size(0),
|
||||
dataReadyHandler(0)
|
||||
{
|
||||
// let d->sentinel point to itself so that we can use d->sentinel->next as
|
||||
// QAtomicPointer<Node> for d->queueHead and d->queueTail
|
||||
sentinel->next = sentinel;
|
||||
}
|
||||
|
||||
LockFreeQueueBasePrivate::~LockFreeQueueBasePrivate()
|
||||
{
|
||||
Q_ASSERT(queueHead);
|
||||
LockFreeQueueBase::NodeBase *node = lastHeadNode;
|
||||
while (node != sentinel) {
|
||||
LockFreeQueueBase::NodeBase *toDelete = node;
|
||||
node = const_cast<LockFreeQueueBase::NodeBase *>(node->next);
|
||||
toDelete->deref();
|
||||
}
|
||||
}
|
||||
|
||||
LockFreeQueueBase::LockFreeQueueBase()
|
||||
: d(new LockFreeQueueBasePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
LockFreeQueueBase::~LockFreeQueueBase()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void LockFreeQueueBase::setDataReadyHandler(DataReadyHandler *h)
|
||||
{
|
||||
QWriteLocker lock(&d->dataReadyHandlerMutex);
|
||||
d->dataReadyHandler = h;
|
||||
}
|
||||
|
||||
void LockFreeQueueBase::_enqueue(NodeBase *newNode)
|
||||
{
|
||||
newNode->ref();
|
||||
newNode->next = d->sentinel;
|
||||
/*if (d->size > 0 && newNode->priority > std::numeric_limits<int>::min()) {
|
||||
NodeBasePointer *node = d->queueHead.fetchAndStoreRelaxed(&d->sentinel->next);
|
||||
if (node == &d->sentinel->next) {
|
||||
// Another thread got the real node, we just got the placeholder telling us to not touch
|
||||
// anything. As we replaced &d->sentinel->next with &d->sentinel->next in
|
||||
// d->queueHead we don't have to reset anything.
|
||||
}
|
||||
// node is a pointer to a Node::next member pointing to the first entry in
|
||||
// the list
|
||||
if (*node == d->sentinel) {
|
||||
// the list is empty, good
|
||||
}
|
||||
} else {*/
|
||||
// just append
|
||||
NodeBasePointer &lastNextPointer = *d->queueTail.fetchAndStoreAcquire(&newNode->next);
|
||||
lastNextPointer = newNode;
|
||||
d->size.ref();
|
||||
|
||||
if (d->dataReadyHandler) {
|
||||
QReadLocker lock(&d->dataReadyHandlerMutex);
|
||||
if (d->dataReadyHandler) {
|
||||
d->dataReadyHandler->dataReady();
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
LockFreeQueueBase::NodeBase *LockFreeQueueBase::_acquireHeadNodeBlocking()
|
||||
{
|
||||
NodeBasePointer *node = 0;
|
||||
while (d->size > 0) {
|
||||
if ((node = d->queueHead.fetchAndStoreRelaxed(&d->sentinel->next)) != &d->sentinel->next) {
|
||||
// node is a pointer to a Node::next member pointing to the first entry in the list
|
||||
if (*node != d->sentinel) {
|
||||
d->size.deref();
|
||||
NodeBase *_node = const_cast<NodeBase *>(*node); // cast volatile away
|
||||
_node->ref();
|
||||
|
||||
NodeBase *toDeref = d->lastHeadNode;
|
||||
d->lastHeadNode = _node;
|
||||
const bool check = d->queueHead.testAndSetRelease(&d->sentinel->next, &_node->next);
|
||||
Q_ASSERT(check); Q_UNUSED(check);
|
||||
toDeref->deref();
|
||||
|
||||
return _node;
|
||||
}
|
||||
// empty (d->size == 0), put it back
|
||||
const bool check = d->queueHead.testAndSetRelaxed(&d->sentinel->next, node);
|
||||
Q_ASSERT(check); Q_UNUSED(check);
|
||||
// try again, with some luck d->size is > 0 again
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LockFreeQueueBase::NodeBase *LockFreeQueueBase::_acquireHeadNode()
|
||||
{
|
||||
if (*d->queueHead == d->sentinel || d->queueHead == &d->sentinel->next) {
|
||||
return 0;
|
||||
}
|
||||
// setting d->queueHead to &d->sentinel->next makes the above check fail (i.e. all
|
||||
// other threads in a dequeue function will exit). Also enqueue will not modify
|
||||
// this as d->queueTail references d->lastHeadNode->next which != d->sentinel->next
|
||||
NodeBasePointer *node = d->queueHead.fetchAndStoreRelaxed(&d->sentinel->next);
|
||||
if (node == &d->sentinel->next) {
|
||||
// Another thread got the real node, we just got the placeholder telling us to not touch
|
||||
// anything. As we replaced &d->sentinel->next with &d->sentinel->next in
|
||||
// d->queueHead we don't have to reset anything.
|
||||
return 0;
|
||||
}
|
||||
// node is a pointer to a Node::next member pointing to the first entry in
|
||||
// the list
|
||||
if (*node == d->sentinel) {
|
||||
//qDebug() << "empty, put it back";
|
||||
const bool check = d->queueHead.testAndSetRelaxed(&d->sentinel->next, node);
|
||||
Q_ASSERT(check); Q_UNUSED(check);
|
||||
return 0;
|
||||
}
|
||||
d->size.deref();
|
||||
|
||||
NodeBase *_node = const_cast<NodeBase *>(*node);
|
||||
_node->ref();
|
||||
|
||||
NodeBase *toDeref = d->lastHeadNode;
|
||||
d->lastHeadNode = _node;
|
||||
const bool check = d->queueHead.testAndSetRelease(&d->sentinel->next, &_node->next);
|
||||
Q_ASSERT(check); Q_UNUSED(check);
|
||||
toDeref->deref();
|
||||
|
||||
return _node;
|
||||
}
|
||||
|
||||
int LockFreeQueueBase::size() const
|
||||
{
|
||||
return d->size;
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef LOCKFREEQUEUE_P_H
|
||||
#define LOCKFREEQUEUE_P_H
|
||||
|
||||
#include <QtCore/QVector>
|
||||
|
||||
class LockFreeQueueBasePrivate;
|
||||
struct MemoryPool;
|
||||
class LockFreeQueueBase
|
||||
{
|
||||
friend class LockFreeQueueBasePrivate;
|
||||
public:
|
||||
struct DataReadyHandler
|
||||
{
|
||||
virtual ~DataReadyHandler() {}
|
||||
virtual void dataReady() = 0;
|
||||
};
|
||||
|
||||
void setDataReadyHandler(DataReadyHandler *);
|
||||
|
||||
int size() const;
|
||||
bool isEmpty() const { return 0 == size(); }
|
||||
|
||||
protected:
|
||||
friend struct MemoryPool;
|
||||
LockFreeQueueBase();
|
||||
~LockFreeQueueBase();
|
||||
|
||||
public:
|
||||
class NodeBase;
|
||||
typedef volatile NodeBase * NodeBasePointer;
|
||||
class NodeBase
|
||||
{
|
||||
public:
|
||||
inline NodeBase(int p) : priority(p) {}
|
||||
inline NodeBase(NodeBase *n) : next(n), priority(0) {}
|
||||
NodeBasePointer next;
|
||||
int priority;
|
||||
|
||||
inline void ref() { refCount.ref(); }
|
||||
inline void deref() { if (!refCount.deref()) delete this; }
|
||||
|
||||
protected:
|
||||
~NodeBase() { Q_ASSERT(refCount == 0); }
|
||||
private:
|
||||
QAtomicInt refCount;
|
||||
};
|
||||
|
||||
struct NodeBaseKeepNodePool : public NodeBase
|
||||
{
|
||||
inline NodeBaseKeepNodePool(int priority) : NodeBase(priority) {}
|
||||
// allocation is a bottleneck in _enqueue
|
||||
void *operator new(size_t s);
|
||||
void operator delete(void *p, size_t s);
|
||||
|
||||
static void clear();
|
||||
static void setPoolSize(int);
|
||||
static int poolSize();
|
||||
};
|
||||
|
||||
typedef NodeBase StdNewDeleteMemoryManagement;
|
||||
typedef NodeBaseKeepNodePool KeepNodePoolMemoryManagement;
|
||||
protected:
|
||||
|
||||
void _enqueue(NodeBase *);
|
||||
NodeBase *_acquireHeadNode();
|
||||
NodeBase *_acquireHeadNodeBlocking();
|
||||
|
||||
LockFreeQueueBasePrivate *const d;
|
||||
|
||||
};
|
||||
|
||||
template<class T, class MemoryManagementNodeBase = LockFreeQueueBase::StdNewDeleteMemoryManagement>
|
||||
class LockFreeQueue : public LockFreeQueueBase
|
||||
{
|
||||
public:
|
||||
enum BlockingSwitch {
|
||||
BlockUnlessEmpty,
|
||||
NeverBlock
|
||||
};
|
||||
|
||||
struct Node : public MemoryManagementNodeBase
|
||||
{
|
||||
inline Node(const T &d, int priority) : MemoryManagementNodeBase(priority), data(d) {}
|
||||
T data;
|
||||
};
|
||||
|
||||
inline void enqueue(const T &data, int priority = 0)
|
||||
{
|
||||
_enqueue(new Node(data, 0));
|
||||
}
|
||||
|
||||
inline void dequeue(QVector<T> &data, BlockingSwitch block = BlockUnlessEmpty)
|
||||
{
|
||||
int count = 0;
|
||||
while (count < data.capacity()) {
|
||||
NodeBase *node = (block == NeverBlock) ? _acquireHeadNode() : _acquireHeadNodeBlocking();
|
||||
if (!node) {
|
||||
break;
|
||||
}
|
||||
if (count < data.size()) {
|
||||
data[count] = static_cast<Node *>(node)->data;
|
||||
} else {
|
||||
data << static_cast<Node *>(node)->data;
|
||||
}
|
||||
++count;
|
||||
node->deref();
|
||||
}
|
||||
data.resize(count);
|
||||
}
|
||||
|
||||
inline bool dequeue(T *data, BlockingSwitch block = BlockUnlessEmpty)
|
||||
{
|
||||
NodeBase *node = (block == NeverBlock) ? _acquireHeadNode() : _acquireHeadNodeBlocking();
|
||||
if (node) {
|
||||
*data = static_cast<Node *>(node)->data;
|
||||
node->deref();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline LockFreeQueue<T> &operator<<(const T &data) { enqueue(data); return *this; }
|
||||
inline LockFreeQueue<T> &operator>>(T &data)
|
||||
{
|
||||
NodeBase *node = _acquireHeadNodeBlocking();
|
||||
if (node) {
|
||||
data = static_cast<Node *>(node)->data;
|
||||
node->deref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // LOCKFREEQUEUE_P_H
|
|
@ -1,82 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
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) version 3 or any later version
|
||||
accepted by the membership of KDE e.V. (or its successor approved
|
||||
by the membership of KDE e.V.), Nokia Corporation (or its successors,
|
||||
if any) and the KDE Free Qt Foundation, which shall act as a proxy
|
||||
defined in Section 14 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "mediasource.h"
|
||||
#include "mediasource_p.h"
|
||||
|
||||
#define S_D(Class) Class##Private *d = reinterpret_cast<Class##Private *>(Phonon::MediaSource::d.data())
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
MediaSource::MediaSource(const MediaSource &rhs)
|
||||
: Phonon::MediaSource(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
MediaSource::MediaSource(const QList<Phonon::MediaSource> &mediaList)
|
||||
: Phonon::MediaSource(*new MediaSourcePrivate(Link))
|
||||
{
|
||||
S_D(MediaSource);
|
||||
d->linkedSources = mediaList;
|
||||
foreach (const Phonon::MediaSource &ms, mediaList) {
|
||||
Q_ASSERT(static_cast<MediaSource::Type>(ms.type()) != Link);
|
||||
Q_UNUSED(ms);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
MediaSource::MediaSource(const VideoCaptureDevice &videoDevice)
|
||||
: Phonon::MediaSource(*new MediaSourcePrivate(VideoCaptureDeviceSource))
|
||||
{
|
||||
Q_UNUSED(videoDevice);
|
||||
}
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
MediaSource &MediaSource::operator=(const MediaSource &rhs)
|
||||
{
|
||||
d = rhs.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool MediaSource::operator==(const MediaSource &rhs) const
|
||||
{
|
||||
return d == rhs.d;
|
||||
}
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
VideoCaptureDevice MediaSource::videoCaptureDevice() const
|
||||
{
|
||||
return phononVcdToExperimentalVcd(Phonon::MediaSource::videoCaptureDevice());
|
||||
}
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
QList<Phonon::MediaSource> MediaSource::substreams() const
|
||||
{
|
||||
S_D(MediaSource);
|
||||
return d->linkedSources;
|
||||
}
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
|
@ -1,79 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_MEDIASOURCE_H
|
||||
#define PHONON_EXPERIMENTAL_MEDIASOURCE_H
|
||||
|
||||
#include "../mediasource.h"
|
||||
#include "export.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class PHONONEXPERIMENTAL_EXPORT MediaSource : public Phonon::MediaSource
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
Link = 0xffff,
|
||||
VideoCaptureDeviceSource
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a copy of \p rhs.
|
||||
*
|
||||
* This constructor is fast thanks to explicit sharing.
|
||||
*/
|
||||
MediaSource(const MediaSource &rhs);
|
||||
|
||||
MediaSource(const QList<Phonon::MediaSource> &mediaList);
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
MediaSource(const VideoCaptureDevice &videoDevice);
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
|
||||
/**
|
||||
* Assigns \p rhs to this MediaSource and returns a reference to this MediaSource.
|
||||
*
|
||||
* This operation is fast thanks to explicit sharing.
|
||||
*/
|
||||
MediaSource &operator=(const MediaSource &rhs);
|
||||
|
||||
/**
|
||||
* Returns \p true if this MediaSource is equal to \p rhs; otherwise returns \p false.
|
||||
*/
|
||||
bool operator==(const MediaSource &rhs) const;
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
VideoCaptureDevice videoCaptureDevice() const;
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
QList<Phonon::MediaSource> substreams() const;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_MEDIASOURCE_H
|
|
@ -1,49 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_MEDIASOURCE_P_H
|
||||
#define PHONON_EXPERIMENTAL_MEDIASOURCE_P_H
|
||||
|
||||
#include "mediasource.h"
|
||||
#include "../mediasource_p.h"
|
||||
#include "objectdescription.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class MediaSourcePrivate : public Phonon::MediaSourcePrivate
|
||||
{
|
||||
public:
|
||||
MediaSourcePrivate(MediaSource::Type t)
|
||||
: Phonon::MediaSourcePrivate(static_cast<Phonon::MediaSource::Type>(t))
|
||||
{
|
||||
}
|
||||
|
||||
QList<Phonon::MediaSource> linkedSources;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_MEDIASOURCE_P_H
|
|
@ -1,59 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
* Copyright © 2010 Casian Andrei <skeletk13@gmail.com>
|
||||
* Copyright © 2010 Harald Sitter <apachelogger@ubuntu.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) version 3, or any
|
||||
* later version accepted by the membership of KDE e.V. (or its
|
||||
* successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
* (or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
* act as a proxy defined in Section 6 of version 3 of the license.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "objectdescription.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
VideoCaptureDevice phononVcdToExperimentalVcd(const Phonon::VideoCaptureDevice &vcd)
|
||||
{
|
||||
QHash<QByteArray, QVariant> properties;
|
||||
const QList<QByteArray> &propertyNames = vcd.propertyNames();
|
||||
int pi, pn = propertyNames.count();
|
||||
for (pi = 0; pi < pn; ++ pi)
|
||||
properties[propertyNames[pi]] = vcd.property(propertyNames[pi].constData());
|
||||
|
||||
return VideoCaptureDevice(vcd.index(), properties);
|
||||
}
|
||||
|
||||
Phonon::VideoCaptureDevice phononExperimentalVcdToVcd(const Phonon::Experimental::VideoCaptureDevice &vcd)
|
||||
{
|
||||
QHash<QByteArray, QVariant> properties;
|
||||
const QList<QByteArray> &propertyNames = vcd.propertyNames();
|
||||
int pi, pn = propertyNames.count();
|
||||
for (pi = 0; pi < pn; ++ pi)
|
||||
properties[propertyNames[pi]] = vcd.property(propertyNames[pi].constData());
|
||||
|
||||
return Phonon::VideoCaptureDevice(vcd.index(), properties);
|
||||
}
|
||||
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
} // Experimental namespace
|
||||
} // Phonon namespace
|
|
@ -1,58 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright © 2008 Matthias Kretz <kretz@kde.org>
|
||||
Copyright © 2010 Harald Sitter <apachelogger@ubuntu.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#ifndef PHONON_EXPERIMENTAL_OBJECTDESCRIPTION_H
|
||||
#define PHONON_EXPERIMENTAL_OBJECTDESCRIPTION_H
|
||||
|
||||
#include "../objectdescription.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
#ifndef PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
enum ObjectDescriptionType
|
||||
{
|
||||
VideoCaptureDeviceType = 0x10000
|
||||
};
|
||||
|
||||
typedef Phonon::ObjectDescription<static_cast<Phonon::ObjectDescriptionType>(Phonon::Experimental::VideoCaptureDeviceType)> VideoCaptureDevice;
|
||||
|
||||
VideoCaptureDevice phononVcdToExperimentalVcd(const Phonon::VideoCaptureDevice &vcd);
|
||||
|
||||
/**
|
||||
* Generates a Phonon::VideoCaptureDevice from an equal object of
|
||||
* the Phonon::Experimental namespace.
|
||||
*
|
||||
* @arg vcd the VideoCaptureDevice to take as reference
|
||||
* @return a Phonon::VideoCaptureDevice instance with the same properties as the incoming vcd
|
||||
*/
|
||||
Phonon::VideoCaptureDevice phononExperimentalVcdToVcd(const Phonon::Experimental::VideoCaptureDevice &vcd);
|
||||
|
||||
#endif // PHONON_NO_VIDEOCAPTURE
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_OBJECTDESCRIPTION_H
|
|
@ -1,60 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "packet.h"
|
||||
#include "packet_p.h"
|
||||
#include "packetpool.h"
|
||||
#include "packetpool_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
Q_GLOBAL_STATIC(PacketPrivate, shared_null_packet)
|
||||
|
||||
Packet::Packet() : d_ptr(shared_null_packet()) { d_ptr->ref.ref(); }
|
||||
Packet::Packet(PacketPool &pool) : d_ptr(pool.d_ptr->acquirePacket().d_ptr) { d_ptr->ref.ref(); }
|
||||
Packet::Packet(const Packet &rhs) : d_ptr(rhs.d_ptr) { d_ptr->ref.ref(); }
|
||||
Packet::Packet(PacketPrivate &dd) : d_ptr(&dd) { d_ptr->ref.ref(); }
|
||||
Packet &Packet::operator=(const Packet &rhs)
|
||||
{
|
||||
if (!d_ptr->ref.deref()) {
|
||||
Q_ASSERT(d_ptr->m_pool);
|
||||
d_ptr->m_pool->releasePacket(*this);
|
||||
}
|
||||
d_ptr = rhs.d_ptr;
|
||||
d_ptr->ref.ref();
|
||||
return *this;
|
||||
}
|
||||
Packet::~Packet()
|
||||
{
|
||||
if (!d_ptr->ref.deref()) {
|
||||
Q_ASSERT(d_ptr->m_pool);
|
||||
d_ptr->m_pool->releasePacket(*this);
|
||||
}
|
||||
}
|
||||
bool Packet::operator==(const Packet &rhs) const { return d_ptr == rhs.d_ptr; }
|
||||
bool Packet::operator!=(const Packet &rhs) const { return d_ptr != rhs.d_ptr; }
|
||||
bool Packet::isNull() const { return d_ptr->m_pool == 0; }
|
||||
const char *Packet::data() const { return d_ptr->m_data; }
|
||||
char *Packet::data() { return d_ptr->m_data; }
|
||||
int Packet::size() const { return d_ptr->m_size; }
|
||||
void Packet::setSize(int size) { d_ptr->m_size = size; }
|
||||
int Packet::capacity() const { return d_ptr->m_pool ? d_ptr->m_pool->packetSize : 0; }
|
||||
|
||||
} // namespace Phonon
|
|
@ -1,129 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_PACKET_H
|
||||
#define PHONON_PACKET_H
|
||||
|
||||
#include "export.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class PacketPool;
|
||||
|
||||
struct PacketPrivate;
|
||||
/** \class Packet packetpool.h phonon/Packet
|
||||
* \brief Class to access memory preallocated by PacketPool
|
||||
*
|
||||
* \note PacketPool and Packet are threadsafe.
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT Packet
|
||||
{
|
||||
friend class PacketPoolPrivate;
|
||||
Q_DECLARE_PRIVATE(Packet)
|
||||
public:
|
||||
/**
|
||||
* Constructs a null packet.
|
||||
*
|
||||
* \see isNull
|
||||
*/
|
||||
Packet();
|
||||
/**
|
||||
* Returns a packet with a capacity of pool.packetSize if there is still free data in the
|
||||
* PacketPool. Returns a null packet otherwise. The size will initially be set to 0.
|
||||
*/
|
||||
explicit Packet(PacketPool &pool);
|
||||
/**
|
||||
* Returns a shared copy of the object. Note that Packet will not detach (and it can not
|
||||
* detach as there's a fixed amount of memory preallocated. If you want to copy the actual
|
||||
* memory data you have to request another packet from the pool and copy the memory
|
||||
* yourself.)
|
||||
*/
|
||||
Packet(const Packet &rhs);
|
||||
/**
|
||||
* Assigns a shared copy of the object. Note that Packet will not detach (and it can not
|
||||
* detach as there's a fixed amount of memory preallocated. If you want to copy the actual
|
||||
* memory data you have to request another packet from the pool and copy the memory
|
||||
* yourself.)
|
||||
*/
|
||||
Packet &operator=(const Packet &rhs);
|
||||
|
||||
/**
|
||||
* Dereferences the packet data. If this is the last reference that gets released the packet
|
||||
* becomes available in the PacketPool again automatically.
|
||||
*/
|
||||
~Packet();
|
||||
|
||||
/**
|
||||
* Returns whether the packets reference the same data.
|
||||
*/
|
||||
bool operator==(const Packet &rhs) const;
|
||||
|
||||
/**
|
||||
* Returns whether the packets reference different data.
|
||||
*/
|
||||
bool operator!=(const Packet &rhs) const;
|
||||
|
||||
/**
|
||||
* Returns whether this object is a null packet.
|
||||
*
|
||||
* \see Packet()
|
||||
*/
|
||||
bool isNull() const;
|
||||
|
||||
/**
|
||||
* Returns a pointer to read the data this packet references.
|
||||
*
|
||||
* You may read size() bytes.
|
||||
*/
|
||||
const char *data() const;
|
||||
|
||||
/**
|
||||
* Returns a pointer to read and write the data this packet references.
|
||||
*
|
||||
* You may read size() bytes.
|
||||
* You may write capacity() bytes.
|
||||
* If you write to this pointer do not forget to adjust the size by calling setSize().
|
||||
*/
|
||||
char *data();
|
||||
|
||||
/**
|
||||
* Returns the number of bytes that have a defined value.
|
||||
*/
|
||||
int size() const;
|
||||
|
||||
/**
|
||||
* Sets how many bytes in the data pointer have a defined value.
|
||||
*/
|
||||
void setSize(int size);
|
||||
|
||||
/**
|
||||
* Returns the number of bytes that may be accessed.
|
||||
*/
|
||||
int capacity() const;
|
||||
|
||||
protected:
|
||||
explicit Packet(PacketPrivate &dd);
|
||||
PacketPrivate *d_ptr;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
#endif // PHONON_PACKET_H
|
|
@ -1,45 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) version 3.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_PACKET_P_H
|
||||
#define PHONON_PACKET_P_H
|
||||
|
||||
#include <QtCore/qatomic.h>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class PacketPoolPrivate;
|
||||
struct PacketPrivate
|
||||
{
|
||||
inline PacketPrivate(char *_data, PacketPoolPrivate *_pool)
|
||||
: ref(0), m_size(0), m_data(_data), m_pool(_pool) {}
|
||||
inline PacketPrivate() : ref(1), m_size(0), m_data(0), m_pool(0) {}
|
||||
|
||||
QAtomicInt ref;
|
||||
|
||||
int m_size;
|
||||
char *const m_data;
|
||||
PacketPoolPrivate *const m_pool;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_PACKET_P_H
|
|
@ -1,115 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "packetpool.h"
|
||||
#include "packetpool_p.h"
|
||||
#include "packet.h"
|
||||
#include "packet_p.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
int PacketPool::packetSize() const { return d_ptr->packetSize; }
|
||||
int PacketPool::poolSize() const { return d_ptr->poolSize; }
|
||||
int PacketPool::unusedPackets() const { return d_ptr->ringBufferSize; }
|
||||
|
||||
PacketPoolPrivate::PacketPoolPrivate(int _packetSize, int _poolSize)
|
||||
: freePackets(new PacketPrivate *[_poolSize]),
|
||||
packetMemory(new char[_packetSize * _poolSize]),
|
||||
readPosition(0), writePosition(0),
|
||||
ringBufferSize(_poolSize),
|
||||
packetSize(_packetSize),
|
||||
poolSize(_poolSize)
|
||||
{
|
||||
for (int i = 0; i < _poolSize; ++i) {
|
||||
freePackets[i] = new PacketPrivate(&packetMemory[i * packetSize], this);
|
||||
}
|
||||
}
|
||||
|
||||
PacketPoolPrivate::~PacketPoolPrivate()
|
||||
{
|
||||
Q_ASSERT(poolSize == ringBufferSize);
|
||||
for (int i = 0; i < poolSize; ++i) {
|
||||
delete freePackets[i];
|
||||
}
|
||||
delete[] freePackets;
|
||||
delete[] packetMemory;
|
||||
}
|
||||
|
||||
void PacketPoolPrivate::releasePacket(const Packet &packet)
|
||||
{
|
||||
const int _writePos = writePosition.fetchAndAddAcquire(1);
|
||||
int pos = _writePos;
|
||||
while (pos >= poolSize) {
|
||||
pos -= poolSize;
|
||||
}
|
||||
writePosition.testAndSetRelease(_writePos, pos);
|
||||
freePackets[pos] = packet.d_ptr;
|
||||
ringBufferSize.ref();
|
||||
}
|
||||
|
||||
Packet PacketPoolPrivate::acquirePacket()
|
||||
{
|
||||
const int s = ringBufferSize.fetchAndAddRelaxed(-1);
|
||||
if (s <= 0) {
|
||||
ringBufferSize.fetchAndAddRelaxed(1);
|
||||
return Packet();
|
||||
}
|
||||
const int _readPos = readPosition.fetchAndAddRelaxed(1);
|
||||
int pos = _readPos;
|
||||
while (pos >= poolSize) {
|
||||
pos -= poolSize;
|
||||
}
|
||||
readPosition.testAndSetRelease(_readPos, pos);
|
||||
freePackets[pos]->m_size = 0;
|
||||
return Packet(*freePackets[pos]);
|
||||
}
|
||||
|
||||
PacketPool::PacketPool(int packetSize, int _poolSize)
|
||||
: d_ptr(new PacketPoolPrivate(packetSize, _poolSize))
|
||||
{
|
||||
d_ptr->ref.ref();
|
||||
}
|
||||
|
||||
PacketPool::PacketPool(const PacketPool &rhs)
|
||||
: d_ptr(rhs.d_ptr)
|
||||
{
|
||||
d_ptr->ref.ref();
|
||||
}
|
||||
|
||||
PacketPool &PacketPool::operator=(const PacketPool &rhs)
|
||||
{
|
||||
if (d_ptr != rhs.d_ptr) {
|
||||
if (!d_ptr->ref.deref()) {
|
||||
delete d_ptr;
|
||||
}
|
||||
d_ptr = rhs.d_ptr;
|
||||
d_ptr->ref.ref();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
PacketPool::~PacketPool()
|
||||
{
|
||||
if (!d_ptr->ref.deref()) {
|
||||
delete d_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
|
@ -1,79 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_PACKETPOOL_H
|
||||
#define PHONON_PACKETPOOL_H
|
||||
|
||||
#include "export.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
class Packet;
|
||||
class PacketPoolPrivate;
|
||||
/** \class PacketPool packetpool.h phonon/PacketPool
|
||||
* \brief Class to preallocate memory.
|
||||
*
|
||||
* \note PacketPool and Packet are threadsafe.
|
||||
*
|
||||
* \author Matthias Kretz <kretz@kde.org>
|
||||
*/
|
||||
class PHONONEXPERIMENTAL_EXPORT PacketPool
|
||||
{
|
||||
Q_DECLARE_PRIVATE(PacketPool)
|
||||
friend class Packet;
|
||||
public:
|
||||
/**
|
||||
* Allocates \p numberOfPackets packets of \p packetSize bytes each. The memory can be
|
||||
* accessed through Packet objects.
|
||||
*/
|
||||
PacketPool(int packetSize, int numberOfPackets);
|
||||
/**
|
||||
* Copy constructor. Copying is fast since the class is explicitly shared.
|
||||
*/
|
||||
PacketPool(const PacketPool &);
|
||||
/**
|
||||
* Destructs this object. If this is the last reference to the pool the memory will be
|
||||
* freed.
|
||||
*/
|
||||
~PacketPool();
|
||||
/**
|
||||
* Assignmen operator. Copying is fast since the class is explicitly shared.
|
||||
*/
|
||||
PacketPool &operator=(const PacketPool &);
|
||||
|
||||
/**
|
||||
* Returns the packet size that was set in the constructor.
|
||||
*/
|
||||
int packetSize() const;
|
||||
/**
|
||||
* Returns the number of packets that was requested in the constructor.
|
||||
*/
|
||||
int poolSize() const;
|
||||
/**
|
||||
* Returns the number of packets that are still available for use.
|
||||
*/
|
||||
int unusedPackets() const;
|
||||
|
||||
private:
|
||||
PacketPoolPrivate *d_ptr;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
#endif // PHONON_PACKETPOOL_H
|
|
@ -1,61 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) version 3.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PHONON_PACKETPOOL_P_H
|
||||
#define PHONON_PACKETPOOL_P_H
|
||||
|
||||
#include <QtCore/qatomic.h>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
struct PacketPrivate;
|
||||
class PacketPoolPrivate
|
||||
{
|
||||
friend class PacketPool;
|
||||
friend class Packet;
|
||||
public:
|
||||
~PacketPoolPrivate();
|
||||
|
||||
Packet acquirePacket();
|
||||
void releasePacket(const Packet &);
|
||||
|
||||
protected:
|
||||
QAtomicInt ref;
|
||||
|
||||
private:
|
||||
PacketPoolPrivate(int packetSize, int _poolSize);
|
||||
|
||||
// C-array of PacketPrivate*
|
||||
PacketPrivate **freePackets;
|
||||
char *const packetMemory;
|
||||
|
||||
QAtomicInt readPosition;
|
||||
QAtomicInt writePosition;
|
||||
QAtomicInt ringBufferSize;
|
||||
|
||||
const int packetSize;
|
||||
const int poolSize;
|
||||
};
|
||||
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_PACKETPOOL_P_H
|
|
@ -1,67 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_X_PHONONNAMESPACE_H
|
||||
#define PHONON_X_PHONONNAMESPACE_H
|
||||
|
||||
#include "../phononnamespace.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
enum BitRate {
|
||||
UnknownBitRate = -1,
|
||||
/**
|
||||
* Audio Data is transported as values from -128 to 127.
|
||||
*/
|
||||
Signed8Bit = 100,
|
||||
/**
|
||||
* Audio Data is transported as values from 0 to 255
|
||||
*/
|
||||
Unsigned8Bit = 200,
|
||||
/**
|
||||
* Audio Data is transported as values from -2^15 to 2^15-1
|
||||
*/
|
||||
Signed16Bit = 300,
|
||||
Signed18Bit = 400,
|
||||
Signed20Bit = 500,
|
||||
/**
|
||||
* Audio Data is transported as values from -2^23 to 2^23-1. The data is packed in 3
|
||||
* Bytes and not padded with a 0 Byte.
|
||||
*/
|
||||
Signed24Bit = 600,
|
||||
/**
|
||||
* Audio Data is transported as values from -2^31 to 2^31-1
|
||||
*/
|
||||
Signed32Bit = 700,
|
||||
/**
|
||||
* Audio Data is transported as values from -1.0 to 1.0
|
||||
*/
|
||||
Float32Bit = 800
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_X_PHONONNAMESPACE_H
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_RTPRECEIVER_H
|
||||
#define PHONON_RTPRECEIVER_H
|
||||
|
||||
#include "../mediaobject.h"
|
||||
#include "../phonondefs.h"
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class RtpReceiver : public MediaProducer
|
||||
{
|
||||
Q_OBJECT
|
||||
K_DECLARE_PRIVATE(RtpReceiver)
|
||||
PHONON_HEIR(VideoDataOutput)
|
||||
public:
|
||||
setUrl(const KUrl &);
|
||||
setBandwidth(int kiloBitPerSecond);
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
#endif // PHONON_RTPRECEIVER_H
|
|
@ -1,44 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONON_EXPERIMENTAL_SNAPSHOTINTERFACE_H
|
||||
#define PHONON_EXPERIMENTAL_SNAPSHOTINTERFACE_H
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
namespace Experimental
|
||||
{
|
||||
|
||||
class SnapshotInterface
|
||||
{
|
||||
public:
|
||||
virtual ~SnapshotInterface() {}
|
||||
|
||||
virtual QImage snapshot() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Experimental
|
||||
} // namespace Phonon
|
||||
|
||||
Q_DECLARE_INTERFACE(Phonon::Experimental::SnapshotInterface, "0SnapshotInterface.Phonon.kde.org")
|
||||
|
||||
#endif // PHONON_EXPERIMENTAL_SNAPSHOTINTERFACE_H
|
|
@ -1,123 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) version 3, or any
|
||||
later version accepted by the membership of KDE e.V. (or its
|
||||
successor approved by the membership of KDE e.V.), Nokia Corporation
|
||||
(or its successors, if any) and the KDE Free Qt Foundation, which shall
|
||||
act as a proxy defined in Section 6 of version 3 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "streameventqueue_p.h"
|
||||
#include "phononnamespace_p.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
|
||||
//////////////////////////////////////////
|
||||
// any thread
|
||||
|
||||
StreamEventQueue::StreamEventQueue()
|
||||
: m_dropWriteCommands(0),
|
||||
m_connecting(0)
|
||||
{
|
||||
}
|
||||
|
||||
StreamEventQueue::~StreamEventQueue()
|
||||
{
|
||||
}
|
||||
|
||||
void StreamEventQueue::setBackendCommandHandler(LockFreeQueueBase::DataReadyHandler *h)
|
||||
{
|
||||
m_forBackend.setDataReadyHandler(h);
|
||||
}
|
||||
|
||||
void StreamEventQueue::setFrontendCommandHandler(LockFreeQueueBase::DataReadyHandler *h)
|
||||
{
|
||||
m_forFrontend.setDataReadyHandler(h);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
// frontend thread
|
||||
|
||||
void StreamEventQueue::sendToBackend(CommandType command, const QVariant &data)
|
||||
{
|
||||
m_forBackend.enqueue(Command(command, data));
|
||||
}
|
||||
|
||||
bool StreamEventQueue::nextCommandForFrontend(Command *command)
|
||||
{
|
||||
Q_ASSERT(command);
|
||||
return m_forFrontend.dequeue(command);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
// backend thread
|
||||
|
||||
void StreamEventQueue::sendToFrontend(CommandType command, const QVariant &data)
|
||||
{
|
||||
switch (command) {
|
||||
case Seek:
|
||||
case Reset:
|
||||
++m_dropWriteCommands;
|
||||
break;
|
||||
case Connect:
|
||||
++m_connecting;
|
||||
m_dropWriteCommands = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_forFrontend.enqueue(Command(command, data));
|
||||
}
|
||||
|
||||
bool StreamEventQueue::nextCommandForBackend(Command *command)
|
||||
{
|
||||
Q_ASSERT(command);
|
||||
bool valid = m_forBackend.dequeue(command);
|
||||
while (valid) {
|
||||
if (m_connecting) {
|
||||
if (command->command == ConnectDone) {
|
||||
--m_connecting;
|
||||
}
|
||||
// drop all other commands until m_connecting == 0
|
||||
} else if (m_dropWriteCommands) {
|
||||
switch (command->command) {
|
||||
case Write:
|
||||
case EndOfData:
|
||||
// drop until m_dropWriteCommands == 0
|
||||
break;
|
||||
case SeekDone:
|
||||
case ResetDone:
|
||||
--m_dropWriteCommands;
|
||||
break;
|
||||
case ConnectDone:
|
||||
pFatal("received a ConnectDone, but there was no Connect request");
|
||||
break;
|
||||
default:
|
||||
return valid;
|
||||
}
|
||||
} else {
|
||||
return valid;
|
||||
}
|
||||
valid = m_forBackend.dequeue(command);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
} // namespace Phonon
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue