[vlmc-devel] ConsumerEventWatcher
Yikai Lu
git at videolan.org
Mon Jul 4 15:33:51 CEST 2016
vlmc | branch: medialibrary | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jun 12 22:59:52 2016 +0900| [a8a2ab30d4f05da7c45284511a528ce7bd10716d] | committer: Yikai Lu
ConsumerEventWatcher
> https://code.videolan.org/videolan/vlmc/commit/a8a2ab30d4f05da7c45284511a528ce7bd10716d
---
src/CMakeLists.txt | 1 +
src/Tools/ConsumerEventWatcher.cpp | 46 +++++++++++++++++++++++++++++++++++++
src/Tools/ConsumerEventWatcher.h | 47 ++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4618a77..73ec58f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -106,6 +106,7 @@ SET(VLMC_SRCS
Tools/ErrorHandler.cpp
Tools/MemoryPool.hpp
Tools/RendererEventWatcher.cpp
+ Tools/ConsumerEventWatcher.cpp
Tools/Singleton.hpp
Tools/Toggleable.hpp
Tools/VlmcDebug.h
diff --git a/src/Tools/ConsumerEventWatcher.cpp b/src/Tools/ConsumerEventWatcher.cpp
new file mode 100644
index 0000000..6fad22b
--- /dev/null
+++ b/src/Tools/ConsumerEventWatcher.cpp
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * ConsumerEventWatcher.h: Watches events from a IConsumer and convert them to SIGNAL
+ *****************************************************************************
+ * Copyright (C) 2008-2016 VideoLAN
+ *
+ * Authors: Yikei Lu <luyikei.qmltu at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "Tools/ConsumerEventWatcher.h"
+
+ConsumerEventWatcher::ConsumerEventWatcher( QObject* parent ) :
+ QObject( parent )
+{
+}
+
+void
+ConsumerEventWatcher::onPlaying()
+{
+ emit playing();
+}
+
+void
+ConsumerEventWatcher::onStopped()
+{
+ emit stopped();
+}
+
+void
+ConsumerEventWatcher::onVolumeChanged()
+{
+ emit volumeChanged();
+}
diff --git a/src/Tools/ConsumerEventWatcher.h b/src/Tools/ConsumerEventWatcher.h
new file mode 100644
index 0000000..ebaa8e9
--- /dev/null
+++ b/src/Tools/ConsumerEventWatcher.h
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * ConsumerEventWatcher.h: Watches events from a IConsumer and convert them to SIGNAL
+ *****************************************************************************
+ * Copyright (C) 2008-2016 VideoLAN
+ *
+ * Authors: Yikei Lu <luyikei.qmltu at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef CONSUMEREVENTWATCHER_H
+#define CONSUMEREVENTWATCHER_H
+
+
+#include <QObject>
+#include "Backend/IConsumer.h"
+
+class ConsumerEventWatcher : public QObject, public Backend::IConsumerEventCb
+{
+ Q_OBJECT
+public:
+ explicit ConsumerEventWatcher( QObject* parent = 0 );
+
+private:
+ virtual void onPlaying();
+ virtual void onStopped();
+ virtual void onVolumeChanged();
+
+signals:
+ void playing();
+ void stopped();
+ void volumeChanged();
+};
+
+#endif // CONSUMEREVENTWATCHER_H
More information about the Vlmc-devel
mailing list