Android-cuttlefish cvd tool
encoder_provider.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 The Android Open Source Project
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 <memory>
20#include <string>
21#include <vector>
22
23#include "api/environment/environment.h"
24#include "api/video_codecs/sdp_video_format.h"
25#include "api/video_codecs/video_encoder.h"
26
28
29namespace cuttlefish {
30namespace webrtc_streaming {
31
32// Interface for pluggable video encoder backends.
33//
34// Providers register themselves at static init time via
35// REGISTER_ENCODER_PROVIDER. The CompositeEncoderFactory queries
36// providers in priority order (higher = preferred).
37//
38// Priority: 0 = software fallback, 100+ = hardware acceleration.
40 public:
41 virtual ~EncoderProvider() = default;
42
43 virtual std::string GetName() const = 0;
44 virtual int GetPriority() const = 0;
45 virtual bool IsAvailable() const = 0;
46 virtual std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const = 0;
48 const webrtc::Environment& env,
49 const webrtc::SdpVideoFormat& format) const = 0;
50
51 // Descending: higher priority sorts first.
52 bool operator<(const EncoderProvider& other) const {
53 return other.GetPriority() < GetPriority();
54 }
55};
56
57} // namespace webrtc_streaming
58} // namespace cuttlefish
Definition: encoder_provider.h:39
virtual std::string GetName() const =0
bool operator<(const EncoderProvider &other) const
Definition: encoder_provider.h:52
virtual std::vector< webrtc::SdpVideoFormat > GetSupportedFormats() const =0
virtual Result< std::unique_ptr< webrtc::VideoEncoder > > CreateEncoder(const webrtc::Environment &env, const webrtc::SdpVideoFormat &format) const =0
EventFormat format
Definition: kernel_log_server.cc:61
Definition: alloc_driver.h:21
std::variant< GceEnvironment, GitHubRepository, KokoroEnvironment, UnknownEnvironment > Environment
Definition: host_metrics.h:36
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30