ephyr: Remove some pointless indirection in the XV code.
Now that we have XCB on the server side, we don't need to split these functions out. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
46cf6bf569
commit
7a9c311add
|
@ -43,12 +43,6 @@
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif /*FALSE*/
|
#endif /*FALSE*/
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ephyrHostXVInit(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyrHostXVQueryAdaptors (xcb_xv_query_adaptors_reply_t **a_adaptors)
|
ephyrHostXVQueryAdaptors (xcb_xv_query_adaptors_reply_t **a_adaptors)
|
||||||
{
|
{
|
||||||
|
@ -78,19 +72,6 @@ out:
|
||||||
return is_ok;
|
return is_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ephyrHostXVAdaptorArrayDelete (xcb_xv_query_adaptors_reply_t *a_adaptors)
|
|
||||||
{
|
|
||||||
free (a_adaptors);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ephyrHostXVAdaptorArrayGetSize (const xcb_xv_query_adaptors_reply_t *a_this)
|
|
||||||
{
|
|
||||||
EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
|
|
||||||
return a_this->num_adaptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
xcb_xv_adaptor_info_t *
|
xcb_xv_adaptor_info_t *
|
||||||
ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
|
ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
|
||||||
int a_index)
|
int a_index)
|
||||||
|
@ -156,20 +137,6 @@ ephyrHostXVAdaptorGetVideoFormats (const xcb_xv_adaptor_info_t *a_this,
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
ephyrHostXVAdaptorGetNbPorts(const xcb_xv_adaptor_info_t *a_this)
|
|
||||||
{
|
|
||||||
EPHYR_RETURN_VAL_IF_FAIL(a_this, -1);
|
|
||||||
|
|
||||||
return a_this->num_ports;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ephyrHostXVAdaptorGetFirstPortID (const xcb_xv_adaptor_info_t *a_this)
|
|
||||||
{
|
|
||||||
return a_this->base_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyrHostXVAdaptorHasPutVideo (const xcb_xv_adaptor_info_t *a_this,
|
ephyrHostXVAdaptorHasPutVideo (const xcb_xv_adaptor_info_t *a_this,
|
||||||
Bool *a_result)
|
Bool *a_result)
|
||||||
|
@ -538,12 +505,6 @@ ephyrHostGetAtomName(int a_atom)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ephyrHostFree(void *a_pointer)
|
|
||||||
{
|
|
||||||
free(a_pointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyrHostXVPutImage(int a_screen_num,
|
ephyrHostXVPutImage(int a_screen_num,
|
||||||
int a_port_id,
|
int a_port_id,
|
||||||
|
@ -732,18 +693,3 @@ ephyrHostXVGetStill(int a_screen_num, int a_port_id,
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
|
||||||
ephyrHostXVStopVideo(int a_screen_num, int a_port_id)
|
|
||||||
{
|
|
||||||
xcb_connection_t *conn = hostx_get_xcbconn();
|
|
||||||
|
|
||||||
EPHYR_RETURN_VAL_IF_FAIL(conn, FALSE);
|
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
|
||||||
|
|
||||||
xcb_xv_stop_video(conn, a_port_id, hostx_get_window (a_screen_num));
|
|
||||||
|
|
||||||
EPHYR_LOG("leave\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -82,16 +82,10 @@ typedef struct {
|
||||||
unsigned short x1, y1, x2, y2;
|
unsigned short x1, y1, x2, y2;
|
||||||
} EphyrHostBox;
|
} EphyrHostBox;
|
||||||
|
|
||||||
void ephyrHostXVInit(void);
|
|
||||||
|
|
||||||
void ephyrHostFree(void *a_pointer);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* host adaptor array
|
* host adaptor array
|
||||||
*/
|
*/
|
||||||
Bool ephyrHostXVQueryAdaptors(xcb_xv_query_adaptors_reply_t **a_adaptors);
|
Bool ephyrHostXVQueryAdaptors(xcb_xv_query_adaptors_reply_t **a_adaptors);
|
||||||
void ephyrHostXVAdaptorArrayDelete(xcb_xv_query_adaptors_reply_t *a_adaptors);
|
|
||||||
int ephyrHostXVAdaptorArrayGetSize(const xcb_xv_query_adaptors_reply_t *a_this);
|
|
||||||
xcb_xv_adaptor_info_t* ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
|
xcb_xv_adaptor_info_t* ephyrHostXVAdaptorArrayAt(const xcb_xv_query_adaptors_reply_t *a_this,
|
||||||
int a_index);
|
int a_index);
|
||||||
|
|
||||||
|
@ -103,8 +97,6 @@ char ephyrHostXVAdaptorGetType(const xcb_xv_adaptor_info_t *a_this);
|
||||||
char* ephyrHostXVAdaptorGetName(const xcb_xv_adaptor_info_t *a_this);
|
char* ephyrHostXVAdaptorGetName(const xcb_xv_adaptor_info_t *a_this);
|
||||||
EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
|
EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats
|
||||||
(const xcb_xv_adaptor_info_t *a_this, int *a_nb_formats);
|
(const xcb_xv_adaptor_info_t *a_this, int *a_nb_formats);
|
||||||
int ephyrHostXVAdaptorGetNbPorts(const xcb_xv_adaptor_info_t *a_this);
|
|
||||||
int ephyrHostXVAdaptorGetFirstPortID(const xcb_xv_adaptor_info_t *a_this);
|
|
||||||
|
|
||||||
Bool ephyrHostXVAdaptorHasPutVideo(const xcb_xv_adaptor_info_t *a_this,
|
Bool ephyrHostXVAdaptorHasPutVideo(const xcb_xv_adaptor_info_t *a_this,
|
||||||
Bool *a_result);
|
Bool *a_result);
|
||||||
|
@ -216,9 +208,4 @@ Bool ephyrHostXVGetStill(int a_screen_num,
|
||||||
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
|
||||||
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
|
int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h);
|
||||||
|
|
||||||
/*
|
|
||||||
* StopVideo
|
|
||||||
*/
|
|
||||||
Bool ephyrHostXVStopVideo(int a_screen_num, int a_port_id);
|
|
||||||
|
|
||||||
#endif /*__EPHYRHOSTVIDEO_H__*/
|
#endif /*__EPHYRHOSTVIDEO_H__*/
|
||||||
|
|
|
@ -287,8 +287,6 @@ ephyrXVPrivNew(void)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ephyrHostXVInit();
|
|
||||||
|
|
||||||
if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) {
|
if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) {
|
||||||
EPHYR_LOG_ERROR("failed to query the host x for xv properties\n");
|
EPHYR_LOG_ERROR("failed to query the host x for xv properties\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -317,7 +315,7 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this)
|
||||||
if (!a_this)
|
if (!a_this)
|
||||||
return;
|
return;
|
||||||
if (a_this->host_adaptors) {
|
if (a_this->host_adaptors) {
|
||||||
ephyrHostXVAdaptorArrayDelete(a_this->host_adaptors);
|
free(a_this->host_adaptors);
|
||||||
a_this->host_adaptors = NULL;
|
a_this->host_adaptors = NULL;
|
||||||
}
|
}
|
||||||
free(a_this->adaptors);
|
free(a_this->adaptors);
|
||||||
|
@ -396,8 +394,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (a_this->host_adaptors)
|
if (a_this->host_adaptors)
|
||||||
a_this->num_adaptors =
|
a_this->num_adaptors = a_this->host_adaptors->num_adaptors;
|
||||||
ephyrHostXVAdaptorArrayGetSize(a_this->host_adaptors);
|
|
||||||
if (a_this->num_adaptors < 0) {
|
if (a_this->num_adaptors < 0) {
|
||||||
EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
|
EPHYR_LOG_ERROR("failed to get number of host adaptors\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -420,8 +417,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
|
||||||
cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
|
cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i);
|
||||||
if (!cur_host_adaptor)
|
if (!cur_host_adaptor)
|
||||||
continue;
|
continue;
|
||||||
a_this->adaptors[i].nPorts =
|
a_this->adaptors[i].nPorts = cur_host_adaptor->num_ports;
|
||||||
ephyrHostXVAdaptorGetNbPorts(cur_host_adaptor);
|
|
||||||
if (a_this->adaptors[i].nPorts <= 0) {
|
if (a_this->adaptors[i].nPorts <= 0) {
|
||||||
EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i);
|
EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -433,7 +429,7 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
|
||||||
a_this->adaptors[i].name = ephyrHostXVAdaptorGetName(cur_host_adaptor);
|
a_this->adaptors[i].name = ephyrHostXVAdaptorGetName(cur_host_adaptor);
|
||||||
if (!a_this->adaptors[i].name)
|
if (!a_this->adaptors[i].name)
|
||||||
a_this->adaptors[i].name = strdup("Xephyr Video Overlay");
|
a_this->adaptors[i].name = strdup("Xephyr Video Overlay");
|
||||||
base_port_id = ephyrHostXVAdaptorGetFirstPortID(cur_host_adaptor);
|
base_port_id = cur_host_adaptor->base_id;
|
||||||
if (base_port_id < 0) {
|
if (base_port_id < 0) {
|
||||||
EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i);
|
EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -455,10 +451,6 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this)
|
||||||
&num_video_formats);
|
&num_video_formats);
|
||||||
a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
|
a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats;
|
||||||
a_this->adaptors[i].nFormats = num_video_formats;
|
a_this->adaptors[i].nFormats = num_video_formats;
|
||||||
/* got a_this->adaptors[i].nPorts already
|
|
||||||
a_this->adaptors[i].nPorts =
|
|
||||||
ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
|
|
||||||
*/
|
|
||||||
a_this->adaptors[i].pPortPrivates =
|
a_this->adaptors[i].pPortPrivates =
|
||||||
calloc(a_this->adaptors[i].nPorts,
|
calloc(a_this->adaptors[i].nPorts,
|
||||||
sizeof(DevUnion) + sizeof(EphyrPortPriv));
|
sizeof(DevUnion) + sizeof(EphyrPortPriv));
|
||||||
|
@ -710,15 +702,14 @@ ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv,
|
||||||
static void
|
static void
|
||||||
ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit)
|
ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit)
|
||||||
{
|
{
|
||||||
|
xcb_connection_t *conn = hostx_get_xcbconn();
|
||||||
EphyrPortPriv *port_priv = a_port_priv;
|
EphyrPortPriv *port_priv = a_port_priv;
|
||||||
|
EphyrScrPriv *scrpriv = a_info->driver;
|
||||||
|
|
||||||
EPHYR_RETURN_IF_FAIL(a_info && a_info->pScreen);
|
|
||||||
EPHYR_RETURN_IF_FAIL(port_priv);
|
EPHYR_RETURN_IF_FAIL(port_priv);
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
if (!ephyrHostXVStopVideo(a_info->pScreen->myNum, port_priv->port_number)) {
|
xcb_xv_stop_video(conn, port_priv->port_number, scrpriv->win);
|
||||||
EPHYR_LOG_ERROR("XvStopVideo() failed\n");
|
|
||||||
}
|
|
||||||
EPHYR_LOG("leave\n");
|
EPHYR_LOG("leave\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue