summaryrefslogtreecommitdiff
path: root/src/LibCamera.h
blob: 89cf8352951c4283aad62c10b1697a6ad050393e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once

// #include <atomic>
// #include <iomanip>
// #include <iostream>
// #include <signal.h>
// #include <limits.h>
// #include <memory>
// #include <stdint.h>
// #include <string>
// #include <vector>
// #include <unordered_map>
// #include <queue>
// #include <sstream>
// #include <sys/mman.h>
// #include <unistd.h>
// #include <time.h>
// #include <mutex>

#ifdef signals
#error ("don't include this file after any qt files")
#endif

#include <libcamera/controls.h>
#include <libcamera/control_ids.h>
#include <libcamera/property_ids.h>
#include <libcamera/libcamera.h>
#include <libcamera/camera.h>
#include <libcamera/camera_manager.h>
#include <libcamera/framebuffer_allocator.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
#include <libcamera/formats.h>
#include <libcamera/transform.h>
// using namespace libcamera;

// typedef struct {
//     uint8_t *imageData;
//     uint32_t size;
//     uint64_t request;
// } LibcameraOutData;

// class LibCamera {
//     public:
//         LibCamera(){};
//         ~LibCamera(){};
        
//         int initCamera();
//         void configureStill(int width, int height, PixelFormat format, int buffercount, int rotation);
//         int startCamera();
//         int resetCamera(int width, int height, PixelFormat format, int buffercount, int rotation);
//         bool readFrame(LibcameraOutData *frameData);
//         void returnFrameBuffer(LibcameraOutData frameData);

//         void set(ControlList controls);
//         void stopCamera();
//         void closeCamera();

//         Stream *VideoStream(uint32_t *w, uint32_t *h, uint32_t *stride) const;
//         char * getCameraId();

//     private:
//         int startCapture();
//         int queueRequest(Request *request);
//         void requestComplete(Request *request);
//         void processRequest(Request *request);

//         void StreamDimensions(Stream const *stream, uint32_t *w, uint32_t *h, uint32_t *stride) const;

//         unsigned int cameraIndex_;
// 	    uint64_t last_;
//         std::unique_ptr<CameraManager> cm;
//         std::shared_ptr<Camera> camera_;
//         bool camera_acquired_ = false;
//         bool camera_started_ = false;
// 	    std::unique_ptr<CameraConfiguration> config_;
//         std::unique_ptr<FrameBufferAllocator> allocator_;
//         std::vector<std::unique_ptr<Request>> requests_;
//         // std::map<std::string, Stream *> stream_;
//         std::map<int, std::pair<void *, unsigned int>> mappedBuffers_;

//         std::queue<Request *> requestQueue;

//         ControlList controls_;
//         std::mutex control_mutex_;
//         std::mutex camera_stop_mutex_;
//         std::mutex free_requests_mutex_;

//         Stream *viewfinder_stream_ = nullptr;
//         std::string cameraId;
// };