MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
Loading...
Searching...
No Matches
display_manager_base.h
Go to the documentation of this file.
1//
2// Copyright (c) 2025, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
10
11#ifndef HARDWARE_DISPLAY_MANAGER_BASE_H_
12#define HARDWARE_DISPLAY_MANAGER_BASE_H_
13
14#include <errno.h>
15#include <fcntl.h>
16#include <linux/fb.h>
17#include <stdio.h>
18#include <stdlib.h>
19#include <string.h>
20#include <sys/ioctl.h>
21#include <sys/mman.h>
22#include <sys/stat.h>
23#include <sys/types.h>
24#include <unistd.h>
25
26#include <string>
27#include <vector>
28
29#include "common/datatypes.h"
30#include "rtp/rtp_types.h"
31
32namespace mediax {
33
36 public:
41 DisplayManagerBase(std::string name = "") : name_(name){};
42
47 virtual ~DisplayManagerBase() = default;
48
54 virtual Status Initalise() = 0;
55
60 virtual void Run() = 0;
61
66 virtual void Stop() {}
67
74
80 void SetResolution(Resolution resolution) { last_requested_resolution_ = resolution; }
81
87 std::string GetName() { return name_; }
88
94 virtual int GetBytesPerPixel() = 0;
95
101 virtual mediax::rtp::ColourspaceType GetColourspace() { return mediax::rtp::ColourspaceType::kColourspaceUndefined; }
102
112 virtual Status DisplayBuffer(uint8_t *frame_buffer, Resolution resolution, std::string text) = 0;
113
125 Status Rescale(uint8_t *frame_buffer, void *display_buffer, Resolution resolution, int height, int width);
126
131 virtual void Flush() = 0;
132
136 virtual void ToggleFullscreen() {}
137
141 std::vector<uint8_t> scaled_frame_buffer_;
143 std::string name_;
144};
145
146} // namespace mediax
147
148#endif // HARDWARE_DISPLAY_MANAGER_BASE_H_
The display manager class.
Definition display_manager_base.h:35
virtual int GetBytesPerPixel()=0
Get the Bits Per Pixel object.
DisplayManagerBase(std::string name="")
Construct a new Display Manager object.
Definition display_manager_base.h:41
virtual void Flush()=0
Flush the framebuffer /dev/fb0.
virtual Status Initalise()=0
Initalise the display manager.
std::vector< uint8_t > scaled_frame_buffer_
Scaled frame buffer for resolutions that do not match the display.
Definition display_manager_base.h:141
virtual Status DisplayBuffer(uint8_t *frame_buffer, Resolution resolution, std::string text)=0
Buffer must be in the format RGBA.
virtual Resolution GetResolution()=0
Get the Resolution attribute.
virtual void ToggleFullscreen()
Toggle Fullscreen object.
Definition display_manager_base.h:136
std::string GetName()
Get the Name object.
Definition display_manager_base.h:87
void SetResolution(Resolution resolution)
Set the Resolution object.
Definition display_manager_base.h:80
virtual mediax::rtp::ColourspaceType GetColourspace()
Get the Colourspace object.
Definition display_manager_base.h:101
Status Rescale(uint8_t *frame_buffer, void *display_buffer, Resolution resolution, int height, int width)
Rescale the video if needed.
Definition display_manager_base.cc:19
virtual void Stop()
Stop the main loop if there is one.
Definition display_manager_base.h:66
virtual void Run()=0
The main event loop if there is one.
std::string name_
The name of the display, can be used in the window title if windowing is supported.
Definition display_manager_base.h:143
virtual ~DisplayManagerBase()=default
Destroy the Display Manager object.
Resolution last_requested_resolution_
Last requested resolution.
Definition display_manager_base.h:139
ColourspaceType
Supported colour spaces.
Definition rtp_types.h:102
The Astute Systems (MediaX) library for video streaming.
Definition rtp_av1_depayloader.cc:34
Status
Enum of status.
Definition datatypes.h:21
RTP streaming video types.
The video resolution structure.
Definition datatypes.h:34