src/multimedia/qmediaserviceprovider.cpp
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 #include <QtCore/qdebug.h>
       
    43 #include <QtCore/qmap.h>
       
    44 
       
    45 #include "qmediaservice.h"
       
    46 #include "qmediaserviceprovider.h"
       
    47 #include "qmediaserviceproviderplugin.h"
       
    48 #include "qmediapluginloader_p.h"
       
    49 #include "qmediaplayer.h"
       
    50 
       
    51 QT_BEGIN_NAMESPACE
       
    52 
       
    53 class QMediaServiceProviderHintPrivate : public QSharedData
       
    54 {
       
    55 public:
       
    56     QMediaServiceProviderHintPrivate(QMediaServiceProviderHint::Type type)
       
    57         :type(type), features(0)
       
    58     {
       
    59     }
       
    60 
       
    61     QMediaServiceProviderHintPrivate(const QMediaServiceProviderHintPrivate &other)
       
    62         :QSharedData(other),
       
    63         type(other.type),
       
    64         device(other.device),
       
    65         mimeType(other.mimeType),
       
    66         codecs(other.codecs),
       
    67         features(other.features)
       
    68     {
       
    69     }
       
    70 
       
    71     ~QMediaServiceProviderHintPrivate()
       
    72     {
       
    73     }
       
    74 
       
    75     QMediaServiceProviderHint::Type type;
       
    76     QByteArray device;
       
    77     QString mimeType;
       
    78     QStringList codecs;
       
    79     QMediaServiceProviderHint::Features features;
       
    80 };
       
    81 
       
    82 /*!
       
    83     \class QMediaServiceProviderHint
       
    84     \preliminary
       
    85     \brief The QMediaServiceProviderHint class describes what is required of a QMediaService.
       
    86 
       
    87     \ingroup multimedia
       
    88 
       
    89     The QMediaServiceProvider class uses hints to select an appropriate media service.
       
    90 */
       
    91 
       
    92 /*!
       
    93     \enum QMediaServiceProviderHint::Feature
       
    94 
       
    95     Enumerates features a media service may provide.
       
    96 
       
    97     \value LowLatencyPlayback
       
    98             The service is expected to play simple audio formats,
       
    99             but playback should start without significant delay.
       
   100             Such playback service can be used for beeps, ringtones, etc.
       
   101 
       
   102     \value RecordingSupport
       
   103             The service provides audio or video recording functions.
       
   104 
       
   105     \value StreamPlayback
       
   106             The service is capable of playing QIODevice based streams.
       
   107 */
       
   108 
       
   109 /*!
       
   110     \enum QMediaServiceProviderHint::Type
       
   111 
       
   112     Enumerates the possible types of media service provider hint.
       
   113 
       
   114     \value Null               En empty hint, use the default service.
       
   115     \value ContentType        Select media service most suitable for certain content type.
       
   116     \value Device             Select media service which supports certain device.
       
   117     \value SupportedFeatures  Select media service supporting the set of optional features.
       
   118 */
       
   119 
       
   120 
       
   121 /*!
       
   122     Constructs an empty media service provider hint.
       
   123 */
       
   124 QMediaServiceProviderHint::QMediaServiceProviderHint()
       
   125     :d(new QMediaServiceProviderHintPrivate(Null))
       
   126 {
       
   127 }
       
   128 
       
   129 /*!
       
   130     Constructs a ContentType media service provider hint.
       
   131 
       
   132     This type of hint describes a service that is able to play content of a specific MIME \a type
       
   133     encoded with one or more of the listed \a codecs.
       
   134 */
       
   135 QMediaServiceProviderHint::QMediaServiceProviderHint(const QString &type, const QStringList& codecs)
       
   136     :d(new QMediaServiceProviderHintPrivate(ContentType))
       
   137 {
       
   138     d->mimeType = type;
       
   139     d->codecs = codecs;
       
   140 }
       
   141 
       
   142 /*!
       
   143   Constructs a Device media service provider hint.
       
   144 
       
   145   This type of hint describes a media service that utilizes a specific \a device.
       
   146 */
       
   147 QMediaServiceProviderHint::QMediaServiceProviderHint(const QByteArray &device)
       
   148     :d(new QMediaServiceProviderHintPrivate(Device))
       
   149 {
       
   150     d->device = device;
       
   151 }
       
   152 
       
   153 /*!
       
   154     Constructs a SupportedFeatures media service provider hint.
       
   155 
       
   156     This type of hint describes a service which supports a specific set of \a features.
       
   157 */
       
   158 QMediaServiceProviderHint::QMediaServiceProviderHint(QMediaServiceProviderHint::Features features)
       
   159     :d(new QMediaServiceProviderHintPrivate(SupportedFeatures))
       
   160 {
       
   161     d->features = features;
       
   162 }
       
   163 
       
   164 /*!
       
   165     Constructs a copy of the media service provider hint \a other.
       
   166 */
       
   167 QMediaServiceProviderHint::QMediaServiceProviderHint(const QMediaServiceProviderHint &other)
       
   168     :d(other.d)
       
   169 {
       
   170 }
       
   171 
       
   172 /*!
       
   173     Destroys a media service provider hint.
       
   174 */
       
   175 QMediaServiceProviderHint::~QMediaServiceProviderHint()
       
   176 {
       
   177 }
       
   178 
       
   179 /*!
       
   180     Assigns the value \a other to a media service provider hint.
       
   181 */
       
   182 QMediaServiceProviderHint& QMediaServiceProviderHint::operator=(const QMediaServiceProviderHint &other)
       
   183 {
       
   184     d = other.d;
       
   185     return *this;
       
   186 }
       
   187 
       
   188 /*!
       
   189     Identifies if \a other is of equal value to a media service provider hint.
       
   190 
       
   191     Returns true if the hints are equal, and false if they are not.
       
   192 */
       
   193 bool QMediaServiceProviderHint::operator == (const QMediaServiceProviderHint &other) const
       
   194 {
       
   195     return (d == other.d) ||
       
   196            (d->type == other.d->type &&
       
   197             d->device == other.d->device &&
       
   198             d->mimeType == other.d->mimeType &&
       
   199             d->codecs == other.d->codecs &&
       
   200             d->features == other.d->features);
       
   201 }
       
   202 
       
   203 /*!
       
   204     Identifies if \a other is not of equal value to a media service provider hint.
       
   205 
       
   206     Returns true if the hints are not equal, and false if they are.
       
   207 */
       
   208 bool QMediaServiceProviderHint::operator != (const QMediaServiceProviderHint &other) const
       
   209 {
       
   210     return !(*this == other);
       
   211 }
       
   212 
       
   213 /*!
       
   214     Returns true if a media service provider is null.
       
   215 */
       
   216 bool QMediaServiceProviderHint::isNull() const
       
   217 {
       
   218     return d->type == Null;
       
   219 }
       
   220 
       
   221 /*!
       
   222     Returns the type of a media service provider hint.
       
   223 */
       
   224 QMediaServiceProviderHint::Type QMediaServiceProviderHint::type() const
       
   225 {
       
   226     return d->type;
       
   227 }
       
   228 
       
   229 /*!
       
   230     Returns the mime type of the media a service is expected to be able play.
       
   231 */
       
   232 QString QMediaServiceProviderHint::mimeType() const
       
   233 {
       
   234     return d->mimeType;
       
   235 }
       
   236 
       
   237 /*!
       
   238     Returns a list of codes a media service is expected to be able to decode.
       
   239 */
       
   240 QStringList QMediaServiceProviderHint::codecs() const
       
   241 {
       
   242     return d->codecs;
       
   243 }
       
   244 
       
   245 /*!
       
   246     Returns the name of a device a media service is expected to utilize.
       
   247 */
       
   248 QByteArray QMediaServiceProviderHint::device() const
       
   249 {
       
   250     return d->device;
       
   251 }
       
   252 
       
   253 /*!
       
   254     Returns a set of features a media service is expected to provide.
       
   255 */
       
   256 QMediaServiceProviderHint::Features QMediaServiceProviderHint::features() const
       
   257 {
       
   258     return d->features;
       
   259 }
       
   260 
       
   261 
       
   262 Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, loader,
       
   263         (QMediaServiceProviderFactoryInterface_iid, QLatin1String("mediaservice"), Qt::CaseInsensitive))
       
   264 
       
   265 
       
   266 class QPluginServiceProvider : public QMediaServiceProvider
       
   267 {
       
   268     QMap<QMediaService*, QMediaServiceProviderPlugin*> pluginMap;
       
   269 
       
   270 public:
       
   271     QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint)
       
   272     {
       
   273         QString key(type);
       
   274 
       
   275         QList<QMediaServiceProviderPlugin *>plugins;
       
   276         foreach (QObject *obj, loader()->instances(key)) {
       
   277             QMediaServiceProviderPlugin *plugin =
       
   278                 qobject_cast<QMediaServiceProviderPlugin*>(obj);
       
   279             if (plugin)
       
   280                 plugins << plugin;
       
   281         }
       
   282 
       
   283         if (!plugins.isEmpty()) {
       
   284             QMediaServiceProviderPlugin *plugin = 0;
       
   285 
       
   286             switch (hint.type()) {
       
   287             case QMediaServiceProviderHint::Null:
       
   288                 plugin = plugins[0];
       
   289                 //special case for media player, if low latency was not asked,
       
   290                 //prefer services not offering it, since they are likely to support
       
   291                 //more formats
       
   292                 if (type == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) {
       
   293                     foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
       
   294                         QMediaServiceFeaturesInterface *iface =
       
   295                                 qobject_cast<QMediaServiceFeaturesInterface*>(currentPlugin);
       
   296 
       
   297                         if (!iface || !(iface->supportedFeatures(type) &
       
   298                                         QMediaServiceProviderHint::LowLatencyPlayback)) {
       
   299                             plugin = currentPlugin;
       
   300                             break;
       
   301                         }
       
   302 
       
   303                     }
       
   304                 }
       
   305                 break;
       
   306             case QMediaServiceProviderHint::SupportedFeatures:
       
   307                 plugin = plugins[0];
       
   308                 foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
       
   309                     QMediaServiceFeaturesInterface *iface =
       
   310                             qobject_cast<QMediaServiceFeaturesInterface*>(currentPlugin);
       
   311 
       
   312                     if (iface) {
       
   313                         if ((iface->supportedFeatures(type) & hint.features()) == hint.features()) {
       
   314                             plugin = currentPlugin;
       
   315                             break;
       
   316                         }
       
   317                     }
       
   318                 }
       
   319                 break;
       
   320             case QMediaServiceProviderHint::Device: {
       
   321                     foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
       
   322                         QMediaServiceSupportedDevicesInterface *iface =
       
   323                                 qobject_cast<QMediaServiceSupportedDevicesInterface*>(currentPlugin);
       
   324 
       
   325                         if (!iface) {
       
   326                             // the plugin may support the device,
       
   327                             // but this choice still can be overridden
       
   328                             plugin = currentPlugin;
       
   329                         } else {
       
   330                             if (iface->devices(type).contains(hint.device())) {
       
   331                                 plugin = currentPlugin;
       
   332                                 break;
       
   333                             }
       
   334                         }
       
   335                     }
       
   336                 }
       
   337                 break;
       
   338             case QMediaServiceProviderHint::ContentType: {
       
   339                     QtMultimediaKit::SupportEstimate estimate = QtMultimediaKit::NotSupported;
       
   340                     foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
       
   341                         QtMultimediaKit::SupportEstimate currentEstimate = QtMultimediaKit::MaybeSupported;
       
   342                         QMediaServiceSupportedFormatsInterface *iface =
       
   343                                 qobject_cast<QMediaServiceSupportedFormatsInterface*>(currentPlugin);
       
   344 
       
   345                         if (iface)
       
   346                             currentEstimate = iface->hasSupport(hint.mimeType(), hint.codecs());
       
   347 
       
   348                         if (currentEstimate > estimate) {
       
   349                             estimate = currentEstimate;
       
   350                             plugin = currentPlugin;
       
   351 
       
   352                             if (currentEstimate == QtMultimediaKit::PreferredService)
       
   353                                 break;
       
   354                         }
       
   355                     }
       
   356                 }
       
   357                 break;
       
   358             }
       
   359 
       
   360             if (plugin != 0) {
       
   361                 QMediaService *service = plugin->create(key);
       
   362                 if (service != 0)
       
   363                     pluginMap.insert(service, plugin);
       
   364 
       
   365                 return service;
       
   366             }
       
   367         }
       
   368 
       
   369         qWarning() << "defaultServiceProvider::requestService(): no service found for -" << key;
       
   370         return 0;
       
   371     }
       
   372 
       
   373     void releaseService(QMediaService *service)
       
   374     {
       
   375         if (service != 0) {
       
   376             QMediaServiceProviderPlugin *plugin = pluginMap.take(service);
       
   377 
       
   378             if (plugin != 0)
       
   379                 plugin->release(service);
       
   380         }
       
   381     }
       
   382 
       
   383     QtMultimediaKit::SupportEstimate hasSupport(const QByteArray &serviceType,
       
   384                                      const QString &mimeType,
       
   385                                      const QStringList& codecs,
       
   386                                      int flags) const
       
   387     {
       
   388         QList<QObject*> instances = loader()->instances(serviceType);
       
   389 
       
   390         if (instances.isEmpty())
       
   391             return QtMultimediaKit::NotSupported;
       
   392 
       
   393         bool allServicesProvideInterface = true;
       
   394         QtMultimediaKit::SupportEstimate supportEstimate = QtMultimediaKit::NotSupported;
       
   395 
       
   396         foreach(QObject *obj, instances) {
       
   397             QMediaServiceSupportedFormatsInterface *iface =
       
   398                     qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
       
   399 
       
   400 
       
   401             if (flags) {
       
   402                 QMediaServiceFeaturesInterface *iface =
       
   403                         qobject_cast<QMediaServiceFeaturesInterface*>(obj);
       
   404 
       
   405                 if (iface) {
       
   406                     QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
       
   407 
       
   408                     //if low latency playback was asked, skip services known
       
   409                     //not to provide low latency playback
       
   410                     if ((flags & QMediaPlayer::LowLatency) &&
       
   411                         !(features & QMediaServiceProviderHint::LowLatencyPlayback))
       
   412                             continue;
       
   413 
       
   414                     //the same for QIODevice based streams support
       
   415                     if ((flags & QMediaPlayer::StreamPlayback) &&
       
   416                         !(features & QMediaServiceProviderHint::StreamPlayback))
       
   417                             continue;
       
   418                 }
       
   419             }
       
   420 
       
   421             if (iface)
       
   422                 supportEstimate = qMax(supportEstimate, iface->hasSupport(mimeType, codecs));
       
   423             else
       
   424                 allServicesProvideInterface = false;
       
   425         }
       
   426 
       
   427         //don't return PreferredService
       
   428         supportEstimate = qMin(supportEstimate, QtMultimediaKit::ProbablySupported);
       
   429 
       
   430         //Return NotSupported only if no services are available of serviceType
       
   431         //or all the services returned NotSupported, otherwise return at least MaybeSupported
       
   432         if (!allServicesProvideInterface)
       
   433             supportEstimate = qMax(QtMultimediaKit::MaybeSupported, supportEstimate);
       
   434 
       
   435         return supportEstimate;
       
   436     }
       
   437 
       
   438     QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const
       
   439     {
       
   440         QList<QObject*> instances = loader()->instances(serviceType);
       
   441 
       
   442         QStringList supportedTypes;
       
   443 
       
   444         foreach(QObject *obj, instances) {
       
   445             QMediaServiceSupportedFormatsInterface *iface =
       
   446                     qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
       
   447 
       
   448 
       
   449             if (flags & QMediaPlayer::LowLatency) {
       
   450                 QMediaServiceFeaturesInterface *iface =
       
   451                         qobject_cast<QMediaServiceFeaturesInterface*>(obj);
       
   452 
       
   453                 if (iface) {
       
   454                     QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
       
   455 
       
   456                     // If low latency playback was asked for, skip MIME types from services known
       
   457                     // not to provide low latency playback
       
   458                     if ((flags & QMediaPlayer::LowLatency) &&
       
   459                         !(features & QMediaServiceProviderHint::LowLatencyPlayback))
       
   460                         continue;
       
   461 
       
   462                     //the same for QIODevice based streams support
       
   463                     if ((flags & QMediaPlayer::StreamPlayback) &&
       
   464                         !(features & QMediaServiceProviderHint::StreamPlayback))
       
   465                             continue;
       
   466                 }
       
   467             }
       
   468 
       
   469             if (iface) {
       
   470                 supportedTypes << iface->supportedMimeTypes();
       
   471             }
       
   472         }
       
   473 
       
   474         // Multiple services may support the same MIME type
       
   475         supportedTypes.removeDuplicates();
       
   476 
       
   477         return supportedTypes;
       
   478     }
       
   479 
       
   480     QList<QByteArray> devices(const QByteArray &serviceType) const
       
   481     {
       
   482         QList<QByteArray> res;
       
   483 
       
   484         foreach(QObject *obj, loader()->instances(serviceType)) {
       
   485             QMediaServiceSupportedDevicesInterface *iface =
       
   486                     qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
       
   487 
       
   488             if (iface) {
       
   489                 res.append(iface->devices(serviceType));
       
   490             }
       
   491         }
       
   492 
       
   493         return res;
       
   494     }
       
   495 
       
   496     QString deviceDescription(const QByteArray &serviceType, const QByteArray &device)
       
   497     {
       
   498         foreach(QObject *obj, loader()->instances(serviceType)) {
       
   499             QMediaServiceSupportedDevicesInterface *iface =
       
   500                     qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
       
   501 
       
   502             if (iface) {
       
   503                 if (iface->devices(serviceType).contains(device))
       
   504                     return iface->deviceDescription(serviceType, device);
       
   505             }
       
   506         }
       
   507 
       
   508         return QString();
       
   509     }
       
   510 };
       
   511 
       
   512 Q_GLOBAL_STATIC(QPluginServiceProvider, pluginProvider);
       
   513 
       
   514 /*!
       
   515     \class QMediaServiceProvider
       
   516     \preliminary
       
   517     \brief The QMediaServiceProvider class provides an abstract allocator for media services.
       
   518 */
       
   519 
       
   520 /*!
       
   521     \fn QMediaServiceProvider::requestService(const QByteArray &type, const QMediaServiceProviderHint &hint)
       
   522 
       
   523     Requests an instance of a \a type service which best matches the given \a
       
   524     hint.
       
   525 
       
   526     Returns a pointer to the requested service, or a null pointer if there is
       
   527     no suitable service.
       
   528 
       
   529     The returned service must be released with releaseService when it is
       
   530     finished with.
       
   531 */
       
   532 
       
   533 /*!
       
   534     \fn QMediaServiceProvider::releaseService(QMediaService *service)
       
   535 
       
   536     Releases a media \a service requested with requestService().
       
   537 */
       
   538 
       
   539 /*!
       
   540     \fn QtMultimediaKit::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray &serviceType, const QString &mimeType, const QStringList& codecs, int flags) const
       
   541 
       
   542     Returns how confident a media service provider is that is can provide a \a
       
   543     serviceType service that is able to play media of a specific \a mimeType
       
   544     that is encoded using the listed \a codecs while adhering to constraints
       
   545     identified in \a flags.
       
   546 */
       
   547 QtMultimediaKit::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray &serviceType,
       
   548                                                         const QString &mimeType,
       
   549                                                         const QStringList& codecs,
       
   550                                                         int flags) const
       
   551 {
       
   552     Q_UNUSED(serviceType);
       
   553     Q_UNUSED(mimeType);
       
   554     Q_UNUSED(codecs);
       
   555     Q_UNUSED(flags);
       
   556 
       
   557     return QtMultimediaKit::MaybeSupported;
       
   558 }
       
   559 
       
   560 /*!
       
   561     \fn QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType, int flags) const
       
   562 
       
   563     Returns a list of MIME types supported by the service provider for the
       
   564     specified \a serviceType.
       
   565 
       
   566     The resultant list is restricted to MIME types which can be supported given
       
   567     the constraints in \a flags.
       
   568 */
       
   569 QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType, int flags) const
       
   570 {
       
   571     Q_UNUSED(serviceType);
       
   572     Q_UNUSED(flags);
       
   573 
       
   574     return QStringList();
       
   575 }
       
   576 
       
   577 /*!
       
   578   Returns the list of devices related to \a service type.
       
   579 */
       
   580 QList<QByteArray> QMediaServiceProvider::devices(const QByteArray &service) const
       
   581 {
       
   582     Q_UNUSED(service);
       
   583     return QList<QByteArray>();
       
   584 }
       
   585 
       
   586 /*!
       
   587     Returns the description of \a device related to \a serviceType, suitable for use by
       
   588     an application for display.
       
   589 */
       
   590 QString QMediaServiceProvider::deviceDescription(const QByteArray &serviceType, const QByteArray &device)
       
   591 {
       
   592     Q_UNUSED(serviceType);
       
   593     Q_UNUSED(device);
       
   594     return QString();
       
   595 }
       
   596 
       
   597 
       
   598 #ifdef QT_BUILD_INTERNAL
       
   599 
       
   600 static QMediaServiceProvider *qt_defaultMediaServiceProvider = 0;
       
   601 
       
   602 /*!
       
   603     Sets a media service \a provider as the default.
       
   604 
       
   605     \internal
       
   606 */
       
   607 void QMediaServiceProvider::setDefaultServiceProvider(QMediaServiceProvider *provider)
       
   608 {
       
   609     qt_defaultMediaServiceProvider = provider;
       
   610 }
       
   611 
       
   612 #endif
       
   613 
       
   614 /*!
       
   615     Returns a default provider of media services.
       
   616 */
       
   617 QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
       
   618 {
       
   619 #ifdef QT_BUILD_INTERNAL
       
   620     return qt_defaultMediaServiceProvider != 0
       
   621             ? qt_defaultMediaServiceProvider
       
   622             : static_cast<QMediaServiceProvider *>(pluginProvider());
       
   623 #else
       
   624     return pluginProvider();
       
   625 #endif
       
   626 }
       
   627 
       
   628 /*!
       
   629     \class QMediaServiceProviderPlugin
       
   630     \preliminary
       
   631     \brief The QMediaServiceProviderPlugin class interface provides an interface for QMediaService
       
   632     plug-ins.
       
   633 
       
   634     A media service provider plug-in may implement one or more of
       
   635     QMediaServiceSupportedFormatsInterface,
       
   636     QMediaServiceSupportedDevicesInterface, and QMediaServiceFeaturesInterface
       
   637     to identify the features it supports.
       
   638 */
       
   639 
       
   640 /*!
       
   641     \fn QMediaServiceProviderPlugin::keys() const
       
   642 
       
   643     Returns a list of keys for media services a plug-in can create.
       
   644 */
       
   645 
       
   646 /*!
       
   647     \fn QMediaServiceProviderPlugin::create(const QString &key)
       
   648 
       
   649     Constructs a new instance of the QMediaService identified by \a key.
       
   650 
       
   651     The QMediaService returned must be destroyed with release().
       
   652 */
       
   653 
       
   654 /*!
       
   655     \fn QMediaServiceProviderPlugin::release(QMediaService *service)
       
   656 
       
   657     Destroys a media \a service constructed with create().
       
   658 */
       
   659 
       
   660 
       
   661 /*!
       
   662     \class QMediaServiceSupportedFormatsInterface
       
   663     \brief The QMediaServiceSupportedFormatsInterface class interface
       
   664     identifies if a media service plug-in supports a media format.
       
   665 
       
   666     A QMediaServiceProviderPlugin may implement this interface.
       
   667 */
       
   668 
       
   669 /*!
       
   670     \fn QMediaServiceSupportedFormatsInterface::~QMediaServiceSupportedFormatsInterface()
       
   671 
       
   672     Destroys a media service supported formats interface.
       
   673 */
       
   674 
       
   675 /*!
       
   676     \fn QMediaServiceSupportedFormatsInterface::hasSupport(const QString &mimeType, const QStringList& codecs) const
       
   677 
       
   678     Returns the level of support a media service plug-in has for a \a mimeType
       
   679     and set of \a codecs.
       
   680 */
       
   681 
       
   682 /*!
       
   683     \fn QMediaServiceSupportedFormatsInterface::supportedMimeTypes() const
       
   684 
       
   685     Returns a list of MIME types supported by the media service plug-in.
       
   686 */
       
   687 
       
   688 /*!
       
   689     \class QMediaServiceSupportedDevicesInterface
       
   690     \brief The QMediaServiceSupportedDevicesInterface class interface
       
   691     identifies the devices supported by a media service plug-in.
       
   692 
       
   693     A QMediaServiceProviderPlugin may implement this interface.
       
   694 */
       
   695 
       
   696 /*!
       
   697     \fn QMediaServiceSupportedDevicesInterface::~QMediaServiceSupportedDevicesInterface()
       
   698 
       
   699     Destroys a media service supported devices interface.
       
   700 */
       
   701 
       
   702 /*!
       
   703     \fn QMediaServiceSupportedDevicesInterface::devices(const QByteArray &service) const
       
   704 
       
   705     Returns a list of devices supported by a plug-in \a service.
       
   706 */
       
   707 
       
   708 /*!
       
   709     \fn QMediaServiceSupportedDevicesInterface::deviceDescription(const QByteArray &service, const QByteArray &device)
       
   710 
       
   711     Returns a description of a \a device supported by a plug-in \a service.
       
   712 */
       
   713 
       
   714 /*!
       
   715     \class QMediaServiceFeaturesInterface
       
   716     \brief The QMediaServiceFeaturesInterface class interface identifies
       
   717     features supported by a media service plug-in.
       
   718 
       
   719     A QMediaServiceProviderPlugin may implement this interface.
       
   720 */
       
   721 
       
   722 /*!
       
   723     \fn QMediaServiceFeaturesInterface::~QMediaServiceFeaturesInterface()
       
   724 
       
   725     Destroys a media service features interface.
       
   726 */
       
   727 /*!
       
   728     \fn QMediaServiceFeaturesInterface::supportedFeatures(const QByteArray &service) const
       
   729 
       
   730     Returns a set of features supported by a plug-in \a service.
       
   731 */
       
   732 
       
   733 #include "moc_qmediaserviceprovider.cpp"
       
   734 #include "moc_qmediaserviceproviderplugin.cpp"
       
   735 QT_END_NAMESPACE
       
   736