1
/*  This file is part of the KDE project.
2
3
    Copyright (C) 2    //Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).007 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
#ifndef Phonon_GSTREAMER_VIDEOWIDGET_H
19
#define Phonon_GSTREAMER_VIDEOWIDGET_H
20
21
#include <phonon/videowidget.h>
22
#include <phonon/videowidgetinterface.h>
23
24
#include "backend.h"
25
#include "common.h"
26
#include "medianode.h"
27
#include "abstractrenderer.h"
28
#include "videowidget.h"
29
30
#include <gst/gst.h>
31
32
#ifndef QT_NO_PHONON_VIDEO
33
QT_BEGIN_NAMESPACE
34
35
class QString;
36
37
namespace Phonon
38
{
39
namespace Gstreamer
40
{
41
42
class VideoWidget : public QWidget, public Phonon::VideoWidgetInterface, public MediaNode
43
{
44
    Q_OBJECT
45
    Q_INTERFACES(Phonon::VideoWidgetInterface Phonon::Gstreamer::MediaNode)
46
public:
47
    VideoWidget(Backend *backend, QWidget *parent = 0);
48
    ~VideoWidget();
49
50
    void setupVideoBin();
51
    void paintEvent(QPaintEvent *event);
52
    void mediaNodeEvent(const MediaNodeEvent *event);
53
    void setVisible(bool);
54
55
    Phonon::VideoWidget::AspectRatio aspectRatio() const;
56
    void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio);
57
    Phonon::VideoWidget::ScaleMode scaleMode() const;
58
    void setScaleMode(Phonon::VideoWidget::ScaleMode);
59
    qreal brightness() const;
60
    void setBrightness(qreal);
61
    qreal contrast() const;
62
    void setContrast(qreal);
63
    qreal hue() const;
64
    void setHue(qreal);
65
    qreal saturation() const;
66
    void setSaturation(qreal);
67
    void setMovieSize(const QSize &size);
68
    QSize sizeHint() const;
69
    QRect scaleToAspect(QRect srcRect, int w, int h) const;
70
    QRect calculateDrawFrameRect() const;
71
72
    GstElement *videoElement()
73
    {
74
        Q_ASSERT(m_videoBin);
75
        return m_videoBin;
76
    }
77
78
    QSize movieSize() const {
79
        return m_movieSize;
80
    }
81
82
    bool event(QEvent *);
83
84
    QWidget *widget() {
85
        return this;
86
    }
87
88
protected:
89
    GstElement *m_videoBin;
90
    QSize m_movieSize;
91
    AbstractRenderer *m_renderer;
92
93
private:
94
    Phonon::VideoWidget::AspectRatio m_aspectRatio;
95
    qreal m_brightness, m_hue, m_contrast, m_saturation;
96
    Phonon::VideoWidget::ScaleMode m_scaleMode;
97
98
    GstElement *m_videoBalance;
99
    GstElement *m_colorspace;
100
    GstElement *m_videoplug;
101
};
102
103
}
104
} //namespace Phonon::Gstreamer
105
106
QT_END_NAMESPACE
107
#endif //QT_NO_PHONON_VIDEO
108
#endif // Phonon_GSTREAMER_VIDEOWIDGET_H