| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the documentation of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** 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 are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | /*!
|
|---|
| 43 | \page phonon-overview.html
|
|---|
| 44 | \title Phonon Overview
|
|---|
| 45 | \ingroup multimedia
|
|---|
| 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
|
|---|
| 112 | managed by a \l{Phonon::}{MediaController}.
|
|---|
| 113 |
|
|---|
| 114 | \section2 Sinks
|
|---|
| 115 |
|
|---|
| 116 | A sink is a node that can output media from the graph, i.e., it
|
|---|
| 117 | does not send its output to other nodes. A sink is usually a
|
|---|
| 118 | rendering device.
|
|---|
| 119 |
|
|---|
| 120 | The input of sinks in a Phonon media graph comes from a
|
|---|
| 121 | \l{Phonon::}{MediaObject}, though it might have been processed
|
|---|
| 122 | through other nodes on the way.
|
|---|
| 123 |
|
|---|
| 124 | While the \l{Phonon::}{MediaObject} controls the playback, the
|
|---|
| 125 | sink has basic controls for manipulation of the media. With an
|
|---|
| 126 | audio sink, for instance, you can control the volume and mute the
|
|---|
| 127 | sound, i.e., it represents a virtual audio device. Another example
|
|---|
| 128 | is the \l{Phonon::}{VideoWidget}, which can render video on a
|
|---|
| 129 | QWidget and alter the brightness, hue, and scaling of the video.
|
|---|
| 130 |
|
|---|
| 131 | As an example we give an image of a graph used for playing back a
|
|---|
| 132 | video file with sound.
|
|---|
| 133 |
|
|---|
| 134 | \image conceptvideo.png
|
|---|
| 135 |
|
|---|
| 136 | \section2 Processors
|
|---|
| 137 |
|
|---|
| 138 | Phonon does not allow manipulation of media streams directly,
|
|---|
| 139 | i.e., one cannot alter a media stream's bytes programmatically
|
|---|
| 140 | after they have been given to a media object. We have other nodes
|
|---|
| 141 | to help with this: processors, which are placed in the graph on
|
|---|
| 142 | the path somewhere between the media object and its sinks. In
|
|---|
| 143 | Phonon, processors are of the \l{Phonon::}{Effect} class.
|
|---|
| 144 |
|
|---|
| 145 | When inserted into the rendering process, the processor will
|
|---|
| 146 | alter the media stream, and will be active as long as it is part
|
|---|
| 147 | of the graph. To stop, it needs to be removed.
|
|---|
| 148 |
|
|---|
| 149 | \omit \image conceptprocessor.png \endomit
|
|---|
| 150 |
|
|---|
| 151 | The \c {Effect}s may also have controls that affect how the media
|
|---|
| 152 | stream is manipulated. A processor applying a depth effect to
|
|---|
| 153 | audio, for instance, can have a value controlling the amount of
|
|---|
| 154 | depth. An \c Effect can be configured at any point in time.
|
|---|
| 155 |
|
|---|
| 156 | \section1 Playback
|
|---|
| 157 |
|
|---|
| 158 | In some common cases, it is not necessary to build a graph
|
|---|
| 159 | yourself.
|
|---|
| 160 |
|
|---|
| 161 | Phonon has convenience functions for building common graphs. For
|
|---|
| 162 | playing an audio file, you can use the
|
|---|
| 163 | \l{Phonon::}{createPlayer()} function. This will set up the
|
|---|
| 164 | necessary graph and return the media object node; the sound can
|
|---|
| 165 | then be started by calling its \l{Phonon::MediaObject::}{play()}
|
|---|
| 166 | function.
|
|---|
| 167 |
|
|---|
| 168 | \snippet snippets/phonon.cpp 0
|
|---|
| 169 |
|
|---|
| 170 | We have a similar solution for playing video files, the
|
|---|
| 171 | \l{Phonon::}{VideoPlayer}.
|
|---|
| 172 |
|
|---|
| 173 | \snippet snippets/phonon.cpp 1
|
|---|
| 174 |
|
|---|
| 175 | The VideoPlayer is a widget onto which the video will be drawn.
|
|---|
| 176 |
|
|---|
| 177 | The \c .pro file for a project needs the following line to be added:
|
|---|
| 178 |
|
|---|
| 179 | \snippet doc/src/snippets/code/doc_src_phonon.qdoc 0
|
|---|
| 180 |
|
|---|
| 181 | Phonon comes with several widgets that provide functionality
|
|---|
| 182 | commonly associated with multimedia players - notably SeekSlider
|
|---|
| 183 | for controlling the position of the stream, VolumeSlider for
|
|---|
| 184 | controlling sound volume, and EffectWidget for controlling the
|
|---|
| 185 | parameters of an effect. You can learn about them in the API
|
|---|
| 186 | documentation.
|
|---|
| 187 |
|
|---|
| 188 | \section1 Building Graphs
|
|---|
| 189 |
|
|---|
| 190 | If you need more freedom than the convenience functions described
|
|---|
| 191 | in the previous section offers you, you can build the graphs
|
|---|
| 192 | yourself. We will now take a look at how some common graphs are
|
|---|
| 193 | built. Starting a graph up is a matter of calling the
|
|---|
| 194 | \l{Phonon::MediaObject::}{play()} function of the media object.
|
|---|
| 195 |
|
|---|
| 196 | If the media source contains several types of media, for instance, a
|
|---|
| 197 | stream with both video and audio, the graph will contain two
|
|---|
| 198 | output nodes: one for the video and one for the audio.
|
|---|
| 199 |
|
|---|
| 200 | We will now look at the code required to build the graphs discussed
|
|---|
| 201 | previously in the \l{Architecture} section.
|
|---|
| 202 |
|
|---|
| 203 | \section2 Audio
|
|---|
| 204 |
|
|---|
| 205 | When playing back audio, you create the media object and connect
|
|---|
| 206 | it to an audio output node - a node that inherits from
|
|---|
| 207 | AbstractAudioOutput. Currently, AudioOutput, which outputs audio
|
|---|
| 208 | to the sound card, is provided.
|
|---|
| 209 |
|
|---|
| 210 | The code to create the graph is straight forward:
|
|---|
| 211 |
|
|---|
| 212 | \snippet snippets/phonon.cpp 2
|
|---|
| 213 |
|
|---|
| 214 | Notice that the type of media an input source has is resolved by
|
|---|
| 215 | Phonon, so you need not be concerned with this. If a source
|
|---|
| 216 | contains multiple media formats, this is also handled
|
|---|
| 217 | automatically.
|
|---|
| 218 |
|
|---|
| 219 | The media object is always created using the default constructor
|
|---|
| 220 | since it handles all multimedia formats.
|
|---|
| 221 |
|
|---|
| 222 | The setting of a Category, Phonon::MusicCategory in this case,
|
|---|
| 223 | does not affect the actual playback; the category can be used by
|
|---|
| 224 | KDE to control the playback through, for instance, the control
|
|---|
| 225 | panel.
|
|---|
| 226 |
|
|---|
| 227 | \omit Not sure about this
|
|---|
| 228 | Users of KDE can often also choose to send sound with the
|
|---|
| 229 | CommunicationCategory, e.g., given to VoIP, to their headset,
|
|---|
| 230 | while sound with MusicCategory is sent to the sound card.
|
|---|
| 231 | \endomit
|
|---|
| 232 |
|
|---|
| 233 | The AudioOutput class outputs the audio media to a sound card,
|
|---|
| 234 | that is, one of the audio devices of the operating system. An
|
|---|
| 235 | audio device can be a sound card or a intermediate technology,
|
|---|
| 236 | such as \c DirectShow on windows. A default device will be chosen
|
|---|
| 237 | if one is not set with \l{Phonon::AudioOutput::}{setOutputDevice()}.
|
|---|
| 238 |
|
|---|
| 239 | The AudioOutput node will work with all audio formats supported by
|
|---|
| 240 | the back end, so you don't need to know what format a specific
|
|---|
| 241 | media source has.
|
|---|
| 242 |
|
|---|
| 243 | For a an extensive example of audio playback, see the \l{Music
|
|---|
| 244 | Player Example}{Phonon Music Player}.
|
|---|
| 245 |
|
|---|
| 246 | \section3 Audio Effects
|
|---|
| 247 |
|
|---|
| 248 | Since a media stream cannot be manipulated directly, the backend
|
|---|
| 249 | can produce nodes that can process the media streams. These nodes
|
|---|
| 250 | are inserted into the graph between a media object and an output
|
|---|
| 251 | node.
|
|---|
| 252 |
|
|---|
| 253 | Nodes that process media streams inherit from the Effect class.
|
|---|
| 254 | The effects available depends on the underlying system. Most of
|
|---|
| 255 | these effects will be supported by Phonon. See the \l{Querying
|
|---|
| 256 | Backends for Support} section for information on how to resolve
|
|---|
| 257 | the available effects on a particular system.
|
|---|
| 258 |
|
|---|
| 259 | We will now continue the example from above using the Path
|
|---|
| 260 | variable \c path to add an effect. The code is again trivial:
|
|---|
| 261 |
|
|---|
| 262 | \snippet snippets/phonon.cpp 3
|
|---|
| 263 |
|
|---|
| 264 | Here we simply take the first available effect on the system.
|
|---|
| 265 |
|
|---|
| 266 | The effect will start immediately after being inserted into the
|
|---|
| 267 | graph if the media object is playing. To stop it, you have to
|
|---|
| 268 | detach it again using \l{Phonon::Path::}{removeEffect()} of the Path.
|
|---|
| 269 |
|
|---|
| 270 | \section2 Video
|
|---|
| 271 |
|
|---|
| 272 | For playing video, VideoWidget is provided. This class functions
|
|---|
| 273 | both as a node in the graph and as a widget upon which it draws
|
|---|
| 274 | the video stream. The widget will automatically choose an available
|
|---|
| 275 | device for playing the video, which is usually a technology
|
|---|
| 276 | between the Qt application and the graphics card, such as \c
|
|---|
| 277 | DirectShow on Windows.
|
|---|
| 278 |
|
|---|
| 279 | The video widget does not play the audio (if any) in the media
|
|---|
| 280 | stream. If you want to play the audio as well, you will need
|
|---|
| 281 | an AudioOutput node. You create and connect it to the graph as
|
|---|
| 282 | shown in the previous section.
|
|---|
| 283 |
|
|---|
| 284 | The code for creating this graph is given below, after which
|
|---|
| 285 | one can play the video with \l{Phonon::MediaObject::}{play()}.
|
|---|
| 286 |
|
|---|
| 287 | \snippet snippets/phonon.cpp 4
|
|---|
| 288 |
|
|---|
| 289 | The VideoWidget does not need to be set to a Category, it is
|
|---|
| 290 | automatically classified to \l{Phonon::}{VideoCategory}, we only
|
|---|
| 291 | need to assure that the audio is also classified in the same
|
|---|
| 292 | category.
|
|---|
| 293 |
|
|---|
| 294 | The media object will split files with different media content
|
|---|
| 295 | into separate streams before sending them off to other nodes in
|
|---|
| 296 | the graph. It is the media object that determines the type of
|
|---|
| 297 | content appropriate for nodes that connect to it.
|
|---|
| 298 |
|
|---|
| 299 | \omit This section is from the future
|
|---|
| 300 |
|
|---|
| 301 | \section2 Multiple Audio Sources and Graph Outputs
|
|---|
| 302 |
|
|---|
| 303 | In this section, we take a look at a graph that contains multiple
|
|---|
| 304 | audio sources in addition to video. We have a video camera with
|
|---|
| 305 | some embarrassing home footage from last weekend's party, a
|
|---|
| 306 | microphone with which we intend to add commentary, and an audio
|
|---|
| 307 | music file to set the correct mood. It would be an advantage to
|
|---|
| 308 | write the graph output to a file for later viewing, but since this
|
|---|
| 309 | is not yet supported by Qt backends, we will play it back
|
|---|
| 310 | directly.
|
|---|
| 311 |
|
|---|
| 312 | <image of party graph>
|
|---|
| 313 |
|
|---|
| 314 | <code>
|
|---|
| 315 |
|
|---|
| 316 | <code walkthrough>
|
|---|
| 317 |
|
|---|
| 318 | \endomit
|
|---|
| 319 |
|
|---|
| 320 | \section1 Backends
|
|---|
| 321 |
|
|---|
| 322 | The multimedia functionality is not implemented by Phonon itself,
|
|---|
| 323 | but by a back end - often also referred to as an engine. This
|
|---|
| 324 | includes connecting to, managing, and driving the underlying
|
|---|
| 325 | hardware or intermediate technology. For the programmer, this
|
|---|
| 326 | implies that the media nodes, e.g., media objects, processors, and
|
|---|
| 327 | sinks, are produced by the back end. Also, it is responsible for
|
|---|
| 328 | building the graph, i.e., connecting the nodes.
|
|---|
| 329 |
|
|---|
| 330 | The backends of Qt use the media systems DirectShow (which
|
|---|
| 331 | requires DirectX) on Windows, QuickTime on Mac, and GStreamer on
|
|---|
| 332 | Linux. The functionality provided on the different platforms are
|
|---|
| 333 | dependent on these underlying systems and may vary somewhat, e.g.,
|
|---|
| 334 | in the media formats supported.
|
|---|
| 335 |
|
|---|
| 336 | Backends expose information about the underlying system. It can
|
|---|
| 337 | tell which media formats are supported, e.g., \c AVI, \c mp3, or
|
|---|
| 338 | \c OGG.
|
|---|
| 339 |
|
|---|
| 340 | A user can often add support for new formats and filters to the
|
|---|
| 341 | underlying system, by, for instance, installing the DivX codex. We
|
|---|
| 342 | can therefore not give an exact overview of which formats are
|
|---|
| 343 | available with the Qt backends.
|
|---|
| 344 |
|
|---|
| 345 | \omit Not sure I want a separate section for this
|
|---|
| 346 | \section2 Communication with the Backends
|
|---|
| 347 |
|
|---|
| 348 | We cooperate with backends through static functions in the
|
|---|
| 349 | Phonon namespace. We have already seen some of these functions
|
|---|
| 350 | in code examples. Their two main responsibilities are creating
|
|---|
| 351 | graph nodes and supplying information about the capabilities
|
|---|
| 352 | of the various nodes. The nodes uses the backend internally
|
|---|
| 353 | when created, so it is only connecting them in the graph that
|
|---|
| 354 | you need to use the backend directly.
|
|---|
| 355 |
|
|---|
| 356 | The main functions for graph building are:
|
|---|
| 357 |
|
|---|
| 358 | \list
|
|---|
| 359 | \o createPath(): This function creates a path between to
|
|---|
| 360 | nodes, which it takes as arguments.
|
|---|
| 361 | \o
|
|---|
| 362 | \endlist
|
|---|
| 363 |
|
|---|
| 364 | For more detailed information, please consult the API
|
|---|
| 365 | documentation.
|
|---|
| 366 |
|
|---|
| 367 | \endomit
|
|---|
| 368 |
|
|---|
| 369 | \section2 Querying Backends for Support
|
|---|
| 370 |
|
|---|
| 371 | As mentioned, Phonon depends on the backend to provide its
|
|---|
| 372 | functionality. Depending on the individual backend, full support
|
|---|
| 373 | of the API may not be in place. Applications therefore need to
|
|---|
| 374 | check with the backend if functionality they require is
|
|---|
| 375 | implemented. In this section, we take look at how this is done.
|
|---|
| 376 |
|
|---|
| 377 | The backend provides the
|
|---|
| 378 | \l{Phonon::BackendCapabilities::}{availableMimeTypes()} and
|
|---|
| 379 | \l{Phonon::BackendCapabilities::}{isMimeTypeAvailable()} functions
|
|---|
| 380 | to query which MIME types the backend can produce nodes for. The
|
|---|
| 381 | types are listed as strings, which for any type is equal for any
|
|---|
| 382 | backend or platform.
|
|---|
| 383 |
|
|---|
| 384 | The backend will emit a signal -
|
|---|
| 385 | \l{Phonon::BackendCapabilities::}{Notifier::capabilitiesChanged()}
|
|---|
| 386 | - if its abilities have changed. If the available audio devices
|
|---|
| 387 | have changed, the
|
|---|
| 388 | \l{Phonon::BackendCapabilities::}{Notifier::availableAudioOutputDevicesChanged()}
|
|---|
| 389 | signal is emitted instead.
|
|---|
| 390 |
|
|---|
| 391 | To query the actual audio devices possible, we have the
|
|---|
| 392 | \l{Phonon::BackendCapabilities::}{availableAudioOutputDevices()} as
|
|---|
| 393 | mentioned in the \l{#Sinks}{Sinks} section. To query information
|
|---|
| 394 | about the individual devices, you can examine its \c name(); this
|
|---|
| 395 | string is dependent on the operating system, and the Qt backends
|
|---|
| 396 | does not analyze the devices further.
|
|---|
| 397 |
|
|---|
| 398 | The sink for playback of video does not have a selection of
|
|---|
| 399 | devices. For convenience, the \l{Phonon::}{VideoWidget} is both a
|
|---|
| 400 | node in the graph and a widget on which the video output is
|
|---|
| 401 | rendered. To query the various video formats available, use
|
|---|
| 402 | \l{Phonon::BackendCapabilities::}{isMimeTypeAvailable()}. To add
|
|---|
| 403 | it to a path, you can use the Phonon::createPath() as usual. After
|
|---|
| 404 | creating a media object, it is also possible to call its
|
|---|
| 405 | \l{Phonon::MediaObject::}{hasVideo()} function.
|
|---|
| 406 |
|
|---|
| 407 | See also the \l{Capabilities Example}.
|
|---|
| 408 |
|
|---|
| 409 | \section1 Installing Phonon
|
|---|
| 410 |
|
|---|
| 411 | When running the Qt configure script, you will be notified whether
|
|---|
| 412 | Phonon support is available on your system. As mentioned
|
|---|
| 413 | previously, to use develop and run Phonon applications, you also
|
|---|
| 414 | need to link to a backend, which provides the multimedia
|
|---|
| 415 | functionality.
|
|---|
| 416 |
|
|---|
| 417 | Note that Phonon applications will compile and run without a
|
|---|
| 418 | working backend, but will, of course, not work as expected.
|
|---|
| 419 |
|
|---|
| 420 | The following sections explains requirements for each backend.
|
|---|
| 421 |
|
|---|
| 422 | \section2 Windows
|
|---|
| 423 |
|
|---|
| 424 | On Windows, building Phonon requires DirectX and DirectShow
|
|---|
| 425 | version 9 or higher. You'll need additional SDKs you can download
|
|---|
| 426 | from Microsoft.
|
|---|
| 427 |
|
|---|
| 428 | \section3 Windows XP and later Windows versions
|
|---|
| 429 |
|
|---|
| 430 | If you develop for Windows XP and up, you should download the Windows SDK
|
|---|
| 431 | \l{http://www.microsoft.com/downloads/details.aspx?FamilyID=e6e1c3df-a74f-4207-8586-711ebe331cdc&DisplayLang=en}{here}.
|
|---|
| 432 | Before building Qt, just call the script: \c {C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\setenv.cmd}
|
|---|
| 433 |
|
|---|
| 434 | \note Visual C++ 2008 already contains the Windows SDK and doesn't
|
|---|
| 435 | need that package and has already the environment set up for a
|
|---|
| 436 | smooth compilation of phonon.
|
|---|
| 437 |
|
|---|
| 438 | \section3 Earlier Windows versions than Windows XP
|
|---|
| 439 |
|
|---|
| 440 | If you want to support previous Windows versions, you should download and install the Platform SDK. You find it
|
|---|
| 441 | \l{http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en}{here}.
|
|---|
| 442 |
|
|---|
| 443 | \note The platform SDK provided with Visual C++ is not
|
|---|
| 444 | complete and
|
|---|
| 445 | you'll need this one to have DirectShow 9.0 support. You can download the DirectX SDK
|
|---|
| 446 | \l{http://www.microsoft.com/downloads/details.aspx?familyid=09F7578C-24AA-4E0A-BF91-5FEC24C8C7BF&displaylang=en}{here}.
|
|---|
| 447 |
|
|---|
| 448 | \section3 Setting up the environment
|
|---|
| 449 |
|
|---|
| 450 | Once the SDKs are installed, please make sure to set your
|
|---|
| 451 | environment variables LIB and INCLUDE correctly. The paths to the
|
|---|
| 452 | include and lib directory of the SDKs should appear first.
|
|---|
| 453 | Typically, to setup your environment, you would execute the
|
|---|
| 454 | following script:
|
|---|
| 455 |
|
|---|
| 456 | \code
|
|---|
| 457 | Set DXSDK_DIR=C:\Program Files\Microsoft DirectX SDK (February 2007)
|
|---|
| 458 | %DXSDK_DIR%\utilities\bin\dx_setenv.cmd
|
|---|
| 459 | C:\program files\Microsoft Platform SDK\setenv.cmd
|
|---|
| 460 | \endcode
|
|---|
| 461 |
|
|---|
| 462 | If your environment is setup correctly, executing configure.exe on
|
|---|
| 463 | your Qt installation should automatically activate Phonon.
|
|---|
| 464 |
|
|---|
| 465 | \warning The MinGW version of Qt does not support building the
|
|---|
| 466 | Qt backend.
|
|---|
| 467 |
|
|---|
| 468 | \section2 Linux
|
|---|
| 469 |
|
|---|
| 470 | The Qt backend on Linux uses GStreamer (minimum version is 0.10),
|
|---|
| 471 | which must be installed on the system. At a minimum, you need the
|
|---|
| 472 | GStreamer library and base plugins, which provides support for \c
|
|---|
| 473 | .ogg files. The package names may vary between Linux
|
|---|
| 474 | distributions; on Mandriva, they have the following names:
|
|---|
| 475 |
|
|---|
| 476 | \table
|
|---|
| 477 | \header
|
|---|
| 478 | \o Package
|
|---|
| 479 | \o Description
|
|---|
| 480 | \row
|
|---|
| 481 | \o libgstreamer0.10_0.10
|
|---|
| 482 | \o The GStreamer base library.
|
|---|
| 483 | \row
|
|---|
| 484 | \o libgstreamer0.10_0.10-devel
|
|---|
| 485 | \o Contains files for developing applications with
|
|---|
| 486 | GStreamer.
|
|---|
| 487 | \row
|
|---|
| 488 | \o libgstreamer-plugins-base0.10
|
|---|
| 489 | \o Contains the basic plugins for audio and video
|
|---|
| 490 | playback, and will enable support for \c ogg files.
|
|---|
| 491 | \row
|
|---|
| 492 | \o libgstreamer-plugins-base0.10-devel
|
|---|
| 493 | \o Makes it possible to develop applications using the
|
|---|
| 494 | base plugins.
|
|---|
| 495 | \endtable
|
|---|
| 496 |
|
|---|
| 497 | \omit Should go in troubleshooting (in for example README)
|
|---|
| 498 | alsasink backend for GStreamer
|
|---|
| 499 | \table
|
|---|
| 500 | \header
|
|---|
| 501 | \o Variable
|
|---|
| 502 | \o Description
|
|---|
| 503 | \row
|
|---|
| 504 | \o PHONON_GST_AUDIOSINK
|
|---|
| 505 | \o Sets the audio sink to be used. Possible values are
|
|---|
| 506 | ... alsasink.
|
|---|
| 507 | \row
|
|---|
| 508 | \o PHONON_GSTREAMER_DRIVER
|
|---|
| 509 | \o Sets the driver for GStreamer. This driver will
|
|---|
| 510 | usually be configured automatically when
|
|---|
| 511 | installing.
|
|---|
| 512 | \row
|
|---|
| 513 | \o PHONON_GST_VIDEOWIDGET
|
|---|
| 514 | \o This variable can be set to the name of a widget to
|
|---|
| 515 | use as the video widget??
|
|---|
| 516 | \row
|
|---|
| 517 | \o PHONON_GST_DEBUG
|
|---|
| 518 | \o Phonon will give debug information while running if
|
|---|
| 519 | this variable is set to a number between 1 and 3.
|
|---|
| 520 | \row
|
|---|
| 521 | \o PHONON_TESTURL
|
|---|
| 522 | \o ...
|
|---|
| 523 | \endtable
|
|---|
| 524 | \endomit
|
|---|
| 525 |
|
|---|
| 526 | \section2 Mac OS X
|
|---|
| 527 |
|
|---|
| 528 | On Mac OS X, Qt uses QuickTime for its backend. The minimum
|
|---|
| 529 | supported version is 7.0.
|
|---|
| 530 |
|
|---|
| 531 | \section1 Deploying Phonon Applications on Windows and Mac OS X
|
|---|
| 532 |
|
|---|
| 533 | On Windows and Mac OS X, the Qt backend makes use of the
|
|---|
| 534 | \l{QtOpenGL Module}{QtOpenGL} module. You therefore need to deploy
|
|---|
| 535 | the QtOpenGL shared library. If this is not what you want, it is
|
|---|
| 536 | possible to configure Qt without OpenGL support. In that case, you
|
|---|
| 537 | need to run \c configure with the \c -no-opengl option.
|
|---|
| 538 |
|
|---|
| 539 | \section1 Work in Progress
|
|---|
| 540 |
|
|---|
| 541 | Phonon and its Qt backends, though fully functional for
|
|---|
| 542 | multimedia playback, are still under development. Functionality to
|
|---|
| 543 | come is the possibility to capture media and more processors for
|
|---|
| 544 | both music and video files.
|
|---|
| 545 |
|
|---|
| 546 | Another important consideration is to implement support for
|
|---|
| 547 | storing media to files; i.e., not playing back media directly.
|
|---|
| 548 |
|
|---|
| 549 | We also hope in the future to be able to support direct
|
|---|
| 550 | manipulation of media streams. This will give the programmer more
|
|---|
| 551 | freedom to manipulate streams than just through processors.
|
|---|
| 552 |
|
|---|
| 553 | Currently, the multimedia framework supports one input source. It will be
|
|---|
| 554 | possible to include several sources. This is useful in, for example, audio
|
|---|
| 555 | mixer applications where several audio sources can be sent, processed and
|
|---|
| 556 | output as a single audio stream.
|
|---|
| 557 | */
|
|---|
| 558 |
|
|---|
| 559 | /*!
|
|---|
| 560 | \namespace Phonon
|
|---|
| 561 | \brief The Phonon namespace contains classes and functions for multimedia applications.
|
|---|
| 562 | \since 4.4
|
|---|
| 563 |
|
|---|
| 564 | This namespace contains classes to access multimedia functions for
|
|---|
| 565 | audio and video playback. Those classes are not dependent on any specific
|
|---|
| 566 | framework, but rather use exchangeable backends to do the work.
|
|---|
| 567 |
|
|---|
| 568 | See the \l{Phonon Module} page for general information about the
|
|---|
| 569 | framework and the \l{Phonon Overview} for an introductory tour of its
|
|---|
| 570 | features.
|
|---|
| 571 | */
|
|---|
| 572 |
|
|---|
| 573 | /*!
|
|---|
| 574 | \page phonon-module.html
|
|---|
| 575 | \module Phonon
|
|---|
| 576 | \title Phonon Module
|
|---|
| 577 | \contentspage Qt's Modules
|
|---|
| 578 | \previouspage QtXmlPatterns
|
|---|
| 579 | \nextpage Qt3Support
|
|---|
| 580 | \ingroup modules
|
|---|
| 581 |
|
|---|
| 582 | \brief The Phonon module contains namespaces and classes for multimedia functionality.
|
|---|
| 583 |
|
|---|
| 584 | \generatelist{classesbymodule Phonon}
|
|---|
| 585 |
|
|---|
| 586 | Phonon is a cross-platform multimedia framework that enables the use of
|
|---|
| 587 | audio and video content in Qt applications. The \l{Phonon Overview}
|
|---|
| 588 | document provides an introduction to the architecture and features included
|
|---|
| 589 | in Phonon. The \l{Phonon} namespace contains a list of all classes, functions
|
|---|
| 590 | and namespaces provided by the module.
|
|---|
| 591 |
|
|---|
| 592 | Applications that use Phonon's classes need to
|
|---|
| 593 | be configured to be built against the Phonon module.
|
|---|
| 594 | The following declaration in a \c qmake project file ensures that
|
|---|
| 595 | an application is compiled and linked appropriately:
|
|---|
| 596 |
|
|---|
| 597 | \snippet doc/src/snippets/code/doc_src_phonon.qdoc 1
|
|---|
| 598 |
|
|---|
| 599 | The Phonon module is part of the \l{Qt Full Framework Edition} and the
|
|---|
| 600 | \l{Open Source Versions of Qt}.
|
|---|
| 601 |
|
|---|
| 602 | \section1 Qt Backends
|
|---|
| 603 |
|
|---|
| 604 | Qt Backends are currently developed for Phonon version 4.1. The Phonon
|
|---|
| 605 | project has moved on and introduced new features that the Qt Backends do not
|
|---|
| 606 | implement. We have chosen not to document the part of Phonon that we do not
|
|---|
| 607 | support. Any class or function not appearing in our documentation can be
|
|---|
| 608 | considered unsupported.
|
|---|
| 609 |
|
|---|
| 610 | \section1 License Information
|
|---|
| 611 |
|
|---|
| 612 | Qt Commercial Edition licensees that wish to distribute applications that
|
|---|
| 613 | use the Phonon module need to be aware of their obligations under the
|
|---|
| 614 | GNU Lesser General Public License (LGPL).
|
|---|
| 615 |
|
|---|
| 616 | Developers using the Open Source Edition can choose to redistribute
|
|---|
| 617 | the module under the appropriate version of the GNU LGPL; version 2.1
|
|---|
| 618 | for applications and libraries licensed under the GNU GPL version 2,
|
|---|
| 619 | or version 3 for applications and libraries licensed under the GNU
|
|---|
| 620 | GPL version 2.
|
|---|
| 621 |
|
|---|
| 622 | \legalese
|
|---|
| 623 | This file is part of the KDE project
|
|---|
| 624 |
|
|---|
| 625 | Copyright (C) 2005-2007 Matthias Kretz <kretz@kde.org> \BR
|
|---|
| 626 | Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 627 | Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 628 |
|
|---|
| 629 | This library is free software; you can redistribute it and/or
|
|---|
| 630 | modify it under the terms of the GNU Library General Public
|
|---|
| 631 | License version 2 as published by the Free Software Foundation.
|
|---|
| 632 |
|
|---|
| 633 | This library is distributed in the hope that it will be useful,
|
|---|
| 634 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 635 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 636 | Library General Public License for more details.
|
|---|
| 637 |
|
|---|
| 638 | You should have received a copy of the GNU Library General Public License
|
|---|
| 639 | along with this library; see the file COPYING.LIB. If not, write to
|
|---|
| 640 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|---|
| 641 | Boston, MA 02110-1301, USA.
|
|---|
| 642 | \endlegalese
|
|---|
| 643 | */
|
|---|