Commit graph

1736 commits

Author SHA1 Message Date
Laurent Pinchart
556e03fea7 test: libtest: buffer_source: Close video device right after allocation
There's no need to keep the video device open after allocating buffers,
as V4L2 supports buffer orphaning and the exported buffers will still be
usable. Close the device right after allocation to avoid the need for
delayed cleanups.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18 19:15:18 +02:00
Niklas Söderlund
aaf1ce50f9 libcamera: PixelFormat: Mark all function arguments of type PixelFormat as const reference
PixelFormat was previously an alias for unsigned int but is now a
class. Make all functions taking PixelFormat do so as a const reference.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Laurent Pinchart
718f5e99a9 libcamera: PixelFormat: Make constructor explicit
To achieve the goal of preventing unwanted conversion between a DRM and
a V4L2 FourCC, make the PixelFormat constructor that takes an integer
value explicit. All users of pixel formats flagged by the compiler
are fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
8c0bbcd3d3 libcamera: PixelFormat: Turn into a class
Create a class to represent a pixel format. This is done to add support
for modifiers for the formats. So far no modifiers are added by any
pipeline handler, all plumbing to deal with them is however in place.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
4bc262ecaa libcamera: pipeline: uvcvideo: Translate from V4L2 to DRM pixel formats
When generating a camera configuration, pixel formats from the video
device are used directly. They however contain V4L2 pixel format
FourCCs, not DRM pixel format FourCCs. Translate the pixel formats to
DRM before using them in the camera configuration.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
4f3096f352 libcamera: pipeline: vimc: Remove internal usage of ImageFormats
There is no need to use the ImageFormats helper to generate a map of
PixelFormat to sizes, use std::map directly.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
63050a8b57 test: v4l2_videodevice: buffer_cache: Use DRM pixel format
The pixel format used in the stream configuration is from V4L2 but
should be from DRM, fix it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
eb20c54f24 libcamera: pixelformats: include linux/drm_fourcc.h
Instead of having to include linux/drm_fourcc.h everywhere a DRM FourCC
is used in conjunction with PixelFormat include the header directly in
pixelformats.h.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Niklas Söderlund
f28ca20960 libcamera: Use PixelFormat instead of unsigned int where appropriate
Use the PixelFormat instead of unsigned int where a pixel format is to
be used. PixelFormat is defined as an unsigned int but is about to be
turned into a class to add functionality.

There is no functional change in this patch.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 18:02:40 +01:00
Kaaira Gupta
9a1e71b8a1 tests: remove IPA_PROXY_PATH environment variable
The tests declare a hard-coded LIBCAMERA_IPA_PROXY_PATH to allow tests
to run from tests-suite.

Now that the proxy path is determined at runtime, we can remove the
redundant setting of LIBCAMERA_IPA_PROXY_PATH for tests.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-18 16:17:56 +00:00
Kaaira Gupta
250df52bd9 libcamera: ipa_proxy: search for proxy in build tree
When libcamera is built and tested before installing, it will
be unable to locate the path to proxy workers, or previously
installed files in the system path may be incorrect to load.

Hence, when libcamera is not installed, but is running from a build
tree, identify the location of that tree by using libcameraPath(), and
from that point add relative path to the proxy workers directory.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-18 16:17:51 +00:00
Kaaira Gupta
df493769a0 libcamera: utils: Move libcamera build path lookup to utils
The IPA proxy manager will need to find the libcamera build path exactly
the same way as the IPA module mnager. Move the isLibcameraInstalled()
and libcameraPath() functions to utils to make them reusable.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-18 20:54:25 +05:30
Kaaira Gupta
1eaf7407c2 libcamera: ipa_proxy: rearrange proxies precedence
User environment path in LIBCAMERA_IPA_PROXY_PATH should take precedence
over system loading locations. Change precedence accordingly

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-18 20:54:24 +05:30
Kaaira Gupta
6afe116dcc libcamera: ipa_proxy: use utils::split()
Replace the manual string splitting with utils::split()

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-18 20:54:23 +05:30
Niklas Söderlund
00eb88f893 cam: Create stream names after configuring the camera
The stream in the stream configuration is not filled in before we
configure the camera, move the generating and caching of names after the
configuration.

