Commit 955f9260 authored by Christian Fremerey's avatar Christian Fremerey Committed by Commit Bot

[Video Capture, Linux] Make VideoCaptureDeviceFactoryLinux testable

Follow-up to https://chromium-review.googlesource.com/c/chromium/src/+/1120856

This CL is a pure refactoring and has no intended function change.

This CL is part of a series, see Design Doc at
https://docs.google.com/document/d/1ihGDZloUGdDpZ5XfmiI3AcqsSxOP9kOe5GxXOTqpHW4/edit?usp=sharing

Test: capture_unittests with physical camera attached
Bug: 768887
Change-Id: Ia9bb5c832066d43d3a2295e9a6c97a31ebc266ed
Reviewed-on: https://chromium-review.googlesource.com/1121239Reviewed-by: default avatarEmircan Uysaler <emircan@chromium.org>
Commit-Queue: Christian Fremerey <chfremer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574963}
parent 9cc13217
......@@ -21,6 +21,14 @@ namespace media {
class CAPTURE_EXPORT VideoCaptureDeviceFactoryLinux
: public VideoCaptureDeviceFactory {
public:
class CAPTURE_EXPORT DeviceProvider {
public:
virtual ~DeviceProvider() {}
virtual void GetDeviceIds(std::vector<std::string>* target_container) = 0;
virtual std::string GetDeviceModelId(const std::string& device_id) = 0;
virtual std::string GetDeviceDisplayName(const std::string& device_id) = 0;
};
explicit VideoCaptureDeviceFactoryLinux(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
~VideoCaptureDeviceFactoryLinux() override;
......@@ -34,7 +42,17 @@ class CAPTURE_EXPORT VideoCaptureDeviceFactoryLinux
VideoCaptureFormats* supported_formats) override;
private:
bool HasUsableFormats(int fd, uint32_t capabilities);
std::list<float> GetFrameRateList(int fd,
uint32_t fourcc,
uint32_t width,
uint32_t height);
void GetSupportedFormatsForV4L2BufferType(
int fd,
VideoCaptureFormats* supported_formats);
scoped_refptr<V4L2CaptureDevice> v4l2_;
std::unique_ptr<DeviceProvider> device_provider_;
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryLinux);
};
......
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