JeVois  1.5
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
VideoOutput.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
20 #include <jevois/Image/RawImage.H>
22 
23 namespace jevois
24 {
25  //! Base class for video output. Gadget, MovieOutput, VideoDisplay, and VideoOutputNone derive from it
26  /*! This virtual base class provides the interface for video output, as needed by Engine. \ingroup core */
28  {
29  public:
30  //! Virtual destructor for safe inheritance
31  virtual ~VideoOutput();
32 
33  //! Set the video format and frame rate
34  /*! Sometimes this may be implemented as a no-op. For the USB Gadget class, we cannot decide and set the format,
35  it is set as the result of USB/UVC commands being received, so that the USB host is prepared to receive images
36  with the selected format and frame size. For the VideoDisplay class, this allocates the output buffers and
37  must be called before streaming starts.
38 
39  Engine calls this (as well as setFormat() on the camera) from within its own setFormat(), so usually one would
40  just set the format at the Engine level and not directly on VideoOutput. */
41  virtual void setFormat(VideoMapping const & m) = 0;
42 
43  //! Get a pre-allocated image so that we can fill the pixel data and later send out using send()
44  /*! May throw if no buffer is available, i.e., all have been queued to send to the host but have not yet been
45  sent. Application code must balance exactly one send() for each get(). */
46  virtual void get(RawImage & img) = 0;
47 
48  //! Send an image out
49  /*! May throw if the format is incorrect or std::overflow_error if we have not yet consumed the previous image. */
50  virtual void send(RawImage const & img) = 0;
51 
52  //! Start streaming
53  virtual void streamOn() = 0;
54 
55  //! Abort streaming
56  /*! This only cancels future get() and send() calls, one should still call streamOff() to turn off streaming. */
57  virtual void abortStream() = 0;
58 
59  //! Stop streaming
60  virtual void streamOff() = 0;
61  };
62 }
63 
virtual void setFormat(VideoMapping const &m)=0
Set the video format and frame rate.
virtual void abortStream()=0
Abort streaming.
virtual ~VideoOutput()
Virtual destructor for safe inheritance.
Definition: VideoOutput.C:21
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition: RawImage.H:110
Simple struct to hold video mapping definitions for the processing Engine.
Definition: VideoMapping.H:41
virtual void send(RawImage const &img)=0
Send an image out.
Base class for video output. Gadget, MovieOutput, VideoDisplay, and VideoOutputNone derive from it...
Definition: VideoOutput.H:27
virtual void streamOn()=0
Start streaming.
virtual void streamOff()=0
Stop streaming.