[libcamera-devel] [PATCH RESEND v2 1/4] libcamera: Add MediaObject class hierarchy
Jacopo Mondi
jacopo at jmondi.org
Fri Dec 28 15:26:48 CET 2018
Hi Laurent
On Fri, Dec 28, 2018 at 03:50:27PM +0200, Laurent Pinchart wrote:
[snip]
> > > > + */
> > > > +const MediaPad *MediaEntity::getPad(std::function<bool(MediaPad *)> f)
> > > > +{
> > > > + const MediaPad *_p = __getPad(sources_, f);
> > > > + return (_p ? _p : __getPad(sinks_, f));
> > > > +}
> >
> > Maybe just keep a getPad() that goes on the now single pad vector but
> > still using a predicate to do the matching?
>
> If the getPadById() function is reworked to use the mediaObjects_ map,
> getPadByIndex() can be merged with getPad(), and you won't need a predicate.
>
I really don't want to break the encapsulation this class hierarchy
provides. MediaDevice creates and manages a hierarchy of MediaObjects,
but MediaObjects should not go and call into the media device. If it
happens there's something fishy in the design and I would like to keep
this rule firm. Also the mediaObjects_ array contains all objects, entities,
pads and links, as "MediaObject *". I should walk all of it every time
to match ids.
I'm fine with a single mediaObject_ vector in MediaDevice as a general
pool where to retrieve stuff from by id (in the media device itself), but
for this classes I would like to keep the current structure, where
entities have pads, and pads have links. They should provide accessors
to those, but that's it, I don't want them to fish from the global
object pool.
Am I overthinking it?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20181228/1b55b02e/attachment.sig>
More information about the libcamera-devel
mailing list