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
17#include <optional>
18#include <string>
19
22
23namespace cuttlefish {
24
25constexpr const char kMediaFlag[] = "media";
26inline constexpr char kDefaultV4l2ProxyDevicePath[] = "/dev/video0";
27constexpr const char kMediaHelp[] =
28 "Colon separated media device properties: "
29 "\"[type]:[key1]=[val1]:[key2]=[val2]\". "
30 "Supported types:\n"
31 " 'v4l2_emulated_camera_mplane': emulated media capture device "
32 "(multi-plane)\n"
33 " 'v4l2_emulated_camera_mplane_external': emulated media capture "
34 "device (multi-plane) for the reference external camera HAL\n"
35 " 'v4l2_proxy': proxy a host V4L2 device into the guest\n"
36 " 'v4l2_stream_proxy': stream video from a host named pipe into the "
37 "guest\n\n"
38 "v4l2_proxy properties:\n"
39 " 'device_path': optional, path to host V4L2 device (defaults to "
40 "/dev/video0)\n\n"
41 "v4l2_stream_proxy properties:\n"
42 " 'input_path': path to the host named pipe\n"
43 " 'input_width': width of the video stream in pixels\n"
44 " 'input_height': height of the video stream in pixels\n"
45 " 'input_fps': frames per second (e.g., 30 or 30000/1001)\n\n"
46 "Supported keys:\n"
47 " 'lens_facing': optional, supported values: 'FRONT', 'BACK', "
48 "'EXTERNAL'\n\n"
49 "Example usage:\n"
50 " --media=v4l2_emulated_camera_mplane:lens_facing=BACK\n"
51 " --media=v4l2_proxy:device_path=/dev/video0\n"
52 " --media=v4l2_stream_proxy:input_path=/tmp/fifo:"
53 "input_width=640:input_height=480:input_fps=30\n";
54
56 const std::string& flag);
57
59ParseMediaConfigsFromArgs(std::vector<std::string>& args, int num_instances);
60
61} // namespace cuttlefish
Definition: alloc_driver.h:21
Result< std::optional< CuttlefishConfig::MediaConfig > > ParseMediaConfig(const std::string &flag)
Definition: media.cpp:43
constexpr const char kMediaHelp[]
Definition: media.h:27
constexpr const char kMediaFlag[]
Definition: media.h:25
Result< std::vector< std::vector< CuttlefishConfig::MediaConfig > > > ParseMediaConfigsFromArgs(std::vector< std::string > &args, int num_instances)
Definition: media.cpp:149
constexpr char kDefaultV4l2ProxyDevicePath[]
Definition: media.h:26
tl::expected< T, StackTraceError< E > > Result
Definition: result_type.h:30