Android-cuttlefish cvd tool
screen_connector_common.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 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 <stdint.h>
20
21#include <functional>
22#include <type_traits>
23
24namespace cuttlefish {
25
26template <typename T>
27struct is_movable {
28 static constexpr const bool value =
29 std::is_move_constructible<T>::value && std::is_move_assignable<T>::value;
30};
31
32// this callback type is going directly to socket-based or wayland
33// ScreenConnector
35 std::function<void(uint32_t /*display_number*/, //
36 uint32_t /*frame_width*/, //
37 uint32_t /*frame_height*/, //
38 uint32_t /*frame_fourcc_format*/, //
39 uint32_t /*frame_stride_bytes*/, //
40 uint8_t* /*frame_pixels*/)>;
41
42namespace ScreenConnectorInfo {
43
44uint32_t ScreenHeight(uint32_t display_number);
45uint32_t ScreenWidth(uint32_t display_number);
46uint32_t ComputeScreenStrideBytes(uint32_t w);
47uint32_t ComputeScreenSizeInBytes(uint32_t w, uint32_t h);
48
49} // namespace ScreenConnectorInfo
50
52 virtual bool RenderConfirmationUi(uint32_t display_number,
53 uint32_t frame_width, uint32_t frame_height,
54 uint32_t frame_fourcc_format,
55 uint32_t frame_stride_bytes,
56 uint8_t* frame_bytes) = 0;
57 virtual bool IsCallbackSet() const = 0;
58 virtual ~ScreenConnectorFrameRenderer() = default;
59};
60
61// this is inherited by the data type that represents the processed frame
62// being moved around.
66};
67
68} // namespace cuttlefish
uint32_t ComputeScreenSizeInBytes(const uint32_t w, const uint32_t h)
Definition: screen_connector_common.cc:56
uint32_t ScreenWidth(uint32_t display_number)
Definition: screen_connector_common.cc:46
uint32_t ComputeScreenStrideBytes(const uint32_t w)
Definition: screen_connector_common.cc:52
uint32_t ScreenHeight(uint32_t display_number)
Definition: screen_connector_common.cc:40
Definition: alloc_utils.cpp:23
std::function< void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint8_t *)> GenerateProcessedFrameCallbackImpl
Definition: screen_connector_common.h:40
Definition: screen_connector_common.h:63
uint32_t display_number_
Definition: screen_connector_common.h:64
bool is_success_
Definition: screen_connector_common.h:65
Definition: screen_connector_common.h:51
virtual bool IsCallbackSet() const =0
virtual bool RenderConfirmationUi(uint32_t display_number, uint32_t frame_width, uint32_t frame_height, uint32_t frame_fourcc_format, uint32_t frame_stride_bytes, uint8_t *frame_bytes)=0
Definition: screen_connector_common.h:27
static constexpr const bool value
Definition: screen_connector_common.h:28