webrtc/talk/media/devices/v4llookup.h
henrike@webrtc.org 28e2075280 Adds trunk/talk folder of revision 359 from libjingles google code to
trunk/talk


git-svn-id: http://webrtc.googlecode.com/svn/trunk@4318 4adac7df-926f-26a2-2b94-8c16560cd09d
2013-07-10 00:45:36 +00:00

45 lines
1.0 KiB
C++

/*
* Copyright 2009 Google Inc.
* Author: lexnikitin@google.com (Alexey Nikitin)
*
* V4LLookup provides basic functionality to work with V2L2 devices in Linux
* The functionality is implemented as a class with virtual methods for
* the purpose of unit testing.
*/
#ifndef TALK_MEDIA_DEVICES_V4LLOOKUP_H_
#define TALK_MEDIA_DEVICES_V4LLOOKUP_H_
#include <string>
#ifdef LINUX
namespace cricket {
class V4LLookup {
public:
virtual ~V4LLookup() {}
static bool IsV4L2Device(const std::string& device_path) {
return GetV4LLookup()->CheckIsV4L2Device(device_path);
}
static void SetV4LLookup(V4LLookup* v4l_lookup) {
v4l_lookup_ = v4l_lookup;
}
static V4LLookup* GetV4LLookup() {
if (!v4l_lookup_) {
v4l_lookup_ = new V4LLookup();
}
return v4l_lookup_;
}
protected:
static V4LLookup* v4l_lookup_;
// Making virtual so it is easier to mock
virtual bool CheckIsV4L2Device(const std::string& device_path);
};
} // namespace cricket
#endif // LINUX
#endif // TALK_MEDIA_DEVICES_V4LLOOKUP_H_