VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gvcapturefactory_v4l.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_v4l.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 "gvcapture_v4l.h"
27 #include "gstr.h"
28 
29 Gv::Capture * Gv::CaptureFactory::create( const std::string & dev_name , const std::string & config , Gv::Timezone tz )
30 {
31  if( dev_name == "demo" || ( dev_name == "test" && G::Str::splitMatch(config,"demo",";") ) )
32  return new CaptureTest( config , new Demo(CaptureTest::dx(0),CaptureTest::dy(0),config,tz) ) ;
33  else if( dev_name == "test" )
34  return new CaptureTest( config , new Bars(CaptureTest::dx(0),CaptureTest::dy(0),config) ) ;
35  else
36  return new CaptureV4l( dev_name , config ) ;
37 }
38 
39 /// \file gvcapturefactory_v4l.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.
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
virtual unsigned int dy() const override
Override from Capture.