author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 20:15:53 +0300 | |
branch | RCL_3 |
changeset 14 | c0432d11811c |
parent 8 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
||
9 |
This library is distributed in the hope that it will be useful, |
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
||
17 |
*/ |
|
18 |
||
19 |
#include "mediaobject.h" |
|
20 |
#include "utils.h" |
|
21 |
||
22 |
#include "videowidget.h" |
|
23 |
||
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
24 |
#ifdef PHONON_MMF_VIDEO_SURFACES |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
25 |
#include "videooutput_surface.h" |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
26 |
#else |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
27 |
#include "videooutput_dsa.h" |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
28 |
#endif |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
29 |
|
0 | 30 |
QT_BEGIN_NAMESPACE |
31 |
||
32 |
using namespace Phonon; |
|
33 |
using namespace Phonon::MMF; |
|
34 |
||
35 |
/*! \class MMF::VideoWidget |
|
36 |
\internal |
|
37 |
*/ |
|
38 |
||
39 |
//----------------------------------------------------------------------------- |
|
40 |
// Constants |
|
41 |
//----------------------------------------------------------------------------- |
|
42 |
||
43 |
static const qreal DefaultBrightness = 1.0; |
|
44 |
static const qreal DefaultContrast = 1.0; |
|
45 |
static const qreal DefaultHue = 1.0; |
|
46 |
static const qreal DefaultSaturation = 1.0; |
|
47 |
||
48 |
||
49 |
//----------------------------------------------------------------------------- |
|
50 |
// Constructor / destructor |
|
51 |
//----------------------------------------------------------------------------- |
|
52 |
||
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
53 |
MMF::VideoWidget::VideoWidget(QWidget *parent) |
0 | 54 |
: MediaNode(parent) |
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
55 |
#ifdef PHONON_MMF_VIDEO_SURFACES |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
56 |
, m_videoOutput(new SurfaceVideoOutput(parent)) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
57 |
#else |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
58 |
, m_videoOutput(new DsaVideoOutput(parent)) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
59 |
#endif |
0 | 60 |
, m_brightness(DefaultBrightness) |
61 |
, m_contrast(DefaultContrast) |
|
62 |
, m_hue(DefaultHue) |
|
63 |
, m_saturation(DefaultSaturation) |
|
64 |
{ |
|
65 |
TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi); |
|
66 |
TRACE_ENTRY_0(); |
|
67 |
||
68 |
TRACE_EXIT_0(); |
|
69 |
} |
|
70 |
||
71 |
MMF::VideoWidget::~VideoWidget() |
|
72 |
{ |
|
73 |
TRACE_CONTEXT(VideoWidget::~VideoWidget, EVideoApi); |
|
74 |
TRACE_ENTRY_0(); |
|
75 |
||
76 |
TRACE_EXIT_0(); |
|
77 |
} |
|
78 |
||
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
79 |
#ifndef PHONON_MMF_VIDEO_SURFACES |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
80 |
void MMF::VideoWidget::setAncestorMoveMonitor(AncestorMoveMonitor *monitor) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
81 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
82 |
static_cast<DsaVideoOutput *>(m_videoOutput.data())->setAncestorMoveMonitor(monitor); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
83 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
84 |
#endif |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
85 |
|
0 | 86 |
|
87 |
//----------------------------------------------------------------------------- |
|
88 |
// VideoWidgetInterface |
|
89 |
//----------------------------------------------------------------------------- |
|
90 |
||
91 |
Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const |
|
92 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
return m_videoOutput->aspectRatio(); |
0 | 94 |
} |
95 |
||
96 |
void MMF::VideoWidget::setAspectRatio |
|
97 |
(Phonon::VideoWidget::AspectRatio aspectRatio) |
|
98 |
{ |
|
99 |
TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi); |
|
100 |
TRACE("aspectRatio %d", aspectRatio); |
|
101 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
m_videoOutput->setAspectRatio(aspectRatio); |
0 | 103 |
} |
104 |
||
105 |
qreal MMF::VideoWidget::brightness() const |
|
106 |
{ |
|
107 |
return m_brightness; |
|
108 |
} |
|
109 |
||
110 |
void MMF::VideoWidget::setBrightness(qreal brightness) |
|
111 |
{ |
|
112 |
TRACE_CONTEXT(VideoWidget::setBrightness, EVideoApi); |
|
113 |
TRACE("brightness %f", brightness); |
|
114 |
||
115 |
m_brightness = brightness; |
|
116 |
} |
|
117 |
||
118 |
Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const |
|
119 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
return m_videoOutput->scaleMode(); |
0 | 121 |
} |
122 |
||
123 |
void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) |
|
124 |
{ |
|
125 |
TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); |
|
14
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
126 |
TRACE("setScaleMode %d", scaleMode); |
0 | 127 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
m_videoOutput->setScaleMode(scaleMode); |
0 | 129 |
} |
130 |
||
131 |
qreal MMF::VideoWidget::contrast() const |
|
132 |
{ |
|
133 |
return m_contrast; |
|
134 |
} |
|
135 |
||
136 |
void MMF::VideoWidget::setContrast(qreal contrast) |
|
137 |
{ |
|
138 |
TRACE_CONTEXT(VideoWidget::setContrast, EVideoApi); |
|
139 |
TRACE("contrast %f", contrast); |
|
140 |
||
141 |
m_contrast = contrast; |
|
142 |
} |
|
143 |
||
144 |
qreal MMF::VideoWidget::hue() const |
|
145 |
{ |
|
146 |
return m_hue; |
|
147 |
} |
|
148 |
||
149 |
void MMF::VideoWidget::setHue(qreal hue) |
|
150 |
{ |
|
151 |
TRACE_CONTEXT(VideoWidget::setHue, EVideoApi); |
|
152 |
TRACE("hue %f", hue); |
|
153 |
||
154 |
m_hue = hue; |
|
155 |
} |
|
156 |
||
157 |
qreal MMF::VideoWidget::saturation() const |
|
158 |
{ |
|
159 |
return m_saturation; |
|
160 |
} |
|
161 |
||
162 |
void MMF::VideoWidget::setSaturation(qreal saturation) |
|
163 |
{ |
|
164 |
TRACE_CONTEXT(VideoWidget::setSaturation, EVideoApi); |
|
165 |
TRACE("saturation %f", saturation); |
|
166 |
||
167 |
m_saturation = saturation; |
|
168 |
} |
|
169 |
||
170 |
QWidget* MMF::VideoWidget::widget() |
|
171 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
return m_videoOutput.data(); |
0 | 173 |
} |
174 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
175 |
//----------------------------------------------------------------------------- |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
176 |
// MediaNode |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
177 |
//----------------------------------------------------------------------------- |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
178 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
179 |
void MMF::VideoWidget::connectMediaObject(MediaObject *mediaObject) |
0 | 180 |
{ |
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
181 |
mediaObject->setVideoOutput(m_videoOutput.data()); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
182 |
} |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
183 |
|
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
184 |
void MMF::VideoWidget::disconnectMediaObject(MediaObject *mediaObject) |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
185 |
{ |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
186 |
mediaObject->setVideoOutput(0); |
0 | 187 |
} |
188 |
||
189 |
QT_END_NAMESPACE |
|
190 |