From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 276F9477B4 for ; Fri, 22 Sep 2023 11:37:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AC3BE68C8D4; Fri, 22 Sep 2023 14:37:33 +0300 (EEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2720268C8D4 for ; Fri, 22 Sep 2023 14:37:26 +0300 (EEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1c4586b12feso16569015ad.2 for ; Fri, 22 Sep 2023 04:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695382644; x=1695987444; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=YvgZBQ5o9+yWzU1Z+qHW+1ke50TcL8m1XP6/fEynmZs=; b=TdUuQxXqiQYo4u/7bjKJBHXuSR7Ctijnw0/ESv/3jE4XHFu8nEu1YiTSoodKVWCzkT N6R1dSkvmLc1ikZHwXC+LWtljVEu1HhkdHNG3vWc3mkPzKwZoO5jS1JwGlxysz5Hu9Yb nFqSgX+lMHZjsXnIOS3BpeGADhuO7hx0S+FfzNQEnDa6Y8wenM42d0OeEFwcuOdvhPAE ghyCiGAC2fN+gdAZXEqVItaosqm0u8SUnA5LzsWTI8+9ws+VbWZqK+qNUwUw/ywBsqdJ vfX0JWT0wz9tqVrRd4umRE5k3FLLiqfTGuOsJPdz4PQReHsY+1TOG5tsx7KBG0jXnXdt r5pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695382644; x=1695987444; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YvgZBQ5o9+yWzU1Z+qHW+1ke50TcL8m1XP6/fEynmZs=; b=N0DYgGp0tFG+gS5SPcGsEqQ8+QVcNVzBvIQOV4oxasfS3Wo6ClbiDScSEGB8MppZpX tbJ91D4Aavd6VDfNTi29HPQN/KnbcNFp5O2By5qC0/+JMTaydD4gygYemB2dVCHK5lIf aDeBCZ2h9mqnGPXzlm1jKAdJPGNmyIX7nxMikrEFHvfGVWOLn3dBtySLqn2qCZHR0jRg m+j20PDp0pHzPR1sda3XjHRODksBSPFAqP24DGkKQaZKMvf+9C5OOspbrwOGy/+abwyR 5d7v/fzTEIXNyjULSp2p0yVNBLwl/HcDupuyoy0ZbzEMnlenzy241QlzS3pFPZPi3cca 6Fnw== X-Gm-Message-State: AOJu0Yx8EDGIF5nk4aG0cH/EzkSw+HIxeUWET0Q9ECt4GciVNKo6sv22 zyujtrogNqgS8Noa7r2PM2lymdQfDyk= X-Google-Smtp-Source: AGHT+IGBkCAbgu+/erWIlKf1qw8bHS03i4cneO7NYgS8dg2dd/XYdWZpcpqc4dE+hTXfG/2H8TbMTw== X-Received: by 2002:a17:903:11c7:b0:1c5:eebb:5071 with SMTP id q7-20020a17090311c700b001c5eebb5071mr759041plh.27.1695382644332; Fri, 22 Sep 2023 04:37:24 -0700 (PDT) Received: from [192.168.1.107] ([103.194.71.93]) by smtp.gmail.com with ESMTPSA id v10-20020a1709029a0a00b001b53953f306sm3240921plp.178.2023.09.22.04.37.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Sep 2023 04:37:24 -0700 (PDT) Message-ID: Date: Fri, 22 Sep 2023 17:07:20 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20230920184058.1263793-1-abhishek.ojha@savoirfairelinux.com> Content-Language: en-US From: llyyr In-Reply-To: <20230920184058.1263793-1-abhishek.ojha@savoirfairelinux.com> Subject: Re: [FFmpeg-devel] [RFC PATCH 1/2] libavdevice/pipewiregrab: add pipewire based grab X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 9/21/23 00:10, Abhishek Ojha wrote: > This is an proof of concept for pipewire grab to enable screen capture > on wayland. Add a new Linux capture based on [1] PipeWire and the > [2] Desktop portal. > This new capture starts by asking the Desktop portal for a screencapture > session.There are quite a few D-Bus calls involved in this, but the key > points are: > > 1. A connection to org.freedesktop.portal.ScreenCast is estabilished, > and the available cursor modes are updated. Currently only embedded > and hidden currsor mode enabled. > > 2. Call CreateSession via dbus call. This is the first step of the > communication. Response callback return the status of created > session. > > 3. Call SelectSources . This is when a system dialog pops up asking > the user to either select a monitor (desktop capture).Only monitor > capture is enabled in current implementation. > > 4. Call Start . This signals the compositor that it can setup a PipeWire > stream, and start sending buffers. > > Above flow is implemented as per the [2] xdg-desktop-portal. Once flow > is completed, pipewire fd is received and using this pipewire stream is > created and receive buffer from the created stream. > > For cursor implementation, embedded cursor mode is enabled that means > cursor metadata is not handled in current implementation and has no > control over the cursor bitmap. > > gdbus/pipewire logic, this is based on obs-xdg, gstpipewire and > pipewire examples, and initial pipewire grab logic, this is based on > libavdevice/xcbgrab and libavdevice/v4l2 > > This implementation shows the skeleton implementation and enables basic > functionality. I'd like to hear opinions and suggestions to improve and > properly use this. > > [1] https://pipewire.org/ > [2] https://github.com/flatpak/xdg-desktop-portal/ > > Below are the arguments for pipewiregrab. > ffplay -f pipewiregrab -draw_mouse 1 -i :0.0 > > Signed-off-by: Abhishek Ojha > --- > configure | 9 + > libavdevice/Makefile | 1 + > libavdevice/alldevices.c | 1 + > libavdevice/pipewiregrab.c | 1836 ++++++++++++++++++++++++++++++++++++ > 4 files changed, 1847 insertions(+) > create mode 100644 libavdevice/pipewiregrab.c > > diff --git a/configure b/configure > index e40dcce09e..325b10484f 100755 > --- a/configure > +++ b/configure > @@ -299,6 +299,7 @@ External library support: > --enable-libxcb-shm enable X11 grabbing shm communication [autodetect] > --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect] > --enable-libxcb-shape enable X11 grabbing shape rendering [autodetect] > + --enable-libpipewire enable screen grabbing using pipewire [autodetect] > --enable-libxvid enable Xvid encoding via xvidcore, > native MPEG-4/Xvid encoder exists [no] > --enable-libxml2 enable XML parsing using the C library libxml2, needed > @@ -1788,6 +1789,8 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" > libxcb_shm > libxcb_shape > libxcb_xfixes > + libpipewire > + libgio_unix > lzma > mediafoundation > metal > @@ -3621,6 +3624,7 @@ v4l2_outdev_suggest="libv4l2" > vfwcap_indev_deps="vfw32 vfwcap_defines" > xcbgrab_indev_deps="libxcb" > xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes" > +pipewiregrab_indev_deps="libpipewire libgio_unix pthreads" > xv_outdev_deps="xlib_xv xlib_x11 xlib_xext" > > # protocols > @@ -7041,6 +7045,11 @@ if enabled libxcb; then > enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image > fi > > +enabled libpipewire && check_pkg_config libpipewire "libpipewire-0.3 >= 0.3.40" pipewire/pipewire.h pw_init > +if enabled libpipewire; then > + enabled libgio_unix && check_pkg_config libgio_unix gio-unix-2.0 gio/gio.h g_main_loop_new > +fi > + I just tried this and it failed to build due to missing locale_t and other locale related issues in pipewire's spa library. Upon further inspection, it seems Pipewire wants _XOPEN_SOURCE=700 but ffmpeg's configure sets _XOPEN_SOURCE=600. Not sure who's at fault here but I was able to get it to build after explicitly setting that. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".