LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
track_publication.h
1/*
2 * Copyright 2025 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an “AS IS” BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <cstdint>
20#include <memory>
21#include <string>
22#include <vector>
23
24#include "livekit/e2ee.h"
25#include "livekit/ffi_handle.h"
26#include "livekit/track.h"
27
28namespace livekit {
29
30class Track;
31class LocalTrack;
32class RemoteTrack;
33
41public:
42 virtual ~TrackPublication() = default;
43
44 TrackPublication(const TrackPublication &) = delete;
45 TrackPublication &operator=(const TrackPublication &) = delete;
46 TrackPublication(TrackPublication &&) noexcept = default;
47 TrackPublication &operator=(TrackPublication &&) noexcept = default;
48
49 // Basic metadata
50 const std::string &sid() const noexcept { return sid_; }
51 const std::string &name() const noexcept { return name_; }
52 TrackKind kind() const noexcept { return kind_; }
53 TrackSource source() const noexcept { return source_; }
54 bool simulcasted() const noexcept { return simulcasted_; }
55 std::uint32_t width() const noexcept { return width_; }
56 std::uint32_t height() const noexcept { return height_; }
57 const std::string &mimeType() const noexcept { return mime_type_; }
58 bool muted() const noexcept { return muted_; }
59 void setMuted(bool muted) noexcept { muted_ = muted; }
60
61 EncryptionType encryptionType() const noexcept { return encryption_type_; }
62 const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
63 return audio_features_;
64 }
65
67 uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
68
70 std::shared_ptr<Track> track() const noexcept { return track_; }
71 void setTrack(const std::shared_ptr<Track> &track) noexcept {
72 track_ = track;
73 }
74
75protected:
76 TrackPublication(FfiHandle handle, std::string sid, std::string name,
77 TrackKind kind, TrackSource source, bool simulcasted,
78 std::uint32_t width, std::uint32_t height,
79 std::string mime_type, bool muted,
80 EncryptionType encryption_type,
81 std::vector<AudioTrackFeature> audio_features);
82
83 FfiHandle handle_;
84 std::shared_ptr<Track> track_;
85
86 std::string sid_;
87 std::string name_;
88 TrackKind kind_;
89 TrackSource source_;
90 bool simulcasted_{false};
91 std::uint32_t width_{0};
92 std::uint32_t height_{0};
93 std::string mime_type_;
94 bool muted_{false};
95 EncryptionType encryption_type_;
96 std::vector<AudioTrackFeature> audio_features_;
97};
98
99} // namespace livekit
Definition track_publication.h:40
uintptr_t ffiHandleId() const noexcept
Underlying FFI handle value.
Definition track_publication.h:67
std::shared_ptr< Track > track() const noexcept
Associated Track (if attached).
Definition track_publication.h:70