blob: dfaaf418d40dd69921759c69158b94ef3453c8ae [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_IMPL_H_
#define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_IMPL_H_
#include "media/capture/video/video_capture_system.h"
namespace media {
// Layer on top of VideoCaptureDeviceFactory that translates device descriptors
// to string identifiers and consolidates and caches device descriptors and
// supported formats into VideoCaptureDeviceInfos.
class CAPTURE_EXPORT VideoCaptureSystemImpl : public VideoCaptureSystem {
public:
explicit VideoCaptureSystemImpl(
std::unique_ptr<VideoCaptureDeviceFactory> factory);
~VideoCaptureSystemImpl() override;
void GetDeviceInfosAsync(DeviceInfoCallback result_callback) override;
std::unique_ptr<VideoCaptureDevice> CreateDevice(
const std::string& device_id) override;
private:
// Returns nullptr if no descriptor found.
const VideoCaptureDeviceInfo* LookupDeviceInfoFromId(
const std::string& device_id);
const std::unique_ptr<VideoCaptureDeviceFactory> factory_;
std::vector<VideoCaptureDeviceInfo> devices_info_cache_;
base::ThreadChecker thread_checker_;
};
} // namespace media
#endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_SYSTEM_IMPL_H_