| Related |
show
-
[libcamera-devel,RESEND,v2,0/4] Add MediaDevice and associated MediaObject
-
[libcamera-devel,RESEND,v2,1/4] libcamera: Add MediaObject class hierarchy
-
[libcamera-devel,RESEND,v2,2/4] libcamera: Add MediaDevice class
-
[libcamera-devel,RESEND,v2,3/4] libcamera: media device: Add MediaDeviceDesc
-
[libcamera-devel,RESEND,v2,4/4] libcamera: media device: Add 'match()' method
|
Hello, this is v2 of MediaDevice and friends. v1 available for reference here: https://lists.libcamera.org/pipermail/libcamera-devel/2018-December/000120.html While reviewing Kieran's and Niklas' patches I noticed some comments I made on their series actually applied on my v1, so here it is the outcome of a small private self-review. I'm sure I have missed something anyhow... It's mostly about using 'const' a lot more for values returned by reference by getter functions, a more extensive use of 'auto' keyboard to shorten iterators declarations and a few cosmetic changes. Both branches (v1 and v2) are available for comparison (jmondi/master/media_device_v1 and jmondi/master/media_device_v2) and a diff is collected here: https://paste.debian.net/1057251/ On top of the first two patches that were included in v1, I have added what I proposed in the review of Niklas' series: a MediaDeviceDesc object and a match function to be added to the MediaDevice. Niklas, what do you think about this? Does this help clarifying the proposal I made in the review comments? (those patches are now broken out to eases discussion and review, but will be ideally squashed on the [02/04] later). I have some private tests for IPU3, and the matching code looks like the following: MediaDeviceDesc cio2_desc("ipu3-cio2"); cio2_desc.addEntity("ipu3-csi2 0"); cio2_desc.addEntity("ipu3-cio2 0"); cio2_desc.addEntity("ipu3-csi2 1"); cio2_desc.addEntity("ipu3-cio2 1"); cio2_desc.addEntity("ipu3-csi2 2"); cio2_desc.addEntity("ipu3-cio2 2"); cio2_desc.addEntity("ipu3-csi2 3"); cio2_desc.addEntity("ipu3-cio2 3"); cio2_desc.addEntity("ov13858 2-0010"); cio2_desc.addEntity("ov5670 4-0036"); bool match = cio2.match(cio2_desc); if (match) { LOG(Info) << "CIO2 matched"; } else { LOG(Error) << "Cannot match CIO2 with the provided desc"; return -1; } If we adopt something like this, in place of cio2.match() we would have a MediaEnumerator, as proposed by Niklas, but the idea stays the same: is the MediaDevice that matches the MediaDeviceDesc, and the MediaEnumerator receives a MediaDeviceDesc and tries it on all its open MediaDevices. Thanks j v1 -> v2: - diff collected here: https://paste.debian.net/1057251/ - patches 3 and 4 are new, broken out for review, to be squashed later. Jacopo Mondi (4): libcamera: Add MediaObject class hierarchy libcamera: Add MediaDevice class libcamera: media device: Add MediaDeviceDesc libcamera: media device: Add 'match()' method src/libcamera/include/media_device.h | 115 +++++ src/libcamera/include/media_object.h | 117 +++++ src/libcamera/media_device.cpp | 615 +++++++++++++++++++++++++++ src/libcamera/media_object.cpp | 302 +++++++++++++ src/libcamera/meson.build | 2 + 5 files changed, 1151 insertions(+) create mode 100644 src/libcamera/include/media_device.h create mode 100644 src/libcamera/include/media_object.h create mode 100644 src/libcamera/media_device.cpp create mode 100644 src/libcamera/media_object.cpp -- 2.20.1