1 /* This file is part of the KDE project
2 Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #ifndef PHONON_OBJECTDESCRIPTION_H
21 #define PHONON_OBJECTDESCRIPTION_H
24 #include <kdelibs_export.h>
25 #include <QSharedDataPointer>
33 class ObjectDescriptionPrivate
;
35 enum ObjectDescriptionType
37 AudioOutputDeviceType
,
38 AudioCaptureDeviceType
,
39 VideoOutputDeviceType
,
40 VideoCaptureDeviceType
,
50 * \short Provides a tuple of enduser visible name and description.
52 * Some parts give the enduser choices, e.g. what source to capture audio from.
53 * These choices are described by the name and description methods of this class
54 * and identified with the id method. Subclasses then define additional
55 * information like which audio and video choices belong together.
57 * \author Matthias Kretz <kretz@kde.org>
58 * \see AudioCaptureDevice
59 * \see VideoCaptureDevice
61 template<ObjectDescriptionType T
>
62 class PHONONCORE_EXPORT ObjectDescription
65 ObjectDescription( const ObjectDescription
<T
>& rhs
);
66 ObjectDescription
<T
>& operator=( const ObjectDescription
<T
>& rhs
);
71 * Returns \c true if this ObjectDescription describes the same
72 * as \p otherDescription; otherwise returns \c false.
74 bool operator==( const ObjectDescription
<T
>& otherDescription
) const;
77 * Returns the name of the capture source.
79 * \return A string that should be presented to the user to
80 * choose the capture source.
82 const QString
& name() const;
85 * Returns a description of the capture source. This text should
86 * make clear what sound source this is, which is sometimes hard
87 * to describe or understand from just the name.
89 * \return A string describing the capture source.
91 const QString
& description() const;
94 * Returns a named property.
96 * If the property is not set an invalid value is returned.
98 * \see propertyNames()
100 QVariant
property(const char *name
) const;
103 * Returns all names that return valid data when property() is called.
107 QList
<QByteArray
> propertyNames() const;
110 * A unique identifier for this capture source. Used internally
111 * to distinguish between the capture sources.
113 * \return An integer that uniquely identifies every capture
119 * Returns \c true if the Tuple is valid (index != -1); otherwise returns
122 bool isValid() const;
126 * Returns a new description object that describes the
127 * device/effect/codec/... with the given \p index.
129 static ObjectDescription
<T
> fromIndex( int index
);
136 ObjectDescription(int index
, const QHash
<QByteArray
, QVariant
>& properties
);
141 * The data is implicitly shared.
143 QSharedDataPointer
<ObjectDescriptionPrivate
> d
;
146 typedef ObjectDescription
<AudioOutputDeviceType
> AudioOutputDevice
;
147 typedef ObjectDescription
<AudioCaptureDeviceType
> AudioCaptureDevice
;
148 typedef ObjectDescription
<VideoOutputDeviceType
> VideoOutputDevice
;
149 typedef ObjectDescription
<VideoCaptureDeviceType
> VideoCaptureDevice
;
150 typedef ObjectDescription
<AudioEffectType
> AudioEffectDescription
;
151 typedef ObjectDescription
<VideoEffectType
> VideoEffectDescription
;
152 typedef ObjectDescription
<AudioCodecType
> AudioCodecDescription
;
153 typedef ObjectDescription
<VideoCodecType
> VideoCodecDescription
;
154 typedef ObjectDescription
<ContainerFormatType
> ContainerFormatDescription
;
155 typedef ObjectDescription
<VisualizationType
> VisualizationDescription
;
159 #endif // PHONON_OBJECTDESCRIPTION_H
160 // vim: sw=4 ts=4 tw=80