kdemm Library API Documentation

KDE::Multimedia::Factory Class Reference

Factory to access the preferred Backend. More...

#include <factory.h>

Inheritance diagram for KDE::Multimedia::Factory:

Inheritance graph
[legend]
Collaboration diagram for KDE::Multimedia::Factory:

Collaboration graph
[legend]
List of all members.

Signals

void deleteYourObjects ()
void recreateObjects ()

DCOP Member Functions

void kdemmBackendChanged ()

Public Member Functions

PlayercreatePlayer ()
VideoPlayercreateVideoPlayer ()
bool playSoundEvent (const KURL &url)
ChannelcreateChannel (const QString &title, const QString &channeltype=QString::fromLatin1("default"), Channel::Direction direction=Channel::Output)
QStringList availableChannels (Channel::Direction direction=Channel::Output) const
QStringList playableMimeTypes () const
bool isMimeTypePlayable (const QString &mimetype) const
QString backendName () const
QString backendComment () const
QString backendVersion () const
QString backendIcon () const
QString backendWebsite () const

Static Public Member Functions

static Factoryself ()

Protected Member Functions

 Factory ()
 ~Factory ()

Detailed Description

Factory to access the preferred Backend.

This class is your entry point to KDE Multimedia usage. It provides the necessary objects for playing audio and video.

For simple access to just playing an audio file see SimplePlayer.

Remarks:
Extensions to the existing functionality can either be added by using the reserved virtual functions in Backend or by adding a new interface e.g. BackendV2 and creating a BackendV2 instance when the Backend instance is created.
Author:
Matthias Kretz <kretz@kde.org>
Since:
4.0

Definition at line 67 of file factory.h.


Member Function Documentation

Factory * KDE::Multimedia::Factory::self  )  [static]
 

Returns a pointer to the factory.

Use this function to get an instance of KLibLoader.

Returns:
a pointer to the loader. If no loader exists until now then one is created

Definition at line 115 of file factory.cpp.

References Factory().

Referenced by KDE::Multimedia::SimplePlayer::SimplePlayer().

Player * KDE::Multimedia::Factory::createPlayer  ) 
 

Create a new Player.

You need to call it like this:

 Factory::self()->createPlayer();

Returns:
a pointer to the Player the backend provides

Definition at line 175 of file factory.cpp.

References QObject::connect(), and QObject::destroyed().

Referenced by KDE::Multimedia::SimplePlayer::SimplePlayer().

VideoPlayer * KDE::Multimedia::Factory::createVideoPlayer  ) 
 

Create a new VideoPlayer object.

The Backend does not have to implement this functionality so you have to check that it didn't return 0.

Returns:
A new instance to a VideoPlayer from the Backend. Or 0 if the Backend does not support the VideoPlayer interface.

Definition at line 188 of file factory.cpp.

References QObject::connect(), and QObject::destroyed().

bool KDE::Multimedia::Factory::playSoundEvent const KURL url  ) 
 

Play the specified sound-file with no further control.

Returns immediatly.

Returns:
if the file was be succesfully issued, but is not a garantie for succes of playing the entire file.

Definition at line 201 of file factory.cpp.

Channel * KDE::Multimedia::Factory::createChannel const QString title,
const QString channeltype = QString::fromLatin1("default"),
Channel::Direction  direction = Channel::Output
 

Creates a new Channel object that you can use for a Player object to play to.

Parameters:
title A user visible title for the Channel. Most of the time you will use the application's name.
channeltype availableChannels() returns a list of strings where you can choose one to be used. Most of the time you will use the "default" channel. But the Backend could also provide special purpose channels like one for notifications, one for previews and one for media playback.
direction Whether it's a Channel::Input or Channel::Output that you're requesting.
Returns:
Returns a Channel object or 0 if your request couldn't be fullfilled.

Definition at line 209 of file factory.cpp.

References QObject::connect(), and QObject::destroyed().

Referenced by KDE::Multimedia::SimplePlayer::SimplePlayer().

QStringList KDE::Multimedia::Factory::availableChannels Channel::Direction  direction = Channel::Output  )  const
 

Returns the names of the channels that can be used to play or record, depending on the value of direction.

Parameters:
direction If set to Channel::Output you will get the names of all output channels, if set to Channel::Input you get the same for the input channels.

Definition at line 223 of file factory.cpp.

QStringList KDE::Multimedia::Factory::playableMimeTypes  )  const
 

Returns the mimetypes that can be played.

Definition at line 231 of file factory.cpp.

Referenced by isMimeTypePlayable().

bool KDE::Multimedia::Factory::isMimeTypePlayable const QString mimetype  )  const
 

Checks whether a certain mimetype is playable.

Definition at line 239 of file factory.cpp.

References KMimeType::mimeType(), and playableMimeTypes().

QString KDE::Multimedia::Factory::backendName  )  const
 

Get the name of the Backend.

It's the name from the .desktop file.

Definition at line 252 of file factory.cpp.

QString KDE::Multimedia::Factory::backendComment  )  const
 

Get the comment of the Backend.

It's the comment from the .desktop file.

Definition at line 260 of file factory.cpp.

QString KDE::Multimedia::Factory::backendVersion  )  const
 

Get the version of the Backend.

It's the version from the .desktop file.

The version is especially interesting if there are several versions available for binary incompatible versions of the backend's media framework.

Definition at line 268 of file factory.cpp.

QString KDE::Multimedia::Factory::backendIcon  )  const
 

Get the icon (name) of the Backend.

It's the icon from the .desktop file.

Definition at line 276 of file factory.cpp.

QString KDE::Multimedia::Factory::backendWebsite  )  const
 

Get the website of the Backend.

It's the website from the .desktop file.

Definition at line 284 of file factory.cpp.

void KDE::Multimedia::Factory::deleteYourObjects  )  [signal]
 

This signal is emitted when the user changes the backend.

You then have to free all your references to Player or Channel objects.

void KDE::Multimedia::Factory::recreateObjects  )  [signal]
 

After you got a deleteYourObjects() signal the backend is changed internally.

Then you will receive this signal, and only then should you reconstruct all your objects again. This time they will internally use the new backend.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdemm Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 13 04:04:42 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003