[libcamera-devel,v2,00/27] GStreamer Element for libcamera
mbox series

Message ID 20200227200407.490616-1-nicolas.dufresne@collabora.com
Headers show
Series
  • GStreamer Element for libcamera
Related show

Message

Nicolas Dufresne Feb. 27, 2020, 8:03 p.m. UTC
This patchset introduces two GStreamer features for libcamera. A
GstDeviceProvider that allow enumerating the cameras and a libcamerasrc element
the allow streaming from a selected camera.

This is an early implementation that is not feature complete. It is designed to
support multiple streams even though it currently only allow one srcpad. The goal
of this submission is to get an inital element merged so that further
improvement can happen incrementally.

To test these features, you'll need GStreamer 1.16 (downgrade might be
possible). To get the list of cameras you can run the following. Regression
exist in the monitor of GStreamer 1.16.2 that may cause a crash, and also in
master that may show nothing. This will be addressed in later release of
GStreamer.

  gst-device-monitor-1.0 Video/Source

To stream from a cameram, you can use the following pipeline:

  gst-launch-1.0 libcamerasrc ! videoconvert ! autovideosink

Changes since v1:
  - Fixed review comments
  - Use a C++ class for glib mutex scoped locker
  - Fixed a potential deadlock on exhausted buffer pool
  - Minimum GStreamer requirement now set to 1.14

Jakub Adam (2):
  gst: utils: Factor-out the task resume helper
  gst: libcamerasrc: Prevent src task deadlock on exhausted buffer pool

Nicolas Dufresne (25):
  Add GStreamer plugin and element skeleton
  gst: Add utility to convert StreamFormats to GstCaps
  gst: Add initial device provider
  gst: utils: Add simple scoped lockers for GMutex and GRectMutex
  gst: Add pads to the source
  gst: libcamerasrc: Allocate and add static pad
  gst: libcamerasrc: Add camera-name property
  gst: libcamerasrc: Add a debug category
  gst: libcamerasrc: Implement selection and acquisition
  gst: libcamerasrc: Add a task for the streaming thread
  gst: libcamerapad: Add a method to access the role
  gst: libcamerasrc: Store the srcpad in a vector
  gst: libcamerasrc: Send stream start event
  gst: utils: Add StreamConfiguration helpers
  gst: libcamerasrc: Implement minimal caps negotiation
  gst: libcamerasrc: Push segment event
  gst: Add a pool and an allocator implementation
  gst: libcamerapad: Allow storing a pool
  gst: libcamerasrc: Allocate and release buffers
  gst: Add getters for Stream and FrameBuffer
  gst: pad: Add method to store retrieve pending buffers
  gst: libcamerasrc: Implement initial streaming
  gst: libcamerasrc: Implement timestamp support
  gst: libcamerasrc: Add a TODO comment
  gst: Reduce GStreamer requirement to 1.14

 meson_options.txt                       |   5 +
 src/gstreamer/gstlibcamera-utils.cpp    | 173 +++++++
 src/gstreamer/gstlibcamera-utils.h      |  73 +++
 src/gstreamer/gstlibcamera.c            |  27 +
 src/gstreamer/gstlibcameraallocator.cpp | 252 +++++++++
 src/gstreamer/gstlibcameraallocator.h   |  31 ++
 src/gstreamer/gstlibcamerapad.cpp       | 197 +++++++
 src/gstreamer/gstlibcamerapad.h         |  37 ++
 src/gstreamer/gstlibcamerapool.cpp      | 145 ++++++
 src/gstreamer/gstlibcamerapool.h        |  39 ++
 src/gstreamer/gstlibcameraprovider.cpp  | 235 +++++++++
 src/gstreamer/gstlibcameraprovider.h    |  23 +
 src/gstreamer/gstlibcamerasrc.cpp       | 654 ++++++++++++++++++++++++
 src/gstreamer/gstlibcamerasrc.h         |  22 +
 src/gstreamer/meson.build               |  30 ++
 src/meson.build                         |   2 +
 16 files changed, 1945 insertions(+)
 create mode 100644 src/gstreamer/gstlibcamera-utils.cpp
 create mode 100644 src/gstreamer/gstlibcamera-utils.h
 create mode 100644 src/gstreamer/gstlibcamera.c
 create mode 100644 src/gstreamer/gstlibcameraallocator.cpp
 create mode 100644 src/gstreamer/gstlibcameraallocator.h
 create mode 100644 src/gstreamer/gstlibcamerapad.cpp
 create mode 100644 src/gstreamer/gstlibcamerapad.h
 create mode 100644 src/gstreamer/gstlibcamerapool.cpp
 create mode 100644 src/gstreamer/gstlibcamerapool.h
 create mode 100644 src/gstreamer/gstlibcameraprovider.cpp
 create mode 100644 src/gstreamer/gstlibcameraprovider.h
 create mode 100644 src/gstreamer/gstlibcamerasrc.cpp
 create mode 100644 src/gstreamer/gstlibcamerasrc.h
 create mode 100644 src/gstreamer/meson.build

Comments

Laurent Pinchart Feb. 29, 2020, 3:16 p.m. UTC | #1
Hi Nicolas,

On Thu, Feb 27, 2020 at 03:03:40PM -0500, Nicolas Dufresne wrote:
> This patchset introduces two GStreamer features for libcamera. A
> GstDeviceProvider that allow enumerating the cameras and a libcamerasrc element
> the allow streaming from a selected camera.

Great work ! Thanks a lot again, it's very nice to see the gstreamer
element nearing completion.

> This is an early implementation that is not feature complete. It is designed to
> support multiple streams even though it currently only allow one srcpad. The goal
> of this submission is to get an inital element merged so that further
> improvement can happen incrementally.
> 
> To test these features, you'll need GStreamer 1.16 (downgrade might be

Is this still true ?

> possible). To get the list of cameras you can run the following. Regression
> exist in the monitor of GStreamer 1.16.2 that may cause a crash, and also in
> master that may show nothing. This will be addressed in later release of
> GStreamer.
> 
>   gst-device-monitor-1.0 Video/Source
> 
> To stream from a cameram, you can use the following pipeline:
> 
>   gst-launch-1.0 libcamerasrc ! videoconvert ! autovideosink

Would you be able to add this to a README.md in the gstreamer directory
? Maybe with just a bit of additional information to tell how to select
a camera ? And with any additional design documentation that you think
would be useful for the future (for instance briefly explaining the
rationale behind some of the design decisions) to help other developers
?

> Changes since v1:
>   - Fixed review comments
>   - Use a C++ class for glib mutex scoped locker
>   - Fixed a potential deadlock on exhausted buffer pool
>   - Minimum GStreamer requirement now set to 1.14
> 
> Jakub Adam (2):
>   gst: utils: Factor-out the task resume helper
>   gst: libcamerasrc: Prevent src task deadlock on exhausted buffer pool
> 
> Nicolas Dufresne (25):
>   Add GStreamer plugin and element skeleton
>   gst: Add utility to convert StreamFormats to GstCaps
>   gst: Add initial device provider
>   gst: utils: Add simple scoped lockers for GMutex and GRectMutex
>   gst: Add pads to the source
>   gst: libcamerasrc: Allocate and add static pad
>   gst: libcamerasrc: Add camera-name property
>   gst: libcamerasrc: Add a debug category
>   gst: libcamerasrc: Implement selection and acquisition
>   gst: libcamerasrc: Add a task for the streaming thread
>   gst: libcamerapad: Add a method to access the role
>   gst: libcamerasrc: Store the srcpad in a vector
>   gst: libcamerasrc: Send stream start event
>   gst: utils: Add StreamConfiguration helpers
>   gst: libcamerasrc: Implement minimal caps negotiation
>   gst: libcamerasrc: Push segment event
>   gst: Add a pool and an allocator implementation
>   gst: libcamerapad: Allow storing a pool
>   gst: libcamerasrc: Allocate and release buffers
>   gst: Add getters for Stream and FrameBuffer
>   gst: pad: Add method to store retrieve pending buffers
>   gst: libcamerasrc: Implement initial streaming
>   gst: libcamerasrc: Implement timestamp support
>   gst: libcamerasrc: Add a TODO comment
>   gst: Reduce GStreamer requirement to 1.14
> 
>  meson_options.txt                       |   5 +
>  src/gstreamer/gstlibcamera-utils.cpp    | 173 +++++++
>  src/gstreamer/gstlibcamera-utils.h      |  73 +++
>  src/gstreamer/gstlibcamera.c            |  27 +
>  src/gstreamer/gstlibcameraallocator.cpp | 252 +++++++++
>  src/gstreamer/gstlibcameraallocator.h   |  31 ++
>  src/gstreamer/gstlibcamerapad.cpp       | 197 +++++++
>  src/gstreamer/gstlibcamerapad.h         |  37 ++
>  src/gstreamer/gstlibcamerapool.cpp      | 145 ++++++
>  src/gstreamer/gstlibcamerapool.h        |  39 ++
>  src/gstreamer/gstlibcameraprovider.cpp  | 235 +++++++++
>  src/gstreamer/gstlibcameraprovider.h    |  23 +
>  src/gstreamer/gstlibcamerasrc.cpp       | 654 ++++++++++++++++++++++++
>  src/gstreamer/gstlibcamerasrc.h         |  22 +
>  src/gstreamer/meson.build               |  30 ++
>  src/meson.build                         |   2 +
>  16 files changed, 1945 insertions(+)
>  create mode 100644 src/gstreamer/gstlibcamera-utils.cpp
>  create mode 100644 src/gstreamer/gstlibcamera-utils.h
>  create mode 100644 src/gstreamer/gstlibcamera.c
>  create mode 100644 src/gstreamer/gstlibcameraallocator.cpp
>  create mode 100644 src/gstreamer/gstlibcameraallocator.h
>  create mode 100644 src/gstreamer/gstlibcamerapad.cpp
>  create mode 100644 src/gstreamer/gstlibcamerapad.h
>  create mode 100644 src/gstreamer/gstlibcamerapool.cpp
>  create mode 100644 src/gstreamer/gstlibcamerapool.h
>  create mode 100644 src/gstreamer/gstlibcameraprovider.cpp
>  create mode 100644 src/gstreamer/gstlibcameraprovider.h
>  create mode 100644 src/gstreamer/gstlibcamerasrc.cpp
>  create mode 100644 src/gstreamer/gstlibcamerasrc.h
>  create mode 100644 src/gstreamer/meson.build