[556] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[651] | 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[556] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
| 6 | **
|
---|
| 7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 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 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
| 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | /*!
|
---|
| 43 | \page phonon-overview.html
|
---|
| 44 | \title Phonon Overview
|
---|
| 45 | \ingroup frameworks-technologies
|
---|
| 46 |
|
---|
| 47 | \tableofcontents
|
---|
| 48 |
|
---|
| 49 | \section1 Introduction
|
---|
| 50 |
|
---|
| 51 | Qt uses the Phonon multimedia framework to provide functionality
|
---|
| 52 | for playback of the most common multimedia formats. The media can
|
---|
| 53 | be read from files or streamed over a network, using a QURL to a
|
---|
| 54 | file.
|
---|
| 55 |
|
---|
| 56 | In this overview, we take a look at the main concepts of Phonon.
|
---|
| 57 | We also explain the architecture, examine the
|
---|
| 58 | core API classes, and show examples on how to use the classes
|
---|
| 59 | provided.
|
---|
| 60 |
|
---|
| 61 | \section1 Architecture
|
---|
| 62 |
|
---|
| 63 | Phonon has three basic concepts: media objects, sinks, and paths.
|
---|
| 64 | A media object manages a media source, for instance, a music file;
|
---|
| 65 | it provides simple playback control, such as starting, stopping,
|
---|
| 66 | and pausing the playback. A sink outputs the media from Phonon,
|
---|
| 67 | e.g., by rendering video on a widget, or by sending audio to a
|
---|
| 68 | sound card. Paths are used to connect Phonon objects, i.e., a
|
---|
| 69 | media object and a sink, in a graph - called a media graph in
|
---|
| 70 | Phonon.
|
---|
| 71 |
|
---|
| 72 | As an example, we show a media graph for an audio stream:
|
---|
| 73 |
|
---|
| 74 | \image conceptaudio.png
|
---|
| 75 |
|
---|
| 76 | The playback is started and managed by the media object, which
|
---|
| 77 | send the media stream to any sinks connected to it by a path. The
|
---|
| 78 | sink then plays the stream back, usually though a sound card.
|
---|
| 79 |
|
---|
| 80 | \omit Not sure if this goes here, or anywhere...
|
---|
| 81 | All nodes in the graph are synchronized by the framework,
|
---|
| 82 | meaning that if more than one sink is connected to the same
|
---|
| 83 | media object, the framework will handle the synchronization
|
---|
| 84 | between the sinks; this happens for instance when a media
|
---|
| 85 | source containing video with sound is played back. More on
|
---|
| 86 | this later.
|
---|
| 87 | \endomit
|
---|
| 88 |
|
---|
| 89 | \section2 Media Objects
|
---|
| 90 |
|
---|
| 91 | The media object, an instance of the \l{Phonon::}{MediaObject}
|
---|
| 92 | class, lets you start, pause, and stop the playback of a media
|
---|
| 93 | stream, i.e., it provided basic control over the playback. You may
|
---|
| 94 | think of the object as a simple media player.
|
---|
| 95 |
|
---|
| 96 | The media data is provided by a media source, which is
|
---|
| 97 | kept by the media object. The media source is a separate
|
---|
| 98 | object - an instance of \l{Phonon::}{MediaSource} - in Phonon, and
|
---|
| 99 | not part of the graph itself. The source will supply the media
|
---|
| 100 | object with raw data. The data can be read from files and streamed
|
---|
| 101 | over a network. The contents of the source will be interpreted by
|
---|
| 102 | the media object.
|
---|
| 103 |
|
---|
| 104 | A media object is always instantiated with the default constructor
|
---|
| 105 | and then supplied with a media source. Concrete code examples are
|
---|
| 106 | given later in this overview.
|
---|
| 107 |
|
---|
| 108 | As a complement to the media object, Phonon also provides
|
---|
| 109 | \l{Phonon::}{MediaController}, which provides control over
|
---|
| 110 | features that are optional for a given media. For instance, for
|
---|
| 111 | chapters, menus, and titles of a VOB (DVD) file will be features
|
---|
| |
---|