LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
video_source.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
21#include "livekit/ffi_handle.h"
22
23namespace livekit {
24
25class VideoFrame;
26
32enum class VideoRotation {
33 VIDEO_ROTATION_0 = 0,
34 VIDEO_ROTATION_90 = 90,
35 VIDEO_ROTATION_180 = 180,
36 VIDEO_ROTATION_270 = 270,
37};
38
44public:
54 VideoSource(int width, int height);
55 virtual ~VideoSource() = default;
56
57 VideoSource(const VideoSource &) = delete;
58 VideoSource &operator=(const VideoSource &) = delete;
59 VideoSource(VideoSource &&) noexcept = default;
60 VideoSource &operator=(VideoSource &&) noexcept = default;
61
63 int width() const noexcept { return width_; }
64 int height() const noexcept { return height_; }
65
67 std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
68
81 void captureFrame(const VideoFrame &frame, std::int64_t timestamp_us = 0,
82 VideoRotation rotation = VideoRotation::VIDEO_ROTATION_0);
83
84private:
85 FfiHandle handle_; // owned FFI handle
86 int width_{0};
87 int height_{0};
88};
89
90} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
Definition video_frame.h:59
Definition video_source.h:43
int width() const noexcept
Source resolution as declared at construction.
Definition video_source.h:63
VideoSource(int width, int height)
void captureFrame(const VideoFrame &frame, std::int64_t timestamp_us=0, VideoRotation rotation=VideoRotation::VIDEO_ROTATION_0)
std::uint64_t ffi_handle_id() const noexcept
Underlying FFI handle ID (0 if invalid).
Definition video_source.h:67