GTK: Xv: Add a couple of error checks.

This commit is contained in:
Brandon Wright 2019-09-08 12:45:18 -05:00
parent 3b09fbacaf
commit 673896f7aa
1 changed files with 11 additions and 5 deletions

View File

@ -233,7 +233,7 @@ S9xXVDisplayDriver::init ()
XvAdaptorInfo *adaptors; XvAdaptorInfo *adaptors;
XvAttribute *port_attr; XvAttribute *port_attr;
VisualID visualid = None; VisualID visualid = None;
unsigned int num_adaptors; unsigned int num_adaptors = 0;
GdkScreen *screen; GdkScreen *screen;
GdkWindow *root; GdkWindow *root;
@ -245,10 +245,13 @@ S9xXVDisplayDriver::init ()
root = gdk_screen_get_root_window (screen); root = gdk_screen_get_root_window (screen);
xv_portid = -1; xv_portid = -1;
XvQueryAdaptors (display, if ((XvQueryAdaptors (display,
gdk_x11_window_get_xid (root), gdk_x11_window_get_xid (root),
&num_adaptors, &num_adaptors,
&adaptors); &adaptors)) != Success)
{
fprintf (stderr, "No Xv compatible adaptors.\n");
}
for (int i = 0; i < (int) num_adaptors; i++) for (int i = 0; i < (int) num_adaptors; i++)
@ -367,7 +370,10 @@ S9xXVDisplayDriver::init ()
free (formats); free (formats);
if (format == -1) if (format == -1)
{
fprintf (stderr, "No compatible formats found for Xv.\n");
return -1; return -1;
}
/* Build a table for yuv conversion */ /* Build a table for yuv conversion */
if (format == FOURCC_YUY2) if (format == FOURCC_YUY2)