OpenTera WebRTC API (C++) 1.2.5
VideoStreamConfiguration.h
1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_CONFIGURATIONS_STREAM_CONFIGURATION_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_CONFIGURATIONS_STREAM_CONFIGURATION_H
3 
4 #include <api/data_channel_interface.h>
5 
6 #include <string>
7 #include <unordered_set>
8 
9 namespace opentera
10 {
14  enum class VideoStreamCodec
15  {
16  VP8,
17  VP9,
18  H264
19  };
20  absl::optional<VideoStreamCodec> stringToVideoStreamCodec(std::string_view value);
21 
26  {
27  std::unordered_set<VideoStreamCodec> m_forcedCodecs; // Empty means all
28  bool m_forceGStreamerHardwareAcceleration;
29  bool m_useGStreamerSoftwareEncoderDecoder;
30 
32  std::unordered_set<VideoStreamCodec> forcedCodecs,
35 
36  public:
37  VideoStreamConfiguration(const VideoStreamConfiguration& other) = default;
39  virtual ~VideoStreamConfiguration() = default;
40 
42  static VideoStreamConfiguration create(std::unordered_set<VideoStreamCodec> forcedCodecs);
44  std::unordered_set<VideoStreamCodec> forcedCodecs,
47 
48  [[nodiscard]] const std::unordered_set<VideoStreamCodec>& forcedCodecs() const;
49  [[nodiscard]] bool forceGStreamerHardwareAcceleration() const;
50  [[nodiscard]] bool useGStreamerSoftwareEncoderDecoder() const;
51 
52  VideoStreamConfiguration& operator=(const VideoStreamConfiguration& other) = default;
53  VideoStreamConfiguration& operator=(VideoStreamConfiguration&& other) = default;
54  };
55 
60  inline VideoStreamConfiguration VideoStreamConfiguration::create() { return {{}, false, false}; }
61 
68  inline VideoStreamConfiguration VideoStreamConfiguration::create(std::unordered_set<VideoStreamCodec> forcedCodecs)
69  {
70  return {std::move(forcedCodecs), false, false};
71  }
72 
84  std::unordered_set<VideoStreamCodec> forcedCodecs,
85  bool forceGStreamerHardwareAcceleration,
86  bool useGStreamerSoftwareEncoderDecoder)
87  {
89  }
90 
95  inline const std::unordered_set<VideoStreamCodec>& VideoStreamConfiguration::forcedCodecs() const
96  {
97  return m_forcedCodecs;
98  }
99 
105  {
106  return m_forceGStreamerHardwareAcceleration;
107  }
108 
114  {
115  return m_useGStreamerSoftwareEncoderDecoder;
116  }
117 
118 }
119 
120 #endif
Represents a video stream configuration.
Definition: VideoStreamConfiguration.h:26
static VideoStreamConfiguration create()
Creates a stream configuration with default values.
Definition: VideoStreamConfiguration.h:60
const std::unordered_set< VideoStreamCodec > & forcedCodecs() const
Returns the codecs that must be used. An empty set means all codecs.
Definition: VideoStreamConfiguration.h:95
bool forceGStreamerHardwareAcceleration() const
Indicates that hardware accelerated codecs must be used.
Definition: VideoStreamConfiguration.h:104
bool useGStreamerSoftwareEncoderDecoder() const
Indicates to use GStreamer software codecs instead of WebRTC ones.
Definition: VideoStreamConfiguration.h:113