This class implements the factory design pattern for creating connections to supported video sources.
More...
#include <videosourcefactory.h>
This class implements the factory design pattern for creating connections to supported video sources.
It ensures no duplicate connection is created to any one supported video source, and in addition takes care of properly garbage-collecting all video source connections created during the lifetime of the singleton factory.
- See also
- IVideoSource
-
Device
§ VideoSourceFactory()
gg::VideoSourceFactory::VideoSourceFactory |
( |
| ) |
|
|
protected |
The constructor should never be publicly called.
- See also
- get_instance
§ ~VideoSourceFactory()
gg::VideoSourceFactory::~VideoSourceFactory |
( |
| ) |
|
|
virtual |
§ connect_network_source()
Open connection to network connection specified by given address
.
- Parameters
-
- Returns
- pointer to the created video source. The ownership of this object passes to the caller. So the caller is responsible for garbage-collecting it.
- Exceptions
-
NetworkSourceUnavailable | if no connection can be established |
VideoSourceError | if GIFT-Grab not built with options required for the passed device and colour combination OR if there was a problem constructing the requested video source |
§ create_file_reader()
IVideoSource * gg::VideoSourceFactory::create_file_reader |
( |
const std::string |
filepath, |
|
|
enum ColourSpace |
colour_space |
|
) |
| |
Create a reader to read colour_space
frames format from filepath
.
- Parameters
-
filepath | Attempting to open an already open video file leads to undefined behaviour. However once the returned video source used for reading the file is destroyed, it can be re-opened. |
colour_space | |
- Returns
- a polymorphic video file reader. The ownership of this returned object passes to the caller. The reader behaves like other video sources as far the callback paradigm (observer pattern) is concerned. Calling the
get_frame
method on this object leads to undefined behaviour, and hence should be avoided. The reader keeps sending out data with all pixels black after all video frames in the opened file are exhausted.
- Exceptions
-
VideoSourceError | with a detailed error message if opening of filepath fails for any reason |
§ DISALLOW_COPY_AND_ASSIGNMENT()
§ free_device()
void gg::VideoSourceFactory::free_device |
( |
enum Device |
device | ) |
|
Close connection to specified device
, if existing.
- Parameters
-
- Exceptions
-
- See also
- get_device the IVideoSource object
get_device
returns will be destroyed by this, and hence the previously returned pointer will become unusable
§ get_device()
Try to connect to specified device
for capturing video with specified colour
space.
Note that the availability of capturing video with specified colour
space depends on the custom build options selected. Cf. documentation (README file) for details.
- Parameters
-
- Returns
- pointer to the device's framegrabber. Client should not delete this pointer on its own. The factory will take care of properly garbage-collecting this at the end of the factory singleton's lifetime.
- Exceptions
-
- See also
- free_device if the intention is to connect to
device
with another colour
than the one device
is currently connected to
- Exceptions
-
VideoSourceError | if GIFT-Grab not built with options required for the passed device and colour combination OR if there was a problem constructing the requested video source |
§ get_instance()
Get reference to singleton instance of this class.
- Returns
§ _device_colours
ColourSpace gg::VideoSourceFactory::_device_colours[Device::COUNT] |
|
protected |
At a single point in time, only one connection using only one colour space may exist.
§ _devices
IVideoSource* gg::VideoSourceFactory::_devices[Device::COUNT] |
|
protected |
So that can keep track of everything opened and in use.
- See also
- Device the length of this pointer array is to be kept in sync with the number of devices supported
The documentation for this class was generated from the following files: