Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1252)

Unified Diff: media/gpu/generic_v4l2_device.h

Issue 2398883002: Add support for multiple V4L2 video devices of the same type. (Closed)
Patch Set: Fixes for image processor. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/gpu/generic_v4l2_device.h
diff --git a/media/gpu/generic_v4l2_device.h b/media/gpu/generic_v4l2_device.h
index 86d2df6699b2c236b9bee54d1a61102090c0bca9..ae5be187385439c574d179eb8f20dfcc822a18e5 100644
--- a/media/gpu/generic_v4l2_device.h
+++ b/media/gpu/generic_v4l2_device.h
@@ -11,6 +11,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <map>
+
#include "base/files/scoped_file.h"
#include "base/macros.h"
#include "media/gpu/v4l2_device.h"
@@ -21,6 +23,10 @@ class GenericV4L2Device : public V4L2Device {
public:
explicit GenericV4L2Device(Type type);
+ bool Initialize() override;
kcwu 2016/10/06 10:39:59 Why put line 26 and 28 before line 30?
Pawel Osciak 2016/10/07 08:30:23 Ah right, good point.
+
+ bool Open(uint32_t v4l2_pixfmt) override;
+
// V4L2Device implementation.
int Ioctl(int request, void* arg) override;
bool Poll(bool poll_device, bool* event_pending) override;
@@ -32,7 +38,6 @@ class GenericV4L2Device : public V4L2Device {
int flags,
unsigned int offset) override;
void Munmap(void* addr, unsigned int len) override;
- bool Initialize() override;
std::vector<base::ScopedFD> GetDmabufsForV4L2Buffer(
int index,
@@ -54,9 +59,48 @@ class GenericV4L2Device : public V4L2Device {
GLenum GetTextureTarget() override;
uint32_t PreferredInputFormat() override;
+ std::vector<uint32_t> GetSupportedImageProcessorPixelformats(
+ v4l2_buf_type buf_type) override;
+
+ VideoDecodeAccelerator::SupportedProfiles GetSupportedDecodeProfiles(
+ const size_t num_formats,
+ const uint32_t pixelformats[]) override;
+
+ VideoEncodeAccelerator::SupportedProfiles GetSupportedEncodeProfiles()
+ override;
+
+ bool IsJpegDecodingSupported() override;
+
private:
+ // Vector of video device node paths and corresponding pixelformats supported
+ // by each device node.
+ using Devices = std::vector<std::pair<std::string, std::vector<uint32_t>>>;
+
~GenericV4L2Device() override;
+ // Open device node for |path|.
+ bool OpenDevicePath(const std::string& path);
+
+ // Close the currently open device.
+ void CloseDevice();
+
+ // Enumerate all V4L2 devices on the system for |type| and store the results
+ // under devices_by_type_[type].
+ void EnumerateDevicesForType(V4L2Device::Type type);
+
+ // Return device information for all devices of |type| available in the
+ // system. Enumerates and queries devices on first run and caches the results
+ // for subsequent calls.
+ const Devices& GetDevicesForType(V4L2Device::Type type);
+
+ // Return device node path for device of |type| supporting |pixfmt|, or
+ // an empty string if the given combination is not supported by the system.
+ std::string GetDevicePathFor(V4L2Device::Type type, uint32_t pixfmt);
+
+ // Stores information for all devices available on the system
+ // for each device Type.
+ std::map<V4L2Device::Type, Devices> devices_by_type_;
+
// The actual device fd.
base::ScopedFD device_fd_;

Powered by Google App Engine
This is Rietveld 408576698