1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998, 1999, 2000 VideoLAN
5 * $Id: vout_sdl.c,v 1.56 2001/07/06 08:43:31 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Pierre Baillet <oct@zoy.org>
9 * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 #define MODULE_NAME sdl
27 #include "modules_inner.h"
29 /*****************************************************************************
31 *****************************************************************************/
34 #include <errno.h> /* ENOMEM */
35 #include <stdlib.h> /* free() */
36 #include <string.h> /* strerror() */
38 #include <sys/types.h>
40 # include <netinet/in.h> /* BSD: struct in_addr */
52 #include "video_output.h"
55 #include "interface.h"
56 /* FIXME: get rid of this */
57 #include "keystrokes.h"
62 #include "modules_export.h"
64 /*****************************************************************************
65 * FIXME: this file is ... *
67 * XXX XXX FIXME XXX XXX XXX XXX *
68 * XXX XXX XXX XXX XXX XXX XXX XXX *
69 * XXX XXX XXX XXX FIXME XXX *
70 * XXX XXX XXX TODO XXX XXX XXX *
71 * XXX XXX XXX XXX XXX XXX *
72 * FIXME FIXME FIXME XXX XXX *
74 *****************************************************************************/
76 /*****************************************************************************
77 * vout_sys_t: video output SDL method descriptor
78 *****************************************************************************
79 * This structure is part of the video output thread descriptor.
80 * It describes the SDL specific properties of an output thread.
81 *****************************************************************************/
82 typedef struct vout_sys_s
87 SDL_Surface * p_display; /* display device */
88 SDL_Overlay * p_overlay; /* overlay device */
92 boolean_t b_reopen_display;
94 boolean_t b_cursor_autohidden;
97 Uint8 * p_sdl_buf[2]; /* Buffer information */
101 /*****************************************************************************
103 *****************************************************************************/
104 static int vout_Probe ( probedata_t *p_data );
105 static int vout_Create ( struct vout_thread_s * );
106 static int vout_Init ( struct vout_thread_s * );
107 static void vout_End ( struct vout_thread_s * );
108 static void vout_Destroy ( struct vout_thread_s * );
109 static int vout_Manage ( struct vout_thread_s * );
110 static void vout_Display ( struct vout_thread_s * );
111 static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green,
112 u16 *blue, u16 *transp );
114 static int SDLOpenDisplay ( vout_thread_t *p_vout );
115 static void SDLCloseDisplay ( vout_thread_t *p_vout );
117 /*****************************************************************************
118 * Functions exported as capabilities. They are declared as static so that
119 * we don't pollute the namespace too much.
120 *****************************************************************************/
121 void _M( vout_getfunctions )( function_list_t * p_function_list )
123 p_function_list->pf_probe = vout_Probe;
124 p_function_list->functions.vout.pf_create = vout_Create;
125 p_function_list->functions.vout.pf_init = vout_Init;
126 p_function_list->functions.vout.pf_end = vout_End;
127 p_function_list->functions.vout.pf_destroy = vout_Destroy;
128 p_function_list->functions.vout.pf_manage = vout_Manage;
129 p_function_list->functions.vout.pf_display = vout_Display;
130 p_function_list->functions.vout.pf_setpalette = vout_SetPalette;
133 /*****************************************************************************
134 * vout_Probe: probe the video driver and return a score
135 *****************************************************************************
136 * This function tries to initialize SDL and returns a score to the
137 * plugin manager so that it can select the best plugin.
138 *****************************************************************************/
139 static int vout_Probe( probedata_t *p_data )
141 if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
149 /*****************************************************************************
150 * vout_Create: allocate SDL video thread output method
151 *****************************************************************************
152 * This function allocate and initialize a SDL vout method. It uses some of the
153 * vout properties to choose the correct mode, and change them according to the
154 * mode actually used.
155 *****************************************************************************/
156 static int vout_Create( vout_thread_t *p_vout )
158 /* Allocate structure */
159 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
160 if( p_vout->p_sys == NULL )
162 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
166 /* Initialize library */
167 if( SDL_Init( SDL_INIT_VIDEO
169 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
170 | SDL_INIT_EVENTTHREAD
172 | SDL_INIT_NOPARACHUTE ) < 0 )
174 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
175 free( p_vout->p_sys );
179 p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
181 p_vout->p_sys->b_cursor_autohidden = 0;
182 p_vout->p_sys->i_lastmoved = mdate();
184 p_vout->b_fullscreen = main_GetIntVariable( VOUT_FULLSCREEN_VAR,
185 VOUT_FULLSCREEN_DEFAULT );
186 p_vout->p_sys->b_overlay = main_GetIntVariable( VOUT_OVERLAY_VAR,
187 VOUT_OVERLAY_DEFAULT );
188 p_vout->p_sys->i_width = main_GetIntVariable( VOUT_WIDTH_VAR,
189 VOUT_WIDTH_DEFAULT );
190 p_vout->p_sys->i_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
191 VOUT_HEIGHT_DEFAULT );
193 p_vout->p_sys->p_display = NULL;
194 p_vout->p_sys->p_overlay = NULL;
196 if( SDLOpenDisplay(p_vout) )
198 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
199 free( p_vout->p_sys );
203 /* FIXME: get rid of this ASAP, it's FUCKING UGLY */
204 { intf_thread_t * p_intf = p_main->p_intf;
205 intf_AssignKey(p_intf, SDLK_q, INTF_KEY_QUIT, 0);
206 intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, 0);
207 /* intf_AssignKey(p_intf,3,'Q'); */
208 intf_AssignKey(p_intf, SDLK_0, INTF_KEY_SET_CHANNEL,0);
209 intf_AssignKey(p_intf, SDLK_1, INTF_KEY_SET_CHANNEL,1);
210 intf_AssignKey(p_intf, SDLK_2, INTF_KEY_SET_CHANNEL,2);
211 intf_AssignKey(p_intf, SDLK_3, INTF_KEY_SET_CHANNEL,3);
212 intf_AssignKey(p_intf, SDLK_4, INTF_KEY_SET_CHANNEL,4);
213 intf_AssignKey(p_intf, SDLK_5, INTF_KEY_SET_CHANNEL,5);
214 intf_AssignKey(p_intf, SDLK_6, INTF_KEY_SET_CHANNEL,6);
215 intf_AssignKey(p_intf, SDLK_7, INTF_KEY_SET_CHANNEL,7);
216 intf_AssignKey(p_intf, SDLK_8, INTF_KEY_SET_CHANNEL,8);
217 intf_AssignKey(p_intf, SDLK_9, INTF_KEY_SET_CHANNEL,9);
218 intf_AssignKey(p_intf, SDLK_PLUS, INTF_KEY_INC_VOLUME, 0);
219 intf_AssignKey(p_intf, SDLK_MINUS, INTF_KEY_DEC_VOLUME, 0);
220 intf_AssignKey(p_intf, SDLK_m, INTF_KEY_TOGGLE_VOLUME, 0);
221 /* intf_AssignKey(p_intf,'M','M'); */
222 intf_AssignKey(p_intf, SDLK_g, INTF_KEY_DEC_GAMMA, 0);
223 /* intf_AssignKey(p_intf,'G','G'); */
224 intf_AssignKey(p_intf, SDLK_c, INTF_KEY_TOGGLE_GRAYSCALE, 0);
225 intf_AssignKey(p_intf, SDLK_SPACE, INTF_KEY_TOGGLE_INTERFACE, 0);
226 intf_AssignKey(p_intf, SDLK_i, INTF_KEY_TOGGLE_INFO, 0);
227 intf_AssignKey(p_intf, SDLK_s, INTF_KEY_TOGGLE_SCALING, 0);
228 intf_AssignKey(p_intf, SDLK_d, INTF_KEY_DUMP_STREAM, 0); }
233 /*****************************************************************************
234 * vout_Init: initialize SDL video thread output method
235 *****************************************************************************
236 * This function initialize the SDL display device.
237 *****************************************************************************/
238 static int vout_Init( vout_thread_t *p_vout )
240 /* This hack is hugly, but hey, you are, too. */
242 SDL_Overlay * p_overlay;
244 p_overlay = SDL_CreateYUVOverlay(
245 main_GetIntVariable( VOUT_WIDTH_VAR,VOUT_WIDTH_DEFAULT ),
246 main_GetIntVariable( VOUT_HEIGHT_VAR,VOUT_HEIGHT_DEFAULT ),
248 p_vout->p_sys->p_display );
250 if( p_overlay == NULL )
252 intf_ErrMsg( "vout error: could not create SDL overlay" );
253 p_vout->b_need_render = 1;
257 intf_WarnMsg( 2, "vout: YUV acceleration %s",
258 p_overlay->hw_overlay ? "activated" : "unavailable !" );
259 p_vout->b_need_render = !p_overlay->hw_overlay;
261 SDL_FreeYUVOverlay( p_overlay );
266 /*****************************************************************************
267 * vout_End: terminate Sys video thread output method
268 *****************************************************************************
269 * Terminate an output method created by vout_SDLCreate
270 *****************************************************************************/
271 static void vout_End( vout_thread_t *p_vout )
273 SDLCloseDisplay( p_vout );
274 SDL_QuitSubSystem( SDL_INIT_VIDEO );
277 /*****************************************************************************
278 * vout_Destroy: destroy Sys video thread output method
279 *****************************************************************************
280 * Terminate an output method created by vout_SDLCreate
281 *****************************************************************************/
282 static void vout_Destroy( vout_thread_t *p_vout )
284 free( p_vout->p_sys );
287 /*****************************************************************************
288 * vout_Manage: handle Sys events
289 *****************************************************************************
290 * This function should be called regularly by video output thread. It returns
291 * a non null value if an error occured.
292 *****************************************************************************/
293 static int vout_Manage( vout_thread_t *p_vout )
295 SDL_Event event; /* SDL event */
299 while( SDL_PollEvent(&event) )
303 case SDL_VIDEORESIZE: /* Resizing of window */
304 p_vout->i_width = event.resize.w;
305 p_vout->i_height = event.resize.h;
306 p_vout->i_changes |= VOUT_SIZE_CHANGE;
309 case SDL_MOUSEMOTION:
310 if( p_vout->p_sys->b_cursor &&
311 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
313 if( p_vout->p_sys->b_cursor_autohidden )
315 p_vout->p_sys->b_cursor_autohidden = 0;
320 p_vout->p_sys->i_lastmoved = mdate();
325 case SDL_MOUSEBUTTONUP:
326 switch( event.button.button )
328 case SDL_BUTTON_RIGHT:
329 p_main->p_intf->b_menu_change = 1;
334 case SDL_MOUSEBUTTONDOWN:
335 switch( event.button.button )
337 case SDL_BUTTON_MIDDLE:
338 p_vout->i_changes |= VOUT_CURSOR_CHANGE;
344 intf_ProcessKey( p_main->p_intf, SDLK_q );
347 case SDL_KEYDOWN: /* if a key is pressed */
349 switch( event.key.keysym.sym )
351 case SDLK_f: /* switch to fullscreen */
352 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
355 case SDLK_y: /* switch to hard YUV */
356 p_vout->i_changes |= VOUT_YUV_CHANGE;
359 case SDLK_c: /* toggle grayscale */
360 p_vout->b_grayscale = ! p_vout->b_grayscale;
361 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
364 case SDLK_i: /* toggle info */
365 p_vout->b_info = ! p_vout->b_info;
366 p_vout->i_changes |= VOUT_INFO_CHANGE;
369 case SDLK_s: /* toggle scaling */
370 p_vout->b_scale = ! p_vout->b_scale;
371 p_vout->i_changes |= VOUT_SCALE_CHANGE;
374 case SDLK_SPACE: /* toggle interface */
375 p_vout->b_interface = ! p_vout->b_interface;
376 p_vout->i_changes |= VOUT_INTF_CHANGE;
380 network_ChannelJoin( 0 );
383 network_ChannelJoin( 1 );
386 network_ChannelJoin( 2 );
389 network_ChannelJoin( 3 );
392 network_ChannelJoin( 4 );
395 network_ChannelJoin( 5 );
398 network_ChannelJoin( 6 );
401 network_ChannelJoin( 7 );
404 network_ChannelJoin( 8 );
407 network_ChannelJoin( 9 );
411 p_main->p_intf->b_menu_change = 1;
415 p_key = SDL_GetKeyName( event.key.keysym.sym ) ;
416 if( intf_ProcessKey( p_main->p_intf,
417 (char )event.key.keysym.sym ) )
419 intf_DbgMsg( "unhandled key '%c' (%i)",
420 (char)event.key.keysym.sym,
421 event.key.keysym.sym );
435 if( p_vout->i_changes & VOUT_SIZE_CHANGE )
437 p_vout->p_sys->i_width = p_vout->i_width;
438 p_vout->p_sys->i_height = p_vout->i_height;
440 /* Need to reopen display */
441 SDLCloseDisplay( p_vout );
442 if( SDLOpenDisplay( p_vout ) )
444 intf_ErrMsg( "vout error: can't reopen display after resize" );
447 p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
453 if( p_vout->i_changes & VOUT_YUV_CHANGE )
455 p_vout->b_need_render = ! p_vout->b_need_render;
457 /* Need to reopen display */
458 SDLCloseDisplay( p_vout );
459 if( SDLOpenDisplay( p_vout ) )
461 intf_ErrMsg( "error: can't reopen display after YUV change" );
464 p_vout->i_changes &= ~VOUT_YUV_CHANGE;
470 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
472 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
474 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
476 p_vout->p_sys->b_cursor_autohidden = 0;
477 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
478 ! p_vout->p_sys->b_cursor_autohidden );
480 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
486 if( ! p_vout->p_sys->b_cursor_autohidden &&
487 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
489 /* Hide the mouse automatically */
490 p_vout->p_sys->b_cursor_autohidden = 1;
494 if( p_vout->i_changes & VOUT_CURSOR_CHANGE )
496 p_vout->p_sys->b_cursor = ! p_vout->p_sys->b_cursor;
498 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
499 ! p_vout->p_sys->b_cursor_autohidden );
501 p_vout->i_changes &= ~VOUT_CURSOR_CHANGE;
507 /*****************************************************************************
508 * vout_SetPalette: sets an 8 bpp palette
509 *****************************************************************************
510 * This function sets the palette given as an argument. It does not return
511 * anything, but could later send information on which colors it was unable
513 *****************************************************************************/
514 static void vout_SetPalette( p_vout_thread_t p_vout, u16 *red, u16 *green,
515 u16 *blue, u16 *transp)
517 /* Create a display surface with a grayscale palette */
518 SDL_Color colors[256];
521 /* Fill colors with color information */
522 for( i = 0; i < 256; i++ )
524 colors[ i ].r = red[ i ] >> 8;
525 colors[ i ].g = green[ i ] >> 8;
526 colors[ i ].b = blue[ i ] >> 8;
530 if( SDL_SetColors( p_vout->p_sys->p_display, colors, 0, 256 ) == 0 )
532 intf_ErrMsg( "vout error: failed setting palette" );
537 /*****************************************************************************
538 * vout_Display: displays previously rendered output
539 *****************************************************************************
540 * This function send the currently rendered image to the display, wait until
541 * it is displayed and switch the two rendering buffer, preparing next frame.
542 *****************************************************************************/
543 static void vout_Display( vout_thread_t *p_vout )
546 if((p_vout->p_sys->p_display != NULL) && !p_vout->p_sys->b_reopen_display)
548 if( !p_vout->b_need_render )
551 * p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to
554 /* TODO: support for streams other than 4:2:0 */
555 /* create the overlay if necessary */
556 if( p_vout->p_sys->p_overlay == NULL )
558 p_vout->p_sys->p_overlay = SDL_CreateYUVOverlay(
559 p_vout->p_rendered_pic->i_width,
560 p_vout->p_rendered_pic->i_height,
562 p_vout->p_sys->p_display
566 if( p_vout->p_sys->p_overlay == NULL )
568 /* Overlay allocation failed, switch back to software mode */
569 intf_ErrMsg( "vout error: could not create SDL overlay" );
570 p_vout->b_need_render = 1;
575 intf_WarnMsg( 2, "vout: YUV acceleration %s",
576 p_vout->p_sys->p_overlay->hw_overlay
577 ? "activated" : "unavailable !" );
579 SDL_LockYUVOverlay(p_vout->p_sys->p_overlay);
580 /* copy the data into video buffers */
582 memcpy(p_vout->p_sys->p_overlay->pixels[0],
583 p_vout->p_rendered_pic->p_y,
584 p_vout->p_sys->p_overlay->h *
585 p_vout->p_sys->p_overlay->pitches[0]);
587 memcpy(p_vout->p_sys->p_overlay->pixels[1],
588 p_vout->p_rendered_pic->p_v,
589 p_vout->p_sys->p_overlay->h *
590 p_vout->p_sys->p_overlay->pitches[1] / 2);
592 memcpy(p_vout->p_sys->p_overlay->pixels[2],
593 p_vout->p_rendered_pic->p_u,
594 p_vout->p_sys->p_overlay->h *
595 p_vout->p_sys->p_overlay->pitches[2] / 2);
597 #define BUFFER (&p_vout->p_buffer[p_vout->i_buffer_index])
598 disp.w = BUFFER->i_pic_width;
599 disp.h = BUFFER->i_pic_height;
601 disp.x = (p_vout->i_width - disp.w)/2;
602 disp.y = (p_vout->i_height - disp.h)/2;
604 SDL_DisplayYUVOverlay( p_vout->p_sys->p_overlay , &disp );
605 SDL_UnlockYUVOverlay(p_vout->p_sys->p_overlay);
611 /* Software YUV: change display frame */
612 SDL_Flip( p_vout->p_sys->p_display );
616 /* following functions are local */
618 /*****************************************************************************
619 * SDLOpenDisplay: open and initialize SDL device
620 *****************************************************************************
621 * Open and initialize display according to preferences specified in the vout
623 *****************************************************************************/
624 static int SDLOpenDisplay( vout_thread_t *p_vout )
626 SDL_Rect clipping_rect;
630 * TODO: Check that we can request for a DOUBLEBUF HWSURFACE display
633 /* init flags and cursor */
634 flags = SDL_ANYFORMAT | SDL_HWPALETTE;
636 if( p_vout->b_fullscreen )
638 flags |= SDL_FULLSCREEN;
642 flags |= SDL_RESIZABLE;
645 if( p_vout->b_need_render )
647 flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
651 flags |= SDL_SWSURFACE; /* save video memory */
654 bpp = SDL_VideoModeOK( p_vout->p_sys->i_width,
655 p_vout->p_sys->i_height,
656 p_vout->i_screen_depth, flags );
660 intf_ErrMsg( "vout error: no video mode available" );
664 p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->p_sys->i_width,
665 p_vout->p_sys->i_height,
668 if( p_vout->p_sys->p_display == NULL )
670 intf_ErrMsg( "vout error: cannot set video mode" );
674 SDL_LockSurface( p_vout->p_sys->p_display );
676 SDL_WM_SetCaption( VOUT_TITLE " (SDL output)",
677 VOUT_TITLE " (SDL output)" );
678 SDL_EventState(SDL_KEYUP , SDL_IGNORE); /* ignore keys up */
680 if( p_vout->b_need_render )
682 p_vout->p_sys->p_sdl_buf[ 0 ] = p_vout->p_sys->p_display->pixels;
683 SDL_Flip(p_vout->p_sys->p_display);
684 p_vout->p_sys->p_sdl_buf[ 1 ] = p_vout->p_sys->p_display->pixels;
685 SDL_Flip(p_vout->p_sys->p_display);
687 /* Set clipping for text */
690 clipping_rect.w = p_vout->p_sys->p_display->w;
691 clipping_rect.h = p_vout->p_sys->p_display->h;
692 SDL_SetClipRect(p_vout->p_sys->p_display, &clipping_rect);
694 /* Set thread information */
695 p_vout->i_width = p_vout->p_sys->p_display->w;
696 p_vout->i_height = p_vout->p_sys->p_display->h;
697 p_vout->i_bytes_per_line = p_vout->p_sys->p_display->pitch;
699 p_vout->i_screen_depth =
700 p_vout->p_sys->p_display->format->BitsPerPixel;
701 p_vout->i_bytes_per_pixel =
702 p_vout->p_sys->p_display->format->BytesPerPixel;
704 p_vout->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
705 p_vout->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
706 p_vout->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
708 /* FIXME: palette in 8bpp ?? */
709 /* Set and initialize buffers */
710 p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_sdl_buf[ 0 ],
711 p_vout->p_sys->p_sdl_buf[ 1 ] );
715 p_vout->p_sys->p_sdl_buf[ 0 ] = p_vout->p_sys->p_display->pixels;
716 p_vout->p_sys->p_sdl_buf[ 1 ] = p_vout->p_sys->p_display->pixels;
718 /* Set thread information */
719 p_vout->i_width = p_vout->p_sys->p_display->w;
720 p_vout->i_height = p_vout->p_sys->p_display->h;
721 p_vout->i_bytes_per_line = p_vout->p_sys->p_display->pitch;
723 p_vout->pf_setbuffers( p_vout, p_vout->p_sys->p_sdl_buf[ 0 ],
724 p_vout->p_sys->p_sdl_buf[ 1 ] );
727 p_vout->p_sys->b_reopen_display = 0;
732 /*****************************************************************************
733 * SDLCloseDisplay: close and reset SDL device
734 *****************************************************************************
735 * This function returns all resources allocated by SDLOpenDisplay and restore
736 * the original state of the device.
737 *****************************************************************************/
738 static void SDLCloseDisplay( vout_thread_t *p_vout )
740 if( p_vout->p_sys->p_display != NULL )
742 if( p_vout->p_sys->p_overlay != NULL )
744 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
745 p_vout->p_sys->p_overlay = NULL;
748 SDL_UnlockSurface ( p_vout->p_sys->p_display );
749 SDL_FreeSurface( p_vout->p_sys->p_display );
750 p_vout->p_sys->p_display = NULL;