diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c index 9a5a3ba73..5c3eb051f 100644 --- a/hw/kdrive/ephyr/ephyrhostvideo.c +++ b/hw/kdrive/ephyr/ephyrhostvideo.c @@ -137,74 +137,6 @@ ephyrHostXVAdaptorGetVideoFormats (const xcb_xv_adaptor_info_t *a_this, return formats; } -Bool -ephyrHostXVAdaptorHasPutVideo (const xcb_xv_adaptor_info_t *a_this, - Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((a_this->type & (XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_INPUT_MASK)) == - (XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_INPUT_MASK)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasGetVideo(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result) -{ - if ((a_this->type & (XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_OUTPUT_MASK)) == - (XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_OUTPUT_MASK)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasPutStill(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((a_this->type & (XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_INPUT_MASK)) == - (XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_INPUT_MASK)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasGetStill(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((a_this->type & (XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_OUTPUT_MASK)) == - (XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_OUTPUT_MASK)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasPutImage(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((a_this->type & (XCB_XV_TYPE_IMAGE_MASK | XCB_XV_TYPE_INPUT_MASK)) == - (XCB_XV_TYPE_IMAGE_MASK | XCB_XV_TYPE_INPUT_MASK)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - Bool ephyrHostXVQueryEncodings(int a_port_id, EphyrHostEncoding ** a_encodings, diff --git a/hw/kdrive/ephyr/ephyrhostvideo.h b/hw/kdrive/ephyr/ephyrhostvideo.h index 56a7359e5..40a12ace1 100644 --- a/hw/kdrive/ephyr/ephyrhostvideo.h +++ b/hw/kdrive/ephyr/ephyrhostvideo.h @@ -98,17 +98,6 @@ char* ephyrHostXVAdaptorGetName(const xcb_xv_adaptor_info_t *a_this); EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats (const xcb_xv_adaptor_info_t *a_this, int *a_nb_formats); -Bool ephyrHostXVAdaptorHasPutVideo(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasGetVideo(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasPutStill(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasGetStill(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasPutImage(const xcb_xv_adaptor_info_t *a_this, - Bool *a_result); - /* * encoding */ diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c index 7d249d229..bf00694f7 100644 --- a/hw/kdrive/ephyr/ephyrvideo.c +++ b/hw/kdrive/ephyr/ephyrvideo.c @@ -169,6 +169,12 @@ static int s_base_port_id; * * ************/ +static Bool +adaptor_has_flags(const xcb_xv_adaptor_info_t *adaptor, uint32_t flags) +{ + return (adaptor->type & flags) == flags; +} + static Bool DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result) { @@ -508,7 +514,6 @@ static Bool ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this) { int i = 0; - Bool has_it = FALSE; xcb_xv_adaptor_info_t *cur_host_adaptor = NULL; EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE); @@ -528,45 +533,26 @@ ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this) EPHYR_LOG_ERROR("failed to get host adaptor at index %d\n", i); continue; } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutImage(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_IMAGE_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutImage = ephyrPutImage; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutVideo(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutVideo = ephyrPutVideo; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasGetVideo(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_OUTPUT_MASK)) a_this->adaptors[i].GetVideo = ephyrGetVideo; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutStill(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutStill = ephyrPutStill; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasGetStill(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_OUTPUT_MASK)) a_this->adaptors[i].GetStill = ephyrGetStill; - } } EPHYR_LOG("leave\n"); return TRUE;