GIFT-Grab  1708
Copyright (c) 2015-7, University College London (UCL)
gg::BroadcastDaemon Class Reference

An object of this class serves as a surrogate for implementing the observer pattern (http://www.oodesign.com/observer-pattern.html) for IVideoSource implementors that do not inherently support it due to implementation details related to used external libraries. More...

#include <broadcastdaemon.h>

Public Member Functions

 BroadcastDaemon (IVideoSource *source)
 Link given video source with this object (see class description) More...
 
virtual ~BroadcastDaemon ()
 
void start (float frame_rate)
 Start broadcasting at specified frame rate. More...
 
void stop ()
 Stop current broadcast. More...
 

Protected Member Functions

void run (float sleep_duration_ms)
 This method is passed to broadcaster thread. More...
 

Protected Attributes

IVideoSource_source
 
bool _running
 Flag indicating status to actual daemon thread. More...
 
std::thread _thread
 Actual daemon thread. More...
 
std::mutex _lock
 

Detailed Description

An object of this class serves as a surrogate for implementing the observer pattern (http://www.oodesign.com/observer-pattern.html) for IVideoSource implementors that do not inherently support it due to implementation details related to used external libraries.

This class is intended to be used as a visitor (http://www.oodesign.com/visitor-pattern.html) to an IVideoSource object for augmenting that object's functionality.

Attention
In Python: This class is not available yet.

Constructor & Destructor Documentation

§ BroadcastDaemon()

gg::BroadcastDaemon::BroadcastDaemon ( IVideoSource source)

Link given video source with this object (see class description)

Parameters
sourceThe caller is responsible for ensuring the life span of the passed source outlasts this daemon
Exceptions
VideoSourceErrorif passed source pointer is null

§ ~BroadcastDaemon()

gg::BroadcastDaemon::~BroadcastDaemon ( )
virtual

Member Function Documentation

§ run()

void gg::BroadcastDaemon::run ( float  sleep_duration_ms)
protected

This method is passed to broadcaster thread.

Parameters
sleep_duration_ms

§ start()

void gg::BroadcastDaemon::start ( float  frame_rate)

Start broadcasting at specified frame rate.

Parameters
frame_ratein frames per second
Exceptions
VideoSourceErrorif broadcast already running, or if invalid frame rate value passed

§ stop()

void gg::BroadcastDaemon::stop ( )

Stop current broadcast.

Member Data Documentation

§ _lock

std::mutex gg::BroadcastDaemon::_lock
protected

§ _running

bool gg::BroadcastDaemon::_running
protected

Flag indicating status to actual daemon thread.

§ _source

IVideoSource* gg::BroadcastDaemon::_source
protected
See also
the public constructor

§ _thread

std::thread gg::BroadcastDaemon::_thread
protected

Actual daemon thread.

See also
_running
_lock

The documentation for this class was generated from the following files: