[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/network/kcall
From:       George Kiagiadakis <gkiagiad () csd ! uoc ! gr>
Date:       2009-07-25 10:52:19
Message-ID: 1248519139.165521.29999.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1002197 by gkiagia:

Merge changes from libqtgstreamer and libkgstdevices.
- Implement a wrapper for the GstXOverlay interface.
- Port the video widget from phonon to use QtGstreamer and polish its API.
libqtgstreamer HEAD: 31e57437f8597a8a30134985837e0cb89e9e1867
libkgstdevices HEAD: 6f616860e33087db53aa8d6087af02eb5c5469dd

 M  +1 -0      kcall_handler/CMakeLists.txt  
 M  +1 -0      kcm/CMakeLists.txt  
 M  +3 -0      libkgstdevices/CMakeLists.txt  
 A             libkgstdevices/abstractrenderer.cpp   [License: LGPL]
 A             libkgstdevices/abstractrenderer.h   [License: LGPL]
 M  +22 -3     libkgstdevices/devicemanager.cpp  
 A             libkgstdevices/overlayrenderer.cpp   [License: LGPL]
 A             libkgstdevices/overlayrenderer.h   [License: LGPL]
 M  +51 -13    libkgstdevices/tabledevicechooser.cpp  
 M  +1 -0      libkgstdevices/tabledevicechooser.h  
 A             libkgstdevices/videowidget.cpp   [License: LGPL]
 A             libkgstdevices/videowidget.h   [License: LGPL]
 M  +1 -0      libqtgstreamer/CMakeLists.txt  
 A             libqtgstreamer/interfaces (directory)  
 A             libqtgstreamer/interfaces/qgstxoverlay.cpp   \
libkgstdevices/tabledevicechooser.h#1001543 [License: LGPL (v2.1+)]  A             \
libqtgstreamer/interfaces/qgstxoverlay.h   \
libkgstdevices/tabledevicechooser.h#1001543 [License: LGPL (v2.1+)]  M  +1 -0      \
libqtgstreamer/qgstdeclarations.h    M  +1 -0      libqtgstreamer/qgstelement.h  


--- trunk/playground/network/kcall/kcall_handler/CMakeLists.txt #1002196:1002197
@@ -27,6 +27,7 @@
                                     QtGstreamer
                                     #extra dependencies of libQtGstreamer
                                     ${GSTREAMER_LIBRARIES}
+                                    ${GSTREAMER_INTERFACE_LIBRARY}
                                     ${GOBJECT_LIBRARIES}
                                     #extra dependencies of libqtpfarsight
                                     ${TELEPATHY_QT4_FARSIGHT_LIBRARIES}
--- trunk/playground/network/kcall/kcm/CMakeLists.txt #1002196:1002197
@@ -8,6 +8,7 @@
                                     QtGstreamer
                                     #extra dependencies of libQtGstreamer
                                     ${GSTREAMER_LIBRARIES}
+                                    ${GSTREAMER_INTERFACE_LIBRARY}
                                     ${GOBJECT_LIBRARIES}
 )
 
--- trunk/playground/network/kcall/libkgstdevices/CMakeLists.txt #1002196:1002197
@@ -4,6 +4,9 @@
     devicemanager.cpp
     devicesmodel.cpp
     tabledevicechooser.cpp
+    abstractrenderer.cpp
+    overlayrenderer.cpp
+    videowidget.cpp
 )
 
 add_definitions(-fPIC)
--- trunk/playground/network/kcall/libkgstdevices/devicemanager.cpp #1002196:1002197
@@ -15,6 +15,8 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "devicemanager.h"
+#include "overlayrenderer.h"
+#include "videowidget.h"
 #include "../libqtgstreamer/qgstelementfactory.h"
 #include <QtCore/QPointer>
 #include <QtCore/QDataStream>
