linux-capture: Add function to check extensions

Add an internal function to check for all the extensions needed by the
xshm capture to work.
master
fryshorts 2014-12-21 22:32:28 +01:00
parent 172a4d7a52
commit 4ad41004e0
1 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <inttypes.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xlib-xcb.h>
#include <xcb/shm.h>
#include <xcb/xinerama.h>
#include <obs-module.h>
#include <util/dstr.h>
@ -74,6 +77,24 @@ static inline void xshm_resize_texture(struct xshm_data *data)
GS_BGRA, 1, NULL, GS_DYNAMIC);
}
/**
* Check if the xserver supports all the extensions we need
*/
static bool xshm_check_extensions(xcb_connection_t *xcb)
{
bool ok = true;
if (!xcb_get_extension_data(xcb, &xcb_shm_id)->present) {
blog(LOG_ERROR, "Missing SHM extension !");
ok = false;
}
if (!xcb_get_extension_data(xcb, &xcb_xinerama_id)->present)
blog(LOG_INFO, "Missing Xinerama extension !");
return ok;
}
/**
* Update the capture
*