VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gvcapturefactory_test.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 //
18 // gvcapturefactory_test.cpp
19 //
20 
21 #include "gdef.h"
22 #include "gvcapturefactory.h"
23 #include "gvcapture_test.h"
24 #include "gvbars.h"
25 #include "gvdemo.h"
26 #include "gstr.h"
27 
28 Gv::Capture * Gv::CaptureFactory::create( const std::string & dev_name , const std::string & config , Gv::Timezone tz )
29 {
30  if( dev_name == "demo" || G::Str::splitMatch(config,"demo",";") )
31  return new CaptureTest( config , new Demo(CaptureTest::dx(0),CaptureTest::dy(0),config,tz) ) ;
32  else
33  return new CaptureTest( config , new Bars(CaptureTest::dx(0),CaptureTest::dy(0),config) ) ;
34 }
35 
36 /// \file gvcapturefactory_test.cpp
A representation of a timezone.
Definition: gvtimezone.h:35
virtual unsigned int dx() const override
Override from Capture.
static Capture * create(const std::string &dev_name, const std::string &config, Gv::Timezone=Gv::Timezone())
Factory method.
An image generator class for a demo animation.
Definition: gvdemo.h:37
static bool splitMatch(const std::string &in, const std::string &s, const std::string &ws=Str::ws())
Returns true if any of the split parts of 'in' are equal to 's'.
Definition: gstr.cpp:927
A video capture abstract interface, exposing a file descriptor and a method to handle read events on ...
Definition: gvcapture.h:40
A Gv::Capture implementation that serves up dummy frames created by a Gv::ImageGenerator.
virtual unsigned int dy() const override
Override from Capture.
An image generator for test images comprising horizontal or vertical colour bars. ...
Definition: gvbars.h:37