1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: vout_sdl.c,v 1.78 2002/01/05 03:49:18 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 /*****************************************************************************
28 *****************************************************************************/
29 #include <errno.h> /* ENOMEM */
30 #include <stdlib.h> /* free() */
31 #include <string.h> /* strerror() */
33 #include <videolan/vlc.h>
35 #include <sys/types.h>
37 # include <netinet/in.h> /* BSD: struct in_addr */
40 #include SDL_INCLUDE_FILE
45 #include "video_output.h"
47 #include "interface.h"
49 #include "stream_control.h" /* needed by input_ext-intf.h... */
50 #include "input_ext-intf.h"
52 #define SDL_MAX_DIRECTBUFFERS 5
53 #define SDL_DEFAULT_BPP 16
55 /*****************************************************************************
56 * vout_sys_t: video output SDL method descriptor
57 *****************************************************************************
58 * This structure is part of the video output thread descriptor.
59 * It describes the SDL specific properties of an output thread.
60 *****************************************************************************/
61 typedef struct vout_sys_s
63 SDL_Surface * p_display; /* display device */
69 SDL_Overlay * p_overlay; /* An overlay we keep to grab the XVideo port */
78 boolean_t b_cursor_autohidden;
83 /*****************************************************************************
84 * picture_sys_t: direct buffer method descriptor
85 *****************************************************************************
86 * This structure is part of the picture descriptor, it describes the
87 * SDL specific properties of a direct buffer.
88 *****************************************************************************/
89 typedef struct picture_sys_s
91 SDL_Overlay *p_overlay;
95 /*****************************************************************************
96 * Seeking function TODO: put this in a generic location !
97 *****************************************************************************/
98 static __inline__ void vout_Seek( off_t i_seek )
100 #define area p_main->p_intf->p_input->stream.p_selected_area
101 off_t i_tell = area->i_tell;
103 i_tell += i_seek * (off_t)50 * p_main->p_intf->p_input->stream.i_mux_rate;
105 i_tell = ( i_tell <= area->i_start ) ? area->i_start
106 : ( i_tell >= area->i_size ) ? area->i_size
109 input_Seek( p_main->p_intf->p_input, i_tell );
113 /*****************************************************************************
115 *****************************************************************************/
116 static int vout_Probe ( probedata_t *p_data );
117 static int vout_Create ( struct vout_thread_s * );
118 static int vout_Init ( struct vout_thread_s * );
119 static void vout_End ( struct vout_thread_s * );
120 static void vout_Destroy ( struct vout_thread_s * );
121 static int vout_Manage ( struct vout_thread_s * );
122 static void vout_Render ( struct vout_thread_s *, struct picture_s * );
123 static void vout_Display ( struct vout_thread_s *, struct picture_s * );
125 static int SDLOpenDisplay ( vout_thread_t *p_vout );
126 static void SDLCloseDisplay ( vout_thread_t *p_vout );
127 static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
129 /*****************************************************************************
130 * Functions exported as capabilities. They are declared as static so that
131 * we don't pollute the namespace too much.
132 *****************************************************************************/
133 void _M( vout_getfunctions )( function_list_t * p_function_list )
135 p_function_list->pf_probe = vout_Probe;
136 p_function_list->functions.vout.pf_create = vout_Create;
137 p_function_list->functions.vout.pf_init = vout_Init;
138 p_function_list->functions.vout.pf_end = vout_End;
139 p_function_list->functions.vout.pf_destroy = vout_Destroy;
140 p_function_list->functions.vout.pf_manage = vout_Manage;
141 p_function_list->functions.vout.pf_render = vout_Render;
142 p_function_list->functions.vout.pf_display = vout_Display;
145 /*****************************************************************************
146 * vout_Probe: probe the video driver and return a score
147 *****************************************************************************
148 * This function tries to initialize SDL and returns a score to the
149 * plugin manager so that it can select the best plugin.
150 *****************************************************************************/
151 static int vout_Probe( probedata_t *p_data )
153 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
161 /*****************************************************************************
162 * vout_Create: allocate SDL video thread output method
163 *****************************************************************************
164 * This function allocate and initialize a SDL vout method. It uses some of the
165 * vout properties to choose the correct mode, and change them according to the
166 * mode actually used.
167 *****************************************************************************/
168 static int vout_Create( vout_thread_t *p_vout )
170 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
175 /* Allocate structure */
176 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
177 if( p_vout->p_sys == NULL )
179 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
183 /* Initialize library */
184 if( SDL_Init( SDL_INIT_VIDEO
186 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
187 | SDL_INIT_EVENTTHREAD
190 /* In debug mode you may want vlc to dump a core instead of staying
192 | SDL_INIT_NOPARACHUTE
196 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
197 free( p_vout->p_sys );
201 p_vout->p_sys->b_cursor = 1;
202 p_vout->p_sys->b_cursor_autohidden = 0;
203 p_vout->p_sys->i_lastmoved = mdate();
205 if( p_vout->render.i_height * p_vout->render.i_aspect
206 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
208 p_vout->p_sys->i_width = p_vout->render.i_height
209 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
210 p_vout->p_sys->i_height = p_vout->render.i_height;
214 p_vout->p_sys->i_width = p_vout->render.i_width;
215 p_vout->p_sys->i_height = p_vout->render.i_width
216 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
220 if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 300 )
222 p_vout->p_sys->i_width <<= 1;
223 p_vout->p_sys->i_height <<= 1;
225 else if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 400 )
227 p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
228 p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
232 if( SDLOpenDisplay( p_vout ) )
234 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
235 SDL_QuitSubSystem( SDL_INIT_VIDEO );
236 free( p_vout->p_sys );
243 /*****************************************************************************
244 * vout_Init: initialize SDL video thread output method
245 *****************************************************************************
246 * This function initialize the SDL display device.
247 *****************************************************************************/
248 static int vout_Init( vout_thread_t *p_vout )
253 p_vout->p_sys->i_surfaces = 0;
255 I_OUTPUTPICTURES = 0;
257 /* Initialize the output structure */
258 if( p_vout->p_sys->p_overlay == NULL )
260 /* All we have is an RGB image with square pixels */
261 p_vout->output.i_width = p_vout->p_sys->i_width;
262 p_vout->output.i_height = p_vout->p_sys->i_height;
263 p_vout->output.i_aspect = p_vout->p_sys->i_width
265 / p_vout->p_sys->i_height;
269 /* We may need to convert the chroma, but at least we keep the
271 p_vout->output.i_width = p_vout->render.i_width;
272 p_vout->output.i_height = p_vout->render.i_height;
273 p_vout->output.i_aspect = p_vout->render.i_aspect;
276 /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
277 while( I_OUTPUTPICTURES < SDL_MAX_DIRECTBUFFERS )
281 /* Find an empty picture slot */
282 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
284 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
286 p_pic = p_vout->p_picture + i_index;
291 /* Allocate the picture if we found one */
292 if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
297 p_pic->i_status = DESTROYED_PICTURE;
298 p_pic->i_type = DIRECT_PICTURE;
300 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
308 /*****************************************************************************
309 * vout_End: terminate Sys video thread output method
310 *****************************************************************************
311 * Terminate an output method created by vout_SDLCreate
312 *****************************************************************************/
313 static void vout_End( vout_thread_t *p_vout )
317 /* Free the output buffers we allocated */
318 for( i_index = I_OUTPUTPICTURES ; i_index ; )
321 if( p_vout->p_sys->p_overlay == NULL )
327 SDL_UnlockYUVOverlay(
328 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
330 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
332 free( PP_OUTPUTPICTURE[ i_index ]->p_sys );
336 /*****************************************************************************
337 * vout_Destroy: destroy Sys video thread output method
338 *****************************************************************************
339 * Terminate an output method created by vout_SDLCreate
340 *****************************************************************************/
341 static void vout_Destroy( vout_thread_t *p_vout )
343 SDLCloseDisplay( p_vout );
345 SDL_QuitSubSystem( SDL_INIT_VIDEO );
347 free( p_vout->p_sys );
350 /*****************************************************************************
351 * vout_Manage: handle Sys events
352 *****************************************************************************
353 * This function should be called regularly by video output thread. It returns
354 * a non null value if an error occured.
355 *****************************************************************************/
356 static int vout_Manage( vout_thread_t *p_vout )
358 SDL_Event event; /* SDL event */
361 while( SDL_PollEvent(&event) )
365 case SDL_VIDEORESIZE: /* Resizing of window */
366 p_vout->p_sys->i_width = event.resize.w;
367 p_vout->p_sys->i_height = event.resize.h;
368 SDLCloseDisplay( p_vout );
369 SDLOpenDisplay( p_vout );
372 case SDL_MOUSEMOTION:
373 if( p_vout->p_sys->b_cursor &&
374 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
376 if( p_vout->p_sys->b_cursor_autohidden )
378 p_vout->p_sys->b_cursor_autohidden = 0;
383 p_vout->p_sys->i_lastmoved = mdate();
388 case SDL_MOUSEBUTTONUP:
389 switch( event.button.button )
391 case SDL_BUTTON_RIGHT:
392 p_main->p_intf->b_menu_change = 1;
397 case SDL_MOUSEBUTTONDOWN:
398 switch( event.button.button )
400 case SDL_BUTTON_LEFT:
401 /* In this part we will eventually manage
402 * clicks for DVD navigation for instance. For the
403 * moment just pause the stream. */
404 input_SetStatus( p_main->p_intf->p_input, INPUT_STATUS_PAUSE );
418 p_main->p_intf->b_die = 1;
421 case SDL_KEYDOWN: /* if a key is pressed */
423 switch( event.key.keysym.sym )
425 case SDLK_q: /* quit */
427 p_main->p_intf->b_die = 1;
430 case SDLK_f: /* switch to fullscreen */
431 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
434 case SDLK_c: /* toggle grayscale */
435 p_vout->b_grayscale = ! p_vout->b_grayscale;
436 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
439 case SDLK_i: /* toggle info */
440 p_vout->b_info = ! p_vout->b_info;
441 p_vout->i_changes |= VOUT_INFO_CHANGE;
444 case SDLK_s: /* toggle scaling */
445 p_vout->b_scale = ! p_vout->b_scale;
446 p_vout->i_changes |= VOUT_SCALE_CHANGE;
449 case SDLK_SPACE: /* toggle interface */
450 p_vout->b_interface = ! p_vout->b_interface;
451 p_vout->i_changes |= VOUT_INTF_CHANGE;
455 p_main->p_intf->b_menu_change = 1;
474 case SDLK_F10: network_ChannelJoin( 0 ); break;
475 case SDLK_F1: network_ChannelJoin( 1 ); break;
476 case SDLK_F2: network_ChannelJoin( 2 ); break;
477 case SDLK_F3: network_ChannelJoin( 3 ); break;
478 case SDLK_F4: network_ChannelJoin( 4 ); break;
479 case SDLK_F5: network_ChannelJoin( 5 ); break;
480 case SDLK_F6: network_ChannelJoin( 6 ); break;
481 case SDLK_F7: network_ChannelJoin( 7 ); break;
482 case SDLK_F8: network_ChannelJoin( 8 ); break;
483 case SDLK_F9: network_ChannelJoin( 9 ); break;
486 intf_DbgMsg( "unhandled key %i", event.key.keysym.sym );
496 /* Fullscreen change */
497 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
499 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
501 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
503 p_vout->p_sys->b_cursor_autohidden = 0;
504 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
505 ! p_vout->p_sys->b_cursor_autohidden );
507 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
511 if( ! p_vout->p_sys->b_cursor_autohidden &&
512 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
514 /* Hide the mouse automatically */
515 p_vout->p_sys->b_cursor_autohidden = 1;
522 /*****************************************************************************
523 * vout_Render: render previously calculated output
524 *****************************************************************************/
525 static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
530 /*****************************************************************************
531 * vout_Display: displays previously rendered output
532 *****************************************************************************
533 * This function sends the currently rendered image to the display.
534 *****************************************************************************/
535 static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
540 vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
547 if( p_vout->p_sys->p_overlay == NULL )
550 SDL_Flip( p_vout->p_sys->p_display );
554 /* Overlay picture */
555 SDL_UnlockYUVOverlay( p_pic->p_sys->p_overlay);
556 SDL_DisplayYUVOverlay( p_pic->p_sys->p_overlay , &disp );
557 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay);
561 /* following functions are local */
563 /*****************************************************************************
564 * SDLOpenDisplay: open and initialize SDL device
565 *****************************************************************************
566 * Open and initialize display according to preferences specified in the vout
568 *****************************************************************************/
569 static int SDLOpenDisplay( vout_thread_t *p_vout )
574 /* Initialize flags and cursor */
575 i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
576 i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
578 i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
579 SDL_DEFAULT_BPP, i_flags );
582 intf_ErrMsg( "vout error: no video mode available" );
586 p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
587 p_vout->p_sys->i_height,
590 if( p_vout->p_sys->p_display == NULL )
592 intf_ErrMsg( "vout error: cannot set video mode" );
596 SDL_LockSurface( p_vout->p_sys->p_display );
598 /* Choose the chroma we will try first. */
599 switch( p_vout->render.i_chroma )
603 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
608 p_vout->output.i_chroma = SDL_UYVY_OVERLAY;
611 p_vout->output.i_chroma = SDL_YVYU_OVERLAY;
617 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
621 p_vout->p_sys->p_overlay =
622 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
623 p_vout->p_sys->p_display );
625 /* FIXME: if the first overlay we find is software, don't stop,
626 * because we may find a hardware one later ... */
628 /* If this best choice failed, fall back to other chromas */
629 if( p_vout->p_sys->p_overlay == NULL )
631 p_vout->output.i_chroma = SDL_IYUV_OVERLAY;
632 p_vout->p_sys->p_overlay =
633 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
634 p_vout->p_sys->p_display );
637 if( p_vout->p_sys->p_overlay == NULL )
639 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
640 p_vout->p_sys->p_overlay =
641 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
642 p_vout->p_sys->p_display );
645 if( p_vout->p_sys->p_overlay == NULL )
647 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
648 p_vout->p_sys->p_overlay =
649 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
650 p_vout->p_sys->p_display );
653 if( p_vout->p_sys->p_overlay == NULL )
655 intf_WarnMsg( 3, "vout warning: no SDL overlay for 0x%.8x (%4.4s)",
656 p_vout->render.i_chroma,
657 (char*)&p_vout->render.i_chroma );
659 switch( p_vout->p_sys->p_display->format->BitsPerPixel )
662 p_vout->output.i_chroma = FOURCC_BI_RGB;
665 p_vout->output.i_chroma = FOURCC_RV15;
668 p_vout->output.i_chroma = FOURCC_RV16;
671 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
674 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
677 intf_ErrMsg( "vout error: unknown screen depth" );
678 SDL_UnlockSurface( p_vout->p_sys->p_display );
679 SDL_FreeSurface( p_vout->p_sys->p_display );
683 p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
684 p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
685 p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
687 SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
688 VOUT_TITLE " (software RGB SDL output)" );
692 if( p_vout->p_sys->p_overlay->hw_overlay )
694 SDL_WM_SetCaption( VOUT_TITLE " (hardware YUV SDL output)",
695 VOUT_TITLE " (hardware YUV SDL output)" );
699 SDL_WM_SetCaption( VOUT_TITLE " (software YUV SDL output)",
700 VOUT_TITLE " (software YUV SDL output)" );
704 SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
709 /*****************************************************************************
710 * SDLCloseDisplay: close and reset SDL device
711 *****************************************************************************
712 * This function returns all resources allocated by SDLOpenDisplay and restore
713 * the original state of the device.
714 *****************************************************************************/
715 static void SDLCloseDisplay( vout_thread_t *p_vout )
717 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
718 SDL_UnlockSurface ( p_vout->p_sys->p_display );
719 SDL_FreeSurface( p_vout->p_sys->p_display );
722 /*****************************************************************************
723 * SDLNewPicture: allocate a picture
724 *****************************************************************************
725 * Returns 0 on success, -1 otherwise
726 *****************************************************************************/
727 static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
729 int i_width = p_vout->output.i_width;
730 int i_height = p_vout->output.i_height;
732 if( p_vout->p_sys->p_overlay == NULL )
735 if( p_vout->p_sys->i_surfaces )
737 /* We already allocated this surface, return */
741 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
743 if( p_pic->p_sys == NULL )
748 p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
749 p_pic->p->i_lines = p_vout->p_sys->p_display->h;
750 p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
751 p_pic->p->i_pixel_bytes = 2;
753 if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
755 p_pic->p->b_margin = 0;
759 p_pic->p->b_margin = 1;
760 p_pic->p->b_hidden = 1;
761 p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
764 p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
765 p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
766 p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
768 p_vout->p_sys->i_surfaces++;
774 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
776 if( p_pic->p_sys == NULL )
781 p_pic->p_sys->p_overlay =
782 SDL_CreateYUVOverlay( i_width, i_height,
783 p_vout->output.i_chroma,
784 p_vout->p_sys->p_display );
786 if( p_pic->p_sys->p_overlay == NULL )
788 free( p_pic->p_sys );
792 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
794 p_pic->Y_PIXELS = p_pic->p_sys->p_overlay->pixels[0];
795 p_pic->p[Y_PLANE].i_lines = p_pic->p_sys->p_overlay->h;
796 p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[0];
798 switch( p_vout->output.i_chroma )
800 case SDL_YV12_OVERLAY:
801 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
802 p_pic->p[Y_PLANE].b_margin = 0;
804 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
805 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
806 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
807 p_pic->p[U_PLANE].i_pixel_bytes = 1;
808 p_pic->p[U_PLANE].b_margin = 0;
810 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
811 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
812 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
813 p_pic->p[V_PLANE].i_pixel_bytes = 1;
814 p_pic->p[V_PLANE].b_margin = 0;
819 case SDL_IYUV_OVERLAY:
820 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
821 p_pic->p[Y_PLANE].b_margin = 0;
823 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
824 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
825 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
826 p_pic->p[U_PLANE].i_pixel_bytes = 1;
827 p_pic->p[U_PLANE].b_margin = 0;
829 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
830 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
831 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
832 p_pic->p[V_PLANE].i_pixel_bytes = 1;
833 p_pic->p[V_PLANE].b_margin = 0;
839 p_pic->p[Y_PLANE].i_pixel_bytes = 2;
840 p_pic->p[Y_PLANE].b_margin = 0;