GIFT-Grab  1708
Copyright (c) 2015-7, University College London (UCL)
ivideosource.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "videoframe.h"
4 #include "except.h"
5 #include "iobservable.h"
6 #include "macros.h"
7 
16 {
17 public:
21  virtual ~IVideoSource()
22  {
23 
24  }
25 
26 public:
33  {
34  return _colour;
35  }
36 
48  virtual bool get_frame_dimensions(int & width, int & height) = 0;
49 
59  virtual bool get_frame(gg::VideoFrame & frame) = 0;
60 
65  virtual double get_frame_rate() = 0;
66 
75  virtual void set_sub_frame(int x, int y, int width, int height) = 0;
76 
82  virtual void get_full_frame() { _get_sub_frame = false; }
83 
90  void set_number_of_frames_to_burn(unsigned int burn_num)
91  {
92  _num_burn_frames = burn_num;
93  }
94 
101  {
102  return _num_burn_frames;
103  }
104 
105 protected:
111  :_get_sub_frame(false), _num_burn_frames(0)
112  {}
113 
120  : _colour(colour)
121  , _get_sub_frame(false)
122  , _num_burn_frames(0)
123  {
124 
125  }
126 
132 
140 
145  unsigned int _num_burn_frames;
146 
147 protected:
149 };
virtual bool get_frame_dimensions(int &width, int &height)=0
Get frame dimensions.
virtual void get_full_frame()
Reset sub-framing, i.e. return full frames instead of only ROI.
Definition: ivideosource.h:82
IVideoSource()
Default constructor that resets sub-framing and also _num_burn_frames.
Definition: ivideosource.h:110
ColourSpace
Supported colour spaces.
Definition: videoframe.h:29
virtual gg::ColourSpace get_colour()
Get colour space in which this source is operating.
Definition: ivideosource.h:32
This abstract class defines the interface that every video source must implement. ...
Definition: ivideosource.h:15
gg::ColourSpace _colour
Indicates the colour space in which this source is operating.
Definition: ivideosource.h:131
IVideoSource(gg::ColourSpace colour)
Constructor setting colour space.
Definition: ivideosource.h:119
virtual bool get_frame(gg::VideoFrame &frame)=0
Grab next available frame.
unsigned int get_number_of_frames_to_burn()
Definition: ivideosource.h:100
DISALLOW_COPY_AND_ASSIGNMENT(IVideoSource)
bool _get_sub_frame
If false, then grab full frames, otherwise a specific ROI within grabbed frames.
Definition: ivideosource.h:139
Every IVideoSource that broadcasts video frames needs to implement this interface, which defines the observable (subject / publisher) part of the observer design pattern (aka subscriber-publisher).
Definition: iobservable.h:42
unsigned int _num_burn_frames
Number of frames to discard after starting streaming.
Definition: ivideosource.h:145
A class to represent a video frame.
Definition: videoframe.h:47
virtual double get_frame_rate()=0
Get frame rate of used source.
virtual ~IVideoSource()
Destructor, doing nothing.
Definition: ivideosource.h:21
virtual void set_sub_frame(int x, int y, int width, int height)=0
Set a ROI within each grabbed frame.
void set_number_of_frames_to_burn(unsigned int burn_num)
Set number of frames to discard after starting streaming (i.e. one-off, until streaming becomes stabl...
Definition: ivideosource.h:90