source: trunk/src/3rdparty/phonon/mmf/videowidget.cpp

Last change on this file was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 4.7 KB
Line 
1/* This file is part of the KDE project.
2
3Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5This library is free software: you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation, either version 2.1 or 3 of the License.
8
9This library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU Lesser General Public License for more details.
13
14You should have received a copy of the GNU Lesser General Public License
15along 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
24#ifdef PHONON_MMF_VIDEO_SURFACES
25#include "videooutput_surface.h"
26#else
27#include "videooutput_dsa.h"
28#endif
29
30QT_BEGIN_NAMESPACE
31
32using namespace Phonon;
33using namespace Phonon::MMF;
34
35/*! \class MMF::VideoWidget
36 \internal
37*/
38
39//-----------------------------------------------------------------------------
40// Constants
41//-----------------------------------------------------------------------------
42
43static const qreal DefaultBrightness = 1.0;
44static const qreal DefaultContrast = 1.0;
45static const qreal DefaultHue = 1.0;
46static const qreal DefaultSaturation = 1.0;
47
48
49//-----------------------------------------------------------------------------
50// Constructor / destructor
51//-----------------------------------------------------------------------------
52
53MMF::VideoWidget::VideoWidget(QWidget *parent)
54 : MediaNode(parent)
55#ifdef PHONON_MMF_VIDEO_SURFACES
56 , m_videoOutput(new SurfaceVideoOutput(parent))
57#else
58 , m_videoOutput(new DsaVideoOutput(parent))
59#endif
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 parent->setProperty("_q_DummyWindowSurface", true);
69
70 TRACE_EXIT_0();
71}
72
73MMF::VideoWidget::~VideoWidget()
74{
75 TRACE_CONTEXT(VideoWidget::~VideoWidget, EVideoApi);
76 TRACE_ENTRY_0();
77
78 TRACE_EXIT_0();
79}
80
81#ifndef PHONON_MMF_VIDEO_SURFACES
82void MMF::VideoWidget::setAncestorMoveMonitor(AncestorMoveMonitor *monitor)
83{
84 static_cast<DsaVideoOutput *>(m_videoOutput.data())->setAncestorMoveMonitor(monitor);
85}
86#endif
87
88
89//-----------------------------------------------------------------------------
90// VideoWidgetInterface
91//-----------------------------------------------------------------------------
92
93Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const
94{
95 return m_videoOutput->aspectRatio();
96}
97
98void MMF::VideoWidget::setAspectRatio
99(Phonon::VideoWidget::AspectRatio aspectRatio)
100{
101 TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
102 TRACE("aspectRatio %d", aspectRatio);
103
104 m_videoOutput->setAspectRatio(aspectRatio);
105}
106
107qreal MMF::VideoWidget::brightness() const
108{
109 return m_brightness;
110}
111
112void MMF::VideoWidget::setBrightness(qreal brightness)
113{
114 TRACE_CONTEXT(VideoWidget::setBrightness, EVideoApi);
115 TRACE("brightness %f", brightness);
116
117 m_brightness = brightness;
118}
119
120Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const
121{
122 return m_videoOutput->scaleMode();
123}
124
125void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
126{
127 TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
128 TRACE("setScaleMode %d", scaleMode);
129
130 m_videoOutput->setScaleMode(scaleMode);
131}
132
133qreal MMF::VideoWidget::contrast() const
134{
135 return m_contrast;
136}
137
138void MMF::VideoWidget::setContrast(qreal contrast)
139{
140 TRACE_CONTEXT(VideoWidget::setContrast, EVideoApi);
141 TRACE("contrast %f", contrast);
142
143 m_contrast = contrast;
144}
145
146qreal MMF::VideoWidget::hue() const
147{
148 return m_hue;
149}
150
151void MMF::VideoWidget::setHue(qreal hue)
152{
153 TRACE_CONTEXT(VideoWidget::setHue, EVideoApi);
154 TRACE("hue %f", hue);
155
156 m_hue = hue;
157}
158
159qreal MMF::VideoWidget::saturation() const
160{
161 return m_saturation;
162}
163
164void MMF::VideoWidget::setSaturation(qreal saturation)
165{
166 TRACE_CONTEXT(VideoWidget::setSaturation, EVideoApi);
167 TRACE("saturation %f", saturation);
168
169 m_saturation = saturation;
170}
171
172QWidget* MMF::VideoWidget::widget()
173{
174 return m_videoOutput.data();
175}
176
177//-----------------------------------------------------------------------------
178// MediaNode
179//-----------------------------------------------------------------------------
180
181void MMF::VideoWidget::connectMediaObject(MediaObject *mediaObject)
182{
183 mediaObject->setVideoOutput(m_videoOutput.data());
184}
185
186void MMF::VideoWidget::disconnectMediaObject(MediaObject *mediaObject)
187{
188 mediaObject->setVideoOutput(0);
189}
190
191QT_END_NAMESPACE
192
Note: See TracBrowser for help on using the repository browser.