Without this fix writing multiple streams to disk overwrites the frames
as the filenames are not unique.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-18 04:19:02 +01:00
Kieran Bingham
d15f979ead utils: checkstyle: Add a ShellChecker
Hook the utility 'shellcheck' into our checkstyle helper to
automatically verify shell script additions.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-16 15:21:51 +00:00
Kieran Bingham
32ccaf458f qcam: format_convertor: Extend 32 bit ARGB format combinations
Add further support to the pixel format convertor to allow ARGB, RGBA,
and ABGR formats to be displayed in qcam.

Blank lines are added between the sections for NV, RGB, YUV, and MJPEG
configurations.

The implementation of the RGB conversions are highly inefficient, and
where possible should be extended to use hardware accelerations such as
OpenGL, or in the event that the input format is identical (or
compatible) with the output format - a more optimised memcpy should be
implemented.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-16 15:21:15 +00:00
Laurent Pinchart
4de31ccc9e libcamera: controls: Fix strict aliasing violation
gcc 8.3.0 for ARM complains about strict aliasing violations:

../../src/libcamera/controls.cpp: In member function ‘void libcamera::ControlValue::release()’:
../../src/libcamera/controls.cpp:111:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   delete[] *reinterpret_cast<char **>(&storage_);

Fix it and simplify the code at the same time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-08 19:35:24 +02:00
Laurent Pinchart
291d4878bb test: file-descriptor: Fix undefined O_TMPFILE compilation error
O_TMPFILE is not defined by all libc implementations. libcamera has an
internal definition in utils.h to work around this. Include utils.h in
the test to fix the compilation error.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:35:23 +02:00
Laurent Pinchart
1268751ce6 v4l2: v4l2_camera_proxy: Fix sign compare compilation error
When compiling for ARM and uClibc, gcc-8.3.0 complains about comparison
of integer expressions of different signedness:

