1#ifndef MILLICAST_API_SOURCE_H
2#define MILLICAST_API_SOURCE_H
34 friend class AudioPlayback;
53 using SourcePtr = std::shared_ptr<T>;
55 using Ptr = SourcePtr<Source>;
57 struct SourceInformation {
61 std::string unique_id;
70 template <
typename T = Type>
92 [[nodiscard]]
MILLICAST_API const std::string& unique_id()
const;
106 [[nodiscard]]
MILLICAST_API const std::string& track_name()
const;
117 MILLICAST_API virtual std::weak_ptr<Track> start_capture() = 0;
133 [[nodiscard]]
MILLICAST_API virtual bool is_capturing()
const = 0;
138 Source(
const SourceInformation& information)
noexcept;
144 std::string _unique_id;
145 std::string _track_name;
151[[nodiscard]]
MILLICAST_API Source::Type Source::type<Source::Type>()
const;
153[[nodiscard]]
MILLICAST_API std::string Source::type<std::string>()
const;
161class VideoSource :
public Source {
163 using Ptr = Source::SourcePtr<VideoSource>;
169 struct Builder :
public SourceInformation {
170 std::vector<VideoCapabilities>
185 [[nodiscard]]
MILLICAST_API const std::vector<VideoCapabilities>&
186 capabilities() const;
188 std::vector<VideoCapabilities>& capabilities);
195 [[nodiscard]]
MILLICAST_API const VideoCapabilities& capability() const;
203 MILLICAST_API void set_capability(const VideoCapabilities& capability);
204 MILLICAST_API void set_capability(VideoCapabilities&& capability);
207 const std::
string& unique_device_id = ""){};
209 ~VideoSource()
override =
default;
212 using Source::Source;
213 std::vector<VideoCapabilities> _capabilities;
214 VideoCapabilities _capability;
230 virtual void set_volume(uint32_t v) = 0;
239 virtual void set_num_channel(uint8_t n) = 0;
246 virtual void mute(
bool m) = 0;
253 virtual uint32_t get_volume() = 0;
260 [[nodiscard]]
virtual bool is_muted()
const = 0;
267class AudioSource :
public Source,
public AudioControl {
269 using Ptr = Source::SourcePtr<AudioSource>;
274 struct Builder :
public SourceInformation {
283 ~AudioSource() override = default;
286 using Source::Source;
296class AudioPlayback : public Source, public AudioControl {
298 std::weak_ptr<Track> start_capture()
override = 0;
299 void stop_capture()
override = 0;
300 [[nodiscard]]
bool is_capturing()
const override = 0;
303 using Ptr = Source::SourcePtr<AudioPlayback>;
309 struct Builder :
public SourceInformation {
328 [[nodiscard]]
MILLICAST_API virtual
bool is_playing() const = 0;
331 using Source::Source;
337class CustomAudioSource : public Source {
339 using Ptr = Source::SourcePtr<CustomAudioSource>;
343 struct Builder :
public SourceInformation {
355 [[nodiscard]]
MILLICAST_API std::weak_ptr<Track> start_capture() override = 0;
356 [[nodiscard]]
MILLICAST_API bool is_capturing() const override = 0;
366 const millicast::AudioFrame& frame) = 0;
369 using Source::Source;
372class CustomVideoSource : public Source {
374 using Ptr = Source::SourcePtr<CustomVideoSource>;
378 struct Builder :
public SourceInformation {
387 [[nodiscard]]
MILLICAST_API std::weak_ptr<Track> start_capture() override = 0;
388 [[nodiscard]]
MILLICAST_API bool is_capturing() const override = 0;
398 const millicast::VideoFrame& frame) = 0;
401 using Source::Source;
#define MILLICAST_API
Definition exports.h:51