qtmobility/plugins/multimedia/gstreamer/qgstreamervideowidget.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
   110             m_videoSink = 0;
   110             m_videoSink = 0;
   111         } else {
   111         } else {
   112             gst_element_set_state(m_videoSink, GST_STATE_NULL);
   112             gst_element_set_state(m_videoSink, GST_STATE_NULL);
   113 
   113 
   114             g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
   114             g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
       
   115 #ifdef Q_WS_MAEMO_5
       
   116             //the overlay xvideo adapter fails to switch winId,
       
   117             //use "SGX Textured Video" adapter instead
       
   118             g_object_set(G_OBJECT(m_videoSink), "device", "1", NULL);
       
   119 #endif
   115         }
   120         }
   116     }
   121     }
   117 
   122 
   118     if (!m_videoSink)
   123     if (!m_videoSink)
   119         m_videoSink = gst_element_factory_make ("ximagesink", NULL);
   124         m_videoSink = gst_element_factory_make ("ximagesink", NULL);
   120 
   125 
   121     gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership
   126     gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership
   122     gst_object_sink (GST_OBJECT (m_videoSink));
   127     gst_object_sink (GST_OBJECT (m_videoSink));
       
   128 
       
   129 
   123 }
   130 }
   124 
   131 
   125 QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
   132 QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
   126 {
   133 {
   127     if (m_videoSink)
   134     if (m_videoSink)
   216 QWidget *QGstreamerVideoWidgetControl::videoWidget()
   223 QWidget *QGstreamerVideoWidgetControl::videoWidget()
   217 {
   224 {
   218     return m_widget;
   225     return m_widget;
   219 }
   226 }
   220 
   227 
   221 QVideoWidget::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
   228 Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
   222 {
   229 {
   223     return m_aspectRatioMode;
   230     return m_aspectRatioMode;
   224 }
   231 }
   225 
   232 
   226 void QGstreamerVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
   233 void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
   227 {
   234 {
   228     if (m_videoSink) {
   235     if (m_videoSink) {
   229         g_object_set(G_OBJECT(m_videoSink),
   236         g_object_set(G_OBJECT(m_videoSink),
   230                      "force-aspect-ratio",
   237                      "force-aspect-ratio",
   231                      (mode == QVideoWidget::KeepAspectRatio),
   238                      (mode == Qt::KeepAspectRatio),
   232                      (const char*)NULL);
   239                      (const char*)NULL);
   233     }
   240     }
   234 
   241 
   235     m_aspectRatioMode = mode;
   242     m_aspectRatioMode = mode;
   236 }
   243 }