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/video_codecs/sdp_video_format.h"
24#include "api/video_codecs/video_encoder.h"
25
27
28namespace cuttlefish {
29namespace webrtc_streaming {
30
31// Interface for pluggable video encoder backends.
32//
33// Providers register themselves at static init time via
34// REGISTER_ENCODER_PROVIDER. The CompositeEncoderFactory queries
35// providers in priority order (higher = preferred).
36//
37// Priority: 0 = software fallback, 100+ = hardware acceleration.
39 public:
40 virtual ~EncoderProvider() = default;
41
42 virtual std::string GetName() const = 0;
43 virtual int GetPriority() const = 0;
44 virtual bool IsAvailable() const = 0;
45 virtual std::vector<webrtc::SdpVideoFormat> GetSupportedFormats() const = 0;
47 const webrtc::SdpVideoFormat& format) const = 0;
48
49 // Descending: higher priority sorts first.
50 bool operator<(const EncoderProvider& other) const {
51 return other.GetPriority() < GetPriority();
52 }
53};
54
55} // namespace webrtc_streaming
56} // namespace cuttlefish
Definition: encoder_provider.h:38
virtual Result< std::unique_ptr< webrtc::VideoEncoder > > CreateEncoder(const webrtc::SdpVideoFormat &format) const =0
virtual std::string GetName() const =0
bool operator<(const EncoderProvider &other) const
Definition: encoder_provider.h:50
virtual std::vector< webrtc::SdpVideoFormat > GetSupportedFormats() const =0
EventFormat format
Definition: kernel_log_server.cc:60
Definition: alloc_driver.h:20
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30