[vlmc-devel] IConsumer

Yikai Lu git at videolan.org
Mon Jul 4 15:33:41 CEST 2016


vlmc | branch: medialibrary | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jun 12 00:12:23 2016 +0900| [98983433f0605569e24be289b26f4273f3cb2fd2] | committer: Yikai Lu

IConsumer

> https://code.videolan.org/videolan/vlmc/commit/98983433f0605569e24be289b26f4273f3cb2fd2
---

 src/Backend/IConsumer.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/CMakeLists.txt      |  1 +
 2 files changed, 68 insertions(+)

diff --git a/src/Backend/IConsumer.h b/src/Backend/IConsumer.h
new file mode 100644
index 0000000..48f955f
--- /dev/null
+++ b/src/Backend/IConsumer.h
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * IConsumer: Defines an interface to control a player
+ *****************************************************************************
+ * 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 IRENDERER_H
+#define IRENDERER_H
+
+#include <string>
+#include <cstdint>
+#include <cstddef>
+
+#include "IService.h"
+
+namespace Backend
+{
+    class IProducer;
+
+    class IConsumerEventCb
+    {
+    public:
+        virtual ~IConsumerEventCb() = default;
+        virtual void    onPlaying() = 0;
+        virtual void    onStopped() = 0;
+        virtual void    onVolumeChanged() = 0;
+    };
+
+    class IConsumer : virtual public IService
+    {
+    public:
+        virtual ~IConsumer() = default;
+
+        virtual void    setName( const char* name ) = 0;
+        virtual void    setCallback( IConsumerEventCb* callback ) = 0;
+        /**
+         * @brief start Initializes and launches playback.
+         */
+        virtual void    start() = 0;
+        virtual void    stop() = 0;
+        virtual bool    isStopped() const = 0;
+
+        virtual int     volume() const = 0;
+        virtual void    setVolume( int volume ) = 0;
+
+        virtual bool    connect( IProducer& provider ) = 0;
+        virtual bool    isConnected() const = 0;
+    };
+}
+
+#endif // IRENDERER_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 345653f..a73f683 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -59,6 +59,7 @@ SET(VLMC_SRCS
     Commands/Commands.cpp
     Backend/IBackend.h
     Backend/IService.h
+    Backend/IConsumer.h
     Backend/VLC/VLCBackend.cpp
     Backend/VLC/VLCSourceRenderer.cpp
     Backend/VLC/VLCVmemRenderer.cpp



More information about the Vlmc-devel mailing list