Patch Detail
Show a patch.
GET /api/patches/15802/?format=api
{ "id": 15802, "url": "https://patchwork.libcamera.org/api/patches/15802/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15802/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220505151851.2421-4-ecurtin@redhat.com>", "date": "2022-05-05T15:18:51", "name": "[libcamera-devel,v8,4/4] cam: sdl_sink: Add MJPG support to SDL sink", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e90ed115996b9e84fcc7cab7dba03789f555dfd4", "submitter": { "id": 101, "url": "https://patchwork.libcamera.org/api/people/101/?format=api", "name": "Eric Curtin", "email": "ecurtin@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15802/mbox/", "series": [ { "id": 3095, "url": "https://patchwork.libcamera.org/api/series/3095/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3095", "date": "2022-05-05T15:18:48", "name": "[libcamera-devel,v8,1/4] cam: event_loop: Add timer events to event loop", "version": 8, "mbox": "https://patchwork.libcamera.org/series/3095/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15802/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15802/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AE136C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 5 May 2022 15:19:24 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E6E060424;\n\tThu, 5 May 2022 17:19:24 +0200 (CEST)", "from us-smtp-delivery-74.mimecast.com\n\t(us-smtp-delivery-74.mimecast.com [170.10.133.74])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 14A2360424\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 5 May 2022 17:19:22 +0200 (CEST)", "from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\tus-mta-614-76qiXz_kNHasdTyfK3l-wA-1; Thu, 05 May 2022 11:19:18 -0400", "by mail-wm1-f69.google.com with SMTP id\n\tv191-20020a1cacc8000000b0038ce818d2efso1848840wme.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 05 May 2022 08:19:18 -0700 (PDT)", "from localhost.localdomain\n\t([2001:bb6:9634:7100:33b0:c1b1:8875:4adb])\n\tby smtp.gmail.com with ESMTPSA id\n\tz6-20020a056000110600b0020ad05214d5sm1434819wrw.2.2022.05.05.08.19.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 05 May 2022 08:19:16 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651763964;\n\tbh=D+P+IMGuJSzjIrxIpKf7YEsqyDJtPhyn1Yyzkm/vWvw=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=uI6ZtdDnROtaYycBS7RQI3gsQMz8mZMyDUvtQIV2pCO82tRqOX1dYDC+w7JPSO23o\n\tSA6vWp6IfQDBVGw9iQzUxQvu4haDzDZAZrEiZCFoZJXOOkwk/5ZwRonZLIdyWl7ikk\n\ttWm8dWGlGeQxntttYgxEk8VM7AgfaeeTpfelvxqH2sN6nBVx80N+Oxil/JkYUlWL7p\n\taN5HTu65OkuahXAZnwjx+VQs7Q90NO9zTfVpTdY2vRXh5mTAAmADIeIv5fbcT+WbAi\n\tUB4wcTJwN5fW2sQ/MnI5EKr6hWtofQ8rMmMqxS6oTp6bz/0/cM9+kE/3z7+3yhdVTQ\n\tEqdYdF7HkDqhg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1651763962;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=6eHuKn7G9MDNmHaezjG84YR7jDVwdOksX6s62gQFrUc=;\n\tb=E1apAvv+RVhtlk38dSUEPWxSISQEHH0hd86NyaEVm3lZnaWLhVQGfTeB12DxWbDHX7dGCS\n\tDKcKkn+x3MgUIJbWAxW05wuSb4PQWAFa3emx/fAd6/IRrcbck2pl3aYhOjqBeV4F19ywd2\n\t9pZxijXArniZ5jTDWpJ/cv2HtYxHoKE=" ], "Authentication-Results": [ "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"E1apAvv+\"; \n\tdkim-atps=neutral", "relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ecurtin@redhat.com" ], "X-MC-Unique": "76qiXz_kNHasdTyfK3l-wA-1", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=6eHuKn7G9MDNmHaezjG84YR7jDVwdOksX6s62gQFrUc=;\n\tb=CAXXc8GfKSBDnccYNG5fxzjIjr63Z9HfTOuk7KgdUIbcMUCQ5gSaojuVI2xZpeldnL\n\tpmYELBdO23BxD7Nc65soW8HPSyjWuY65zdH4ckIHsBqOiAWfaGfcYmALulzq9+VpkGgp\n\twSInxXn0/+CPm94CQAl1MstksLtvmeR8QiXiXeAt5tAzHkWifWjeAYXaNlGnrrBRHNcQ\n\tTIEFRsA6zacOW8WZo+udpj0LvXnDu/jtzsmHoSrFFr7VjUQhbWBYMI3v/m5Y7s4T2R2b\n\t1l7JK1dWFtWMwwcbnHtqVUADOneGiv5quN/HXP89vbxkXXcMVO90capynt/WTUWe4rWH\n\tqaXw==", "X-Gm-Message-State": "AOAM531/pfX9jZN2tdX+XEsjsLPoyWUjyOoZ6E1NtQczd1K353VTl9Pq\n\t240TQS1QGnYPgiFBekhFnYwHgX1rqsmPhUo1I9R1FjAFW3XX9c5T+JqU+x9HUi+Sj4AxzYEXEI6\n\tmRNTA3CW1lVMwk6oTZK8tTFfQZBFm/oevyoy0fNe83y+CPej2sAY9/9zwYAxu3UEB9uWCQC+6vW\n\tHkKOOaDdCt", "X-Received": [ "by 2002:a7b:cc12:0:b0:37c:1ae:100a with SMTP id\n\tf18-20020a7bcc12000000b0037c01ae100amr5412228wmh.54.1651763956991; \n\tThu, 05 May 2022 08:19:16 -0700 (PDT)", "by 2002:a7b:cc12:0:b0:37c:1ae:100a with SMTP id\n\tf18-20020a7bcc12000000b0037c01ae100amr5412198wmh.54.1651763956697; \n\tThu, 05 May 2022 08:19:16 -0700 (PDT)" ], "X-Google-Smtp-Source": "ABdhPJytCO1a/TICuJe/OW6k4ypaM3ZW0pLIRGA+IgHqGImkASG+wn2mhs+u5+fO0zFeALfsQS/Hgw==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 5 May 2022 16:18:51 +0100", "Message-Id": "<20220505151851.2421-4-ecurtin@redhat.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220505151851.2421-1-ecurtin@redhat.com>", "References": "<20220505151851.2421-1-ecurtin@redhat.com>", "MIME-Version": "1.0", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true", "Subject": "[libcamera-devel] [PATCH v8 4/4] cam: sdl_sink: Add MJPG support to\n\tSDL sink", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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>", "From": "Eric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Eric Curtin <ecurtin@redhat.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "So we have at least two supported capturing pixel formats (although\nmany possible output pixel formats thanks to SDL conversion). MJPG\nsupport only built in if SDL2_image is available, provides\ndecompression.\n\nSigned-off-by: Eric Curtin <ecurtin@redhat.com>\n---\n src/cam/meson.build | 9 +++++++++\n src/cam/sdl_sink.cpp | 9 +++++++++\n src/cam/sdl_texture_mjpg.cpp | 18 ++++++++++++++++++\n src/cam/sdl_texture_mjpg.h | 10 ++++++++++\n 4 files changed, 46 insertions(+)\n create mode 100644 src/cam/sdl_texture_mjpg.cpp\n create mode 100644 src/cam/sdl_texture_mjpg.h", "diff": "diff --git a/src/cam/meson.build b/src/cam/meson.build\nindex 3032730b..afc0ea9f 100644\n--- a/src/cam/meson.build\n+++ b/src/cam/meson.build\n@@ -41,6 +41,14 @@ if libsdl2.found()\n 'sdl_texture.cpp',\n 'sdl_texture_yuyv.cpp'\n ])\n+\n+ libsdl2_image = dependency('SDL2_image', required : false)\n+ if libsdl2.found()\n+ cam_cpp_args += ['-DHAVE_SDL_IMAGE']\n+ cam_sources += files([\n+ 'sdl_texture_mjpg.cpp'\n+ ])\n+ endif\n endif\n \n cam = executable('cam', cam_sources,\n@@ -49,6 +57,7 @@ cam = executable('cam', cam_sources,\n libcamera_public,\n libdrm,\n libsdl2,\n+ libsdl2_image,\n libevent,\n ],\n cpp_args : cam_cpp_args,\ndiff --git a/src/cam/sdl_sink.cpp b/src/cam/sdl_sink.cpp\nindex 6fbeaf56..f15c01cb 100644\n--- a/src/cam/sdl_sink.cpp\n+++ b/src/cam/sdl_sink.cpp\n@@ -19,6 +19,10 @@\n \n #include \"sdl_texture_yuyv.h\"\n \n+#ifdef HAVE_SDL_IMAGE\n+#include \"sdl_texture_mjpg.h\"\n+#endif\n+\n #include \"event_loop.h\"\n #include \"image.h\"\n \n@@ -59,6 +63,11 @@ int SDLSink::configure(const libcamera::CameraConfiguration &config)\n \tcase libcamera::formats::YUYV:\n \t\tsdlTexture_ = std::make_unique<SDLTextureYUYV>(sdlRect_);\n \t\tbreak;\n+#ifdef HAVE_SDL_IMAGE\n+\tcase libcamera::formats::MJPEG:\n+\t\tsdlTexture_ = std::make_unique<SDLTextureMJPG>(sdlRect_);\n+\t\tbreak;\n+#endif\n \tdefault:\n \t\tstd::cerr << \"Unsupported pixel format \"\n \t\t\t << cfg.pixelFormat.toString() << std::endl;\ndiff --git a/src/cam/sdl_texture_mjpg.cpp b/src/cam/sdl_texture_mjpg.cpp\nnew file mode 100644\nindex 00000000..636fdbea\n--- /dev/null\n+++ b/src/cam/sdl_texture_mjpg.cpp\n@@ -0,0 +1,18 @@\n+#include \"sdl_texture_mjpg.h\"\n+\n+#include <SDL2/SDL_image.h>\n+\n+using namespace libcamera;\n+\n+SDLTextureMJPG::SDLTextureMJPG(const SDL_Rect &sdlRect)\n+\t: SDLTexture(sdlRect, SDL_PIXELFORMAT_RGB24, 0)\n+{\n+}\n+\n+void SDLTextureMJPG::update(const Span<uint8_t> &data)\n+{\n+\tSDL_RWops *buffer_stream = SDL_RWFromMem(data.data(), data.size());\n+\tSDL_Surface *frame = IMG_Load_RW(buffer_stream, 0);\n+\tSDL_UpdateTexture(ptr_, NULL, frame->pixels, frame->pitch);\n+\tSDL_FreeSurface(frame);\n+}\ndiff --git a/src/cam/sdl_texture_mjpg.h b/src/cam/sdl_texture_mjpg.h\nnew file mode 100644\nindex 00000000..fefaaeeb\n--- /dev/null\n+++ b/src/cam/sdl_texture_mjpg.h\n@@ -0,0 +1,10 @@\n+#pragma once\n+\n+#include \"sdl_texture.h\"\n+\n+class SDLTextureMJPG : public SDLTexture\n+{\n+public:\n+\tSDLTextureMJPG(const SDL_Rect &sdlRect);\n+\tvoid update(const libcamera::Span<uint8_t> &data) override;\n+};\n", "prefixes": [ "libcamera-devel", "v8", "4/4" ] }