{"id":535,"url":"https://patchwork.libcamera.org/api/1.1/patches/535/?format=json","web_url":"https://patchwork.libcamera.org/patch/535/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190206060818.13907-21-laurent.pinchart@ideasonboard.com>","date":"2019-02-06T06:08:11","name":"[libcamera-devel,20/27] libcamera: pipeline: uvcvideo: Implement capture support","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f2cae3002f65b80ce804ee6a03072fbbb7d1bc72","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/535/mbox/","series":[{"id":170,"url":"https://patchwork.libcamera.org/api/1.1/series/170/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=170","date":"2019-02-06T06:07:51","name":"Capture frames throught requests","version":1,"mbox":"https://patchwork.libcamera.org/series/170/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/535/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/535/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E12B61048\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:28 +0100 (CET)","from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0B43F2D9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Feb 2019 07:08:27 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433308;\n\tbh=RKXY6CJrIGea4sPWYGzQGXfcjVU1phDzf+yLipwbUn4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=HWX91i+mybB7eTstLxl6F9ejWKZ2uWVNXFfTe9I8XN0m4ICsB7Rh0yji0gXrPpjDz\n\t9ezBIjxhAgMkgKDi8Uf6v3TraA7/g91P7Byt7h/VzofxnZ2hlE2OE+MmedsuIgVsY4\n\tMKo/A4nASObhqaxHQb245XcuftNIT2z7TmKQnhDc=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Feb 2019 08:08:11 +0200","Message-Id":"<20190206060818.13907-21-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.19.2","In-Reply-To":"<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>","References":"<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 20/27] libcamera: pipeline: uvcvideo:\n\tImplement capture support","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 06 Feb 2019 06:08:30 -0000"},"content":"From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReplace the buffer allocation, capture start/stop and request queue\nstubs with real implementations.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 35 ++++++++++++++++++++++-------\n 1 file changed, 27 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 74bdf5c5aea5..fc31c52c0ecd 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -6,6 +6,7 @@\n  */\n \n #include <libcamera/camera.h>\n+#include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n@@ -84,35 +85,53 @@ int PipelineHandlerUVC::configureStreams(Camera *camera,\n {\n \tStreamConfiguration *cfg = &config[&stream_];\n \n-\tLOG(UVC, Info) << \"TODO: Configure the camera for resolution \"\n-\t\t       << cfg->width << \"x\" << cfg->height;\n+\tLOG(UVC, Debug) << \"Configure the camera for resolution \"\n+\t\t\t<< cfg->width << \"x\" << cfg->height;\n \n-\treturn 0;\n+\tV4L2DeviceFormat format = {};\n+\tformat.width = cfg->width;\n+\tformat.height = cfg->height;\n+\tformat.fourcc = cfg->pixelFormat;\n+\n+\treturn video_->setFormat(&format);\n }\n \n int PipelineHandlerUVC::allocateBuffers(Camera *camera, Stream *stream)\n {\n-\treturn -ENOTRECOVERABLE;\n+\tconst StreamConfiguration &cfg = stream->configuration();\n+\n+\tLOG(UVC, Debug) << \"Requesting \" << cfg.bufferCount << \" buffers\";\n+\n+\treturn video_->exportBuffers(cfg.bufferCount, &stream->bufferPool());\n }\n \n int PipelineHandlerUVC::freeBuffers(Camera *camera, Stream *stream)\n {\n-\treturn 0;\n+\treturn video_->releaseBuffers();\n }\n \n int PipelineHandlerUVC::start(const Camera *camera)\n {\n-\tLOG(UVC, Error) << \"TODO: start camera\";\n-\treturn 0;\n+\treturn video_->streamOn();\n }\n \n void PipelineHandlerUVC::stop(const Camera *camera)\n {\n-\tLOG(UVC, Error) << \"TODO: stop camera\";\n+\tvideo_->streamOff();\n }\n \n int PipelineHandlerUVC::queueRequest(const Camera *camera, Request *request)\n {\n+\tBuffer *buffer = request->findBuffer(&stream_);\n+\tif (!buffer) {\n+\t\tLOG(UVC, Error)\n+\t\t\t<< \"Attempt to queue request with invalid stream\";\n+\n+\t\treturn -ENOENT;\n+\t}\n+\n+\tvideo_->queueBuffer(buffer);\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","20/27"]}