Lines Matching refs:xv

90     XVContext *xv = s->priv_data;  in xv_write_trailer()  local
91 if (xv->display) { in xv_write_trailer()
92 XShmDetach(xv->display, &xv->yuv_shminfo); in xv_write_trailer()
93 if (xv->yuv_image) in xv_write_trailer()
94 shmdt(xv->yuv_image->data); in xv_write_trailer()
95 XFree(xv->yuv_image); in xv_write_trailer()
96 if (xv->gc) in xv_write_trailer()
97 XFreeGC(xv->display, xv->gc); in xv_write_trailer()
98 XCloseDisplay(xv->display); in xv_write_trailer()
105 XVContext *xv = s->priv_data; in xv_write_header() local
127 xv->image_format = encctx->pix_fmt; in xv_write_header()
129 xv->display = XOpenDisplay(xv->display_name); in xv_write_header()
130 if (!xv->display) { in xv_write_header()
131 av_log(s, AV_LOG_ERROR, "Could not open the X11 display '%s'\n", xv->display_name); in xv_write_header()
135 xv->image_width = encctx->width; in xv_write_header()
136 xv->image_height = encctx->height; in xv_write_header()
137 if (!xv->window_width && !xv->window_height) { in xv_write_header()
139 xv->window_width = encctx->width; in xv_write_header()
140 xv->window_height = encctx->height; in xv_write_header()
143 xv->window_width = av_rescale(xv->window_width, sar.num, sar.den); in xv_write_header()
145 xv->window_height = av_rescale(xv->window_height, sar.den, sar.num); in xv_write_header()
148 if (!xv->window_id) { in xv_write_header()
149 xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display), in xv_write_header()
150 xv->window_x, xv->window_y, in xv_write_header()
151 xv->window_width, xv->window_height, in xv_write_header()
153 if (!xv->window_title) { in xv_write_header()
154 if (!(xv->window_title = av_strdup(s->filename))) { in xv_write_header()
159 XStoreName(xv->display, xv->window, xv->window_title); in xv_write_header()
160 xv->wm_delete_message = XInternAtom(xv->display, "WM_DELETE_WINDOW", False); in xv_write_header()
161 XSetWMProtocols(xv->display, xv->window, &xv->wm_delete_message, 1); in xv_write_header()
162 XMapWindow(xv->display, xv->window); in xv_write_header()
164 xv->window = xv->window_id; in xv_write_header()
166 … if (XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &num_adaptors, &ai) != Success) { in xv_write_header()
174 xv->xv_port = ai[0].base_id; in xv_write_header()
177 fv = XvListImageFormats(xv->display, xv->xv_port, &num_formats); in xv_write_header()
197 xv->gc = XCreateGC(xv->display, xv->window, 0, 0); in xv_write_header()
198 xv->image_width = encctx->width; in xv_write_header()
199 xv->image_height = encctx->height; in xv_write_header()
200 xv->yuv_image = XvShmCreateImage(xv->display, xv->xv_port, tag, 0, in xv_write_header()
201 xv->image_width, xv->image_height, &xv->yuv_shminfo); in xv_write_header()
202 xv->yuv_shminfo.shmid = shmget(IPC_PRIVATE, xv->yuv_image->data_size, in xv_write_header()
204 xv->yuv_shminfo.shmaddr = (char *)shmat(xv->yuv_shminfo.shmid, 0, 0); in xv_write_header()
205 xv->yuv_image->data = xv->yuv_shminfo.shmaddr; in xv_write_header()
206 xv->yuv_shminfo.readOnly = False; in xv_write_header()
208 XShmAttach(xv->display, &xv->yuv_shminfo); in xv_write_header()
209 XSync(xv->display, False); in xv_write_header()
210 shmctl(xv->yuv_shminfo.shmid, IPC_RMID, 0); in xv_write_header()
212 XGetWindowAttributes(xv->display, xv->window, &window_attrs); in xv_write_header()
215 XAllocColor(xv->display, window_attrs.colormap, &fgcolor); in xv_write_header()
216 XSetForeground(xv->display, xv->gc, fgcolor.pixel); in xv_write_header()
218 xv->window_width = xv->window_height = 0; in xv_write_header()
228 XVContext *xv = s->priv_data; in compute_display_area() local
239 if (av_cmp_q(dar, (AVRational){ xv->dest_w, xv->dest_h }) > 0) { in compute_display_area()
241 xv->dest_y = xv->dest_h; in compute_display_area()
242 xv->dest_x = 0; in compute_display_area()
243 xv->dest_h = av_rescale(xv->dest_w, dar.den, dar.num); in compute_display_area()
244 xv->dest_y -= xv->dest_h; in compute_display_area()
245 xv->dest_y /= 2; in compute_display_area()
248 xv->dest_x = xv->dest_w; in compute_display_area()
249 xv->dest_y = 0; in compute_display_area()
250 xv->dest_w = av_rescale(xv->dest_h, dar.num, dar.den); in compute_display_area()
251 xv->dest_x -= xv->dest_w; in compute_display_area()
252 xv->dest_x /= 2; in compute_display_area()
258 XVContext *xv = s->priv_data; in xv_repaint() local
261 XGetWindowAttributes(xv->display, xv->window, &window_attrs); in xv_repaint()
262 if (window_attrs.width != xv->window_width || window_attrs.height != xv->window_height) { in xv_repaint()
264 xv->dest_w = window_attrs.width; in xv_repaint()
265 xv->dest_h = window_attrs.height; in xv_repaint()
267 if (xv->dest_x) { in xv_repaint()
268 rect[0].width = rect[1].width = xv->dest_x; in xv_repaint()
272 rect[1].x = xv->dest_w + xv->dest_x; in xv_repaint()
273 XFillRectangles(xv->display, xv->window, xv->gc, rect, 2); in xv_repaint()
275 if (xv->dest_y) { in xv_repaint()
277 rect[0].height = rect[1].height = xv->dest_y; in xv_repaint()
280 rect[1].y = xv->dest_h + xv->dest_y; in xv_repaint()
281 XFillRectangles(xv->display, xv->window, xv->gc, rect, 2); in xv_repaint()
285 if (XvShmPutImage(xv->display, xv->xv_port, xv->window, xv->gc, in xv_repaint()
286 xv->yuv_image, 0, 0, xv->image_width, xv->image_height, in xv_repaint()
287 xv->dest_x, xv->dest_y, xv->dest_w, xv->dest_h, True) != Success) { in xv_repaint()
296 XVContext *xv = s->priv_data; in write_picture() local
297 XvImage *img = xv->yuv_image; in write_picture()
305 if (!xv->window_id) { in write_picture()
307 while (XPending(xv->display)) { in write_picture()
308 XNextEvent(xv->display, &event); in write_picture()
309 if (event.type == ClientMessage && event.xclient.data.l[0] == xv->wm_delete_message) { in write_picture()
310 av_log(xv, AV_LOG_DEBUG, "Window close event.\n"); in write_picture()
317 xv->image_format, img->width, img->height); in write_picture()