* kdemm is included but not used by knotify as it does not work out of the box git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
@ -0,0 +1,39 @@ | |||
<?xml version="1.0"?> | |||
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" | |||
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> | |||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" | |||
prefer="public"> | |||
<public publicId="-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" | |||
uri="dtd/kdex.dtd" /> | |||
<public publicId="-//KDE//ELEMENTS DocBook XML Hierarchy Redeclarations 2 V1.0//EN" | |||
uri="dtd/rdbhier2.elements" /> | |||
<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.1//EN" | |||
uri="dtd/rdbpool.elements" /> | |||
<public publicId="-//KDE//ELEMENTS DocBook XML Modifications (Restrictions) V1.1//EN" | |||
uri="dtd/modifications.elements" /> | |||
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.2//EN" | |||
uri="entities/general.entities" /> | |||
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations (Persons) V1.0//EN" | |||
uri="entities/contributor.entities" /> | |||
<public publicId="-//KDE//ENTITIES DocBook XML Localisation Entity Declarations V1.0//EN" | |||
uri="entities/l10n.entities" /> | |||
<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" | |||
uri="obsolete/kdex.dtd" /> | |||
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.1//EN" | |||
uri="obsolete/general.entities" /> | |||
<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.0//EN" | |||
uri="obsolete/rdbpool.elements" /> | |||
<public publicId="-//KDE//ELEMENTS DocBook XML Modifications V1.0//EN" | |||
uri="obsolete/modifications.elements" /> | |||
<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.0//EN" | |||
uri="obsolete/kdex-412-10.dtd" /> | |||
<public publicId="-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" | |||
uri="obsolete/kdex-412-10.dtd" /> | |||
</catalog> |
@ -0,0 +1,54 @@ | |||
#include <ktrader.h> | |||
#include <kservice.h> | |||
#include <kmimetype.h> | |||
#include <assert.h> | |||
#include <kstandarddirs.h> | |||
#include <kservicegroup.h> | |||
#include <kimageio.h> | |||
#include <kuserprofile.h> | |||
#include <kprotocolinfo.h> | |||
#include <kapplication.h> | |||
#include <stdio.h> | |||
int main(int argc, char *argv[]) | |||
{ | |||
KApplication k(argc,argv,"blurb",false); | |||
KMimeType::List mtl = KMimeType::allMimeTypes( ); | |||
assert( mtl.count() ); | |||
qDebug( "Found %d mime types.", mtl.count() ); | |||
TQValueListIterator<KMimeType::Ptr> it(mtl.begin()); | |||
KServiceTypeProfile::OfferList ol; | |||
for (; it != mtl.end(); ++it) | |||
{ | |||
{ | |||
// Application | |||
printf( "APP:%s:", (*it)->name().latin1() ); | |||
ol = KServiceTypeProfile::offers((*it)->name(), "Application"); | |||
TQValueListIterator<KServiceOffer> it2(ol.begin()); | |||
for (; it2 != ol.end(); ++it2) { | |||
if ((*it2).allowAsDefault()) | |||
printf( " %s", (*it2).service()->desktopEntryPath().ascii() ); | |||
} | |||
printf( "\n" ); | |||
} | |||
{ | |||
// Embedded | |||
printf( "PART:%s:", (*it)->name().latin1() ); | |||
ol = KServiceTypeProfile::offers((*it)->name(), "KParts/ReadOnlyPart"); | |||
TQValueListIterator<KServiceOffer> it2(ol.begin()); | |||
for (; it2 != ol.end(); ++it2) { | |||
if ((*it2).allowAsDefault()) | |||
printf( " %s", (*it2).service()->desktopEntryPath().ascii() ); | |||
} | |||
printf( "\n" ); | |||
} | |||
} | |||
} | |||
@ -0,0 +1,31 @@ | |||
There should be at least two libs: | |||
1. kdemm(core) | |||
============== | |||
Provides the wrapper for the media framework and all needed media functionality. | |||
Whether this lib needs to depend on kdeui? Depends on how we could handle video | |||
without UI... but if possible we should put the video-widget in kdemmwidgets. | |||
The Requirements & Specification document can be found in reqspec.html | |||
2. kdemmwidgets | |||
=============== | |||
Provides convenience widgets for the common widgets that are needed: | |||
- Position slider (display position and move it to seek) | |||
- Volume fader | |||
- Effects dialog (including EQ) | |||
- Video widget | |||
- Player controls as toolbar | |||
Also there could be a KPart: | |||
3. kdemmpart | |||
============ | |||
A KPart implementing the KMediaPlayer interface. | |||
// vim: tw=80 |
@ -0,0 +1,43 @@ | |||
# This file is part of the KDE libraries | |||
# Copyright (C) 2004 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., 59 Temple Place - Suite 330, | |||
# Boston, MA 02111-1307, USA. | |||
INCLUDES = -I$(top_srcdir)/kdecore -I$(top_srcdir)/kio $(all_includes) | |||
SUBDIRS = . test | |||
lib_LTLIBRARIES = libkdemm.la | |||
kdemmincludedir = $(includedir)/kdemm | |||
kdemminclude_HEADERS = backend.h factory.h player.h channel.h videoplayer.h mixeriface.h simpleplayer.h | |||
libkdemm_la_SOURCES = backend.cpp factory.cpp player.cpp channel.cpp videoplayer.cpp mixeriface.skel simpleplayer.cpp factory.skel | |||
libkdemm_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(USER_LDFLAGS) -version-info 0:0:0 -no-undefined | |||
libkdemm_la_LIBADD = ../kdecore/libkdecore.la ../kio/libkio.la | |||
factory_DCOPIDLNG = true | |||
METASOURCES = AUTO | |||
kde_servicetypes_DATA = mmbackendinfo.desktop | |||
SRCDOC_DEST=$(kde_htmldir)/en/kdelibs/kdemm | |||
DOXYGEN_REFERENCES = dcop kdecore kio | |||
include ../admin/Doxyfile.am | |||
@ -0,0 +1,27 @@ | |||
Factory | |||
- get a list of available backends | |||
- be able to choose the one you want to use, overriding the KTrader information | |||
- test on the fly switching | |||
Audio | |||
- function to retrieve the PCM data that currently is played (could be done in | |||
the Channel as well as in the Player) | |||
Video | |||
- either a new interface or somehow integrate into the player | |||
If it's a new interface we have to copy most of the Player class, which I | |||
wouldn't like to see. | |||
two wrapper APIs: | |||
- for notifications | |||
play file and don't care | |||
automatically use the notification channel if present | |||
- for simple players | |||
open file and provide seek and volume | |||
Mixer abstraction | |||
- provide access to the hardware mixer and/or the mixer of the backend | |||
- provide access to software volume controls (like the Channels) | |||
Record Interface | |||
- simple PCM recording API |
@ -0,0 +1,78 @@ | |||
/* This file is part of the KDE project | |||
Copyright (C) 2004 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., 59 Temple Place - Suite 330, | |||
Boston, MA 02111-1307, USA. | |||
*/ | |||
#include "backend.h" | |||
#include "player.h" | |||
#include <tqstringlist.h> | |||
#include <kglobal.h> | |||
#include <kinstance.h> | |||
#include <kaboutdata.h> | |||
namespace KDE | |||
{ | |||
namespace Multimedia | |||
{ | |||
class Backend::Private | |||
{ | |||
public: | |||
Channel * channel; | |||
}; | |||
Backend::Backend( TQObject * parent, const char * name ) | |||
: TQObject( parent, name ) | |||
, d( 0 ) | |||
{ | |||
} | |||
Backend::~Backend() | |||
{ | |||
delete d; | |||
} | |||
bool Backend::playSoundEvent( const KURL & url ) | |||
{ | |||
if( ! d ) | |||
{ | |||
d = new Private; | |||
TQString ctype = "notifications"; | |||
if( availableChannels( Channel::Output ).contains( ctype ) < 1 ) | |||
ctype = "default"; | |||
d->channel = createChannel( KGlobal::instance()->aboutData()->programName(), ctype, Channel::Output ); | |||
} | |||
Player * player = createPlayer(); | |||
player->setOutputChannel( d->channel ); | |||
connect( player, TQT_SIGNAL( finished() ), player, TQT_SLOT( deleteLater() ) ); | |||
if( player->load( url ) ) | |||
if( player->play() ) | |||
return true; | |||
delete player; | |||
return false; | |||
} | |||
}} // namespaces | |||
#include "backend.moc" | |||
// vim: sw=4 ts=4 noet |
@ -0,0 +1,86 @@ | |||
/* This file is part of the KDE project | |||
Copyright (C) 2004 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., 59 Temple Place - Suite 330, | |||
Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef BACKEND_H | |||
#define BACKEND_H | |||
#include <tqobject.h> | |||
#include <kdemacros.h> | |||
#include <kdemm/channel.h> | |||
#include <kurl.h> | |||
namespace KDE | |||
{ | |||
namespace Multimedia | |||
{ | |||
class Player; | |||
class VideoPlayer; | |||
/** | |||
* \brief Base class for all KDE Multimedia Backends | |||
* | |||
* This class provides the interface for Multimedia Backends. Use it to get | |||
* a pointer to a new Player or VideoWidget. There are some reserved | |||
* functions for later extension of the class. | |||
* | |||
* \author Matthias Kretz <kretz@kde.org> | |||
* \since 4.0 | |||
*/ | |||
class Backend : public QObject | |||
{ | |||
Q_OBJECT | |||
public: | |||
/** | |||
* default TQObject constructor | |||
*/ | |||
Backend( TQObject * parent = 0, const char * name = 0 ); | |||
virtual ~Backend(); | |||
/** | |||
* @return A new instance to a Player from the Backend. | |||
*/ | |||
virtual Player * createPlayer() = 0; | |||
/** | |||
* Create a new VideoPlayer object. The Backend does not have to | |||
* implement this function. | |||
* | |||
* @return A new instance to a VideoPlayer from the Backend. Or 0 if | |||
* the Backend does not support the VideoPlayer interface. | |||
*/ | |||
virtual VideoPlayer * createVideoPlayer() { return 0; } | |||
virtual bool playSoundEvent(const KURL & url); | |||
virtual Channel * createChannel( const TQString & title, const TQString & channeltype, | |||
Channel::Direction direction ) = 0; | |||
virtual TQStringList availableChannels( Channel::Direction direction ) const = 0; | |||
virtual TQStringList playableMimeTypes() const = 0; | |||
private: | |||
RESERVE_VIRTUAL_10 | |||
class Private; | |||
Private * d; | |||
}; | |||
}} // namespaces | |||
// vim: sw=4 ts=4 noet tw=80 | |||
#endif // BACKEND_H |
@ -0,0 +1,69 @@ | |||
/* This file is part of the KDE project | |||
Copyright (C) 2004 Scott Wheeler <wheeler@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., 59 Temple Place - Suite 330, | |||
Boston, MA 02111-1307, USA. | |||
*/ | |||
#include "channel.h" | |||
#include <tqstring.h> | |||
namespace KDE | |||
{ | |||
namespace Multimedia | |||
{ | |||
class Channel::Private | |||
{ | |||
public: | |||
TQString channelName; | |||
TQString channelType; | |||
Direction direction; | |||
}; | |||
Channel::Channel( const TQString & channelName, const TQString & type, Direction direction, | |||
TQObject * parent, const char * name ) | |||
: TQObject( parent, name ) | |||
{ | |||
d = new Private; | |||
d->channelName = channelName; | |||
d->channelType = type; | |||
d->direction = direction; | |||
} | |||
Channel::~Channel() | |||
{ | |||
delete d; | |||
} | |||
TQString Channel::channelName() const | |||
{ | |||
return d->channelName; | |||
} | |||
TQString Channel::channelType() const | |||
{ | |||
return d->channelType; | |||
} | |||
Channel::Direction Channel::direction() const | |||
{ | |||
return d->direction; | |||
} | |||
}} | |||
#include "channel.moc" | |||
// vim: sw=4 ts=4 noet |
@ -0,0 +1,96 @@ | |||
/* This file is part of the KDE project | |||
Copyright (C) 2004 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., 59 Temple Place - Suite 330, | |||
Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef KDEMM_CHANNEL_H | |||
#define KDEMM_CHANNEL_H | |||
#include <kdemm/mixeriface.h> | |||
class TQString; | |||
namespace KDE | |||
{ | |||
namespace Multimedia | |||
{ | |||
/** | |||
* \short Abstraction of different inputs or outputs | |||
* | |||
* \author Matthias Kretz <kretz@kde.org> | |||
* \since 4.0 | |||
*/ | |||
class KDE_EXPORT Channel : public TQObject, virtual public MixerIface | |||
{ | |||
Q_OBJECT | |||
public: | |||
virtual ~Channel(); | |||
enum Direction | |||
{ | |||
Input, | |||
Output | |||
}; | |||
/** | |||
* The user visible name of the channel | |||
*/ | |||
virtual TQString channelName() const; | |||
/** | |||
* The (internal) channel type. | |||
*/ | |||
virtual TQString channelType() const; | |||
/** | |||
* Whether it is an Input or Output channel | |||
*/ | |||
virtual Direction direction() const; | |||
/** | |||
* If the channel has a volume control this function returns \p true | |||
*/ | |||
virtual bool hasVolumeControl() const = 0; | |||
/** | |||
* The current volume of the channel | |||
*/ | |||
virtual float volume() const = 0; | |||
/** | |||
* Set the volume for the channel | |||
* | |||
* \returns Returns \p true if the volume has been successfully set | |||
*/ | |||
virtual bool setVolume( float volume ) = 0; | |||
protected: | |||
/** | |||
* You can not instantiate channels yourself, use the Factory to | |||
* create them. | |||
*/ | |||
Channel( const TQString & channelName, const TQString & type, Direction direction, | |||
TQObject * parent = 0, const char * name = 0 ); | |||
private: | |||
class Private; | |||
Private * d; | |||
}; | |||
}} // namespaces | |||
// vim: sw=4 ts=4 noet tw=80 | |||
#endif // KDEMM_CHANNEL_H |
@ -0,0 +1,296 @@ | |||
/* This file is part of the KDE project | |||
Copyright (C) 2004 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., 59 Temple Place - Suite 330, | |||
Boston, MA 02111-1307, USA. | |||
*/ | |||
#include "factory.h" | |||
#include "backend.h" | |||
#include "player.h" | |||
#include "videoplayer.h" | |||
#include "channel.h" | |||
#include <ktrader.h> | |||
#include <kservice.h> | |||
#include <klibloader.h> | |||
#include <kmessagebox.h> | |||
#include <tqfile.h> | |||
#include <klocale.h> | |||
#include <kmimetype.h> | |||
#include <kdebug.h> | |||
namespace KDE | |||
{ | |||
namespace Multimedia | |||
{ | |||
class Factory::Private | |||
{ | |||
public: | |||
Private() | |||
: backend( 0 ) | |||
{ | |||
createBackend(); | |||
} | |||
void createBackend() | |||
{ | |||
KTrader::OfferList offers = KTrader::self()->query( "KDEMultimediaBackend", "Type == 'Service'" ); | |||
KTrader::OfferListIterator it = offers.begin(); | |||
KTrader::OfferListIterator end = offers.end(); | |||
TQStringList errormsg; | |||
for( ; it != end; ++it ) | |||
{ | |||
KService::Ptr ptr = *it; | |||
KLibFactory * factory = KLibLoader::self()->factory( TQFile::encodeName( ptr->library() ) ); | |||
if( factory ) | |||
{ | |||
backend = ( Backend* )factory->create( 0, "Multimedia Backend", "KDE::Multimedia::Backend" ); | |||
if( 0 == backend ) | |||
{ | |||
TQString e = i18n( "create method returned 0" ); | |||
errormsg.append( e ); | |||
kdDebug( 600 ) << "Error getting backend from factory for " << | |||
ptr->name() << ":\n" << e << endl; | |||
} | |||
else | |||
{ | |||
service = ptr; | |||
kdDebug( 600 ) << "using backend: " << ptr->name() << endl; | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
TQString e = KLibLoader::self()->lastErrorMessage(); | |||
errormsg.append( e ); | |||
kdDebug( 600 ) << "Error getting factory for " << ptr->name() << | |||
":\n" << e << endl; | |||
} | |||
} | |||
#if 0 | |||
if( 0 == backend ) | |||
{ | |||
if( offers.size() == 0 ) | |||
KMessageBox::error( 0, i18n( "Unable to find a Multimedia Backend" ) ); | |||
else | |||
{ | |||
TQString details = "<qt><table>"; | |||
TQStringList::Iterator eit = errormsg.begin(); | |||
TQStringList::Iterator eend = errormsg.end(); | |||
KTrader::OfferListIterator oit = offers.begin(); | |||
KTrader::OfferListIterator oend = offers.end(); | |||
for( ; eit != eend || oit != oend; ++eit, ++oit ) | |||
details += TQString( "<tr><td><b>%1</b></td><td>%2</td></tr>" ) | |||
.arg( ( *oit )->name() ).arg( *eit ); | |||
details += "</table></qt>"; | |||
KMessageBox::detailedError( 0, | |||
i18n( "Unable to use any of the available Multimedia Backends" ), details ); | |||
} | |||
} | |||
#endif | |||
} | |||
Backend * backend; | |||
KService::Ptr service; | |||