src/3rdparty/phonon/gstreamer/videowidget.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     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 
       
    29 #include <gst/gst.h>
       
    30 
       
    31 QT_BEGIN_NAMESPACE
       
    32 
       
    33 class QString;
       
    34 
       
    35 namespace Phonon
       
    36 {
       
    37 namespace Gstreamer
       
    38 {
       
    39 
       
    40 class VideoWidget : public QWidget, public Phonon::VideoWidgetInterface, public MediaNode
       
    41 {
       
    42     Q_OBJECT
       
    43     Q_INTERFACES(Phonon::VideoWidgetInterface Phonon::Gstreamer::MediaNode)
       
    44 public:
       
    45     VideoWidget(Backend *backend, QWidget *parent = 0);
       
    46     ~VideoWidget();
       
    47 
       
    48     void setupVideoBin();
       
    49     void paintEvent(QPaintEvent *event);
       
    50     void mediaNodeEvent(const MediaNodeEvent *event);
       
    51     void setVisible(bool);
       
    52 
       
    53     Phonon::VideoWidget::AspectRatio aspectRatio() const;
       
    54     void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio);
       
    55     Phonon::VideoWidget::ScaleMode scaleMode() const;
       
    56     void setScaleMode(Phonon::VideoWidget::ScaleMode);
       
    57     qreal brightness() const;
       
    58     void setBrightness(qreal);
       
    59     qreal contrast() const;
       
    60     void setContrast(qreal);
       
    61     qreal hue() const;
       
    62     void setHue(qreal);
       
    63     qreal saturation() const;
       
    64     void setSaturation(qreal);
       
    65     void setMovieSize(const QSize &size);
       
    66     QSize sizeHint() const;
       
    67     QRect scaleToAspect(QRect srcRect, int w, int h) const;
       
    68     QRect calculateDrawFrameRect() const;
       
    69 
       
    70     GstElement *videoElement()
       
    71     {
       
    72         Q_ASSERT(m_videoBin);
       
    73         return m_videoBin;
       
    74     }
       
    75 
       
    76     QSize movieSize() const {
       
    77         return m_movieSize;
       
    78     }
       
    79 
       
    80     bool event(QEvent *);
       
    81 
       
    82     QWidget *widget() {
       
    83         return this;
       
    84     }
       
    85 
       
    86 protected:
       
    87     GstElement *m_videoBin;
       
    88     QSize m_movieSize;
       
    89     AbstractRenderer *m_renderer;
       
    90 
       
    91 private:
       
    92     Phonon::VideoWidget::AspectRatio m_aspectRatio;
       
    93     qreal m_brightness, m_hue, m_contrast, m_saturation;
       
    94     Phonon::VideoWidget::ScaleMode m_scaleMode;
       
    95 
       
    96     GstElement *m_videoBalance;
       
    97     GstElement *m_colorspace;
       
    98     GstElement *m_videoplug;
       
    99 };
       
   100 
       
   101 }
       
   102 } //namespace Phonon::Gstreamer
       
   103 
       
   104 QT_END_NAMESPACE
       
   105 
       
   106 #endif // Phonon_GSTREAMER_VIDEOWIDGET_H