Android-cuttlefish cvd tool
media.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#pragma once
17
18#include <fruit/fruit.h>
19
20#include <cstddef>
21#include <string>
22#include <vector>
23
27
28namespace cuttlefish {
29
30// Component to share data between MediaConfigsFlag and MediaConfigsFragment
32 public:
33 virtual ~MediaConfigs() = default;
34
35 virtual std::string Name() const = 0;
36
37 virtual const std::vector<CuttlefishConfig::MediaConfig>& GetConfigs(
38 size_t instance_index) const = 0;
39 virtual const std::vector<std::vector<CuttlefishConfig::MediaConfig>>&
40 GetAllConfigs() const = 0;
41 virtual void SetConfigs(
42 const std::vector<std::vector<CuttlefishConfig::MediaConfig>>&
43 configs) = 0;
44};
45
46// Component to parse the --media command line flag and update the
47// MediaConfigs.
48class MediaConfigsFlag : public FlagFeature {};
49
50// Component to serialize and deserialize the MediaConfigs to/from Json.
52
53fruit::Component<MediaConfigs> MediaConfigsComponent();
54
55fruit::Component<fruit::Required<MediaConfigs, ConfigFlag>, MediaConfigsFlag>
57
58fruit::Component<fruit::Required<MediaConfigs>, MediaConfigsFragment>
60
61} // namespace cuttlefish
Definition: config_fragment.h:24
Definition: feature.h:114
Definition: media.h:48
Definition: media.h:51
Definition: media.h:31
virtual ~MediaConfigs()=default
virtual const std::vector< std::vector< CuttlefishConfig::MediaConfig > > & GetAllConfigs() const =0
virtual std::string Name() const =0
virtual const std::vector< CuttlefishConfig::MediaConfig > & GetConfigs(size_t instance_index) const =0
virtual void SetConfigs(const std::vector< std::vector< CuttlefishConfig::MediaConfig > > &configs)=0
Definition: alloc_driver.h:21
fruit::Component< fruit::Required< MediaConfigs >, MediaConfigsFragment > MediaConfigsFragmentComponent()
Definition: media.cpp:191
fruit::Component< MediaConfigs > MediaConfigsComponent()
Definition: media.cpp:76
fruit::Component< fruit::Required< MediaConfigs, ConfigFlag >, MediaConfigsFlag > MediaConfigsFlagComponent()
Definition: media.cpp:117