Torc  0.1
torcpicamera.h
Go to the documentation of this file.
1 #ifndef TORCPICAMERA_H
2 #define TORCPICAMERA_H
3 
4 // Torc
5 #include "torcomxcore.h"
6 #include "torcomxport.h"
7 #include "torcomxcomponent.h"
8 #include "torcomxtunnel.h"
9 #include "torccamera.h"
10 
11 class TorcPiCamera final : public TorcCameraDevice
12 {
13  Q_OBJECT
14 
15  public:
17  {
18  Unknown = 0,
19  V1 = 1,
20  V2 = 2
21  };
22 
23  static bool gPiCameraDetected;
24  TorcPiCamera(const TorcCameraParams &Params);
25  virtual ~TorcPiCamera() = default;
26 
27  bool Setup (void) override;
28  bool Start (void) override;
29  bool Stop (void) override;
30 
31  public slots:
32  void StreamVideo (bool Video) override;
33  void BufferReady (OMX_BUFFERHEADERTYPE *Buffer, quint64 Type);
34 
35  protected:
36  bool EnableStills (uint Count) override;
37  void StartStill (void) override;
38 
39  private:
40  bool LoadDrivers (void);
41  bool LoadCameraSettings (void);
42  bool ConfigureCamera (void);
43  bool ConfigureVideoEncoder(void);
44  bool ConfigureImageEncoder(void);
45 
46  void StartVideo (void);
47  void ProcessVideoBuffer (OMX_BUFFERHEADERTYPE *Buffer);
48  bool EnableVideo (bool Video);
49  void ProcessStillsBuffer(OMX_BUFFERHEADERTYPE *Buffer);
50 
51 
52  private:
53  Q_DISABLE_COPY(TorcPiCamera)
54 
55  PiCameraType m_cameraType;
56  bool m_stillsEnabled;
57  bool m_videoEnabled;
58 
59  // OpenMax
60  TorcOMXCore m_core;
61  TorcOMXComponent m_camera;
62  TorcOMXComponent m_videoEncoder;
63  TorcOMXComponent m_nullSink;
64  TorcOMXComponent m_splitter;
65  TorcOMXComponent m_imageEncoder;
66  OMX_U32 m_cameraPreviewPort;
67  OMX_U32 m_cameraVideoPort;
68  OMX_U32 m_videoEncoderInputPort;
69  OMX_U32 m_videoEncoderOutputPort;
70  OMX_U32 m_imageEncoderOutputPort;
71  TorcOMXTunnel m_splitterTunnel;
72  TorcOMXTunnel m_videoTunnel;
73  TorcOMXTunnel m_previewTunnel;
74  TorcOMXTunnel m_imageTunnel;
75 };
76 
77 #endif // TORCPICAMERA_H
TorcPiCamera(const TorcCameraParams &Params)
bool Stop(void) override
bool EnableStills(uint Count) override
void BufferReady(OMX_BUFFERHEADERTYPE *Buffer, quint64 Type)
An OpenMax buffer is ready (full)
virtual ~TorcPiCamera()=default
bool Start(void) override
Start the camera.
bool Setup(void) override
void StartStill(void) override
Start capturing a still image buffer.
static bool gPiCameraDetected
Definition: torcpicamera.h:23
void StreamVideo(bool Video) override