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

List:       kde-commits
Subject:    kdesupport/phonon/phonon/experimental
From:       Matthias Kretz <kretz () kde ! org>
Date:       2008-07-03 14:46:54
Message-ID: 1215096414.695673.18209.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 827647 by mkretz:

make AvCapture a MediaNode subclass and add a simple interface for it

 M  +5 -0      CMakeLists.txt  
 M  +18 -17    avcapture.cpp  
 M  +8 -9      avcapture.h  
 M  +3 -2      avcapture_p.h  
 A             avcaptureinterface.h   [License: LGPL]
 M  +2 -1      backendinterface.h  
 M  +11 -0     factory.cpp  
 M  +2 -0      factory_p.h  


--- trunk/kdesupport/phonon/phonon/experimental/CMakeLists.txt #827646:827647
@@ -4,12 +4,14 @@
 set(phononexperimental_LIB_SRCS
     abstractvideodataoutput.cpp
     audiodataoutput.cpp
+    avcapture.cpp
     backendcapabilities.cpp
     factory.cpp
     globalconfig.cpp
     mediasource.cpp
     videodataoutput.cpp
     videodataoutput2.cpp
+    videowidget.cpp
     visualization.cpp
     ../abstractaudiooutput_p.cpp
     ../abstractvideooutput_p.cpp
@@ -28,15 +30,18 @@
 install(FILES
     abstractvideodataoutput.h
     audiodataoutput.h
+    avcapture.h
     backendcapabilities.h
     backendinterface.h
     export.h
     mediasource.h
     objectdescription.h
+    snapshotinterface.h
     videodataoutput.h
     videodataoutput2.h
     videodataoutputinterface.h
     videoframe.h
     videoframe2.h
+    videowidget.h
     visualization.h
     DESTINATION ${INCLUDE_INSTALL_DIR}/phonon/experimental COMPONENT Devel)
--- trunk/kdesupport/phonon/phonon/experimental/avcapture.cpp #827646:827647
@@ -1,5 +1,5 @@
 /*  This file is part of the KDE project
-    Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
+    Copyright (C) 2005-2006, 2008 Matthias Kretz <kretz@kde.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -19,26 +19,28 @@
     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 */
+
 #include "avcapture.h"
+#include "avcaptureinterface.h"
 #include "avcapture_p.h"
 #include "factory_p.h"
 #include "objectdescription.h"
 
 #define PHONON_CLASSNAME AvCapture
+#define PHONON_INTERFACENAME AvCaptureInterface
 
 namespace Phonon
 {
 namespace Experimental
 {
+PHONON_OBJECT_IMPL
 
-PHONON_HEIR_IMPL(MediaProducer)
-
 AudioCaptureDevice AvCapture::audioCaptureDevice() const
 {
     K_D(const AvCapture);
     int index;
     if (d->m_backendObject)
-        BACKEND_GET(int, index, "audioCaptureDevice");
+        index = INTERFACE_CALL(audioCaptureDevice());
     else
         index = d->audioCaptureDevice;
     return AudioCaptureDevice::fromIndex(index);
@@ -48,7 +50,7 @@
 {
     K_D(AvCapture);
     if (d->m_backendObject)
-        BACKEND_CALL1("setAudioCaptureDevice", int, audioCaptureDevice.index());
+        INTERFACE_CALL(setAudioCaptureDevice(audioCaptureDevice.index()));
     else
         d->audioCaptureDevice = audioCaptureDevice.index();
 }
@@ -57,7 +59,7 @@
 {
     K_D(AvCapture);
     if (d->m_backendObject)
-        BACKEND_CALL1("setAudioCaptureDevice", int, audioCaptureDeviceIndex);
+        INTERFACE_CALL(setAudioCaptureDevice(audioCaptureDeviceIndex));
     else
         d->audioCaptureDevice = audioCaptureDeviceIndex;
 }
@@ -67,7 +69,7 @@
     K_D(const AvCapture);
     int index;
     if (d->m_backendObject)
-        BACKEND_GET(int, index, "videoCaptureDevice");
+        index = INTERFACE_CALL(videoCaptureDevice());
     else
         index = d->videoCaptureDevice;
     return VideoCaptureDevice::fromIndex(index);
@@ -77,7 +79,7 @@
 {
     K_D(AvCapture);
     if (d->m_backendObject)
-        BACKEND_CALL1("setVideoCaptureDevice", int, videoCaptureDevice.index());
+        INTERFACE_CALL(setVideoCaptureDevice(videoCaptureDevice.index()));
     else
         d->videoCaptureDevice = videoCaptureDevice.index();
 }
@@ -86,32 +88,31 @@
 {
     K_D(AvCapture);
     if (d->m_backendObject)
-        BACKEND_CALL1("setVideoCaptureDevice", int, videoCaptureDeviceIndex);
+        INTERFACE_CALL(setVideoCaptureDevice(videoCaptureDeviceIndex));
     else
         d->videoCaptureDevice = videoCaptureDeviceIndex;
 }
 
 bool AvCapturePrivate::aboutToDeleteBackendObject()
 {
-    pBACKEND_GET(int, audioCaptureDevice, "audioCaptureDevice");
-    pBACKEND_GET(int, videoCaptureDevice, "videoCaptureDevice");
-    return MediaProducerPrivate::aboutToDeleteBackendObject();
+    audioCaptureDevice = pINTERFACE_CALL(audioCaptureDevice());
+    videoCaptureDevice = pINTERFACE_CALL(videoCaptureDevice());
+    return true;
 }
 
 void AvCapturePrivate::setupBackendObject()
 {
     Q_ASSERT(m_backendObject);
-    MediaProducerPrivate::setupBackendObject();
 
     // set up attributes
-    pBACKEND_CALL1("setAudioCaptureDevice", int, audioCaptureDevice);
-    pBACKEND_CALL1("setVideoCaptureDevice", int, videoCaptureDevice);
+    pINTERFACE_CALL(setAudioCaptureDevice(audioCaptureDevice));
+    pINTERFACE_CALL(setVideoCaptureDevice(videoCaptureDevice));
 }
 
 } // namespace Experimental
 } // namespace Phonon
 
-#include "avcapture.moc"
+#include "moc_avcapture.cpp"
 
 #undef PHONON_CLASSNAME
-// vim: sw=4 ts=4 tw=80
+#undef PHONON_INTERFACENAME
--- trunk/kdesupport/phonon/phonon/experimental/avcapture.h #827646:827647
@@ -1,5 +1,5 @@
 /*  This file is part of the KDE project
-    Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
+    Copyright (C) 2005-2006, 2008 Matthias Kretz <kretz@kde.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -19,13 +19,13 @@
     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 */
-#ifndef PHONON_AVCAPTURE_H
-#define PHONON_AVCAPTURE_H
+#ifndef PHONON_EXPERIMENTAL_AVCAPTURE_H
+#define PHONON_EXPERIMENTAL_AVCAPTURE_H
 
 #include "export.h"
-#include "../mediaobject.h"
+#include "../medianode.h"
 #include "../phonondefs.h"
-#include "../objectdescription.h"
+#include "objectdescription.h"
 
 class QString;
 class QStringList;
@@ -52,11 +52,11 @@
      * @see BackendCapabilities::availableAudioCaptureDevices
      * @see BackendCapabilities::availableVideoCaptureDevices
      */
-    class PHONONEXPERIMENTAL_EXPORT AvCapture : public MediaProducer
+    class PHONONEXPERIMENTAL_EXPORT AvCapture : public QObject, public Phonon::MediaNode
     {
         Q_OBJECT
         K_DECLARE_PRIVATE(AvCapture)
-        PHONON_HEIR(AvCapture)
+        PHONON_OBJECT(AvCapture)
         Q_PROPERTY(AudioCaptureDevice audioCaptureDevice READ audioCaptureDevice WRITE setAudioCaptureDevice)
         Q_PROPERTY(VideoCaptureDevice videoCaptureDevice READ videoCaptureDevice WRITE setVideoCaptureDevice)
         public:
@@ -131,5 +131,4 @@
 } // namespace Experimental
 } // namespace Phonon
 
-// vim: sw=4 ts=4 tw=80
-#endif // PHONON_AVCAPTURE_H
+#endif // PHONON_EXPERIMENTAL_AVCAPTURE_H
--- trunk/kdesupport/phonon/phonon/experimental/avcapture_p.h #827646:827647
@@ -24,14 +24,15 @@
 #define AVCAPTURE_P_H
 
 #include "avcapture.h"
-#include "../mediaobject_p.h"
+#include "../medianode_p.h"
+#include "../phonondefs_p.h"
 
 namespace Phonon
 {
 namespace Experimental
 {
 
-class AvCapturePrivate : public MediaProducerPrivate
+class AvCapturePrivate : public MediaNodePrivate
 {
     Q_DECLARE_PUBLIC(AvCapture)
     PHONON_PRIVATECLASS
--- trunk/kdesupport/phonon/phonon/experimental/backendinterface.h #827646:827647
@@ -29,7 +29,8 @@
 namespace BackendInterface
 {
 enum Class {
-    VideoDataOutputClass = 0x10000
+    VideoDataOutputClass = 0x10000,
+    AvCaptureClass
 };
 } // namespace BackendInterface
 } // namespace Experimental
--- trunk/kdesupport/phonon/phonon/experimental/factory.cpp #827646:827647
@@ -92,5 +92,16 @@
     return 0;
 }
 
+QObject *Factory::createAvCapture(QObject *parent)
+{
+    Phonon::BackendInterface *b = qobject_cast<Phonon::BackendInterface *>(Phonon::Factory::backend());
+    if (b) {
+        return Phonon::Factory::registerQObject(b->createObject(
+                    static_cast<Phonon::BackendInterface::Class>(Phonon::Experimental::BackendInterface::AvCaptureClass),
+                    parent));
+    }
+    return 0;
+}
+
 } // namespace Experimental
 } // namespace Phonon
--- trunk/kdesupport/phonon/phonon/experimental/factory_p.h #827646:827647
@@ -53,6 +53,8 @@
      */
     PHONONEXPERIMENTAL_EXPORT QObject *createVideoDataOutput(QObject *parent = 0);
 
+    QObject *createAvCapture(QObject *parent = 0);
+
 } // namespace Factory
 } // namespace Experimental
 } // namespace Phonon
[prev in list] [next in list] [prev in thread] [next in thread] 

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