LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data 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#include "livekit/visibility.h"
28
29namespace livekit {
30
31class Track;
32class LocalTrack;
33class RemoteTrack;
34
39class LIVEKIT_API TrackPublication {
40public:
41 virtual ~TrackPublication() = default;
42
43 TrackPublication(const TrackPublication&) = delete;
44 TrackPublication& operator=(const TrackPublication&) = delete;
45 TrackPublication(TrackPublication&&) noexcept = default;
46 TrackPublication& operator=(TrackPublication&&) noexcept = default;
47
48 // Basic metadata
49 const std::string& sid() const noexcept { return sid_; }
50 const std::string& name() const noexcept { return name_; }
51 TrackKind kind() const noexcept { return kind_; }
52 TrackSource source() const noexcept { return source_; }
53 bool simulcasted() const noexcept { return simulcasted_; }
54 std::uint32_t width() const noexcept { return width_; }
55 std::uint32_t height() const noexcept { return height_; }
56 const std::string& mimeType() const noexcept { return mime_type_; }
57 bool muted() const noexcept { return muted_; }
58 void setMuted(bool muted) noexcept { muted_ = muted; }
59
60 EncryptionType encryptionType() const noexcept { return encryption_type_; }
61 const std::vector<AudioTrackFeature>& audioFeatures() const noexcept { return audio_features_; }
62
64 uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
65
67 std::shared_ptr<Track> track() const noexcept { return track_; }
68 void setTrack(const std::shared_ptr<Track>& track) noexcept { track_ = track; }
69
70protected:
71 TrackPublication(FfiHandle handle, std::string sid, std::string name, TrackKind kind, TrackSource source,
72 bool simulcasted, std::uint32_t width, std::uint32_t height, std::string mime_type, bool muted,
73 EncryptionType encryption_type, std::vector<AudioTrackFeature> audio_features);
74
75 FfiHandle handle_;
76 std::shared_ptr<Track> track_;
77
78 std::string sid_;
79 std::string name_;
80 TrackKind kind_;
81 TrackSource source_;
82 bool simulcasted_{false};
83 std::uint32_t width_{0};
84 std::uint32_t height_{0};
85 std::string mime_type_;
86 bool muted_{false};
87 EncryptionType encryption_type_;
88 std::vector<AudioTrackFeature> audio_features_;
89};
90
91} // namespace livekit
Base class for a track that has been published to a room.
Definition track_publication.h:39
uintptr_t ffiHandleId() const noexcept
Underlying FFI handle value.
Definition track_publication.h:64
std::shared_ptr< Track > track() const noexcept
Associated Track (if attached).
Definition track_publication.h:67
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
TrackKind
Media kind for an audio or video track.
Definition track.h:36
TrackSource
Source category for a published track.
Definition track.h:43
EncryptionType
Encryption algorithm type used by the underlying stack.
Definition e2ee.h:31