int XvdiGrabPort( ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result ){ unsigned long id; TimeStamp time; UpdateCurrentTime(); time = ClientTimeToServerTime(ctime); if (pPort->grab.client && (client != pPort->grab.client)) { *p_result = XvAlreadyGrabbed; return Success; } if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, pPort->time) == EARLIER)) { *p_result = XvInvalidTime; return Success; } if (client == pPort->grab.client) { *p_result = Success; return Success; } id = FakeClientID(client->index); if (!AddResource(id, XvRTGrab, &pPort->grab)) { return BadAlloc; } /* IF THERE IS ACTIVE VIDEO THEN STOP IT */ if ((pPort->pDraw) && (client != pPort->client)) { XvdiStopVideo(NULL, pPort, pPort->pDraw); } pPort->grab.client = client; pPort->grab.id = id; pPort->time = currentTime; *p_result = Success; return Success; }
static int ProcXvStopVideo(ClientPtr client) { int status, rc; DrawablePtr pDraw; XvPortPtr pPort; REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return status; } rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); if (rc != Success) return rc; return XvdiStopVideo(client, pPort, pDraw); }