mmal_cxx_helper.h
Go to the documentation of this file.
1 #include "interface/mmal/mmal.h"
2 #include "interface/mmal/mmal_buffer.h"
3 #include "interface/mmal/mmal_logging.h"
4 #include "interface/mmal/util/mmal_connection.h"
5 #include "interface/mmal/util/mmal_default_components.h"
6 #include "interface/mmal/util/mmal_util.h"
7 #include "interface/mmal/util/mmal_util_params.h"
8 
9 namespace mmal
10 {
11 // Calls mmal_component_destroy, but returns void
12 
14  void operator()(MMAL_COMPONENT_T* ptr) const {
15  if (ptr != nullptr) {
16  for (size_t i = 0; i < ptr->output_num; ++i) {
17  if (ptr->output[i] && ptr->output[i]->is_enabled) {
18  mmal_port_disable(ptr->output[i]);
19  }
20  }
21  mmal_component_disable(ptr);
22  mmal_component_destroy(ptr);
23  }
24  }
25 };
26 typedef std::unique_ptr<MMAL_COMPONENT_T, component_deleter> component_ptr;
27 
29  void operator()(MMAL_CONNECTION_T* ptr) const {
30  if (ptr != nullptr) {
31  mmal_connection_destroy(ptr);
32  }
33  }
34 };
35 typedef std::unique_ptr<MMAL_CONNECTION_T, connection_deleter> connection_ptr;
36 
37 void default_delete_pool(MMAL_POOL_T* ptr) {
38  if (ptr != nullptr) {
39  fprintf(stderr, "%s\n", "LEAKED POOL! you need to define your own deleter");
40  }
41 }
42 typedef std::unique_ptr<MMAL_POOL_T, std::function<void(MMAL_POOL_T*)>> pool_ptr;
43 
44 
45 // Standard ports for the camera component
47 {
48  // We can't use an enum class here, we rely on implictly converting to an int
49  // which is not allowed for an enum class
50  enum {
51  preview = 0,
52  video = 1,
53  capture = 2
54  };
55 };
56 
57 }
void operator()(MMAL_CONNECTION_T *ptr) const
std::unique_ptr< MMAL_CONNECTION_T, connection_deleter > connection_ptr
std::unique_ptr< MMAL_COMPONENT_T, component_deleter > component_ptr
std::unique_ptr< MMAL_POOL_T, std::function< void(MMAL_POOL_T *)> > pool_ptr
void operator()(MMAL_COMPONENT_T *ptr) const
void default_delete_pool(MMAL_POOL_T *ptr)


raspicam_node
Author(s):
autogenerated on Sun Jul 5 2020 03:45:18