Commit 50f05e26 authored by IOhannes m zmölnig's avatar IOhannes m zmölnig
Browse files

use "const std::string&" in plugin API

Closes: https://github.com/umlaeute/Gem/issues/158
breaks ABI & (inheritance) API
parent 2559f5bc
......@@ -43,7 +43,7 @@ namespace gem { namespace plugins {
virtual ~filmIMAGE(void) {
delete m_handle;
}
virtual bool open(const std::string name, const gem::Properties&requestprops) {
virtual bool open(const std::string&name, const gem::Properties&requestprops) {
gem::Properties props=requestprops;
m_image.newfilm=true;
return m_handle->load(name, m_image.image, props);
......@@ -179,7 +179,7 @@ namespace gem { namespace plugins {
}
}
virtual bool open(const std::string name, const gem::Properties&requestprops) {
virtual bool open(const std::string&name, const gem::Properties&requestprops) {
if(m_handle)close();
std::vector<std::string> backends;
......
......@@ -80,7 +80,7 @@ class GEM_EXTERN film
* anything about the internal cs of the decoder
*/
/* returns TRUE if loading was successful, FALSE otherwise */
virtual bool open(const std::string,
virtual bool open(const std::string&,
const gem::Properties&requestprops) = 0;
/* some error codes */
......
......@@ -38,7 +38,7 @@ namespace gem { namespace plugins {
std::string m_codec; // currently selected codec
struct codechandle {
codechandle(gem::plugins::record*h, const std::string c):handle(h), codec(c) {}
codechandle(gem::plugins::record*h, const std::string&c):handle(h), codec(c) {}
gem::plugins::record*handle;
std::string codec;
......@@ -46,7 +46,7 @@ namespace gem { namespace plugins {
std::map<std::string, std::vector<codechandle> >m_codechandle;
std::vector<std::string>m_codecs;
void addCodecHandle(gem::plugins::record*handle, const std::string codec) {
void addCodecHandle(gem::plugins::record*handle, const std::string&codec) {
#ifdef __GNUC__
# warning better handling of duplicate codecs
#endif
......@@ -150,7 +150,7 @@ namespace gem { namespace plugins {
}
return m_codecs;
}
virtual const std::string getCodecDescription(const std::string codecname) {
virtual const std::string getCodecDescription(const std::string&codecname) {
std::string descr;
std::vector<codechandle>handles=m_codechandle[codecname];
if(handles.size()>0)
......@@ -164,7 +164,7 @@ namespace gem { namespace plugins {
// that can handle the given codec
// calling this method will eventually call the setCodec() method of all handles
// specifying an empty codec, will select all handles
virtual bool setCodec(const std::string codecname) {
virtual bool setCodec(const std::string&codecname) {
m_selectedHandles.clear();
if(codecname.empty()) {
checkSelectedHandles();
......@@ -239,7 +239,7 @@ namespace gem { namespace plugins {
//
// try all of the currently selected handles (selection through codec)
// until one of them succeeds
virtual bool start(const std::string filename, gem::Properties&props) {
virtual bool start(const std::string&filename, gem::Properties&props) {
stop();
if(!checkSelectedHandles()) {
return false; // no selected codec available
......
......@@ -54,11 +54,11 @@ public:
/**
* get a human readable description of the given codec (e.g. "Motion Jpeg A")
*/
virtual const std::string getCodecDescription(const std::string codecname) = 0;
virtual const std::string getCodecDescription(const std::string&codecname) = 0;
/**
* set the current codec
*/
virtual bool setCodec(const std::string name) = 0;
virtual bool setCodec(const std::string&name) = 0;
/**
* list all properties the currently selected codec supports
......@@ -76,7 +76,7 @@ public:
/*
* returns TRUE if opening was successful, FALSE otherwise
*/
virtual bool start(const std::string filename, gem::Properties&props) = 0;
virtual bool start(const std::string&filename, gem::Properties&props) = 0;
//////////
// record a frame
......
......@@ -62,7 +62,7 @@ void recordBase :: close(void)
// open a file !
//
/////////////////////////////////////////////////////////
bool recordBase :: start(const std::string filename, gem::Properties&props)
bool recordBase :: start(const std::string&filename, gem::Properties&props)
{
if(m_pimpl->running)close();
m_pimpl->running=false;
......@@ -89,7 +89,7 @@ bool recordBase::write(imageStruct*img) {
return m_pimpl->running;
}
bool recordBase :: open(const std::string filename)
bool recordBase :: open(const std::string&filename)
{
return false;
}
......@@ -113,7 +113,7 @@ std::vector<std::string>recordBase :: getCodecs()
m_codecdescriptions.clear();
return result;
}
const std::string recordBase :: getCodecDescription(const std::string name)
const std::string recordBase :: getCodecDescription(const std::string&name)
{
std::map<std::string,std::string>::iterator it = m_codecdescriptions.find(name);
......@@ -129,7 +129,7 @@ const std::string recordBase :: getCodecDescription(const std::string name)
// set codec by name
//
/////////////////////////////////////////////////////////
bool recordBase :: setCodec(const std::string name)
bool recordBase :: setCodec(const std::string&name)
{
return false;
}
......
......@@ -48,14 +48,14 @@ namespace gem { namespace plugins {
/* open the record "filename" (think better about URIs ?)
*/
/* returns TRUE if opening was successful, FALSE otherwise */
virtual bool open(const std::string filename);
virtual bool open(const std::string&filename);
//////////
// close the movie file
/* stop recording, close the file and clean up temporary things */
virtual void close(void);
public:
virtual bool start(const std::string filename, gem::Properties&props);
virtual bool start(const std::string&filename, gem::Properties&props);
virtual void stop (void);
virtual bool write(imageStruct*);
......@@ -71,11 +71,11 @@ public:
/**
* default implementation: return empty string
*/
virtual const std::string getCodecDescription(const std::string codecname);
virtual const std::string getCodecDescription(const std::string&codecname);
/**
* default implementation: return FALSE
*/
virtual bool setCodec(const std::string name);
virtual bool setCodec(const std::string&name);
/**
* default implementation: return empty propset
*/
......
......@@ -35,7 +35,7 @@ namespace gem { namespace plugins {
std::string m_codec; // currently selected codec
struct codechandle {
codechandle(gem::plugins::video*h, const std::string c):handle(h), codec(c) {}
codechandle(gem::plugins::video*h, const std::string&c):handle(h), codec(c) {}
gem::plugins::video*handle;
std::string codec;
......@@ -43,7 +43,7 @@ namespace gem { namespace plugins {
std::map<std::string, std::vector<codechandle> >m_codechandle;
std::vector<std::string>m_codecs;
void addCodecHandle(gem::plugins::video*handle, const std::string codec) {
void addCodecHandle(gem::plugins::video*handle, const std::string&codec) {
/* FIXME: we should generate a unique codec-ID, e.g. "<handlename>:<codec>" */
m_codechandle[codec].push_back(codechandle(handle, codec));
m_codecs.push_back(codec);
......@@ -151,7 +151,7 @@ namespace gem { namespace plugins {
}
return result;
}
virtual bool setDevice(const std::string ID) {
virtual bool setDevice(const std::string&ID) {
// compat
bool result=false;
for(unsigned int i=0; i<m_allHandles.size(); i++) {
......@@ -281,7 +281,7 @@ namespace gem { namespace plugins {
}
return result;
}
virtual bool provides(const std::string ID){
virtual bool provides(const std::string&ID){
// OK
for(unsigned int i=0; i<m_allHandles.size(); i++) {
if(m_allHandles[i]->provides(ID))
......
......@@ -71,7 +71,7 @@ namespace gem { namespace plugins {
* the default implementation (which you normally shouldn't need to override)
* will simply set m_devicename and clear m_devicenum
*/
virtual bool setDevice(const std::string) = 0;
virtual bool setDevice(const std::string&) = 0;
//! open the device (calls openDevice())
......@@ -194,7 +194,7 @@ namespace gem { namespace plugins {
// for pix_video: query whether this backend provides access to this class of devices
// (e.g. "dv")
virtual bool provides(const std::string) = 0;
virtual bool provides(const std::string&) = 0;
// get a list of all provided devices
virtual std::vector<std::string>provides(void) = 0;
......
......@@ -74,7 +74,7 @@ public:
const std::string name;
PIMPL(const std::string name_, unsigned int locks_, unsigned int timeout_) :
PIMPL(const std::string&name_, unsigned int locks_, unsigned int timeout_) :
threading(locks_>0),
#ifndef HAVE_PTW32_HANDLE_T
thread(0),
......@@ -247,7 +247,7 @@ public:
// Constructor
//
/////////////////////////////////////////////////////////
videoBase :: videoBase(const std::string name, unsigned int locks) :
videoBase :: videoBase(const std::string&name, unsigned int locks) :
m_capturing(false), m_haveVideo(false),
m_width(64), m_height(64),
m_reqFormat(GL_RGBA_GEM),
......@@ -258,7 +258,7 @@ videoBase :: videoBase(const std::string name, unsigned int locks) :
provide(name);
}
}
videoBase :: videoBase(const std::string name) :
videoBase :: videoBase(const std::string&name) :
m_capturing(false), m_haveVideo(false),
m_width(64), m_height(64),
m_reqFormat(GL_RGBA_GEM),
......@@ -486,7 +486,7 @@ bool videoBase :: setDevice(int d)
m_devicenum=d;
return true;
}
bool videoBase :: setDevice(const std::string name)
bool videoBase :: setDevice(const std::string&name)
{
m_devicenum=-1;
m_devicename=name;
......@@ -502,7 +502,7 @@ const std::string videoBase :: getName() {
/////////////////////////////////////////////////////////
// query whether this backend provides a certain type of video decoding, e.g. "dv"
bool videoBase :: provides(const std::string name) {
bool videoBase :: provides(const std::string&name) {
if(!m_pimpl)return false;
unsigned int i;
for(i=0; i<m_pimpl->m_providers.size(); i++)
......@@ -523,7 +523,7 @@ std::vector<std::string>videoBase :: provides() {
/////////////////////////////////////////////////////////
// remember that this backend provides a certain type of video decoding, e.g. "dv"
void videoBase :: provide(const std::string name) {
void videoBase :: provide(const std::string&name) {
if(!m_pimpl)return;
if(!provides(name)) {
m_pimpl->m_providers.push_back(name);
......
......@@ -133,7 +133,7 @@ namespace gem { namespace plugins {
* the default implementation (which you normally shouldn't need to override)
* will simply set m_devicename and clear m_devicenum
*/
virtual bool setDevice(const std::string);
virtual bool setDevice(const std::string&);
/**
* list all properties the currently opened device supports
......@@ -200,7 +200,7 @@ namespace gem { namespace plugins {
// Constructor
// if numlocks>0 we will use a thread to capture the image create <numlocks> mutexes
//
videoBase(const std::string name);
videoBase(const std::string&name);
//////////
// Destructor
......@@ -222,7 +222,7 @@ namespace gem { namespace plugins {
* e.g. the DirectShow plugin will call: provide("analog"); provide("dv");
* everything you add here, will be automaticalyl enumerated with the provides() methods
*/
void provide(const std::string);
void provide(const std::string&);
//! grab a frame (work-horse)
/* this will be run in a separate thread (if threading is enabled)
......@@ -263,7 +263,7 @@ namespace gem { namespace plugins {
// Constructor
// if numlocks>0 we will use a thread to capture the image create <numlocks> mutexes
//
videoBase(const std::string name, unsigned int numlocks);
videoBase(const std::string&name, unsigned int numlocks);
/*
* THREADING
......@@ -295,7 +295,7 @@ namespace gem { namespace plugins {
public:
// for pix_video: query whether this backend provides access to this class of devices
// (e.g. "dv")
virtual bool provides(const std::string);
virtual bool provides(const std::string&);
// get a list of all provided devices
virtual std::vector<std::string>provides(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment