src/3rdparty/phonon/mmf/videowidget.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    33 
    33 
    34 //-----------------------------------------------------------------------------
    34 //-----------------------------------------------------------------------------
    35 // Constants
    35 // Constants
    36 //-----------------------------------------------------------------------------
    36 //-----------------------------------------------------------------------------
    37 
    37 
    38 static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio =
       
    39     Phonon::VideoWidget::AspectRatioAuto;
       
    40 static const qreal DefaultBrightness = 1.0;
    38 static const qreal DefaultBrightness = 1.0;
    41 static const Phonon::VideoWidget::ScaleMode DefaultScaleMode =
       
    42     Phonon::VideoWidget::FitInView;
       
    43 static const qreal DefaultContrast = 1.0;
    39 static const qreal DefaultContrast = 1.0;
    44 static const qreal DefaultHue = 1.0;
    40 static const qreal DefaultHue = 1.0;
    45 static const qreal DefaultSaturation = 1.0;
    41 static const qreal DefaultSaturation = 1.0;
    46 
    42 
    47 
    43 
    48 //-----------------------------------------------------------------------------
    44 //-----------------------------------------------------------------------------
    49 // Constructor / destructor
    45 // Constructor / destructor
    50 //-----------------------------------------------------------------------------
    46 //-----------------------------------------------------------------------------
    51 
    47 
    52 MMF::VideoWidget::VideoWidget(QWidget* parent)
    48 MMF::VideoWidget::VideoWidget
       
    49     (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent)
    53         :   MediaNode(parent)
    50         :   MediaNode(parent)
    54         ,   m_widget(new VideoOutput(parent))
    51         ,   m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent))
    55         ,   m_aspectRatio(DefaultAspectRatio)
       
    56         ,   m_brightness(DefaultBrightness)
    52         ,   m_brightness(DefaultBrightness)
    57         ,   m_scaleMode(DefaultScaleMode)
       
    58         ,   m_contrast(DefaultContrast)
    53         ,   m_contrast(DefaultContrast)
    59         ,   m_hue(DefaultHue)
    54         ,   m_hue(DefaultHue)
    60         ,   m_saturation(DefaultSaturation)
    55         ,   m_saturation(DefaultSaturation)
    61 {
    56 {
    62     TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi);
    57     TRACE_CONTEXT(VideoWidget::VideoWidget, EVideoApi);
    78 // VideoWidgetInterface
    73 // VideoWidgetInterface
    79 //-----------------------------------------------------------------------------
    74 //-----------------------------------------------------------------------------
    80 
    75 
    81 Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const
    76 Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const
    82 {
    77 {
    83     return m_aspectRatio;
    78     return m_videoOutput->aspectRatio();
    84 }
    79 }
    85 
    80 
    86 void MMF::VideoWidget::setAspectRatio
    81 void MMF::VideoWidget::setAspectRatio
    87 (Phonon::VideoWidget::AspectRatio aspectRatio)
    82 (Phonon::VideoWidget::AspectRatio aspectRatio)
    88 {
    83 {
    89     TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
    84     TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi);
    90     TRACE("aspectRatio %d", aspectRatio);
    85     TRACE("aspectRatio %d", aspectRatio);
    91 
    86 
    92     m_aspectRatio = aspectRatio;
    87     m_videoOutput->setAspectRatio(aspectRatio);
    93 }
    88 }
    94 
    89 
    95 qreal MMF::VideoWidget::brightness() const
    90 qreal MMF::VideoWidget::brightness() const
    96 {
    91 {
    97     return m_brightness;
    92     return m_brightness;
   105     m_brightness = brightness;
   100     m_brightness = brightness;
   106 }
   101 }
   107 
   102 
   108 Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const
   103 Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const
   109 {
   104 {
   110     return m_scaleMode;
   105     return m_videoOutput->scaleMode();
   111 }
   106 }
   112 
   107 
   113 void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
   108 void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode)
   114 {
   109 {
   115     TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
   110     TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi);
   116     TRACE("setScaleMode %d", setScaleMode);
   111     TRACE("setScaleMode %d", setScaleMode);
   117 
   112 
   118     m_scaleMode = scaleMode;
   113     m_videoOutput->setScaleMode(scaleMode);
   119 }
   114 }
   120 
   115 
   121 qreal MMF::VideoWidget::contrast() const
   116 qreal MMF::VideoWidget::contrast() const
   122 {
   117 {
   123     return m_contrast;
   118     return m_contrast;
   157     m_saturation = saturation;
   152     m_saturation = saturation;
   158 }
   153 }
   159 
   154 
   160 QWidget* MMF::VideoWidget::widget()
   155 QWidget* MMF::VideoWidget::widget()
   161 {
   156 {
   162     return m_widget.data();
   157     return m_videoOutput.data();
   163 }
       
   164 
       
   165 VideoOutput& MMF::VideoWidget::videoOutput()
       
   166 {
       
   167     return *static_cast<VideoOutput*>(widget());
       
   168 }
   158 }
   169 
   159 
   170 bool MMF::VideoWidget::activateOnMediaObject(MediaObject *mo)
   160 bool MMF::VideoWidget::activateOnMediaObject(MediaObject *mo)
   171 {
   161 {
   172     mo->setVideoOutput(&videoOutput());
   162     mo->setVideoOutput(m_videoOutput.data());
   173     return true;
   163     return true;
   174 }
   164 }
   175 
   165 
   176 QT_END_NAMESPACE
   166 QT_END_NAMESPACE
   177 
   167