mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugues Fruchet <hugues.fruchet@st.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>
Cc: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Hugues Fruchet" <hugues.fruchet@st.com>
Subject: [PATCH] Support of /dev/video read with USB camera devices
Date: Mon, 4 Mar 2019 13:35:24 +0100	[thread overview]
Message-ID: <1551702925-7739-1-git-send-email-hugues.fruchet@st.com> (raw)

Currently, read() call from /dev/video entry of an USB camera is
returning invalid argument error.
This is quite common for userspace application to read compressed data such as
JPEG from /dev/video then redirect those data to a multimedia player or any
other compressed format consumer, see [1].

There was a tentative of implementation in the past [2] but it was prior to
switch on vb2 helpers usage inside uvc.
Now that vb2 is in place, we can implement read support using vb2_read()
helper.

Tested with Logitech HD Webcam C525 using v4l2-ctl to configure camera
then GStreamer player to play stream:
$> v4l2-ctl -d /dev/video0 --set-fmt-video=width=640,height=480,pixelformat=MJPG
$> gst-play-1.0 /dev/video0

[1]
  http://credentiality2.blogspot.com/2010/04/v4l2-example.html?_sm_au_=ikcQHNZZFn2Rqft5
  https://stackoverrun.com/fr/q/4215615
  https://stackoverflow.com/questions/36297390/read-function-for-webcam-device-in-v4l2-fails-with-invalid-argument
  https://stackoverflow.com/questions/31058571/reading-camera-input-from-dev-video0-in-python-or-c

[2] https://www.mail-archive.com/linux-uvc-devel@lists.berlios.de/msg01258.html

Hugues Fruchet (1):
  media: uvcvideo: Read support

 drivers/media/usb/uvc/uvc_queue.c | 15 ++++++++++++++-
 drivers/media/usb/uvc/uvc_v4l2.c  | 11 ++++++++---
 drivers/media/usb/uvc/uvcvideo.h  |  2 ++
 3 files changed, 24 insertions(+), 4 deletions(-)

-- 
2.7.4


             reply	other threads:[~2019-03-04 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 12:35 Hugues Fruchet [this message]
2019-03-04 12:35 ` [PATCH] media: uvcvideo: Read support Hugues Fruchet
2019-03-04 12:54   ` Hans Verkuil
2019-03-04 13:06   ` Hans Verkuil
2019-03-04 15:36   ` Kieran Bingham
2019-03-04 15:44     ` Laurent Pinchart
2019-03-05 10:24       ` Hugues FRUCHET
2019-03-05 12:41         ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1551702925-7739-1-git-send-email-hugues.fruchet@st.com \
    --to=hugues.fruchet@st.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®