1 /*****************************************************************************
2 * vout_sdl.c: SDL video output display method
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: vout_sdl.c,v 1.82 2002/02/19 00:50:19 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 10
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 )
102 vlc_mutex_lock( &p_input_bank->lock );
103 if( p_input_bank->pp_input[0] != NULL )
105 #define S p_input_bank->pp_input[0]->stream
106 i_tell = S.p_selected_area->i_tell + i_seek * (off_t)50 * S.i_mux_rate;
108 i_tell = ( i_tell <= 0 /*S.p_selected_area->i_start*/ )
109 ? 0 /*S.p_selected_area->i_start*/
110 : ( i_tell >= S.p_selected_area->i_size )
111 ? S.p_selected_area->i_size
114 input_Seek( p_input_bank->pp_input[0], i_tell );
117 vlc_mutex_unlock( &p_input_bank->lock );
120 /*****************************************************************************
122 *****************************************************************************/
123 static int vout_Create ( struct vout_thread_s * );
124 static int vout_Init ( struct vout_thread_s * );
125 static void vout_End ( struct vout_thread_s * );
126 static void vout_Destroy ( struct vout_thread_s * );
127 static int vout_Manage ( struct vout_thread_s * );
128 static void vout_Render ( struct vout_thread_s *, struct picture_s * );
129 static void vout_Display ( struct vout_thread_s *, struct picture_s * );
131 static int SDLOpenDisplay ( vout_thread_t *p_vout );
132 static void SDLCloseDisplay ( vout_thread_t *p_vout );
133 static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
135 /*****************************************************************************
136 * Functions exported as capabilities. They are declared as static so that
137 * we don't pollute the namespace too much.
138 *****************************************************************************/
139 void _M( vout_getfunctions )( function_list_t * p_function_list )
141 p_function_list->functions.vout.pf_create = vout_Create;
142 p_function_list->functions.vout.pf_init = vout_Init;
143 p_function_list->functions.vout.pf_end = vout_End;
144 p_function_list->functions.vout.pf_destroy = vout_Destroy;
145 p_function_list->functions.vout.pf_manage = vout_Manage;
146 p_function_list->functions.vout.pf_render = vout_Render;
147 p_function_list->functions.vout.pf_display = vout_Display;
150 /*****************************************************************************
151 * vout_Create: allocate SDL video thread output method
152 *****************************************************************************
153 * This function allocate and initialize a SDL vout method. It uses some of the
154 * vout properties to choose the correct mode, and change them according to the
155 * mode actually used.
156 *****************************************************************************/
157 static int vout_Create( vout_thread_t *p_vout )
159 if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
164 /* Allocate structure */
165 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
166 if( p_vout->p_sys == NULL )
168 intf_ErrMsg( "vout error: can't create p_sys (%s)", strerror(ENOMEM) );
172 /* Initialize library */
173 if( SDL_Init( SDL_INIT_VIDEO
175 /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
176 | SDL_INIT_EVENTTHREAD
179 /* In debug mode you may want vlc to dump a core instead of staying
181 | SDL_INIT_NOPARACHUTE
185 intf_ErrMsg( "vout error: can't initialize SDL (%s)", SDL_GetError() );
186 free( p_vout->p_sys );
190 p_vout->p_sys->b_cursor = 1;
191 p_vout->p_sys->b_cursor_autohidden = 0;
192 p_vout->p_sys->i_lastmoved = mdate();
194 if( p_vout->render.i_height * p_vout->render.i_aspect
195 >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
197 p_vout->p_sys->i_width = p_vout->render.i_height
198 * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
199 p_vout->p_sys->i_height = p_vout->render.i_height;
203 p_vout->p_sys->i_width = p_vout->render.i_width;
204 p_vout->p_sys->i_height = p_vout->render.i_width
205 * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
209 if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 300 )
211 p_vout->p_sys->i_width <<= 1;
212 p_vout->p_sys->i_height <<= 1;
214 else if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 400 )
216 p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
217 p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
221 if( SDLOpenDisplay( p_vout ) )
223 intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
224 SDL_QuitSubSystem( SDL_INIT_VIDEO );
225 free( p_vout->p_sys );
232 /*****************************************************************************
233 * vout_Init: initialize SDL video thread output method
234 *****************************************************************************
235 * This function initialize the SDL display device.
236 *****************************************************************************/
237 static int vout_Init( vout_thread_t *p_vout )
242 p_vout->p_sys->i_surfaces = 0;
244 I_OUTPUTPICTURES = 0;
246 /* Initialize the output structure */
247 if( p_vout->p_sys->p_overlay == NULL )
249 /* All we have is an RGB image with square pixels */
250 p_vout->output.i_width = p_vout->p_sys->i_width;
251 p_vout->output.i_height = p_vout->p_sys->i_height;
252 p_vout->output.i_aspect = p_vout->p_sys->i_width
254 / p_vout->p_sys->i_height;
258 /* We may need to convert the chroma, but at least we keep the
260 p_vout->output.i_width = p_vout->render.i_width;
261 p_vout->output.i_height = p_vout->render.i_height;
262 p_vout->output.i_aspect = p_vout->render.i_aspect;
265 /* Try to initialize SDL_MAX_DIRECTBUFFERS direct buffers */
266 while( I_OUTPUTPICTURES < SDL_MAX_DIRECTBUFFERS )
270 /* Find an empty picture slot */
271 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
273 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
275 p_pic = p_vout->p_picture + i_index;
280 /* Allocate the picture if we found one */
281 if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
286 p_pic->i_status = DESTROYED_PICTURE;
287 p_pic->i_type = DIRECT_PICTURE;
289 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
297 /*****************************************************************************
298 * vout_End: terminate Sys video thread output method
299 *****************************************************************************
300 * Terminate an output method created by vout_SDLCreate
301 *****************************************************************************/
302 static void vout_End( vout_thread_t *p_vout )
306 /* Free the output buffers we allocated */
307 for( i_index = I_OUTPUTPICTURES ; i_index ; )
310 if( p_vout->p_sys->p_overlay == NULL )
316 SDL_UnlockYUVOverlay(
317 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
319 PP_OUTPUTPICTURE[ i_index ]->p_sys->p_overlay );
321 free( PP_OUTPUTPICTURE[ i_index ]->p_sys );
325 /*****************************************************************************
326 * vout_Destroy: destroy Sys video thread output method
327 *****************************************************************************
328 * Terminate an output method created by vout_SDLCreate
329 *****************************************************************************/
330 static void vout_Destroy( vout_thread_t *p_vout )
332 SDLCloseDisplay( p_vout );
334 SDL_QuitSubSystem( SDL_INIT_VIDEO );
336 free( p_vout->p_sys );
339 /*****************************************************************************
340 * vout_Manage: handle Sys events
341 *****************************************************************************
342 * This function should be called regularly by video output thread. It returns
343 * a non null value if an error occured.
344 *****************************************************************************/
345 static int vout_Manage( vout_thread_t *p_vout )
347 SDL_Event event; /* SDL event */
350 while( SDL_PollEvent(&event) )
354 case SDL_VIDEORESIZE: /* Resizing of window */
355 p_vout->p_sys->i_width = event.resize.w;
356 p_vout->p_sys->i_height = event.resize.h;
357 SDLCloseDisplay( p_vout );
358 SDLOpenDisplay( p_vout );
361 case SDL_MOUSEMOTION:
362 if( p_vout->p_sys->b_cursor &&
363 (abs(event.motion.xrel) > 2 || abs(event.motion.yrel) > 2) )
365 if( p_vout->p_sys->b_cursor_autohidden )
367 p_vout->p_sys->b_cursor_autohidden = 0;
372 p_vout->p_sys->i_lastmoved = mdate();
377 case SDL_MOUSEBUTTONUP:
378 switch( event.button.button )
380 case SDL_BUTTON_RIGHT:
381 p_main->p_intf->b_menu_change = 1;
386 case SDL_MOUSEBUTTONDOWN:
387 switch( event.button.button )
389 case SDL_BUTTON_LEFT:
390 /* In this part we will eventually manage
391 * clicks for DVD navigation for instance. For the
392 * moment just pause the stream. */
393 input_SetStatus( p_input_bank->pp_input[0],
394 INPUT_STATUS_PAUSE );
408 p_main->p_intf->b_die = 1;
411 case SDL_KEYDOWN: /* if a key is pressed */
413 switch( event.key.keysym.sym )
415 case SDLK_q: /* quit */
417 p_main->p_intf->b_die = 1;
420 case SDLK_f: /* switch to fullscreen */
421 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
424 case SDLK_c: /* toggle grayscale */
425 p_vout->b_grayscale = ! p_vout->b_grayscale;
426 p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE;
429 case SDLK_i: /* toggle info */
430 p_vout->b_info = ! p_vout->b_info;
431 p_vout->i_changes |= VOUT_INFO_CHANGE;
434 case SDLK_s: /* toggle scaling */
435 p_vout->b_scale = ! p_vout->b_scale;
436 p_vout->i_changes |= VOUT_SCALE_CHANGE;
439 case SDLK_SPACE: /* toggle interface */
440 p_vout->b_interface = ! p_vout->b_interface;
441 p_vout->i_changes |= VOUT_INTF_CHANGE;
445 p_main->p_intf->b_menu_change = 1;
464 case SDLK_F10: network_ChannelJoin( 0 ); break;
465 case SDLK_F1: network_ChannelJoin( 1 ); break;
466 case SDLK_F2: network_ChannelJoin( 2 ); break;
467 case SDLK_F3: network_ChannelJoin( 3 ); break;
468 case SDLK_F4: network_ChannelJoin( 4 ); break;
469 case SDLK_F5: network_ChannelJoin( 5 ); break;
470 case SDLK_F6: network_ChannelJoin( 6 ); break;
471 case SDLK_F7: network_ChannelJoin( 7 ); break;
472 case SDLK_F8: network_ChannelJoin( 8 ); break;
473 case SDLK_F9: network_ChannelJoin( 9 ); break;
485 /* Fullscreen change */
486 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
488 p_vout->b_fullscreen = ! p_vout->b_fullscreen;
490 SDL_WM_ToggleFullScreen(p_vout->p_sys->p_display);
492 p_vout->p_sys->b_cursor_autohidden = 0;
493 SDL_ShowCursor( p_vout->p_sys->b_cursor &&
494 ! p_vout->p_sys->b_cursor_autohidden );
496 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
500 if( ! p_vout->p_sys->b_cursor_autohidden &&
501 ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
503 /* Hide the mouse automatically */
504 p_vout->p_sys->b_cursor_autohidden = 1;
511 /*****************************************************************************
512 * vout_Render: render previously calculated output
513 *****************************************************************************/
514 static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
519 /*****************************************************************************
520 * vout_Display: displays previously rendered output
521 *****************************************************************************
522 * This function sends the currently rendered image to the display.
523 *****************************************************************************/
524 static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
529 vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
536 if( p_vout->p_sys->p_overlay == NULL )
539 SDL_Flip( p_vout->p_sys->p_display );
543 /* Overlay picture */
544 SDL_UnlockYUVOverlay( p_pic->p_sys->p_overlay);
545 SDL_DisplayYUVOverlay( p_pic->p_sys->p_overlay , &disp );
546 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay);
550 /* following functions are local */
552 /*****************************************************************************
553 * SDLOpenDisplay: open and initialize SDL device
554 *****************************************************************************
555 * Open and initialize display according to preferences specified in the vout
557 *****************************************************************************/
558 static int SDLOpenDisplay( vout_thread_t *p_vout )
563 /* Initialize flags and cursor */
564 i_flags = SDL_ANYFORMAT | SDL_HWPALETTE | SDL_HWSURFACE | SDL_DOUBLEBUF;
565 i_flags |= p_vout->b_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE;
567 i_bpp = SDL_VideoModeOK( p_vout->p_sys->i_width, p_vout->p_sys->i_height,
568 SDL_DEFAULT_BPP, i_flags );
571 intf_ErrMsg( "vout error: no video mode available" );
575 p_vout->p_sys->p_display = SDL_SetVideoMode( p_vout->p_sys->i_width,
576 p_vout->p_sys->i_height,
579 if( p_vout->p_sys->p_display == NULL )
581 intf_ErrMsg( "vout error: cannot set video mode" );
585 SDL_LockSurface( p_vout->p_sys->p_display );
587 /* Choose the chroma we will try first. */
588 switch( p_vout->render.i_chroma )
592 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
597 p_vout->output.i_chroma = SDL_UYVY_OVERLAY;
600 p_vout->output.i_chroma = SDL_YVYU_OVERLAY;
606 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
610 p_vout->p_sys->p_overlay =
611 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
612 p_vout->p_sys->p_display );
614 /* FIXME: if the first overlay we find is software, don't stop,
615 * because we may find a hardware one later ... */
617 /* If this best choice failed, fall back to other chromas */
618 if( p_vout->p_sys->p_overlay == NULL )
620 p_vout->output.i_chroma = SDL_IYUV_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 );
626 if( p_vout->p_sys->p_overlay == NULL )
628 p_vout->output.i_chroma = SDL_YV12_OVERLAY;
629 p_vout->p_sys->p_overlay =
630 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
631 p_vout->p_sys->p_display );
634 if( p_vout->p_sys->p_overlay == NULL )
636 p_vout->output.i_chroma = SDL_YUY2_OVERLAY;
637 p_vout->p_sys->p_overlay =
638 SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
639 p_vout->p_sys->p_display );
642 if( p_vout->p_sys->p_overlay == NULL )
644 intf_WarnMsg( 3, "vout warning: no SDL overlay for 0x%.8x (%4.4s)",
645 p_vout->render.i_chroma,
646 (char*)&p_vout->render.i_chroma );
648 switch( p_vout->p_sys->p_display->format->BitsPerPixel )
651 p_vout->output.i_chroma = FOURCC_BI_RGB;
654 p_vout->output.i_chroma = FOURCC_RV15;
657 p_vout->output.i_chroma = FOURCC_RV16;
660 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
663 p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
666 intf_ErrMsg( "vout error: unknown screen depth" );
667 SDL_UnlockSurface( p_vout->p_sys->p_display );
668 SDL_FreeSurface( p_vout->p_sys->p_display );
672 p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
673 p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
674 p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
676 SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
677 VOUT_TITLE " (software RGB SDL output)" );
681 if( p_vout->p_sys->p_overlay->hw_overlay )
683 SDL_WM_SetCaption( VOUT_TITLE " (hardware YUV SDL output)",
684 VOUT_TITLE " (hardware YUV SDL output)" );
688 SDL_WM_SetCaption( VOUT_TITLE " (software YUV SDL output)",
689 VOUT_TITLE " (software YUV SDL output)" );
693 SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
698 /*****************************************************************************
699 * SDLCloseDisplay: close and reset SDL device
700 *****************************************************************************
701 * This function returns all resources allocated by SDLOpenDisplay and restore
702 * the original state of the device.
703 *****************************************************************************/
704 static void SDLCloseDisplay( vout_thread_t *p_vout )
706 SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
707 SDL_UnlockSurface ( p_vout->p_sys->p_display );
708 SDL_FreeSurface( p_vout->p_sys->p_display );
711 /*****************************************************************************
712 * SDLNewPicture: allocate a picture
713 *****************************************************************************
714 * Returns 0 on success, -1 otherwise
715 *****************************************************************************/
716 static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
718 int i_width = p_vout->output.i_width;
719 int i_height = p_vout->output.i_height;
721 if( p_vout->p_sys->p_overlay == NULL )
724 if( p_vout->p_sys->i_surfaces )
726 /* We already allocated this surface, return */
730 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
732 if( p_pic->p_sys == NULL )
737 p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
738 p_pic->p->i_lines = p_vout->p_sys->p_display->h;
739 p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
740 p_pic->p->i_pixel_bytes = 2;
742 if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
744 p_pic->p->b_margin = 0;
748 p_pic->p->b_margin = 1;
749 p_pic->p->b_hidden = 1;
750 p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
753 p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
754 p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
755 p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
757 p_vout->p_sys->i_surfaces++;
763 p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
765 if( p_pic->p_sys == NULL )
770 p_pic->p_sys->p_overlay =
771 SDL_CreateYUVOverlay( i_width, i_height,
772 p_vout->output.i_chroma,
773 p_vout->p_sys->p_display );
775 if( p_pic->p_sys->p_overlay == NULL )
777 free( p_pic->p_sys );
781 SDL_LockYUVOverlay( p_pic->p_sys->p_overlay );
783 p_pic->Y_PIXELS = p_pic->p_sys->p_overlay->pixels[0];
784 p_pic->p[Y_PLANE].i_lines = p_pic->p_sys->p_overlay->h;
785 p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[0];
787 switch( p_vout->output.i_chroma )
789 case SDL_YV12_OVERLAY:
790 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
791 p_pic->p[Y_PLANE].b_margin = 0;
793 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
794 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
795 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
796 p_pic->p[U_PLANE].i_pixel_bytes = 1;
797 p_pic->p[U_PLANE].b_margin = 0;
799 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
800 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
801 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
802 p_pic->p[V_PLANE].i_pixel_bytes = 1;
803 p_pic->p[V_PLANE].b_margin = 0;
808 case SDL_IYUV_OVERLAY:
809 p_pic->p[Y_PLANE].i_pixel_bytes = 1;
810 p_pic->p[Y_PLANE].b_margin = 0;
812 p_pic->U_PIXELS = p_pic->p_sys->p_overlay->pixels[1];
813 p_pic->p[U_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
814 p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[1];
815 p_pic->p[U_PLANE].i_pixel_bytes = 1;
816 p_pic->p[U_PLANE].b_margin = 0;
818 p_pic->V_PIXELS = p_pic->p_sys->p_overlay->pixels[2];
819 p_pic->p[V_PLANE].i_lines = p_pic->p_sys->p_overlay->h / 2;
820 p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_overlay->pitches[2];
821 p_pic->p[V_PLANE].i_pixel_bytes = 1;
822 p_pic->p[V_PLANE].b_margin = 0;
828 p_pic->p[Y_PLANE].i_pixel_bytes = 2;
829 p_pic->p[Y_PLANE].b_margin = 0;