Refactor source IsConnected() and connected notification.

This commit is contained in:
Peter Johnson
2016-12-04 09:50:01 -08:00
parent 81fd0eefac
commit 7c2f994a66
6 changed files with 16 additions and 20 deletions

View File

@@ -37,8 +37,6 @@ void CvSourceImpl::Start() {
CreateProperty("jpeg_quality", CS_PROP_INTEGER, 0, 100, 1, 80, 80);
}
bool CvSourceImpl::IsConnected() const { return m_connected; }
bool CvSourceImpl::CacheProperties(CS_Status* status) const {
// Doesn't need to do anything.
m_properties_cached = true;
@@ -112,14 +110,6 @@ void CvSourceImpl::NotifyError(llvm::StringRef msg) {
PutError(msg, wpi::Now());
}
void CvSourceImpl::SetConnected(bool connected) {
bool was_connected = m_connected.exchange(connected);
if (was_connected && !connected)
Notifier::GetInstance().NotifySource(*this, CS_SOURCE_DISCONNECTED);
else if (!was_connected && connected)
Notifier::GetInstance().NotifySource(*this, CS_SOURCE_CONNECTED);
}
int CvSourceImpl::CreateProperty(llvm::StringRef name, CS_PropertyKind kind,
int minimum, int maximum, int step,
int defaultValue, int value) {