~jaromil/freej/master

« back to all changes in this revision

Viewing changes to src/include/v4l2_layer.h

  • Committer: fred
  • Date: 2011-04-22 23:45:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1552.
  • Revision ID: git-v1:9be6947d00722cabfcb779eca527e25a692f3258
Added the ability to change the V4L2 devices resolution

- Created a QqComboRes class.

- In Layer class, added the types VIDEOLAYER and V4L2LAYER.

- In v4l2_layer.h and .cpp, created a Res class containing the
available resolutions.

- In QqWidget conctructor, determines if the layer is a v4l2 layer,
added a combobox with the different resolutions if it is.

- In a Qfreej menu, added the full screen function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include <linux/videodev2.h>
28
28
 
 
29
class Res {
 
30
public:
 
31
  Res(int sz);
 
32
  ~Res();
 
33
  bool addRes(int, int, int);
 
34
  int getNb();
 
35
  int getX(int);
 
36
  int getY(int);
 
37
  void setsX(int);
 
38
  int getCurIdx();
 
39
  void chgRes(int);
 
40
  
 
41
private:
 
42
  int m_idx, m_curIdx, m_size, m_fd;
 
43
  int (*m_sizes)[2];
 
44
  bool m_dec;
 
45
  struct v4l2_format m_format;
 
46
};
 
47
 
29
48
class V4L2CamLayer: public Layer {
30
49
 public:
31
50
  V4L2CamLayer();
34
53
  bool open(const char *devfile);
35
54
  void *feed();
36
55
  void close();
 
56
  Res *getRes();
 
57
  void chgRes(int, Res *);
37
58
 
38
59
 protected:
39
60
  bool _init();
47
68
  int framenum; 
48
69
  void *frame;
49
70
 
 
71
  int   nb_sizes;
 
72
  Res   *m_res;
 
73
  struct v4l2_frmsizeenum framesize;
50
74
  struct v4l2_capability capability;
51
75
  struct v4l2_fmtdesc fmtdesc;
52
76
  struct v4l2_input input; ///< info about current video input
58
82
    void *start;
59
83
    size_t length;
60
84
  } *buffers;
61
 
 
 
85
  char m_devfile[2048];
62
86
 
63
87
  // allow to use Factory on this class
64
88
  FACTORY_ALLOWED;