../../src/v4l2/v4l2_camera_proxy.cpp: In member function ‘void* V4L2CameraProxy::mmap(void*, size_t, int, int, off_t)’:
../../src/v4l2/v4l2_camera_proxy.cpp:88:25: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘off_t’ {aka ‘long int’} [-Werror=sign-compare]
  if (index * sizeimage_ != offset || length != sizeimage_) {
      ~~~~~~~~~~~~~~~~~~~^~~~~~~~~

Fix the compilation error with a cast.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:35:21 +02:00
Laurent Pinchart
20fb72a56e v4l2: v4l2_compat: Use correct libcamera_dep dependency
The v4l2-compat shared library is declared as depending on
libcamera_deps. This is not correct, as libcamera_deps contains the
dependencies of libcamera itself. The correct dependency for users of
libcamera is libcamera_dep.

Fixing this allows dropping libcamera_includes from the list of includes
required by v4l2-compat, and libcamera from the link_with list, as they
are already contained in libcamera_dep. We however need to add an
explicit dependency on libdl which was previously provided by
libcamera_deps.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:34:05 +02:00
Laurent Pinchart
f416271212 cam: Link against libatomic if needed
The cam application makes use if std::atomic<>, link against libatomic
if needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:34:03 +02:00
Laurent Pinchart
61aa357a95 libcamera: meson: Make libatomic and libdl dependencies reusable
libcamera.so links against libatomic and libdl, and handles those
dependencies directly in the shared_object() call. More components
within libcamera will need those dependencies, extract them to named
variables to make them reusable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:34:03 +02:00
Laurent Pinchart
434bbe75dc include: libcamera: meson: Add libcamera.h to the libcamera_api array
The libcamera_api array is meant to contain all the headers from the
libcamera public API, for the purpose of generating documentation and
creating the libcamera_dep dependency. libcamera.h is part of the
libcamera public API, add it to the array.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:34:02 +02:00
Kieran Bingham
4ed6876643 include: libcamera: meson: Add control headers to the libcamera_api array
The libcamera_api array is meant to contain all the headers from the
libcamera public API, for the purpose of generating documentation and
creating the libcamera_dep dependency. The generated control headers are
part of the libcamera public API, and used to be included in the
libcamera_api array until commit f870591a9b ("libcamera: properties:
Add location property") inadvertently removed them. Add them back.

Fixes: f870591a9b ("libcamera: properties: Add location property")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Split the change out and reworded the commit message]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:34:01 +02:00
Laurent Pinchart
00804512c6 include: libcamera: Improve automation of libcamera.h generation
The gen-header.sh script that generates libcamera.h takes all .h files
in the include/libcamera/ directory, and manually adds the generated
control_ids.h and version.h. This is fragile, as shown by the failure to
add property_ids.h to the list in commit f870591a9b ("libcamera:
properties: Add location property").

To avoid future omissions, take all the .h.in files into account to
generate libcamera.h. This also fixes the missing property_ids.h.

Fixes: f870591a9b ("libcamera: properties: Add location property")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08 19:33:59 +02:00
Laurent Pinchart
34396936f7 gst: Fix GLib detection
Commit 17cccc68a8 ("Add GStreamer plugin and element skeleton") has
gained a last minute fix for a clang compilation error with GLib prior
to v2.63.0. The fix wasn't properly tested, and failed to check the GLib
dependency correctly. This resulted in compilation of the GStreamer
element to always be disabled.

Fix this by changing the GLib package name from 'glib' to 'glib-2.0'.

Fixes: 17cccc68a8 ("Add GStreamer plugin and element skeleton")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2020-03-07 21:54:06 +02:00
Laurent Pinchart
f36ecf9824 gst: Turn the top-level plugin file gstlibcamera.c into a C++ file
The top-level plugin file gstlibcamera.c is the only C source file in
the whole libcamera GStreamer element. To avoid specifying both C and
C++ compiler arguments in the future, turn it into a C++ file.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2020-03-07 21:53:59 +02:00
Nicolas Dufresne
6f344f8942 gst: Document dependencies and quick usage
This is a quick startup guide allowing to build and use the GStreamer element
from the libcamera source tree.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Jakub Adam
170def84c6 gst: libcamerasrc: Prevent src task deadlock on exhausted buffer pool
Allow GstLibcameraPool to notify the source when a new buffer has become
available in a previously exhausted buffer pool. This can be used to
resume a src task that got paused because it couldn't acquire a buffer.

Without this change the src task will never resume from pause once the
pool gets exhausted.

To trigger the deadlock (it doesn't happen every time), run:

  gst-launch-1.0 libcamerasrc ! queue ! glimagesink

Signed-off-by: Jakub Adam <jakub.adam@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Jakub Adam
9dab15bed6 gst: utils: Factor-out the task resume helper
Task resume will be added in the core GStreamer API in the future and
we will need to call this in another location in the following patches.

Signed-off-by: Jakub Adam <jakub.adam@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
a9ce14b0e0 gst: libcamerasrc: Add a TODO comment
This is to guide upcoming contributors toward what is left to do to get
toward a production ready element.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
0c4147c3b6 gst: libcamerasrc: Implement timestamp support
This is an experimental patch adding timestamp support to the libcamerasrc
element. This patch currently assume that the driver timestamp are relative to
the system monotonic clock. Without a reference clock source, the timestamp are
otherwise unusable, and without timestamp only minor use case can be achieved.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
d1d1348228 gst: libcamerasrc: Implement initial streaming
With this patch, the element is now able to push buffers to the next
element in the graph. The buffers are currently missing any metadata
like timestamp, sequence number. This will be added in the next commit.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
5d6db0936f gst: pad: Add method to store retrieve pending buffers
These will be useful for streaming. The requestComplete callback will
store the buffers on each pads so that the _run() can pick them up
and push them through the pads from a streaming thread.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
db50b1072a gst: Add getters for Stream and FrameBuffer
This adds getters on pad/pool/allocator so that we can retrieve the
Stream or FrameBuffer.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
6d0cf98bb1 gst: libcamerasrc: Allocate and release buffers
Setup the allocation and the release of buffers in the
element. We have one pooling GstAllocator that wraps the
FrameBufferAllocator and tracks the lifetime of FrameBuffer
objects. Then, for each pad we have a GstBufferPool object
which is only used to avoid re-allocating the GstBuffer
structure every time we push a buffer.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
a801f5e4f6 gst: libcamerapad: Allow storing a pool
This adds get/set helper to store a pool on the pad.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:08 +02:00
Nicolas Dufresne
bde275408c gst: Add a pool and an allocator implementation
This is needed to track the lifetime of the FrameBufferAllocator in relation to
the GstBuffer/GstMemory objects travelling inside GStreamer.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:58:07 +02:00
Nicolas Dufresne
d343326d28 gst: libcamerasrc: Push segment event
Now that we have stream-start and caps, we can now push a segment event to
announce what time will our buffer correlate to. For live sources this is just
an open segment in time format.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
2575b49160 gst: libcamerasrc: Implement minimal caps negotiation
This is not expected to work in every possible cases, but should be sufficient as
an initial implementation. What it does is that it turns the StreamFormats into
caps and queries downstream caps with that as a filter.

The result is the subset of caps that can be used. We then keep the first
structure in that result and fixate using the default values found in
StreamConfiguration as a default in case a range is available.

We then validate this configuration and turn the potentially modified
configuration into caps that we push downstream. Note that we trust the order
in StreamFormats as being sorted best first, but this is not currently in
libcamera. A todo has been added in the head of this file as a reminder to fix
that in the core.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
bd0c2df110 gst: utils: Add StreamConfiguration helpers
This adds helpers to deal with the conversion from StreamConfiguration
to caps and vice-versa. This is needed to implement caps negotiation.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
e5f4398c19 gst: libcamerasrc: Send stream start event
Prior to sending caps, we need to send a stream-start event. This requires
generating a stream and a group id. The stream id is random for live sources and
the group id is shared across all pads.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
6d69661c24 gst: libcamerasrc: Store the srcpad in a vector
This will allow implementing generic algorithm even if we cannot
request pads yet.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
d41b356564 gst: libcamerapad: Add a method to access the role
Each pad can have a different roles. Users will have to request and configure
their pads role before moving to a higher state.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
1d8cbaf214 gst: libcamerasrc: Add a task for the streaming thread
Use a GstTask as our internal streaming thread. Unlike GstBaseSrc, we
will be running a streaming thread at the element level rather than
per pad. This is needed to combine buffer request for multiple pads.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
58feb69f85 gst: libcamerasrc: Implement selection and acquisition
This adds code to select and acquire a camera. With this, it is now
possible to run a pipeline like:

   gst-launch-1.0 libcamerasrc ! fakesink

Though no buffer will be streamed yet. In this function, we implement the
change_state() virtual method to trigger actions on specific state transitions.
Note that we also return GST_STATE_CHANGE_NO_PREROLL in
GST_STATE_CHANGE_READY_TO_PAUSED and GST_STATE_CHANGE_PLAYING_TO_PAUSED
transitions as this is required for all live sources.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
cfa61225a4 gst: libcamerasrc: Add a debug category
This will allow selecting libcamerasrc traces with the following
environment:

  GST_DEBUG=libcamerasrc:7

Or all libcamera GStreamer element traces using

  GST_DEBUG="libcamera*:7"

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
2c93810ec1 gst: libcamerasrc: Add camera-name property
This property will be used to select by name the camera to use.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00
Nicolas Dufresne
26c923a27c gst: libcamerasrc: Allocate and add static pad
This pad will always be present and will allow simple pipeline to be used to
stream from the camera.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-07 01:57:45 +02:00