src/multimedia/qmediaplayercontrol.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 "qmediaplayercontrol.h"
       
    43 #include "qmediacontrol_p.h"
       
    44 #include "qmediaplayer.h"
       
    45 
       
    46 QT_BEGIN_NAMESPACE
       
    47 
       
    48 
       
    49 /*!
       
    50     \class QMediaPlayerControl
       
    51     \ingroup multimedia
       
    52 
       
    53     \preliminary
       
    54     \brief The QMediaPlayerControl class provides access to the media playing
       
    55     functionality of a QMediaService.
       
    56 
       
    57     If a QMediaService can play media is will implement QMediaPlayerControl.
       
    58     This control provides a means to set the \l {setMedia()}{media} to play,
       
    59     \l {play()}{start}, \l {pause()} {pause} and \l {stop()}{stop} playback,
       
    60     \l {setPosition()}{seek}, and control the \l {setVolume()}{volume}.
       
    61     It also provides feedback on the \l {duration()}{duration} of the media,
       
    62     the current \l {position()}{position}, and \l {bufferStatus()}{buffering}
       
    63     progress.
       
    64 
       
    65     The functionality provided by this control is exposed to application
       
    66     code through the QMediaPlayer class.
       
    67 
       
    68     The interface name of QMediaPlayerControl is \c com.nokia.Qt.QMediaPlayerControl/1.0 as
       
    69     defined in QMediaPlayerControl_iid.
       
    70 
       
    71     \sa QMediaService::requestControl(), QMediaPlayer
       
    72 */
       
    73 
       
    74 /*!
       
    75     \macro QMediaPlayerControl_iid
       
    76 
       
    77     \c com.nokia.Qt.QMediaPlayerControl/1.0
       
    78 
       
    79     Defines the interface name of the QMediaPlayerControl class.
       
    80 
       
    81     \relates QMediaPlayerControl
       
    82 */
       
    83 
       
    84 /*!
       
    85     Destroys a media player control.
       
    86 */
       
    87 QMediaPlayerControl::~QMediaPlayerControl()
       
    88 {
       
    89 }
       
    90 
       
    91 /*!
       
    92     Constructs a new media player control with the given \a parent.
       
    93 */
       
    94 QMediaPlayerControl::QMediaPlayerControl(QObject *parent):
       
    95     QMediaControl(*new QMediaControlPrivate, parent)
       
    96 {
       
    97 }
       
    98 
       
    99 /*!
       
   100     \fn QMediaPlayerControl::state() const
       
   101 
       
   102     Returns the state of a player control.
       
   103 */
       
   104 
       
   105 /*!
       
   106     \fn QMediaPlayerControl::stateChanged(QMediaPlayer::State state)
       
   107 
       
   108     Signals that the \a state of a player control has changed.
       
   109 
       
   110     \sa state()
       
   111 */
       
   112 
       
   113 /*!
       
   114     \fn QMediaPlayerControl::mediaStatus() const
       
   115 
       
   116     Returns the status of the current media.
       
   117 */
       
   118 
       
   119 /*!
       
   120     \fn QMediaPlayerControl::mediaStatusChanged(QMediaPlayer::MediaStatus status)
       
   121 
       
   122     Signals that the \a status of the current media has changed.
       
   123 
       
   124     \sa mediaStatus()
       
   125 */
       
   126 
       
   127 
       
   128 /*!
       
   129     \fn QMediaPlayerControl::duration() const
       
   130 
       
   131     Returns the duration of the current media in milliseconds.
       
   132 */
       
   133 
       
   134 /*!
       
   135     \fn QMediaPlayerControl::durationChanged(qint64 duration)
       
   136 
       
   137     Signals that the \a duration of the current media has changed.
       
   138 
       
   139     \sa duration()
       
   140 */
       
   141 
       
   142 /*!
       
   143     \fn QMediaPlayerControl::position() const
       
   144 
       
   145     Returns the current playback position in milliseconds.
       
   146 */
       
   147 
       
   148 /*!
       
   149     \fn QMediaPlayerControl::setPosition(qint64 position)
       
   150 
       
   151     Sets the playback \a position of the current media.  This will initiate a seek and it may take
       
   152     some time for playback to reach the position set.
       
   153 */
       
   154 
       
   155 /*!
       
   156     \fn QMediaPlayerControl::positionChanged(qint64 position)
       
   157 
       
   158     Signals the playback \a position has changed.
       
   159 
       
   160     This is only emitted in when there has been a discontinous change in the playback postion, such
       
   161     as a seek or the position being reset.
       
   162 
       
   163     \sa position()
       
   164 */
       
   165 
       
   166 /*!
       
   167     \fn QMediaPlayerControl::volume() const
       
   168 
       
   169     Returns the audio volume of a player control.
       
   170 */
       
   171 
       
   172 /*!
       
   173     \fn QMediaPlayerControl::setVolume(int volume)
       
   174 
       
   175     Sets the audio \a volume of a player control.
       
   176 */
       
   177 
       
   178 /*!
       
   179     \fn QMediaPlayerControl::volumeChanged(int volume)
       
   180 
       
   181     Signals the audio \a volume of a player control has changed.
       
   182 
       
   183     \sa volume()
       
   184 */
       
   185 
       
   186 /*!
       
   187     \fn QMediaPlayerControl::isMuted() const
       
   188 
       
   189     Returns the mute state of a player control.
       
   190 */
       
   191 
       
   192 /*!
       
   193     \fn QMediaPlayerControl::setMuted(bool mute)
       
   194 
       
   195     Sets the \a mute state of a player control.
       
   196 */
       
   197 
       
   198 /*!
       
   199     \fn QMediaPlayerControl::mutedChanged(bool mute)
       
   200 
       
   201     Signals a change in the \a mute status of a player control.
       
   202 
       
   203     \sa isMuted()
       
   204 */
       
   205 
       
   206 /*!
       
   207     \fn QMediaPlayerControl::bufferStatus() const
       
   208 
       
   209     Returns the buffering progress of the current media.  Progress is measured in the percentage
       
   210     of the buffer filled.
       
   211 */
       
   212 
       
   213 /*!
       
   214     \fn QMediaPlayerControl::bufferStatusChanged(int progress)
       
   215 
       
   216     Signals that buffering \a progress has changed.
       
   217 
       
   218     \sa bufferStatus()
       
   219 */
       
   220 
       
   221 /*!
       
   222     \fn QMediaPlayerControl::isAudioAvailable() const
       
   223 
       
   224     Identifies if there is audio output available for the current media.
       
   225 
       
   226     Returns true if audio output is available and false otherwise.
       
   227 */
       
   228 
       
   229 /*!
       
   230     \fn QMediaPlayerControl::audioAvailableChanged(bool audio)
       
   231 
       
   232     Signals that there has been a change in the availability of \a audio output.
       
   233 
       
   234     \sa isAudioAvailable()
       
   235 */
       
   236 
       
   237 /*!
       
   238     \fn QMediaPlayerControl::isVideoAvailable() const
       
   239 
       
   240     Identifies if there is video output available for the current media.
       
   241 
       
   242     Returns true if video output is available and false otherwise.
       
   243 */
       
   244 
       
   245 /*!
       
   246     \fn QMediaPlayerControl::videoAvailableChanged(bool video)
       
   247 
       
   248     Signals that there has been a change in the availability of \a video output.
       
   249 
       
   250     \sa isVideoAvailable()
       
   251 */
       
   252 
       
   253 /*!
       
   254     \fn QMediaPlayerControl::isSeekable() const
       
   255 
       
   256     Identifies if the current media is seekable.
       
   257 
       
   258     Returns true if it possible to seek within the current media, and false otherwise.
       
   259 */
       
   260 
       
   261 /*!
       
   262     \fn QMediaPlayerControl::seekableChanged(bool seekable)
       
   263 
       
   264     Signals that the \a seekable state of a player control has changed.
       
   265 
       
   266     \sa isSeekable()
       
   267 */
       
   268 
       
   269 /*!
       
   270     \fn QMediaPlayerControl::availablePlaybackRanges() const
       
   271 
       
   272     Returns a range of times in milliseconds that can be played back.
       
   273 
       
   274     Usually for local files this is a continuous interval equal to [0..duration()]
       
   275     or an empty time range if seeking is not supported, but for network sources
       
   276     it refers to the buffered parts of the media.
       
   277 */
       
   278 
       
   279 /*!
       
   280     \fn QMediaPlayerControl::availablePlaybackRangesChanged(const QMediaTimeRange &ranges)
       
   281 
       
   282     Signals that the available media playback \a ranges have changed.
       
   283 
       
   284     \sa QMediaPlayerControl::availablePlaybackRanges()
       
   285 */
       
   286 
       
   287 /*!
       
   288     \fn qreal QMediaPlayerControl::playbackRate() const
       
   289 
       
   290     Returns the rate of playback.
       
   291 */
       
   292 
       
   293 /*!
       
   294     \fn QMediaPlayerControl::setPlaybackRate(qreal rate)
       
   295 
       
   296     Sets the \a rate of playback.
       
   297 */
       
   298 
       
   299 /*!
       
   300     \fn QMediaPlayerControl::media() const
       
   301 
       
   302     Returns the current media source.
       
   303 */
       
   304 
       
   305 /*!
       
   306     \fn QMediaPlayerControl::mediaStream() const
       
   307 
       
   308     Returns the current media stream. This is only a valid if a stream was passed to setMedia().
       
   309 
       
   310     \sa setMedia()
       
   311 */
       
   312 
       
   313 /*!
       
   314     \fn QMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream)
       
   315 
       
   316     Sets the current \a media source.  If a \a stream is supplied; data will be read from that
       
   317     instead of attempting to resolve the media source.  The media source may still be used to
       
   318     supply media information such as mime type.
       
   319 
       
   320     Setting the media to a null QMediaContent will cause the control to discard all
       
   321     information relating to the current media source and to cease all I/O operations related
       
   322     to that media.
       
   323 */
       
   324 
       
   325 /*!
       
   326     \fn QMediaPlayerControl::mediaChanged(const QMediaContent& content)
       
   327 
       
   328     Signals that the current media \a content has changed.
       
   329 */
       
   330 
       
   331 /*!
       
   332     \fn QMediaPlayerControl::play()
       
   333 
       
   334     Starts playback of the current media.
       
   335 
       
   336     If successful the player control will immediately enter the \l {QMediaPlayer::PlayingState}
       
   337     {playing} state.
       
   338 
       
   339     \sa state()
       
   340 */
       
   341 
       
   342 /*!
       
   343     \fn QMediaPlayerControl::pause()
       
   344 
       
   345     Pauses playback of the current media.
       
   346 
       
   347     If sucessful the player control will immediately enter the \l {QMediaPlayer::PausedState}
       
   348     {paused} state.
       
   349 
       
   350     \sa state(), play(), stop()
       
   351 */
       
   352 
       
   353 /*!
       
   354     \fn QMediaPlayerControl::stop()
       
   355 
       
   356     Stops playback of the current media.
       
   357 
       
   358     If succesful the player control will immediately enter the \l {QMediaPlayer::StoppedState}
       
   359     {stopped} state.
       
   360 */
       
   361 
       
   362 /*!
       
   363     \fn QMediaPlayerControl::error(int error, const QString &errorString)
       
   364 
       
   365     Signals that an \a error has occurred.  The \a errorString provides a more detailed explanation.
       
   366 */
       
   367 
       
   368 /*!
       
   369     \fn QMediaPlayerControl::playbackRateChanged(qreal rate)
       
   370 
       
   371     Signal emitted when playback rate changes to \a rate.
       
   372 */
       
   373 
       
   374 #include "moc_qmediaplayercontrol.cpp"
       
   375 QT_END_NAMESPACE
       
   376