Copyright © 2018 Rostislav Pehlivanov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. An interface to capture surfaces in an efficient way. Overall usage: 1.) client registers with zwlr_screencontent_manager_v1 2.) server sends client info about surfaces via "receive_surface_info" 3.) client subscribes to capture a surface via the "capture" requests 4.) server sends client events via the "zwlr_screencontent_frame" interface 5.) client finishes and informs server via the "frame_destroy" event 6.) client optionally resubscribes via repeating steps 3.) through 5.) This object represents a frame which is ready to have its resources fetched and used. The receive callback shall be called first, followed by either the "dma_object" callback once per object or the "dma_layer" callback, once per layer. The "dma_plane" callback shall only be called after the "dma_layer" callback corresponding to the layer the plane belongs to has been called. Finally, the "ready" event is called to indicate that all the data has been made available for readout, as well as the time at which presentation happened at. The ownership of the frame is passed to the client, who's responsible for destroying it via the "destroy" event once finished. The data the API describes has been based off of what VASurfaceAttribExternalBuffers contains. All frames are read-only and may not be written into or altered. Special flags that must be respected by the client. Transient frames indicate short lifetime frames (such as swapchain images from external clients). Clients are advised to copy them and do all processing outside of the "ready" event. Main callback supplying the client with information about the frame, as well as an object to serve as context for destruction. Always called first before any other events. The "transform" argument describes the orientation needed to be applied to correctly orient the buffer. For example, a buffer rotated by 90 degrees will have a value of "3" here, corresponding to the need to apply a 270 degree transpose to correctly present the buffer. Callback which serves to supply the client with the file descriptors containing the data for each object. Callback which serves to supply the client with information on what's contained in each file descriptor and how its laid out. Will be called after the main receive event, once per layer. Callback which supplies the client with plane information for each layer. Called as soon as the frame is presented, indicating it is available for reading. The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, each component being an unsigned 32-bit value. Whole seconds are in tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, and the additional fractional part in tv_nsec as nanoseconds. Hence, for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part may have an arbitrary offset at start. If the frame is no longer valid after the "frame" event has been called, this callback will be used to inform the client to scrap the frame. Source is still valid for as long as the subscription function does not return NULL. This may get called if for instance the surface is in the process of resizing. Unreferences the frame, allowing it to be reused. Must be called as soon as its no longer used. This object is a manager which informs clients about capturable windows and is able to create callbacks from which to begin to receive content from. The "title" argument in the "surface_info" event shall be used to provide a user-readable identifier such as a window title or program name. This will be called whenever a surface that's able to be captured appears. Called if a surface becomes unavailable to capture, for example if has been closed. Request to start capturing from a surface with a given id. If an ID becomes unavailable, a NULL will be returned. Request to start capturing from an entire wl_output. If an output becomes unavailable, a NULL will be returned.