Android-cuttlefish cvd tool
decoder_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_decoder.h"
26
28
29namespace cuttlefish {
30namespace webrtc_streaming {
31
32// Interface for pluggable video decoder backends.
33//
34// Mirrors EncoderProvider. WebRTC requires matching encoder and decoder
35// format support for successful SDP negotiation.
36//
37// Priority: 0 = software fallback, 100+ = hardware acceleration.
39 public:
40 virtual ~DecoderProvider() = 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::Environment& env,
48 const webrtc::SdpVideoFormat& format) const = 0;
49
50 // Descending: higher priority sorts first.
51 bool operator<(const DecoderProvider& other) const {
52 return other.GetPriority() < GetPriority();
53 }
54};
55
56} // namespace webrtc_streaming
57} // namespace cuttlefish
Definition: decoder_provider.h:38
bool operator<(const DecoderProvider &other) const
Definition: decoder_provider.h:51
virtual std::vector< webrtc::SdpVideoFormat > GetSupportedFormats() const =0
virtual std::string GetName() const =0
virtual Result< std::unique_ptr< webrtc::VideoDecoder > > CreateDecoder(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