diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2017-05-07 14:09:18 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2018-07-03 11:12:20 +0100 |
commit | a7233f81158864d0bed08278822aa758d79f140e (patch) | |
tree | c3d7af8944dfab04407092f1846e66d9965c4dae | |
parent | 3baca7c0b3dcd70e390be933e64481f644438af3 (diff) |
SAVE add stream-device.hpp file
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/spice-streaming-agent.cpp | 1 | ||||
-rw-r--r-- | src/stream-device.hpp | 31 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index c1b0fa0..e4bac50 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,6 +54,7 @@ spice_streaming_agent_LDADD = \ spice_streaming_agent_SOURCES = \ spice-streaming-agent.cpp \ + stream-device.hpp \ concrete-agent.cpp \ concrete-agent.hpp \ error.cpp \ diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp index 1104214..5f0f1d3 100644 --- a/src/spice-streaming-agent.cpp +++ b/src/spice-streaming-agent.cpp @@ -16,6 +16,7 @@ #include "xorg-utils.hpp" #include "eventfd.hpp" #include "daemon.hpp" +#include "stream-device.hpp" #include <spice/stream-device.h> #include <spice/enums.h> diff --git a/src/stream-device.hpp b/src/stream-device.hpp new file mode 100644 index 0000000..3a22d81 --- /dev/null +++ b/src/stream-device.hpp @@ -0,0 +1,31 @@ +#ifndef STREAMING_AGENT_STREAM_DEVICE_HPP +#define STREAMING_AGENT_STREAM_DEVICE_HPP + +#include <cstdio> + +/*! + * Pure base class implementing the device + */ +class StreamDevice +{ +public: + virtual ~StreamDevice()=default; + /*! Send streaming format + * Must be send before first frame or when the size or encoding change + */ + virtual void SendFormat(unsigned width, unsigned height, unsigned encoding)=0; + /*! Send single frame data + */ + virtual void SendFrame(const void *data, size_t data_size)=0; + /*! Read a message from the server and handle it. + * This function is not blocking. + * @return true if some messages was readed and handled + */ + virtual bool HandleMessage()=0; +protected: + StreamDevice()=default; + StreamDevice(const StreamDevice&)=delete; + void operator=(const StreamDevice&)=delete; +}; + +#endif // STREAMING_AGENT_STREAM_DEVICE_HPP |