src/multimedia/qmediaplaylistioplugin.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 QMEDIAPLAYLISTIOPLUGIN_H
       
    43 #define QMEDIAPLAYLISTIOPLUGIN_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 #include <QtCore/qplugin.h>
       
    47 #include <QtCore/qfactoryinterface.h>
       
    48 
       
    49 #include <qmobilityglobal.h>
       
    50 
       
    51 #include "qmediacontent.h"
       
    52 
       
    53 QT_BEGIN_NAMESPACE
       
    54 class QString;
       
    55 class QUrl;
       
    56 class QByteArray;
       
    57 class QIODevice;
       
    58 class QStringList;
       
    59 
       
    60 class Q_MULTIMEDIA_EXPORT QMediaPlaylistReader
       
    61 {
       
    62 public:
       
    63     virtual ~QMediaPlaylistReader();
       
    64 
       
    65     virtual bool atEnd() const = 0;
       
    66     virtual QMediaContent readItem() = 0;
       
    67     virtual void close() = 0;
       
    68 };
       
    69 
       
    70 class Q_MULTIMEDIA_EXPORT QMediaPlaylistWriter
       
    71 {
       
    72 public:
       
    73     virtual ~QMediaPlaylistWriter();
       
    74 
       
    75     virtual bool writeItem(const QMediaContent &content) = 0;
       
    76     virtual void close() = 0;
       
    77 };
       
    78 
       
    79 struct Q_MULTIMEDIA_EXPORT QMediaPlaylistIOInterface : public QFactoryInterface
       
    80 {
       
    81     virtual bool canRead(QIODevice *device, const QByteArray &format = QByteArray() ) const = 0;
       
    82     virtual bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const = 0;
       
    83 
       
    84     virtual bool canWrite(QIODevice *device, const QByteArray &format) const = 0;
       
    85 
       
    86     virtual QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray()) = 0;
       
    87     virtual QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray()) = 0;
       
    88 
       
    89     virtual QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format) = 0;
       
    90 };
       
    91 
       
    92 #define QMediaPlaylistIOInterface_iid "com.nokia.Qt.QMediaPlaylistIOInterface"
       
    93 Q_DECLARE_INTERFACE(QMediaPlaylistIOInterface, QMediaPlaylistIOInterface_iid);
       
    94 
       
    95 class Q_MULTIMEDIA_EXPORT QMediaPlaylistIOPlugin : public QObject, public QMediaPlaylistIOInterface
       
    96 {
       
    97 Q_OBJECT
       
    98 Q_INTERFACES(QMediaPlaylistIOInterface:QFactoryInterface)
       
    99 public:
       
   100     explicit QMediaPlaylistIOPlugin(QObject *parent = 0);
       
   101     virtual ~QMediaPlaylistIOPlugin();
       
   102 
       
   103     virtual bool canRead(QIODevice *device, const QByteArray &format = QByteArray() ) const = 0;
       
   104     virtual bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const = 0;
       
   105 
       
   106     virtual bool canWrite(QIODevice *device, const QByteArray &format) const = 0;
       
   107 
       
   108     virtual QStringList keys() const = 0;
       
   109 
       
   110     virtual QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray()) = 0;
       
   111     virtual QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray()) = 0;
       
   112 
       
   113     virtual QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format) = 0;
       
   114 };
       
   115 
       
   116 QT_END_NAMESPACE
       
   117 
       
   118 #endif // QMEDIAPLAYLISTIOPLUGIN_H