Stream.h
Go to the documentation of this file.
1 // Copyright (c) 2016 Digital Barriers
4 
31 #pragma once
32 #include "EdgeVisSDK.h"
33 #include "Encoder.h"
34 #include "StreamTypes.h"
35 #include "StreamStatus.h"
36 #include "TransportTypes.h"
37 #include "Pimpl.h"
38 #include "OpResult.h"
39 
40 #include <string>
41 #include <list>
42 
43 namespace EdgeVisDecoderSDK
44 {
45  class Encoder;
46  class StreamImpl;
47  class EncoderImpl;
48  class IStreamListener;
49 
50  class Stream : public EdgeVisSDKPimpl<StreamImpl>
51  {
52  protected:
53  friend class Server;
54 
55  public:
56 
57  Stream() {}
58  EdgeVisSDKPimplWeakConstructor(Stream);
59  DB_EDGEVIS_SDK virtual ~Stream() {}
60 
66  DB_EDGEVIS_SDK StreamType Type() const;
67 
73  DB_EDGEVIS_SDK std::wstring Name() const;
74 
92  DB_EDGEVIS_SDK virtual OpResult SetTransport(TransportType trans);
93 
101  DB_EDGEVIS_SDK virtual TransportType GetTransport();
102 
108  DB_EDGEVIS_SDK Encoder GetEncoder() const;
109 
123  DB_EDGEVIS_SDK OpResult Open();
124 
129  DB_EDGEVIS_SDK void Close();
130 
136  DB_EDGEVIS_SDK virtual bool IsConnected() const;
137 
144  DB_EDGEVIS_SDK void RegisterListener(IStreamListener* listener);
145 
153  DB_EDGEVIS_SDK void UnregisterListener(IStreamListener* listener);
154 
160  DB_EDGEVIS_SDK int64_t GetTotalBytesSent();
161 
167  DB_EDGEVIS_SDK int64_t GetTotalBytesReceived();
168 
172  DB_EDGEVIS_SDK void ResetDataUsageStats();
173 
178  DB_EDGEVIS_SDK int64_t GetStreamUseDuration() const;
179 
185  DB_EDGEVIS_SDK int64_t GetLastStreamUseDuration() const;
186 
193  DB_EDGEVIS_SDK void SetEnableAnalyticsSync(bool enable);
194 
201  DB_EDGEVIS_SDK bool GetEnableAnalyticsSync() const;
202  };
203 }
Defines an interface for a class that listens for incoming data from a Stream.
Definition: IStreamListener.h:35
DB_EDGEVIS_SDK OpResult Open()
Opens the stream.
virtual DB_EDGEVIS_SDK TransportType GetTransport()
Gets the stream&#39;s transport.
DB_EDGEVIS_SDK int64_t GetStreamUseDuration() const
Get the duration in milliseconds that the stream has been open.
DB_EDGEVIS_SDK Encoder GetEncoder() const
Gets the Encoder object that the Stream is on.
DB_EDGEVIS_SDK int64_t GetTotalBytesSent()
Returns the current total number of bytes sent on this stream.
DB_EDGEVIS_SDK void ResetDataUsageStats()
Resets the count of the total number of bytes sent and received for this stream.
TransportType
Describes the TransportTypes that can be used to open streams.
Definition: TransportTypes.h:23
DB_EDGEVIS_SDK void UnregisterListener(IStreamListener *listener)
Removes the specified listener from the set of listeners to be notified about incoming stream data...
virtual DB_EDGEVIS_SDK bool IsConnected() const
Determines if the stream is currently connected (in use).
DB_EDGEVIS_SDK bool GetEnableAnalyticsSync() const
Returns true if Analytics Sync is enabled.
The Stream interface represent a service that is available on an Encoder.
Definition: Stream.h:50
DB_EDGEVIS_SDK StreamType Type() const
Gets the stream type.
DB_EDGEVIS_SDK int64_t GetTotalBytesReceived()
Returns the current total number of bytes received on this stream.
An Encoder interface represents an Encoder that is managed by the server.
Definition: Encoder.h:58
DB_EDGEVIS_SDK void RegisterListener(IStreamListener *listener)
Registers the specified listener to be notified when stream data is received.
DB_EDGEVIS_SDK int64_t GetLastStreamUseDuration() const
Get the duration in milliseconds that the stream was open on last use.
DB_EDGEVIS_SDK std::wstring Name() const
Gets the stream&#39;s name.
StreamType
Defines the type of stream.
Definition: StreamTypes.h:16
A Server interface is used to make a connection to an EdgeVis server.
Definition: Server.h:54
The EdgeVis Decoder SDK namespace.
virtual DB_EDGEVIS_SDK OpResult SetTransport(TransportType trans)
This is underlying transport type.
OpResult
Result of an operation.
Definition: OpResult.h:25
DB_EDGEVIS_SDK void Close()
Closes this stream.
DB_EDGEVIS_SDK void SetEnableAnalyticsSync(bool enable)
Enables or disables synchronization of analytics metadata with audio and video Enabled by default...