esp32cam
OV2640 camera on ESP32-CAM
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
frame.hpp
Go to the documentation of this file.
1#ifndef ESP32CAM_FRAME_HPP
2#define ESP32CAM_FRAME_HPP
3
4#include <cstddef>
5#include <cstdint>
6
7class Client;
8class Print;
9
10namespace esp32cam {
11
13class Frame {
14public: // access
15 ~Frame();
16
17 uint8_t* data() const {
18 return m_data;
19 }
20
21 size_t size() const {
22 return m_size;
23 }
24
25 int getWidth() const {
26 return m_width;
27 }
28
29 int getHeight() const {
30 return m_height;
31 }
32
40 bool writeTo(Print& os, int timeout = 10000);
41
49 bool writeTo(Client& os, int timeout = 10000);
50
51public: // conversion
52 bool isJpeg() const;
53
58 bool toJpeg(int quality);
59
60 bool isBmp() const;
61
63 bool toBmp();
64
65private:
66 Frame();
67
68 explicit Frame(void* fb);
69
70 bool writeToImpl(Print& os, int timeout, Client* client);
71
72 void releaseFb();
73
74private:
75 class CameraFbT;
76 CameraFbT* m_fb = nullptr;
77 uint8_t* m_data = nullptr;
78 size_t m_size = 0;
79 int m_width = -1;
80 int m_height = -1;
81 int m_pixFormat = -1;
82
83 friend class CameraClass;
84};
85
86} // namespace esp32cam
87
88#endif // ESP32CAM_FRAME_HPP
Definition camera.hpp:10
A frame of picture.
Definition frame.hpp:13
bool writeTo(Print &os, int timeout=10000)
Write frame buffer to os .
Definition frame.cpp:40
bool toJpeg(int quality)
Convert frame to JPEG.
Definition frame.cpp:68
uint8_t * data() const
Definition frame.hpp:17
bool toBmp()
Convert frame to BMP.
Definition frame.cpp:104
int getWidth() const
Definition frame.hpp:25
int getHeight() const
Definition frame.hpp:29
size_t size() const
Definition frame.hpp:21
bool isJpeg() const
Definition frame.cpp:63
bool isBmp() const
Definition frame.cpp:99
~Frame()
Definition frame.cpp:23
Definition esp32cam.h:14