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
#include "videoeffect.h"
19
#include "backendheader.h"
20
#include "objc_help.h"
21
#include <phonon/effect.h>
22
#include <phonon/effectparameter.h>
23
24
QT_BEGIN_NAMESPACE
25
26
namespace Phonon
27
{
28
namespace QT7
29
{
30
31
VideoEffect::VideoEffect(int effectId, QObject *parent) : MediaNode(VideoSink | VideoSource, 0, parent), effectId(effectId)
32
{
33
    ciFilter = objc_createCiFilter(effectId);
34
    if (ciFilter)
35
        filterName = objc_getCiFilterInfo()->filterDisplayNames[effectId];
36
}
37
38
VideoEffect::~VideoEffect()
39
{
40
    if (ciFilter)
41
        objc_releaseCiFilter(ciFilter);
42
}
43
44
QList<EffectParameter> VideoEffect::parameters() const
45
{
46
    IMPLEMENTED;
47
    return objc_getCiFilterParameterInfo(ciFilter).parameters;
48
}
49
50
QVariant VideoEffect::parameterValue(const EffectParameter &parameter) const
51
{
52
    IMPLEMENTED;
53
    return objc_getCiFilterParameter(ciFilter, parameter.id());
54
}
55
56
void VideoEffect::setParameterValue(const EffectParameter &parameter, const QVariant &newValue)
57
{
58
    IMPLEMENTED;
59
    objc_setCiFilterParameter(ciFilter, parameter.id(), newValue);
60
}
61
62
void VideoEffect::mediaNodeEvent(const MediaNodeEvent */*event*/)
63
{
64
}
65
66
void VideoEffect::updateVideo(VideoFrame &frame){
67
    frame.applyCoreImageFilter(ciFilter);
68
    MediaNode::updateVideo(frame);
69
}
70
71
}}
72
73
QT_END_NAMESPACE
74
75
#include "moc_videoeffect.cpp"