<div dir="ltr">Thanks so much Peter. I'll look at this stuff today.<div><br></div><div>Question: Do you have any guidance on how to extract/use the OBS library that's cross-platform? I wouldn't want to include everything that OBS has to offer to keep the footprint of our application low. Any docs on their API as well?<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr">Suhail</div><div dir="ltr"><br></div><div dir="ltr">--</div><div dir="ltr"><br></div><div dir="ltr">Founder</div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 5, 2019 at 9:20 AM Peter Harris <<a href="mailto:peter@harr.ca">peter@harr.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2019-08-05 11:07 a.m., Suhail Doshi wrote:<br>
> My question is: Is there a way to get an image of the desktop that<br>
> returns a pointer that's GPU memory? For example, in Windows 10, there's<br>
> an API called the Desktop Duplication API which will allows you to do<br>
> this. Then, it lets you copy the data in that GPU memory block to<br>
> another one such that you can encode the frame with H264, for example. I<br>
> am using NVIDIA GPUs and utilizing their NVENC SDK.<br>
> <br>
> I am looking for an equivalent.<br>
<br>
XCB is very low-level. For most things, you probably want to use a<br>
higher level library (such as, for example, OBS:<br>
<a href="https://github.com/obsproject/obs-studio" rel="noreferrer" target="_blank">https://github.com/obsproject/obs-studio</a> , which includes a<br>
cross-platform library with an API that is probably closer to the<br>
Desktop Duplication API than anything in XCB).<br>
<br>
With that said, if you want to implement the details yourself, you can<br>
take a peek inside OBS and see that the capture method that copies<br>
uncompressed pixels back to main memory uses xcb_shm_get_image (and<br>
xcb_xfixes_get_cursor_image, and xcb_xinerama_query_screens, among other<br>
things).<br>
<a href="https://github.com/obsproject/obs-studio/blob/master/plugins/linux-capture/xshm-input.c" rel="noreferrer" target="_blank">https://github.com/obsproject/obs-studio/blob/master/plugins/linux-capture/xshm-input.c</a><br>
<br>
Peter Harris<br>
</blockquote></div>