@@ -135,9 +137,13 @@
     {
         DevicePrivate d;
 #ifdef Q_WS_X11
-        d.name = i18n("X11 video renderer (Xv/X)");
+        d.name = i18n("Xv video renderer");
         d.driver = "xvimagesink";
         m_availableDevices[DeviceManager::VideoOutput].append(Device(d));
+
+        d.name = i18n("X11 video renderer");
+        d.driver = "ximagesink";
+        m_availableDevices[DeviceManager::VideoOutput].append(Device(d));
 #endif
     }
 
@@ -482,8 +488,21 @@
 
 VideoWidget *DeviceManager::newVideoWidget(QWidget *parent)
 {
-    Q_UNUSED(parent);
-    return NULL;
+    using namespace QtGstreamer;
+    Device device = d->m_currentDevices[VideoOutput];
+    QGstElementPtr element = QGstElementFactory::make(device.driver());
+    if ( element.isNull() ) {
+        kWarning() << "Could not construct" << device.driver();
+        return NULL;
+    }
+
+    AbstractRenderer *renderer = new OverlayRenderer(element);
+    VideoWidget *widget = VideoWidget::newVideoWidget(renderer, parent);
+    if ( !widget ) {
+        delete renderer;
+    }
+
+    return widget;
 }
 
 
--- trunk/playground/network/kcall/libkgstdevices/tabledevicechooser.cpp \
#1002196:1002197 @@ -16,6 +16,7 @@
 */
 #include "tabledevicechooser.h"
 #include "devicesmodel.h"
+#include "videowidget.h"
 #include "ui_tabledevicechooser.h"
 #include "../libqtgstreamer/qgstpipeline.h"
 #include "../libqtgstreamer/qgstelementfactory.h"
@@ -35,6 +36,7 @@
     void onSelectionChanged(const QItemSelection & selected);
     void onModelReset();
     void testDevice();
+    void onVideoWidgetDestroyed();
     void toggleDetails();
 
     QPointer<DeviceManager> m_manager;
@@ -233,28 +235,56 @@
                 return;
             }
 
-            QGstElementPtr colorSpace = \
                QGstElementFactory::make("ffmpegcolorspace");
-            QGstElementPtr videoScale = QGstElementFactory::make("videoscale");
-            QGstElementPtr videoRate = QGstElementFactory::make("videorate");
-            QGstElementPtr videoSink = QGstElementFactory::make("autovideosink");
-            if ( !colorSpace || !videoScale || !videoRate || !videoSink ) {
+            VideoWidget *widget = m_manager->newVideoWidget();
+
+            if ( !widget ) {
                 KMessageBox::sorry(q, i18n("Some gstreamer elements could not be \
                created. "
                                               "Please check your gstreamer \
                installation."));
                 m_testPipeline = QGstPipelinePtr(); //delete the pipeline, no reason \
to keep it.  return;
+            } else if ( !widget->videoBin()->setState(QGstElement::Ready) ) {
+                KMessageBox::sorry(q, i18n("The video output driver could not be \
initialized.")); +                m_testPipeline = QGstPipelinePtr(); //delete the \
pipeline, no reason to keep it. +                return;
             }
 
-            //TODO use the VideoWidget
+            widget->show();
+            widget->setAttribute(Qt::WA_DeleteOnClose);
+            connect(m_testPipeline.data(), SIGNAL(destroyed()), widget, \
SLOT(close())); +            connect(widget, SIGNAL(destroyed()), q, \
SLOT(onVideoWidgetDestroyed()));  
             m_testPipeline->add(inputElement);
-            m_testPipeline->add(colorSpace);
-            m_testPipeline->add(videoScale);
-            m_testPipeline->add(videoRate);
-            m_testPipeline->add(videoSink);
-            QGstElement::link(inputElement, colorSpace, videoScale, videoRate, \
videoSink); +            m_testPipeline->add(widget->videoBin());
+            QGstElement::link(inputElement, widget->videoBin());
             break;
         }
