1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qmediagaplessplaybackcontrol.h" |
41 | #include "qmediacontrol_p.h" |
42 | |
43 | /*! |
44 | \class QMediaGaplessPlaybackControl |
45 | \inmodule QtMultimedia |
46 | |
47 | |
48 | \ingroup multimedia_control |
49 | |
50 | \brief The QMediaGaplessPlaybackControl class provides access to the gapless playback |
51 | related control of a QMediaService. |
52 | |
53 | If a QMediaService supports gapless playback it will implement QMediaGaplessPlaybackControl. |
54 | This control provides a means to set the \l {setNextMedia()}{next media} or |
55 | \l {setCrossfadeTime()}{crossfade time} for smooth transitions between tracks. |
56 | |
57 | The functionality provided by this control is exposed to application |
58 | code through the QMediaPlayer class. |
59 | |
60 | The interface name of QMediaGaplessPlaybackControl is |
61 | \c org.qt-project.qt.mediagaplessplaybackcontrol/5.0 as defined in QMediaGaplessPlaybackControl_iid. |
62 | |
63 | \sa QMediaService::requestControl(), QMediaPlayer |
64 | */ |
65 | |
66 | /*! |
67 | \macro QMediaGaplessPlaybackControl_iid |
68 | |
69 | \c org.qt-project.qt.mediagaplessplaybackcontrol/5.0 |
70 | |
71 | Defines the interface name of the QMediaGaplessPlaybackControl class. |
72 | |
73 | \relates QMediaGaplessPlaybackControl |
74 | */ |
75 | |
76 | /*! |
77 | Destroys a gapless playback control. |
78 | */ |
79 | QMediaGaplessPlaybackControl::~QMediaGaplessPlaybackControl() |
80 | { |
81 | } |
82 | |
83 | /*! |
84 | Constructs a new gapless playback control with the given \a parent. |
85 | */ |
86 | QMediaGaplessPlaybackControl::QMediaGaplessPlaybackControl(QObject *parent): |
87 | QMediaControl(*new QMediaControlPrivate, parent) |
88 | { |
89 | } |
90 | |
91 | /*! |
92 | \fn QMediaGaplessPlaybackControl::nextMedia() const |
93 | |
94 | Returns the content of the next media |
95 | */ |
96 | |
97 | /*! |
98 | \fn QMediaGaplessPlaybackControl::setNextMedia(const QMediaContent& media) |
99 | |
100 | Sets the next \a media for smooth transition. |
101 | */ |
102 | |
103 | /*! |
104 | \fn QMediaGaplessPlaybackControl::nextMediaChanged(const QMediaContent& media) |
105 | |
106 | Signals that the next \a media has changed (either explicitly via \l setNextMedia() or when the |
107 | player clears the next media while advancing to it). |
108 | |
109 | \sa nextMedia() |
110 | */ |
111 | |
112 | /*! |
113 | \fn QMediaGaplessPlaybackControl::advancedToNextMedia() |
114 | |
115 | Signals when the player advances to the next media (the content of next media will be cleared). |
116 | |
117 | \sa nextMedia() |
118 | */ |
119 | |
120 | /*! |
121 | \fn QMediaGaplessPlaybackControl::isCrossfadeSupported() const |
122 | |
123 | Indicates whether crossfading is supported or not. |
124 | If crossfading is not supported, \l setCrossfadeTime() will be ignored and \l crossfadeTime() will |
125 | always return 0. |
126 | |
127 | */ |
128 | |
129 | /*! |
130 | \fn QMediaGaplessPlaybackControl::setCrossfadeTime(qreal crossfadeTime) |
131 | |
132 | Sets the \a crossfadeTime in seconds for smooth transition. |
133 | |
134 | Positive value means how much time it will take for the next media to transit from silent to |
135 | full volume and vice versa for current one. So both current and the next one will be playing |
136 | during this period of time. |
137 | |
138 | A crossfade time of zero or negative will result in gapless playback (suitable for some |
139 | continuous media). |
140 | |
141 | */ |
142 | |
143 | /*! |
144 | \fn QMediaGaplessPlaybackControl::crossfadeTime() const |
145 | |
146 | Returns current crossfade time in seconds. |
147 | */ |
148 | |
149 | /*! |
150 | \fn QMediaGaplessPlaybackControl::crossfadeTimeChanged(qreal crossfadeTime) |
151 | |
152 | Signals that the \a crossfadeTime has changed. |
153 | |
154 | \sa crossfadeTime() |
155 | */ |
156 | |
157 | |