src/multimedia/qmediaserviceprovider.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QMEDIASERVICEPROVIDER_H
       
    43 #define QMEDIASERVICEPROVIDER_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 #include <QtCore/qshareddata.h>
       
    47 #include <qmobilityglobal.h>
       
    48 #include "qtmedianamespace.h"
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 class QMediaService;
       
    53 
       
    54 class QMediaServiceProviderHintPrivate;
       
    55 class Q_MULTIMEDIA_EXPORT QMediaServiceProviderHint
       
    56 {
       
    57 public:
       
    58     enum Type { Null, ContentType, Device, SupportedFeatures };
       
    59 
       
    60     enum Feature {
       
    61         LowLatencyPlayback = 0x01,
       
    62         RecordingSupport = 0x02,
       
    63         StreamPlayback = 0x04
       
    64     };
       
    65     Q_DECLARE_FLAGS(Features, Feature)
       
    66 
       
    67     QMediaServiceProviderHint();
       
    68     QMediaServiceProviderHint(const QString &mimeType, const QStringList& codecs);
       
    69     QMediaServiceProviderHint(const QByteArray &device);
       
    70     QMediaServiceProviderHint(Features features);
       
    71     QMediaServiceProviderHint(const QMediaServiceProviderHint &other);
       
    72     ~QMediaServiceProviderHint();
       
    73 
       
    74     QMediaServiceProviderHint& operator=(const QMediaServiceProviderHint &other);
       
    75 
       
    76     bool operator == (const QMediaServiceProviderHint &other) const;
       
    77     bool operator != (const QMediaServiceProviderHint &other) const;
       
    78 
       
    79     bool isNull() const;
       
    80 
       
    81     Type type() const;
       
    82 
       
    83     QString mimeType() const;
       
    84     QStringList codecs() const;
       
    85 
       
    86     QByteArray device() const;
       
    87 
       
    88     Features features() const;
       
    89 
       
    90     //to be extended, if necessary
       
    91 
       
    92 private:
       
    93     QSharedDataPointer<QMediaServiceProviderHintPrivate> d;
       
    94 };
       
    95 
       
    96 class Q_MULTIMEDIA_EXPORT QMediaServiceProvider : public QObject
       
    97 {
       
    98     Q_OBJECT
       
    99 
       
   100 public:
       
   101     virtual QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint = QMediaServiceProviderHint()) = 0;
       
   102     virtual void releaseService(QMediaService *service) = 0;
       
   103 
       
   104     virtual QtMultimediaKit::SupportEstimate hasSupport(const QByteArray &serviceType,
       
   105                                              const QString &mimeType,
       
   106                                              const QStringList& codecs,
       
   107                                              int flags = 0) const;
       
   108     virtual QStringList supportedMimeTypes(const QByteArray &serviceType, int flags = 0) const;
       
   109 
       
   110     virtual QList<QByteArray> devices(const QByteArray &serviceType) const;
       
   111     virtual QString deviceDescription(const QByteArray &serviceType, const QByteArray &device);
       
   112 
       
   113     static QMediaServiceProvider* defaultServiceProvider();
       
   114 
       
   115 #ifdef QT_BUILD_INTERNAL
       
   116     static void setDefaultServiceProvider(QMediaServiceProvider *provider);
       
   117 #endif
       
   118 };
       
   119 
       
   120 /*!
       
   121     Service with support for media playback
       
   122     Required Controls: QMediaPlayerControl
       
   123     Optional Controls: QMediaPlaylistControl, QAudioDeviceControl
       
   124     Video Output Controls (used by QWideoWidget and QGraphicsVideoItem):
       
   125                         Required: QVideoOutputControl
       
   126                         Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
       
   127 */
       
   128 #define Q_MEDIASERVICE_MEDIAPLAYER "com.nokia.qt.mediaplayer"
       
   129 
       
   130 /*!
       
   131    Service with support for recording from audio sources
       
   132    Required Controls: QAudioDeviceControl
       
   133    Recording Controls (QMediaRecorder):
       
   134                         Required: QMediaRecorderControl
       
   135                         Recommended: QAudioEncoderControl
       
   136                         Optional: QMediaContainerControl
       
   137 */
       
   138 #define Q_MEDIASERVICE_AUDIOSOURCE "com.nokia.qt.audiosource"
       
   139 
       
   140 /*!
       
   141     Service with support for camera use.
       
   142     Required Controls: QCameraControl
       
   143     Optional Controls: QCameraExposureControl, QCameraFocusControl, QImageProcessingControl
       
   144     Still Capture Controls: QImageCaptureControl
       
   145     Recording Controls (QMediaRecorder):
       
   146                         Required: QMediaRecorderControl
       
   147                         Recommended: QAudioEncoderControl, QVideoEncoderControl, QMediaContainerControl
       
   148     Viewfinder Video Output Controls (used by QWideoWidget and QGraphicsVideoItem):
       
   149                         Required: QVideoOutputControl
       
   150                         Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
       
   151 */
       
   152 #define Q_MEDIASERVICE_CAMERA "com.nokia.qt.camera"
       
   153 
       
   154 /*!
       
   155     Service with support for radio tuning.
       
   156     Required Controls: QRadioTunerControl
       
   157     Recording Controls (Optional, used by QMediaRecorder):
       
   158                         Required: QMediaRecorderControl
       
   159                         Recommended: QAudioEncoderControl
       
   160                         Optional: QMediaContainerControl
       
   161 */
       
   162 #define Q_MEDIASERVICE_RADIO "com.nokia.qt.radio"
       
   163 
       
   164 
       
   165 QT_END_NAMESPACE
       
   166 
       
   167 #endif  // QMEDIASERVICEPROVIDER_H