-        //TODO support DeviceManager::VideoOutput
+        case DeviceManager::VideoOutput:
+        {
+            QGstElementPtr videoSrc = QGstElementFactory::make("videotestsrc");
+            VideoWidget *widget = m_manager->newVideoWidget();
+
+            if ( !videoSrc || !widget ) {
+                KMessageBox::sorry(q, i18n("Some gstreamer elements could not be \
created. " +                                              "Please check your \
gstreamer installation.")); +                m_testPipeline = QGstPipelinePtr(); \
//delete the pipeline, no reason to keep it. +                return;
+            } else if ( !widget->videoBin()->setState(QGstElement::Ready) ) {
+                KMessageBox::sorry(q, i18n("The selected video output driver could \
not be " +                                            "initialized. Please select \
another driver.")); +                m_testPipeline = QGstPipelinePtr(); //delete the \
pipeline, no reason to keep it. +                return;
+            }
+
+            widget->show();
+            widget->setAttribute(Qt::WA_DeleteOnClose);
+            connect(m_testPipeline.data(), SIGNAL(destroyed()), widget, \
SLOT(close())); +            connect(widget, SIGNAL(destroyed()), q, \
SLOT(onVideoWidgetDestroyed())); +
+            m_testPipeline->add(videoSrc);
+            m_testPipeline->add(widget->videoBin());
+            QGstElement::link(videoSrc, widget->videoBin());
+            break;
+        }
         default:
             m_testPipeline = QGstPipelinePtr(); //delete the pipeline, no reason to \
keep it.  return;
@@ -264,14 +294,22 @@
         m_ui.testButton->setText(i18nc("stop audio/video test", "Stop test"));
         m_ui.testButton->setIcon(KIcon("media-playback-stop"));
     } else {
+        m_testing = false;
         m_testPipeline->setState(QGstElement::Null);
         m_testPipeline = QGstPipelinePtr(); //delete the pipeline
-        m_testing = false;
         m_ui.testButton->setText(i18nc("test the device", "Test"));
         m_ui.testButton->setIcon(KIcon("media-playback-start"));
     }
 }
 
+void TableDeviceChooser::Private::onVideoWidgetDestroyed()
+{
+    //if we are still testing, stop testing.
+    if ( m_testing ) {
+        testDevice();
+    }
+}
+
 void TableDeviceChooser::Private::toggleDetails()
 {
     if ( m_showingDetails ) {
--- trunk/playground/network/kcall/libkgstdevices/tabledevicechooser.h \
#1002196:1002197 @@ -36,6 +36,7 @@
     Q_PRIVATE_SLOT(d, void onSelectionChanged(const QItemSelection & selected));
     Q_PRIVATE_SLOT(d, void onModelReset());
     Q_PRIVATE_SLOT(d, void testDevice());
+    Q_PRIVATE_SLOT(d, void onVideoWidgetDestroyed());
     Q_PRIVATE_SLOT(d, void toggleDetails());
 };
 
--- trunk/playground/network/kcall/libqtgstreamer/CMakeLists.txt #1002196:1002197
@@ -14,6 +14,7 @@
     qgvalue.cpp
     qgstcaps.cpp
     qgststructure.cpp
+    interfaces/qgstxoverlay.cpp
 )
 
 add_definitions(-fPIC)
--- trunk/playground/network/kcall/libqtgstreamer/qgstdeclarations.h #1002196:1002197
@@ -53,6 +53,7 @@
 typedef QSharedPointer<QGstCaps> QGstCapsPtr;
 class QGstStructure;
 class QGValue;
+class QGstXOverlay;
 
 }
 
--- trunk/playground/network/kcall/libqtgstreamer/qgstelement.h #1002196:1002197
@@ -28,6 +28,7 @@
     Q_OBJECT
     Q_DISABLE_COPY(QGstElement)
     friend class QGstBin;
+    friend class QGstXOverlay;
     friend class QGstElementPrivate;
 public:
     enum State { VoidPending, Null, Ready, Paused, Playing };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic